chore: 替换为commonDownloadExcel
This commit is contained in:
parent
36c6a65d22
commit
240573e354
@ -21,7 +21,7 @@ import {
|
|||||||
clientRemove,
|
clientRemove,
|
||||||
} from '#/api/system/client';
|
} from '#/api/system/client';
|
||||||
import { TableSwitch } from '#/components/table';
|
import { TableSwitch } from '#/components/table';
|
||||||
import { downloadExcel } from '#/utils/file/download';
|
import { commonDownloadExcel } from '#/utils/file/download';
|
||||||
|
|
||||||
import clientDrawer from './client-drawer.vue';
|
import clientDrawer from './client-drawer.vue';
|
||||||
import { columns, querySchema } from './data';
|
import { columns, querySchema } from './data';
|
||||||
@ -114,6 +114,10 @@ function handleMultiDelete() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDownloadExcel() {
|
||||||
|
commonDownloadExcel(clientExport, '客户端数据', tableApi.formApi.form.values);
|
||||||
|
}
|
||||||
|
|
||||||
const { hasAccessByCodes } = useAccess();
|
const { hasAccessByCodes } = useAccess();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -124,13 +128,7 @@ const { hasAccessByCodes } = useAccess();
|
|||||||
<Space>
|
<Space>
|
||||||
<a-button
|
<a-button
|
||||||
v-access:code="['system:client:export']"
|
v-access:code="['system:client:export']"
|
||||||
@click="
|
@click="handleDownloadExcel"
|
||||||
downloadExcel(
|
|
||||||
clientExport,
|
|
||||||
'客户端数据',
|
|
||||||
tableApi.formApi.form.values,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{ $t('pages.common.export') }}
|
{{ $t('pages.common.export') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
|
@ -7,7 +7,6 @@ import { useVbenDrawer, type VbenFormProps } from '@vben/common-ui';
|
|||||||
import { getVxePopupContainer } from '@vben/utils';
|
import { getVxePopupContainer } from '@vben/utils';
|
||||||
|
|
||||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||||
import dayjs from 'dayjs';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
tableCheckboxEvent,
|
tableCheckboxEvent,
|
||||||
@ -19,7 +18,7 @@ import {
|
|||||||
dictDataList,
|
dictDataList,
|
||||||
dictDataRemove,
|
dictDataRemove,
|
||||||
} from '#/api/system/dict/dict-data';
|
} from '#/api/system/dict/dict-data';
|
||||||
import { downloadExcel } from '#/utils/file/download';
|
import { commonDownloadExcel } from '#/utils/file/download';
|
||||||
|
|
||||||
import { emitter } from '../mitt';
|
import { emitter } from '../mitt';
|
||||||
import { columns, querySchema } from './data';
|
import { columns, querySchema } from './data';
|
||||||
@ -54,21 +53,6 @@ const gridOptions: VxeGridProps = {
|
|||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
ajax: {
|
ajax: {
|
||||||
query: async ({ page }, formValues = {}) => {
|
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');
|
|
||||||
}
|
|
||||||
|
|
||||||
const params: any = {
|
const params: any = {
|
||||||
pageNum: page.currentPage,
|
pageNum: page.currentPage,
|
||||||
pageSize: page.pageSize,
|
pageSize: page.pageSize,
|
||||||
@ -136,6 +120,10 @@ function handleMultiDelete() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDownloadExcel() {
|
||||||
|
commonDownloadExcel(dictDataExport, '字典数据', tableApi.formApi.form.values);
|
||||||
|
}
|
||||||
|
|
||||||
emitter.on('rowClick', async (value) => {
|
emitter.on('rowClick', async (value) => {
|
||||||
dictType.value = value;
|
dictType.value = value;
|
||||||
await tableApi.query();
|
await tableApi.query();
|
||||||
@ -149,13 +137,7 @@ emitter.on('rowClick', async (value) => {
|
|||||||
<Space>
|
<Space>
|
||||||
<a-button
|
<a-button
|
||||||
v-access:code="['system:dict:export']"
|
v-access:code="['system:dict:export']"
|
||||||
@click="
|
@click="handleDownloadExcel"
|
||||||
downloadExcel(
|
|
||||||
dictDataExport,
|
|
||||||
'字典数据',
|
|
||||||
tableApi.formApi.form.values,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{ $t('pages.common.export') }}
|
{{ $t('pages.common.export') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
|
@ -31,7 +31,7 @@ import {
|
|||||||
} from '#/api/system/dict/dict-type';
|
} from '#/api/system/dict/dict-type';
|
||||||
import { dictSyncTenant } from '#/api/system/tenant';
|
import { dictSyncTenant } from '#/api/system/tenant';
|
||||||
import { useTenantStore } from '#/store/tenant';
|
import { useTenantStore } from '#/store/tenant';
|
||||||
import { downloadExcel } from '#/utils/file/download';
|
import { commonDownloadExcel } from '#/utils/file/download';
|
||||||
|
|
||||||
import { emitter } from '../mitt';
|
import { emitter } from '../mitt';
|
||||||
import { columns, querySchema } from './data';
|
import { columns, querySchema } from './data';
|
||||||
@ -176,6 +176,14 @@ function handleSyncTenantDict() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDownloadExcel() {
|
||||||
|
commonDownloadExcel(
|
||||||
|
dictTypeExport,
|
||||||
|
'字典类型数据',
|
||||||
|
tableApi.formApi.form.values,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const { hasAccessByRoles } = useAccess();
|
const { hasAccessByRoles } = useAccess();
|
||||||
const tenantStore = useTenantStore();
|
const tenantStore = useTenantStore();
|
||||||
/**
|
/**
|
||||||
@ -206,13 +214,7 @@ const couldSyncTenantDict = computed(() => {
|
|||||||
</Dropdown>
|
</Dropdown>
|
||||||
<a-button
|
<a-button
|
||||||
v-access:code="['system:dict:export']"
|
v-access:code="['system:dict:export']"
|
||||||
@click="
|
@click="handleDownloadExcel"
|
||||||
downloadExcel(
|
|
||||||
dictTypeExport,
|
|
||||||
'字典类型数据',
|
|
||||||
tableApi.formApi.form.values,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{ $t('pages.common.export') }}
|
{{ $t('pages.common.export') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
|
@ -7,7 +7,6 @@ import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui';
|
|||||||
import { getVxePopupContainer } from '@vben/utils';
|
import { getVxePopupContainer } from '@vben/utils';
|
||||||
|
|
||||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||||
import dayjs from 'dayjs';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
tableCheckboxEvent,
|
tableCheckboxEvent,
|
||||||
@ -15,7 +14,7 @@ import {
|
|||||||
type VxeGridProps,
|
type VxeGridProps,
|
||||||
} from '#/adapter/vxe-table';
|
} from '#/adapter/vxe-table';
|
||||||
import { postExport, postList, postRemove } from '#/api/system/post';
|
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 DeptTree from '#/views/system/user/dept-tree.vue';
|
||||||
|
|
||||||
import { columns, querySchema } from './data';
|
import { columns, querySchema } from './data';
|
||||||
@ -58,21 +57,6 @@ const gridOptions: VxeGridProps = {
|
|||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
ajax: {
|
ajax: {
|
||||||
query: async ({ page }, formValues = {}) => {
|
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) {
|
if (selectDeptId.value.length === 1) {
|
||||||
formValues.belongDeptId = selectDeptId.value[0];
|
formValues.belongDeptId = selectDeptId.value[0];
|
||||||
@ -138,6 +122,10 @@ function handleMultiDelete() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDownloadExcel() {
|
||||||
|
commonDownloadExcel(postExport, '岗位信息', tableApi.formApi.form.values);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -152,13 +140,7 @@ function handleMultiDelete() {
|
|||||||
<Space>
|
<Space>
|
||||||
<a-button
|
<a-button
|
||||||
v-access:code="['system:post:export']"
|
v-access:code="['system:post:export']"
|
||||||
@click="
|
@click="handleDownloadExcel"
|
||||||
downloadExcel(
|
|
||||||
postExport,
|
|
||||||
'岗位信息数据',
|
|
||||||
tableApi.formApi.form.values,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{ $t('pages.common.export') }}
|
{{ $t('pages.common.export') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
|
@ -25,7 +25,7 @@ import {
|
|||||||
} from '#/api/system/tenant';
|
} from '#/api/system/tenant';
|
||||||
import { TableSwitch } from '#/components/table';
|
import { TableSwitch } from '#/components/table';
|
||||||
import { useTenantStore } from '#/store/tenant';
|
import { useTenantStore } from '#/store/tenant';
|
||||||
import { downloadExcel } from '#/utils/file/download';
|
import { commonDownloadExcel } from '#/utils/file/download';
|
||||||
|
|
||||||
import { columns, querySchema } from './data';
|
import { columns, querySchema } from './data';
|
||||||
import tenantDrawer from './tenant-drawer.vue';
|
import tenantDrawer from './tenant-drawer.vue';
|
||||||
@ -142,6 +142,11 @@ function handleMultiDelete() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDownloadExcel() {
|
||||||
|
commonDownloadExcel(tenantExport, '租户数据', tableApi.formApi.form.values);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 与后台逻辑相同
|
* 与后台逻辑相同
|
||||||
* 只有超级管理员能访问租户相关
|
* 只有超级管理员能访问租户相关
|
||||||
@ -160,13 +165,7 @@ const isSuperAdmin = computed(() => {
|
|||||||
<Space>
|
<Space>
|
||||||
<a-button
|
<a-button
|
||||||
v-access:code="['system:tenant:export']"
|
v-access:code="['system:tenant:export']"
|
||||||
@click="
|
@click="handleDownloadExcel"
|
||||||
downloadExcel(
|
|
||||||
tenantExport,
|
|
||||||
'租户数据',
|
|
||||||
tableApi.formApi.form.values,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{ $t('pages.common.export') }}
|
{{ $t('pages.common.export') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
|
Loading…
Reference in New Issue
Block a user