This commit is contained in:
hayu 2025-10-31 20:56:57 +08:00
parent ea5921eadf
commit be2d7f7685
1 changed files with 38 additions and 24 deletions

View File

@ -380,8 +380,8 @@ export default {
created() { created() {
this.getList(); this.getList();
this.getImpUnitOptions() this.getImpUnitOptions()
this.handleImpUnitChange() this.departList()
this.handleDepartChange() this.proList()
this.getDeviceType() this.getDeviceType()
}, },
methods: { methods: {
@ -397,10 +397,36 @@ export default {
console.error('获取分公司下拉失败:', e) console.error('获取分公司下拉失败:', e)
} }
}, },
/** 获取项目部下拉 */
async departList() {
try {
const res = await getDepartListByImpUnitApi() //
this.departOptions = res.data.map(item => ({
label: item.departName, //
value: item.departName
}))
} catch (e) {
console.error('获取项目部下拉失败:', e)
}
},
/** 获取工程下拉 */
async proList() {
try {
const res = await getProListByDepartApi() //
this.proOptions = res.data.map(item => ({
label: item.proName, //
value: item.proName
}))
} catch (e) {
console.error('获取工程下拉失败:', e)
}
},
/** 分公司选择变化,加载项目部 */ /** 分公司选择变化,加载项目部 */
async handleImpUnitChange() { async handleImpUnitChange() {
this.queryParams.departName = null // this.queryParams.departName = null //
this.departOptions = [] // this.departOptions = [] //
this.queryParams.proName = null //
this.proOptions = [] //
try { try {
const params = { const params = {
@ -812,19 +838,11 @@ export default {
zipName: row.proName || 'report', zipName: row.proName || 'report',
}; };
// 访 this.downloadZip(
downloadFileApi(payload) '/material/bm_report/downloadSingle',
.then((res) => { JSON.stringify(payload),
downloadFile({ `${row.proName || '文件档案下载'}.zip`
fileName: (row.proName || '文件档案下载') + '.zip', );
fileData: res,
fileType: 'application/zip',
});
})
.catch((err) => {
console.error('单条下载失败:', err);
this.$message.error('下载失败');
});
}, },
@ -897,15 +915,11 @@ export default {
zipName: `报告下载_${(new Date()).toISOString().slice(0,10)}`, zipName: `报告下载_${(new Date()).toISOString().slice(0,10)}`,
}; };
// this.downloadZip(
const res = await batchDownloadFileApi(payload); '/material/bm_report/downloadBulk',
JSON.stringify(payload),
// payload.zipName + '.zip'
downloadFile({ );
fileName: payload.zipName + '.zip',
fileData: res,
fileType: 'application/zip'
});
} catch (err) { } catch (err) {
console.error('一键下载失败', err); console.error('一键下载失败', err);