采购申请增加指定勾选导出
This commit is contained in:
@@ -429,11 +429,23 @@ export function getSupplementFilesByApplyId(applyId: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export function exportPurchaseApply(params?: any) {
|
||||
return request({
|
||||
url: '/purchase/purchasingapply/export',
|
||||
method: 'get',
|
||||
params,
|
||||
responseType: 'blob',
|
||||
});
|
||||
}
|
||||
export function exportPurchaseApply(params?: any, ids?: string[]) {
|
||||
const queryParams = new URLSearchParams();
|
||||
if (params) {
|
||||
Object.keys(params).forEach((key) => {
|
||||
if (params[key] !== undefined && params[key] !== null && params[key] !== '') {
|
||||
queryParams.append(key, params[key]);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (ids && ids.length > 0) {
|
||||
ids.forEach((id) => {
|
||||
queryParams.append('ids', id);
|
||||
});
|
||||
}
|
||||
return request({
|
||||
url: '/purchase/purchasingapply/export?' + queryParams.toString(),
|
||||
method: 'get',
|
||||
responseType: 'blob',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -110,7 +110,9 @@
|
||||
:cell-style="tableStyle.cellStyle"
|
||||
:header-cell-style="tableStyle.headerCellStyle"
|
||||
class="modern-table"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column type="index" label="序号" width="50" align="center">
|
||||
<template #header>
|
||||
<el-icon>
|
||||
@@ -606,14 +608,16 @@ const currFlowJob = ref<{ id?: number; flowInstId?: number } | null>(null);
|
||||
const currFlowCommentType = ref<'apply' | 'file'>('apply');
|
||||
|
||||
const implementFormRef = ref();
|
||||
const fileArchiveDialogRef = ref();
|
||||
const updateFilesDialogRef = ref();
|
||||
const contractDialogRef = ref();
|
||||
const supplementFilesDialogRef = ref();
|
||||
const supplementViewDialogRef = ref();
|
||||
const docAuditViewDialogRef = ref();
|
||||
const purchaseContractDialogRef = ref();
|
||||
const purchaseContractDetailDialogRef = ref();
|
||||
const fileArchiveDialogRef = ref();
|
||||
const updateFilesDialogRef = ref();
|
||||
const contractDialogRef = ref();
|
||||
const supplementFilesDialogRef = ref();
|
||||
const supplementViewDialogRef = ref();
|
||||
const docAuditViewDialogRef = ref();
|
||||
const purchaseContractDialogRef = ref();
|
||||
const purchaseContractDetailDialogRef = ref();
|
||||
|
||||
const selectedRows = ref<any[]>([]);
|
||||
|
||||
/** 采购代表弹窗 */
|
||||
const representorDialogVisible = ref(false);
|
||||
@@ -1277,14 +1281,19 @@ const loadSecondDeptList = async () => {
|
||||
};
|
||||
|
||||
// 导出功能
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
const res: any = await exportPurchaseApply(state.queryForm);
|
||||
downloadFile(res, '采购申请列表.xlsx');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '导出失败');
|
||||
}
|
||||
};
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
const ids = selectedRows.value.length > 0 ? selectedRows.value.map((row) => row.id) : undefined;
|
||||
const res: any = await exportPurchaseApply(state.queryForm, ids);
|
||||
downloadFile(res, '采购申请列表.xlsx');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg || '导出失败');
|
||||
}
|
||||
};
|
||||
|
||||
const handleSelectionChange = (rows: any[]) => {
|
||||
selectedRows.value = rows;
|
||||
};
|
||||
|
||||
const downloadFile = (blob: Blob, fileName: string) => {
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
|
||||
Reference in New Issue
Block a user