导出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

+47 -32
View File
@@ -23,7 +23,14 @@
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()" v-auth="'canteen_boxesBooking_add'">
新 增
</el-button>
<el-button plain :disabled="multiple" icon="Delete" type="primary" v-auth="'canteen_boxesBooking_del'" @click="handleDelete(selectObjs)">
<el-button
plain
:disabled="multiple"
icon="Delete"
type="primary"
v-auth="'canteen_boxesBooking_del'"
@click="handleDelete(selectObjs)"
>
删 除
</el-button>
<right-toolbar
@@ -66,10 +73,18 @@
<el-table-column prop="createTime" label="创建时间" show-overflow-tooltip min-width="160" />
<el-table-column label="操作" width="150" fixed="right">
<template #default="scope">
<el-button icon="edit-pen" text type="primary" v-auth="'canteen_boxesBooking_edit'" @click="formDialogRef.openDialog(scope.row.id)">
<el-button
icon="edit-pen"
text
type="primary"
v-auth="'canteen_boxesBooking_edit'"
@click="formDialogRef.openDialog(scope.row.id)"
>
编辑
</el-button>
<el-button icon="delete" text type="primary" v-auth="'canteen_boxesBooking_del'" @click="handleDelete([scope.row.id])">删除</el-button>
<el-button icon="delete" text type="primary" v-auth="'canteen_boxesBooking_del'" @click="handleDelete([scope.row.id])"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
@@ -82,67 +97,67 @@
</template>
<script setup lang="ts" name="systemBoxesBooking">
import { BasicTableProps, useTable } from '/@/hooks/table';
import { fetchList, delObjs } from '/@/api/canteen/boxesBooking';
import { useMessage, useMessageBox } from '/@/hooks/message';
import { useDict } from '/@/hooks/dict';
import { BasicTableProps, useTable } from "/@/hooks/table"
import { fetchList, delObjs } from "/@/api/canteen/boxesBooking"
import { useMessage, useMessageBox } from "/@/hooks/message"
import { useDict } from "/@/hooks/dict"
// 引入组件
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
const FormDialog = defineAsyncComponent(() => import("./form.vue"))
// 定义查询字典
const { check_status } = useDict('check_status');
const { check_status } = useDict("check_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/boxesBooking/export', Object.assign(state.queryForm, { ids: selectObjs }), 'boxesBooking.xlsx');
};
downBlobFile("/canteen/boxesBooking/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>