Pārlūkot izejas kodu

完整版没问题的下载报告功能

liujiejie 3 mēneši atpakaļ
vecāks
revīzija
78d3319c33
1 mainītis faili ar 70 papildinājumiem un 70 dzēšanām
  1. 70 70
      src/views/performance/assetssMag.vue

+ 70 - 70
src/views/performance/assetssMag.vue

@@ -615,77 +615,77 @@ export default {
           itemField.engineTypeCode,
           itemAnalysis,
         );
-        // const res = await axios.post(
-        //   `/downLoadChart/chartServer/charts/${urlType}`,
-        //   {
-        //     fieldEngineCode: itemField.fieldEngineCode,
-        //     bucketName: "bucket-zhzn",
-        //     engineTypeCode: itemField.machineTypeCode,
-        //     objectName:
-        //       `charts/${row.fieldCode}/${row.batchCode}/${itemAnalysis.analysisTypeCode}/` +
-        //       objectname,
-        //     fieldInfo: this.fieldInfo,
-        //     fileAddr: itemField.fileAddr,
-        //     chartType:
-        //       filterAnalysis.typeDocxName === "production_indicator_unit"
-        //         ? "radar"
-        //         : urlType,
-        //   },
-        // );
-        // // 每完成 10% 提示一次(可调)
-        // const percent = Math.floor(
-        //   (this.progress.current / this.progress.total) * 100,
-        // );
-        // if (percent % 5 === 0 && !this._shownPercents?.includes(percent)) {
-        //   this._shownPercents = this._shownPercents || [];
-        //   this._shownPercents.push(percent);
+        const res = await axios.post(
+          `/downLoadChart/chartServer/charts/${urlType}`,
+          {
+            fieldEngineCode: itemField.fieldEngineCode,
+            bucketName: "bucket-zhzn",
+            engineTypeCode: itemField.machineTypeCode,
+            objectName:
+              `charts/${row.fieldCode}/${row.batchCode}/${itemAnalysis.analysisTypeCode}/` +
+              objectname,
+            fieldInfo: this.fieldInfo,
+            fileAddr: itemField.fileAddr,
+            chartType:
+              filterAnalysis.typeDocxName === "production_indicator_unit"
+                ? "radar"
+                : urlType,
+          },
+        );
+        // 每完成 10% 提示一次(可调)
+        const percent = Math.floor(
+          (this.progress.current / this.progress.total) * 100,
+        );
+        if (percent % 5 === 0 && !this._shownPercents?.includes(percent)) {
+          this._shownPercents = this._shownPercents || [];
+          this._shownPercents.push(percent);
 
-        //   this.$notify.info(
-        //     `📈 已完成 ${percent}%/${this.progress.current}张,共 ${this.progress.total} 张图表`,
-        //   );
-        // }
-        // let key = `zn-techcn-replace-tags-${filterAnalysis.typeDocxName}-${typeChart}`;
-        // if (urlType === "yawErrorBarSumChart") {
-        //   key = `zn-techcn-replace-tags-${filterAnalysis.typeDocxName}-generalFiles2`;
+          this.$notify.info(
+            `📈 已完成 ${percent}%/${this.progress.current}张,共 ${this.progress.total} 张图表`,
+          );
+        }
+        let key = `zn-techcn-replace-tags-${filterAnalysis.typeDocxName}-${typeChart}`;
+        if (urlType === "yawErrorBarSumChart") {
+          key = `zn-techcn-replace-tags-${filterAnalysis.typeDocxName}-generalFiles2`;
 
-        //   if (!this.fileDataList["yawErrorRows"]) {
-        //     this.$set(this.fileDataList, "yawErrorRows", []); // Vue 2 中响应式设置对象属性
-        //   }
-        //   this.fileDataList["yawErrorRows"] = res?.data?.data?.data;
-        // } else if (urlType === "yawErrorChart") {
-        //   key = `zn-techcn-replace-tags-${filterAnalysis.typeDocxName}-generalFiles1`;
-        // }
-        // if (filterAnalysis.typeDocxName === "production_indicator_all") {
-        //   if (!this.fileDataList["rows"]) {
-        //     this.$set(this.fileDataList, "rows", []); // Vue 2 中响应式设置对象属性
-        //   }
-        //   this.fileDataList["rows"] = res?.data?.data?.data;
-        // }
-        // if (itemField.engineTypeCode === "total_fault_result") {
-        //   if (!this.fileDataList["faultRows"]) {
-        //     this.$set(this.fileDataList, "faultRows", []); // Vue 2 中响应式设置对象属性
-        //   }
-        //   this.fileDataList["faultRows"] = res?.data?.data?.data;
-        // }
-        // if (itemField.engineTypeCode === "turbine_fault_result") {
-        //   if (!this.fileDataList["windTurbineRows"]) {
-        //     this.$set(this.fileDataList, "windTurbineRows", []); // Vue 2 中响应式设置对象属性
-        //   }
-        //   this.fileDataList["windTurbineRows"] = res?.data?.data?.data;
-        // }
-        // if (filterAnalysis.typeDocxName === "production_indicator_unit") {
-        //   if (!this.fileDataList[key]) {
-        //     this.$set(this.fileDataList, key, []); // Vue 2 中响应式设置对象属性
-        //   }
-        //   res?.data?.data?.imageUrls.map((imgval) => {
-        //     this.fileDataList[key].push(imgval);
-        //   });
-        // } else {
-        //   if (!this.fileDataList[key]) {
-        //     this.$set(this.fileDataList, key, []); // Vue 2 中响应式设置对象属性
-        //   }
-        //   this.fileDataList[key].push(res?.data?.data?.imageUrl);
-        // }
+          if (!this.fileDataList["yawErrorRows"]) {
+            this.$set(this.fileDataList, "yawErrorRows", []); // Vue 2 中响应式设置对象属性
+          }
+          this.fileDataList["yawErrorRows"] = res?.data?.data?.data;
+        } else if (urlType === "yawErrorChart") {
+          key = `zn-techcn-replace-tags-${filterAnalysis.typeDocxName}-generalFiles1`;
+        }
+        if (filterAnalysis.typeDocxName === "production_indicator_all") {
+          if (!this.fileDataList["rows"]) {
+            this.$set(this.fileDataList, "rows", []); // Vue 2 中响应式设置对象属性
+          }
+          this.fileDataList["rows"] = res?.data?.data?.data;
+        }
+        if (itemField.engineTypeCode === "total_fault_result") {
+          if (!this.fileDataList["faultRows"]) {
+            this.$set(this.fileDataList, "faultRows", []); // Vue 2 中响应式设置对象属性
+          }
+          this.fileDataList["faultRows"] = res?.data?.data?.data;
+        }
+        if (itemField.engineTypeCode === "turbine_fault_result") {
+          if (!this.fileDataList["windTurbineRows"]) {
+            this.$set(this.fileDataList, "windTurbineRows", []); // Vue 2 中响应式设置对象属性
+          }
+          this.fileDataList["windTurbineRows"] = res?.data?.data?.data;
+        }
+        if (filterAnalysis.typeDocxName === "production_indicator_unit") {
+          if (!this.fileDataList[key]) {
+            this.$set(this.fileDataList, key, []); // Vue 2 中响应式设置对象属性
+          }
+          res?.data?.data?.imageUrls.map((imgval) => {
+            this.fileDataList[key].push(imgval);
+          });
+        } else {
+          if (!this.fileDataList[key]) {
+            this.$set(this.fileDataList, key, []); // Vue 2 中响应式设置对象属性
+          }
+          this.fileDataList[key].push(res?.data?.data?.imageUrl);
+        }
       } catch (err) {
         console.error("生成失败:", err);
       }
@@ -700,7 +700,7 @@ export default {
         await this.getAllAnalysis(row.batchCode);
         await this.getFieldDetail(row.batchCode);
         this.$message.info("开始生成word文档");
-        const limit = pLimit(5); // 限制同时并发的请求数量为 5
+        const limit = pLimit(1); // 限制同时并发的请求数量为 5
         const tasks = [];
         for (const itemAnalysis of this.allAnalysis) {
           const filterAnalysis = allAnalysisType.filter(