chore: 替换为commonDownloadExcel

This commit is contained in:
dap
2024-11-14 14:58:42 +08:00
parent 36c6a65d22
commit 240573e354
5 changed files with 35 additions and 72 deletions

View File

@@ -7,7 +7,6 @@ import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import {
tableCheckboxEvent,
@@ -15,7 +14,7 @@ import {
type VxeGridProps,
} from '#/adapter/vxe-table';
import { postExport, postList, postRemove } from '#/api/system/post';
import { downloadExcel } from '#/utils/file/download';
import { commonDownloadExcel } from '#/utils/file/download';
import DeptTree from '#/views/system/user/dept-tree.vue';
import { columns, querySchema } from './data';
@@ -58,21 +57,6 @@ const gridOptions: VxeGridProps = {
proxyConfig: {
ajax: {
query: async ({ page }, formValues = {}) => {
// 区间选择器处理
if (formValues?.createTime) {
formValues.params = {
beginTime: dayjs(formValues.createTime[0]).format(
'YYYY-MM-DD 00:00:00',
),
endTime: dayjs(formValues.createTime[1]).format(
'YYYY-MM-DD 23:59:59',
),
};
Reflect.deleteProperty(formValues, 'createTime');
} else {
Reflect.deleteProperty(formValues, 'params');
}
// 部门树选择处理
if (selectDeptId.value.length === 1) {
formValues.belongDeptId = selectDeptId.value[0];
@@ -138,6 +122,10 @@ function handleMultiDelete() {
},
});
}
function handleDownloadExcel() {
commonDownloadExcel(postExport, '岗位信息', tableApi.formApi.form.values);
}
</script>
<template>
@@ -152,13 +140,7 @@ function handleMultiDelete() {
<Space>
<a-button
v-access:code="['system:post:export']"
@click="
downloadExcel(
postExport,
'岗位信息数据',
tableApi.formApi.form.values,
)
"
@click="handleDownloadExcel"
>
{{ $t('pages.common.export') }}
</a-button>