导出excel加上日期

This commit is contained in:
weiwei committed 2025-03-06 14:38:52 +08:00
1 parent 8bdf76ae3a
commit 5dce0acf8c
67 files changed
+2300 -2278

No files matched your search

+43 -31
View File
@@ -16,7 +16,13 @@
</el-row>
<el-row>
<div class="mb8" style="width: 100%">
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()" v-auth="'canteen_boxesAvailability_add'">
<el-button
icon="folder-add"
type="primary"
class="ml10"
@click="formDialogRef.openDialog()"
v-auth="'canteen_boxesAvailability_add'"
>
新 增
</el-button>
<el-button
@@ -63,7 +69,13 @@
<el-table-column prop="hourIndex" label="时间索引(0-24)" show-overflow-tooltip />
<el-table-column label="操作" width="150">
<template #default="scope">
<el-button icon="edit-pen" text type="primary" v-auth="'canteen_boxesAvailability_edit'" @click="formDialogRef.openDialog(scope.row.id)">
<el-button
icon="edit-pen"
text
type="primary"
v-auth="'canteen_boxesAvailability_edit'"
@click="formDialogRef.openDialog(scope.row.id)"
>
编辑
</el-button>
<el-button icon="delete" text type="primary" v-auth="'canteen_boxesAvailability_del'" @click="handleDelete([scope.row.id])">
@@ -81,67 +93,67 @@
</template>
<script setup lang="ts" name="systemBoxesAvailability">
import { BasicTableProps, useTable } from '/@/hooks/table';
import { fetchList, delObjs } from '/@/api/canteen/boxesAvailability';
import { useMessage, useMessageBox } from '/@/hooks/message';
import { useDict } from '/@/hooks/dict';
import { BasicTableProps, useTable } from "/@/hooks/table"
import { fetchList, delObjs } from "/@/api/canteen/boxesAvailability"
import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
// 引入组件
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
// 定义查询字典
const { booking_status } = useDict('booking_status');
const { booking_status } = useDict("booking_status")
// 定义变量内容
const formDialogRef = ref();
const formDialogRef = ref()
// 搜索变量
const queryRef = ref();
const showSearch = ref(true);
const queryRef = ref()
const showSearch = ref(true)
// 多选变量
const selectObjs = ref([]) as any;
const multiple = ref(true);
const selectObjs = ref([]) as any
const multiple = ref(true)
const state: BasicTableProps = reactive<BasicTableProps>({
queryForm: {},
pageList: fetchList,
});
})
// table hook
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state);
const { getDataList, currentChangeHandle, sizeChangeHandle, sortChangeHandle, downBlobFile, tableStyle } = useTable(state)
// 清空搜索条件
const resetQuery = () => {
// 清空搜索条件
queryRef.value?.resetFields();
queryRef.value?.resetFields()
// 清空多选
selectObjs.value = [];
getDataList();
};
selectObjs.value = []
getDataList()
}
// 导出excel
const exportExcel = () => {
downBlobFile('/canteen/boxesAvailability/export', Object.assign(state.queryForm, { ids: selectObjs }), 'boxesAvailability.xlsx');
};
downBlobFile("/canteen/boxesAvailability/export", Object.assign(state.queryForm, { ids: selectObjs }), "包厢时间段管理.xlsx")
}
// 多选事件
const selectionChangHandle = (objs: { id: string }[]) => {
selectObjs.value = objs.map(({ id }) => id);
multiple.value = !objs.length;
};
selectObjs.value = objs.map(({ id }) => id)
multiple.value = !objs.length
}
// 删除操作
const handleDelete = async (ids: string[]) => {
try {
await useMessageBox().confirm('此操作将永久删除');
await useMessageBox().confirm("此操作将永久删除")
} catch {
return;
return
}
try {
await delObjs(ids);
getDataList();
useMessage().success('删除成功');
await delObjs(ids)
getDataList()
useMessage().success("删除成功")
} catch (err: any) {
useMessage().error(err.msg);
useMessage().error(err.msg)
}
};
}
</script>