This commit is contained in:
parent
ea5921eadf
commit
be2d7f7685
|
|
@ -380,8 +380,8 @@ export default {
|
|||
created() {
|
||||
this.getList();
|
||||
this.getImpUnitOptions()
|
||||
this.handleImpUnitChange()
|
||||
this.handleDepartChange()
|
||||
this.departList()
|
||||
this.proList()
|
||||
this.getDeviceType()
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -397,10 +397,36 @@ export default {
|
|||
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() {
|
||||
this.queryParams.departName = null // 清空项目部已选
|
||||
this.departOptions = [] // 清空原有下拉
|
||||
this.queryParams.proName = null // 清空工程已选
|
||||
this.proOptions = [] // 清空原有下拉
|
||||
|
||||
try {
|
||||
const params = {
|
||||
|
|
@ -812,19 +838,11 @@ export default {
|
|||
zipName: row.proName || 'report',
|
||||
};
|
||||
|
||||
// 访问后端接口(封装调用)
|
||||
downloadFileApi(payload)
|
||||
.then((res) => {
|
||||
downloadFile({
|
||||
fileName: (row.proName || '文件档案下载') + '.zip',
|
||||
fileData: res,
|
||||
fileType: 'application/zip',
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('单条下载失败:', err);
|
||||
this.$message.error('下载失败');
|
||||
});
|
||||
this.downloadZip(
|
||||
'/material/bm_report/downloadSingle',
|
||||
JSON.stringify(payload),
|
||||
`${row.proName || '文件档案下载'}.zip`
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
|
|
@ -897,15 +915,11 @@ export default {
|
|||
zipName: `报告下载_${(new Date()).toISOString().slice(0,10)}`,
|
||||
};
|
||||
|
||||
// 调用统一的封装接口
|
||||
const res = await batchDownloadFileApi(payload);
|
||||
|
||||
// 前端生成下载
|
||||
downloadFile({
|
||||
fileName: payload.zipName + '.zip',
|
||||
fileData: res,
|
||||
fileType: 'application/zip'
|
||||
});
|
||||
this.downloadZip(
|
||||
'/material/bm_report/downloadBulk',
|
||||
JSON.stringify(payload),
|
||||
payload.zipName + '.zip'
|
||||
);
|
||||
|
||||
} catch (err) {
|
||||
console.error('一键下载失败', err);
|
||||
|
|
|
|||
Loading…
Reference in New Issue