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