feat: 各模块支持导出
This commit is contained in:
@@ -78,7 +78,7 @@ export function deleteCustomer(id: number) {
|
|||||||
|
|
||||||
/** 导出客户 */
|
/** 导出客户 */
|
||||||
export function exportCustomer(params: any) {
|
export function exportCustomer(params: any) {
|
||||||
return requestClient.download('/license/customer/export-excel', params);
|
return requestClient.download('/license/customer/export-excel', { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 下载导入模板 */
|
/** 下载导入模板 */
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ export function deleteLicense(id: number) {
|
|||||||
|
|
||||||
/** 导出License */
|
/** 导出License */
|
||||||
export function exportLicense(params: any) {
|
export function exportLicense(params: any) {
|
||||||
return requestClient.download('/license/license/export-excel', params);
|
return requestClient.download('/license/license/export-excel', { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** License SN是否唯一 */
|
/** License SN是否唯一 */
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export function deleteProject(id: number) {
|
|||||||
|
|
||||||
/** 导出项目 */
|
/** 导出项目 */
|
||||||
export function exportProject(params: any) {
|
export function exportProject(params: any) {
|
||||||
return requestClient.download('/license/project/export-excel', params);
|
return requestClient.download('/license/project/export-excel', { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 下载导入模板 */
|
/** 下载导入模板 */
|
||||||
|
|||||||
@@ -36,3 +36,10 @@ export function getExpiryLicensePage(params: PageParam) {
|
|||||||
{ params },
|
{ params },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 导出 */
|
||||||
|
export function exportExpire(params: any) {
|
||||||
|
return requestClient.download('/license/report/expire/export-excel', {
|
||||||
|
params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -45,3 +45,17 @@ export function getProgressByStaffPage(params: PageParam) {
|
|||||||
{ params },
|
{ 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,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { Page, useVbenModal } from '@vben/common-ui';
|
|||||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import {
|
import {
|
||||||
@@ -65,19 +66,15 @@ async function onDelete(row: CustomerApi.Customer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 导出表格 */
|
/** 导出表格 */
|
||||||
async function onExport() {
|
async function onExport(body: any) {
|
||||||
const data = await exportCustomer(await gridApi.formApi.getValues());
|
const formValues = await gridApi.formApi.getValues();
|
||||||
|
const data = await exportCustomer({ ...body, ...formValues });
|
||||||
downloadFileFromBlobPart({
|
downloadFileFromBlobPart({
|
||||||
fileName: `${$t('customer.customer')}.xlsx`,
|
fileName: `${body.filename}.xlsx`,
|
||||||
source: data,
|
source: data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导入客户 */
|
|
||||||
function handleImport() {
|
|
||||||
importModalApi.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
formOptions: {
|
formOptions: {
|
||||||
schema: useGridFormSchema(),
|
schema: useGridFormSchema(),
|
||||||
@@ -105,6 +102,46 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
return true;
|
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: {
|
proxyConfig: {
|
||||||
ajax: {
|
ajax: {
|
||||||
query: async ({ page }, formValues) => {
|
query: async ({ page }, formValues) => {
|
||||||
@@ -123,6 +160,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
search: true,
|
search: true,
|
||||||
|
export: true,
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<CustomerApi.Customer>,
|
} as VxeTableGridOptions<CustomerApi.Customer>,
|
||||||
});
|
});
|
||||||
@@ -144,20 +182,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
auth: ['license:customer:create'],
|
auth: ['license:customer:create'],
|
||||||
onClick: onCreate,
|
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,
|
|
||||||
// },
|
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { Page, useVbenModal } from '@vben/common-ui';
|
|||||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import {
|
import {
|
||||||
@@ -119,9 +120,13 @@ async function onDelete(row: LicenseApi.License) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 导出表格 */
|
/** 导出表格 */
|
||||||
async function onExport() {
|
async function onExport(body: any) {
|
||||||
const data = await exportLicense(await gridApi.formApi.getValues());
|
const formValues = await gridApi.formApi.getValues();
|
||||||
downloadFileFromBlobPart({ fileName: 'License.xlsx', source: data });
|
const data = await exportLicense({ ...body, ...formValues });
|
||||||
|
downloadFileFromBlobPart({
|
||||||
|
fileName: `${body.filename}.xlsx`,
|
||||||
|
source: data,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导入用户 */
|
/** 导入用户 */
|
||||||
@@ -147,6 +152,46 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
customConfig: {
|
customConfig: {
|
||||||
storage: true,
|
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: {
|
proxyConfig: {
|
||||||
sort: true,
|
sort: true,
|
||||||
ajax: {
|
ajax: {
|
||||||
@@ -172,6 +217,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
search: true,
|
search: true,
|
||||||
|
export: true,
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<LicenseApi.License>,
|
} as VxeTableGridOptions<LicenseApi.License>,
|
||||||
});
|
});
|
||||||
@@ -194,13 +240,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
auth: ['license:license:apply'],
|
auth: ['license:license:apply'],
|
||||||
onClick: onCreate,
|
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']),
|
label: $t('ui.actionTitle.import', ['License']),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { Page, useVbenDrawer, useVbenModal } from '@vben/common-ui';
|
|||||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import {
|
import {
|
||||||
@@ -76,19 +77,15 @@ async function onDelete(row: ProjectApi.Project) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 导出表格 */
|
/** 导出表格 */
|
||||||
async function onExport() {
|
async function onExport(body: any) {
|
||||||
const data = await exportProject(await gridApi.formApi.getValues());
|
const formValues = await gridApi.formApi.getValues();
|
||||||
|
const data = await exportProject({ ...body, ...formValues });
|
||||||
downloadFileFromBlobPart({
|
downloadFileFromBlobPart({
|
||||||
fileName: `${$t('project.project')}.xlsx`,
|
fileName: `${body.filename}.xlsx`,
|
||||||
source: data,
|
source: data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 导入项目 */
|
|
||||||
function handleImport() {
|
|
||||||
importModalApi.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 表格操作按钮的回调函数 */
|
/** 表格操作按钮的回调函数 */
|
||||||
function onActionClick({ code, row }: OnActionClickParams<ProjectApi.Project>) {
|
function onActionClick({ code, row }: OnActionClickParams<ProjectApi.Project>) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
@@ -125,6 +122,46 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
customConfig: {
|
customConfig: {
|
||||||
storage: true,
|
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: {
|
proxyConfig: {
|
||||||
sort: true,
|
sort: true,
|
||||||
ajax: {
|
ajax: {
|
||||||
@@ -150,6 +187,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
search: true,
|
search: true,
|
||||||
|
export: true,
|
||||||
},
|
},
|
||||||
} as VxeTableGridOptions<ProjectApi.Project>,
|
} as VxeTableGridOptions<ProjectApi.Project>,
|
||||||
});
|
});
|
||||||
@@ -172,20 +210,6 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
auth: ['license:project:create'],
|
auth: ['license:project:create'],
|
||||||
onClick: onCreate,
|
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,
|
|
||||||
// },
|
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,12 +1,26 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||||
|
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { getExpiryLicensePage } from '#/api/report/expire';
|
import { exportExpire, getExpiryLicensePage } from '#/api/report/expire';
|
||||||
|
|
||||||
import { useExpiringGridColumns, useExpiringGridFormSchema } from '../data';
|
import { useExpiringGridColumns, useExpiringGridFormSchema } from '../data';
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
/** 导出表格 */
|
||||||
|
async function onExport(body: any) {
|
||||||
|
const formValues = await gridApi.formApi.getValues();
|
||||||
|
const data = await exportExpire({ ...body, ...formValues, isExpired: false });
|
||||||
|
downloadFileFromBlobPart({
|
||||||
|
fileName: `${body.filename}.xlsx`,
|
||||||
|
source: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
formOptions: {
|
formOptions: {
|
||||||
schema: useExpiringGridFormSchema(),
|
schema: useExpiringGridFormSchema(),
|
||||||
submitOnEnter: true,
|
submitOnEnter: true,
|
||||||
@@ -30,11 +44,10 @@ const [Grid] = useVbenVxeGrid({
|
|||||||
pagerConfig: {
|
pagerConfig: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
exportConfig: {},
|
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
search: true,
|
search: true,
|
||||||
// export: true,
|
export: true,
|
||||||
},
|
},
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
rowConfig: {
|
rowConfig: {
|
||||||
@@ -52,6 +65,46 @@ const [Grid] = useVbenVxeGrid({
|
|||||||
virtualYConfig: {
|
virtualYConfig: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
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);
|
||||||
|
},
|
||||||
|
},
|
||||||
headerCellStyle: { backgroundColor: '#fafafa' },
|
headerCellStyle: { backgroundColor: '#fafafa' },
|
||||||
} as VxeTableGridOptions<any>,
|
} as VxeTableGridOptions<any>,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +1,26 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||||
|
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { getExpiryLicensePage } from '#/api/report/expire';
|
import { exportExpire, getExpiryLicensePage } from '#/api/report/expire';
|
||||||
|
|
||||||
import { useExpiredGridColumns, useExpiredGridFormSchema } from '../data';
|
import { useExpiredGridColumns, useExpiredGridFormSchema } from '../data';
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
/** 导出表格 */
|
||||||
|
async function onExport(body: any) {
|
||||||
|
const formValues = await gridApi.formApi.getValues();
|
||||||
|
const data = await exportExpire({ ...body, ...formValues, isExpired: true });
|
||||||
|
downloadFileFromBlobPart({
|
||||||
|
fileName: `${body.filename}.xlsx`,
|
||||||
|
source: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
formOptions: {
|
formOptions: {
|
||||||
schema: useExpiredGridFormSchema(),
|
schema: useExpiredGridFormSchema(),
|
||||||
submitOnEnter: true,
|
submitOnEnter: true,
|
||||||
@@ -30,11 +44,10 @@ const [Grid] = useVbenVxeGrid({
|
|||||||
pagerConfig: {
|
pagerConfig: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
exportConfig: {},
|
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
search: true,
|
search: true,
|
||||||
// export: true,
|
export: true,
|
||||||
},
|
},
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
rowConfig: {
|
rowConfig: {
|
||||||
@@ -52,6 +65,46 @@ const [Grid] = useVbenVxeGrid({
|
|||||||
virtualYConfig: {
|
virtualYConfig: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
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);
|
||||||
|
},
|
||||||
|
},
|
||||||
headerCellStyle: { backgroundColor: '#fafafa' },
|
headerCellStyle: { backgroundColor: '#fafafa' },
|
||||||
} as VxeTableGridOptions<any>,
|
} as VxeTableGridOptions<any>,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,12 +1,26 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||||
|
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { getProgressByStaffPage } from '#/api/report/progress';
|
import { exportStaff, getProgressByStaffPage } from '#/api/report/progress';
|
||||||
|
|
||||||
import { useStaffGridColumns, useStaffGridFormSchema } from '../data';
|
import { useStaffGridColumns, useStaffGridFormSchema } from '../data';
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
/** 导出表格 */
|
||||||
|
async function onExport(body: any) {
|
||||||
|
const formValues = await gridApi.formApi.getValues();
|
||||||
|
const data = await exportStaff({ ...body, ...formValues });
|
||||||
|
downloadFileFromBlobPart({
|
||||||
|
fileName: `${body.filename}.xlsx`,
|
||||||
|
source: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
formOptions: {
|
formOptions: {
|
||||||
schema: useStaffGridFormSchema(),
|
schema: useStaffGridFormSchema(),
|
||||||
submitOnEnter: true,
|
submitOnEnter: true,
|
||||||
@@ -29,11 +43,10 @@ const [Grid] = useVbenVxeGrid({
|
|||||||
pagerConfig: {
|
pagerConfig: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
exportConfig: {},
|
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
search: true,
|
search: true,
|
||||||
// export: true,
|
export: true,
|
||||||
},
|
},
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
rowConfig: {
|
rowConfig: {
|
||||||
@@ -51,6 +64,46 @@ const [Grid] = useVbenVxeGrid({
|
|||||||
virtualYConfig: {
|
virtualYConfig: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
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);
|
||||||
|
},
|
||||||
|
},
|
||||||
headerCellStyle: { backgroundColor: '#fafafa' },
|
headerCellStyle: { backgroundColor: '#fafafa' },
|
||||||
spanMethod({ row, rowIndex, column, visibleData }) {
|
spanMethod({ row, rowIndex, column, visibleData }) {
|
||||||
const spanFields = ['projectName', 'customerName', 'author'];
|
const spanFields = ['projectName', 'customerName', 'author'];
|
||||||
|
|||||||
@@ -1,12 +1,26 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||||
|
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { getProgressByProjectPage } from '#/api/report/progress';
|
import { exportProject, getProgressByProjectPage } from '#/api/report/progress';
|
||||||
|
|
||||||
import { useProjectGridColumns, useProjectGridFormSchema } from '../data';
|
import { useProjectGridColumns, useProjectGridFormSchema } from '../data';
|
||||||
|
|
||||||
const [Grid] = useVbenVxeGrid({
|
/** 导出表格 */
|
||||||
|
async function onExport(body: any) {
|
||||||
|
const formValues = await gridApi.formApi.getValues();
|
||||||
|
const data = await exportProject({ ...body, ...formValues });
|
||||||
|
downloadFileFromBlobPart({
|
||||||
|
fileName: `${body.filename}.xlsx`,
|
||||||
|
source: data,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
formOptions: {
|
formOptions: {
|
||||||
schema: useProjectGridFormSchema(),
|
schema: useProjectGridFormSchema(),
|
||||||
submitOnEnter: true,
|
submitOnEnter: true,
|
||||||
@@ -29,11 +43,10 @@ const [Grid] = useVbenVxeGrid({
|
|||||||
pagerConfig: {
|
pagerConfig: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
exportConfig: {},
|
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
search: true,
|
search: true,
|
||||||
// export: true,
|
export: true,
|
||||||
},
|
},
|
||||||
height: 'auto',
|
height: 'auto',
|
||||||
rowConfig: {
|
rowConfig: {
|
||||||
@@ -51,6 +64,46 @@ const [Grid] = useVbenVxeGrid({
|
|||||||
virtualYConfig: {
|
virtualYConfig: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
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);
|
||||||
|
},
|
||||||
|
},
|
||||||
headerCellStyle: { backgroundColor: '#fafafa' },
|
headerCellStyle: { backgroundColor: '#fafafa' },
|
||||||
spanMethod({ row, rowIndex, column, visibleData }) {
|
spanMethod({ row, rowIndex, column, visibleData }) {
|
||||||
const spanFields = ['projectName', 'customerName'];
|
const spanFields = ['projectName', 'customerName'];
|
||||||
|
|||||||
Reference in New Issue
Block a user