diff --git a/apps/web-antd/src/api/license/customer/index.ts b/apps/web-antd/src/api/license/customer/index.ts index f664ab4..d54d62b 100644 --- a/apps/web-antd/src/api/license/customer/index.ts +++ b/apps/web-antd/src/api/license/customer/index.ts @@ -78,7 +78,7 @@ export function deleteCustomer(id: number) { /** 导出客户 */ export function exportCustomer(params: any) { - return requestClient.download('/license/customer/export-excel', params); + return requestClient.download('/license/customer/export-excel', { params }); } /** 下载导入模板 */ diff --git a/apps/web-antd/src/api/license/license/index.ts b/apps/web-antd/src/api/license/license/index.ts index c00605e..7ca96f5 100644 --- a/apps/web-antd/src/api/license/license/index.ts +++ b/apps/web-antd/src/api/license/license/index.ts @@ -122,7 +122,7 @@ export function deleteLicense(id: number) { /** 导出License */ export function exportLicense(params: any) { - return requestClient.download('/license/license/export-excel', params); + return requestClient.download('/license/license/export-excel', { params }); } /** License SN是否唯一 */ diff --git a/apps/web-antd/src/api/license/project/index.ts b/apps/web-antd/src/api/license/project/index.ts index 54b284b..5f2fbf6 100644 --- a/apps/web-antd/src/api/license/project/index.ts +++ b/apps/web-antd/src/api/license/project/index.ts @@ -76,7 +76,7 @@ export function deleteProject(id: number) { /** 导出项目 */ export function exportProject(params: any) { - return requestClient.download('/license/project/export-excel', params); + return requestClient.download('/license/project/export-excel', { params }); } /** 下载导入模板 */ diff --git a/apps/web-antd/src/api/report/expire/index.ts b/apps/web-antd/src/api/report/expire/index.ts index c67b55d..654c678 100644 --- a/apps/web-antd/src/api/report/expire/index.ts +++ b/apps/web-antd/src/api/report/expire/index.ts @@ -36,3 +36,10 @@ export function getExpiryLicensePage(params: PageParam) { { params }, ); } + +/** 导出 */ +export function exportExpire(params: any) { + return requestClient.download('/license/report/expire/export-excel', { + params, + }); +} diff --git a/apps/web-antd/src/api/report/progress/index.ts b/apps/web-antd/src/api/report/progress/index.ts index a3f0826..e1eb0d7 100644 --- a/apps/web-antd/src/api/report/progress/index.ts +++ b/apps/web-antd/src/api/report/progress/index.ts @@ -45,3 +45,17 @@ export function getProgressByStaffPage(params: PageParam) { { params }, ); } + +/** 导出 */ +export function exportProject(params: any) { + return requestClient.download('/license/report/project/export-excel', { + params, + }); +} + +/** 导出 */ +export function exportStaff(params: any) { + return requestClient.download('/license/report/staff/export-excel', { + params, + }); +} diff --git a/apps/web-antd/src/views/license/customer/index.vue b/apps/web-antd/src/views/license/customer/index.vue index 1f749ee..eb26f9c 100644 --- a/apps/web-antd/src/views/license/customer/index.vue +++ b/apps/web-antd/src/views/license/customer/index.vue @@ -7,6 +7,7 @@ import { Page, useVbenModal } from '@vben/common-ui'; import { downloadFileFromBlobPart } from '@vben/utils'; import { message } from 'ant-design-vue'; +import dayjs from 'dayjs'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -65,19 +66,15 @@ async function onDelete(row: CustomerApi.Customer) { } /** 导出表格 */ -async function onExport() { - const data = await exportCustomer(await gridApi.formApi.getValues()); +async function onExport(body: any) { + const formValues = await gridApi.formApi.getValues(); + const data = await exportCustomer({ ...body, ...formValues }); downloadFileFromBlobPart({ - fileName: `${$t('customer.customer')}.xlsx`, + fileName: `${body.filename}.xlsx`, source: data, }); } -/** 导入客户 */ -function handleImport() { - importModalApi.open(); -} - const [Grid, gridApi] = useVbenVxeGrid({ formOptions: { schema: useGridFormSchema(), @@ -105,6 +102,46 @@ const [Grid, gridApi] = useVbenVxeGrid({ return true; }, }, + exportConfig: { + remote: true, + type: 'xlsx', + types: ['xlsx'], + mode: 'all', + modes: [ + { label: '导出全部数据', value: 'all' }, + { label: '导出当前页数据', value: 'current' }, + ], + filename() { + return `客户数据${dayjs().format('YYYYMMDDHHmmss')}`; + }, + sheetName() { + return `客户列表`; + }, + slots: { + parameter: 'exportParameter', + }, + async exportMethod({ options, $grid }) { + const proxyInfo = $grid?.getProxyInfo(); + // 处理条件参数 + const body = { + filename: options.filename, + sheetName: options.sheetName, + isHeader: options.isHeader, + original: options.original, + mode: options.mode, + pageNo: proxyInfo ? proxyInfo.pager.currentPage : null, + pageSize: proxyInfo ? proxyInfo.pager.pageSize : null, + ids: + options.mode === 'selected' + ? options.data.map((item) => item.id) + : [], + includeFields: options.columns.map((column) => { + return column.field; + }), + }; + await onExport(body); + }, + }, proxyConfig: { ajax: { query: async ({ page }, formValues) => { @@ -123,6 +160,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ toolbarConfig: { refresh: { code: 'query' }, search: true, + export: true, }, } as VxeTableGridOptions, }); @@ -144,20 +182,6 @@ const [Grid, gridApi] = useVbenVxeGrid({ auth: ['license:customer:create'], onClick: onCreate, }, - { - label: $t('ui.actionTitle.export'), - type: 'primary', - icon: ACTION_ICON.DOWNLOAD, - auth: ['license:customer:export'], - onClick: onExport, - }, - // { - // label: $t('ui.actionTitle.import', [$t('customer.customer')]), - // type: 'primary', - // icon: ACTION_ICON.UPLOAD, - // auth: ['license:customer:import'], - // onClick: handleImport, - // }, ]" /> diff --git a/apps/web-antd/src/views/license/license/index.vue b/apps/web-antd/src/views/license/license/index.vue index 805337b..f59a8dd 100644 --- a/apps/web-antd/src/views/license/license/index.vue +++ b/apps/web-antd/src/views/license/license/index.vue @@ -8,6 +8,7 @@ import { Page, useVbenModal } from '@vben/common-ui'; import { downloadFileFromBlobPart } from '@vben/utils'; import { message } from 'ant-design-vue'; +import dayjs from 'dayjs'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -119,9 +120,13 @@ async function onDelete(row: LicenseApi.License) { } /** 导出表格 */ -async function onExport() { - const data = await exportLicense(await gridApi.formApi.getValues()); - downloadFileFromBlobPart({ fileName: 'License.xlsx', source: data }); +async function onExport(body: any) { + const formValues = await gridApi.formApi.getValues(); + const data = await exportLicense({ ...body, ...formValues }); + downloadFileFromBlobPart({ + fileName: `${body.filename}.xlsx`, + source: data, + }); } /** 导入用户 */ @@ -147,6 +152,46 @@ const [Grid, gridApi] = useVbenVxeGrid({ customConfig: { storage: true, }, + exportConfig: { + remote: true, + type: 'xlsx', + types: ['xlsx'], + mode: 'all', + modes: [ + { label: '导出全部数据', value: 'all' }, + { label: '导出当前页数据', value: 'current' }, + ], + filename() { + return `License数据${dayjs().format('YYYYMMDDHHmmss')}`; + }, + sheetName() { + return `License列表`; + }, + slots: { + parameter: 'exportParameter', + }, + async exportMethod({ options, $grid }) { + const proxyInfo = $grid?.getProxyInfo(); + // 处理条件参数 + const body = { + filename: options.filename, + sheetName: options.sheetName, + isHeader: options.isHeader, + original: options.original, + mode: options.mode, + pageNo: proxyInfo ? proxyInfo.pager.currentPage : null, + pageSize: proxyInfo ? proxyInfo.pager.pageSize : null, + ids: + options.mode === 'selected' + ? options.data.map((item) => item.id) + : [], + includeFields: options.columns.map((column) => { + return column.field; + }), + }; + await onExport(body); + }, + }, proxyConfig: { sort: true, ajax: { @@ -172,6 +217,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ toolbarConfig: { refresh: { code: 'query' }, search: true, + export: true, }, } as VxeTableGridOptions, }); @@ -194,13 +240,6 @@ const [Grid, gridApi] = useVbenVxeGrid({ auth: ['license:license:apply'], onClick: onCreate, }, - { - label: $t('ui.actionTitle.export'), - type: 'primary', - icon: ACTION_ICON.DOWNLOAD, - auth: ['license:license:export'], - onClick: onExport, - }, { label: $t('ui.actionTitle.import', ['License']), type: 'primary', diff --git a/apps/web-antd/src/views/license/project/index.vue b/apps/web-antd/src/views/license/project/index.vue index 0a1e98f..1b5c61b 100644 --- a/apps/web-antd/src/views/license/project/index.vue +++ b/apps/web-antd/src/views/license/project/index.vue @@ -9,6 +9,7 @@ import { Page, useVbenDrawer, useVbenModal } from '@vben/common-ui'; import { downloadFileFromBlobPart } from '@vben/utils'; import { message } from 'ant-design-vue'; +import dayjs from 'dayjs'; import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; import { @@ -76,19 +77,15 @@ async function onDelete(row: ProjectApi.Project) { } /** 导出表格 */ -async function onExport() { - const data = await exportProject(await gridApi.formApi.getValues()); +async function onExport(body: any) { + const formValues = await gridApi.formApi.getValues(); + const data = await exportProject({ ...body, ...formValues }); downloadFileFromBlobPart({ - fileName: `${$t('project.project')}.xlsx`, + fileName: `${body.filename}.xlsx`, source: data, }); } -/** 导入项目 */ -function handleImport() { - importModalApi.open(); -} - /** 表格操作按钮的回调函数 */ function onActionClick({ code, row }: OnActionClickParams) { switch (code) { @@ -125,6 +122,46 @@ const [Grid, gridApi] = useVbenVxeGrid({ customConfig: { storage: true, }, + exportConfig: { + remote: true, + type: 'xlsx', + types: ['xlsx'], + mode: 'all', + modes: [ + { label: '导出全部数据', value: 'all' }, + { label: '导出当前页数据', value: 'current' }, + ], + filename() { + return `项目数据${dayjs().format('YYYYMMDDHHmmss')}`; + }, + sheetName() { + return `项目列表`; + }, + slots: { + parameter: 'exportParameter', + }, + async exportMethod({ options, $grid }) { + const proxyInfo = $grid?.getProxyInfo(); + // 处理条件参数 + const body = { + filename: options.filename, + sheetName: options.sheetName, + isHeader: options.isHeader, + original: options.original, + mode: options.mode, + pageNo: proxyInfo ? proxyInfo.pager.currentPage : null, + pageSize: proxyInfo ? proxyInfo.pager.pageSize : null, + ids: + options.mode === 'selected' + ? options.data.map((item) => item.id) + : [], + includeFields: options.columns.map((column) => { + return column.field; + }), + }; + await onExport(body); + }, + }, proxyConfig: { sort: true, ajax: { @@ -150,6 +187,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ toolbarConfig: { refresh: { code: 'query' }, search: true, + export: true, }, } as VxeTableGridOptions, }); @@ -172,20 +210,6 @@ const [Grid, gridApi] = useVbenVxeGrid({ auth: ['license:project:create'], onClick: onCreate, }, - { - label: $t('ui.actionTitle.export'), - type: 'primary', - icon: ACTION_ICON.DOWNLOAD, - auth: ['license:project:export'], - onClick: onExport, - }, - // { - // label: $t('ui.actionTitle.import', [$t('project.project')]), - // type: 'primary', - // icon: ACTION_ICON.UPLOAD, - // auth: ['license:project:import'], - // onClick: handleImport, - // }, ]" /> diff --git a/apps/web-antd/src/views/report/expire/modules/expiring.vue b/apps/web-antd/src/views/report/expire/modules/expiring.vue index 0d6771d..6a7442f 100644 --- a/apps/web-antd/src/views/report/expire/modules/expiring.vue +++ b/apps/web-antd/src/views/report/expire/modules/expiring.vue @@ -1,12 +1,26 @@