This commit is contained in:
		
							parent
							
								
									ea5921eadf
								
							
						
					
					
						commit
						be2d7f7685
					
				| 
						 | 
					@ -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);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue