Pārlūkot izejas kodu

生成报告代码,

liujiejie 1 mēnesi atpakaļ
vecāks
revīzija
cc8a599d83

BIN
downLoadServer/src/public/file/副本XXX风电场可靠性和能效双提升数据分析报告(模板).docx


+ 185 - 52
downLoadServer/src/server/controllers/chartController.js

@@ -112,6 +112,102 @@ const handleChartGeneration = async (
  * @param {function} onParsed - 解析成功回调,返回解析后的数据
  * @param {function} onError - 出错时的回调
  */
+// const fetchCsvAndParse = async (
+//   req,
+//   res,
+//   onParsed,
+//   onError,
+//   successMessage,
+//   additionalParams = {}
+// ) => {
+//   try {
+//     const {
+//       fileAddr,
+//       bucketName,
+//       objectName,
+//       fieldInfo,
+//       chartType,
+//       engineTypeCode,
+//     } = req.body;
+//     if (!fileAddr) {
+//       return errorResponse(res, "缺少数据URL", 400);
+//     }
+
+//     const response = await axios.get(fileAddr, { responseType: "text" });
+//     const csvText = response.data;
+//     console.log(req.body, "req.body");
+//     Papa.parse(csvText, {
+//       header: true,
+//       complete: async (result) => {
+//         const data = result.data
+//           .filter((row) => Object.keys(row).length)
+//           .slice(0, result.data.length - 1);
+//         console.log(data, "csv data 数据");
+//         // 调用 onParsed 函数并确保只发送一次响应
+//         try {
+//           let imageUrl = "";
+//           let imageUrls = [];
+//           if (typeof onParsed === "function") {
+//             if (chartType === "radar") {
+//               const results = await Promise.all(
+//                 data &&
+//                   data.map((val) =>
+//                     onParsed(
+//                       val,
+//                       data,
+//                       bucketName,
+//                       objectName,
+//                       fieldInfo,
+//                       engineTypeCode,
+//                       additionalParams
+//                     ).catch((err) => {
+//                       console.error("getRadarCharts failed:", err);
+//                       return null;
+//                     })
+//                   )
+//               );
+//               imageUrls.push(...results); // 如果你还需要存入 imageUrls
+//               console.log(imageUrls, "img");
+//             } else {
+//               imageUrl = await onParsed(
+//                 data,
+//                 bucketName,
+//                 objectName,
+//                 fieldInfo,
+//                 additionalParams
+//               );
+//             }
+//           }
+//           successResponse(res, { data, imageUrl, imageUrls }, successMessage);
+//         } catch (error) {
+//           console.error("处理解析数据时出错:", error);
+//           errorResponse(res, "处理数据失败", 500);
+//         }
+//       },
+//       error: (error) => {
+//         console.error("CSV 解析错误:", error);
+//         if (onError) {
+//           onError(error);
+//         }
+//         errorResponse(res, "CSV 解析失败", 500); // 发送错误响应
+//       },
+//     });
+//   } catch (error) {
+//     console.error("获取 CSV 错误:", error);
+
+//     if (error.response) {
+//       errorResponse(
+//         res,
+//         `获取数据失败: ${error.response.status}`,
+//         error.response.status
+//       );
+//     } else {
+//       errorResponse(res, "获取 CSV 失败", 500);
+//     }
+//   }
+// };
+
+const text = () => {};
 const fetchCsvAndParse = async (
   req,
   res,
@@ -121,72 +217,48 @@ const fetchCsvAndParse = async (
   additionalParams = {}
 ) => {
   try {
-    const { fileAddr, bucketName, objectName, fieldInfo, chartType } = req.body;
+    const {
+      fileAddr,
+      bucketName,
+      objectName,
+      fieldInfo,
+      chartType,
+      engineTypeCode,
+    } = req.body;
     if (!fileAddr) {
       return errorResponse(res, "缺少数据URL", 400);
     }
 
     const response = await axios.get(fileAddr, { responseType: "text" });
     const csvText = response.data;
-    console.log(req.body, "req.body");
+
+    // ✅ 1. 调用 Papa.parse,complete 里只调用封装的 async 函数
     Papa.parse(csvText, {
       header: true,
-      complete: async (result) => {
-        const data = result.data
-          .filter((row) => Object.keys(row).length)
-          .slice(0, result.data.length - 1);
-        console.log(data, "csv data 数据");
-        // 调用 onParsed 函数并确保只发送一次响应
-        try {
-          let imageUrl = "";
-          let imageUrls = [];
-          if (typeof onParsed === "function") {
-            if (chartType === "radar") {
-              const results = await Promise.all(
-                data &&
-                  data.map((val) =>
-                    onParsed(
-                      val,
-                      data,
-                      bucketName,
-                      objectName,
-                      fieldInfo,
-                      additionalParams
-                    ).catch((err) => {
-                      console.error("getRadarCharts failed:", err);
-                      return null;
-                    })
-                  )
-              );
-              imageUrls.push(...results); // 如果你还需要存入 imageUrls
-              console.log(imageUrls, "img");
-            } else {
-              imageUrl = await onParsed(
-                data,
-                bucketName,
-                objectName,
-                fieldInfo,
-                additionalParams
-              );
-            }
-          }
-          successResponse(res, { data, imageUrl, imageUrls }, successMessage);
-        } catch (error) {
-          console.error("处理解析数据时出错:", error);
-          errorResponse(res, "处理数据失败", 500);
-        }
+      complete: (result) => {
+        // ⚠️ Papa 不会等待 async,这里显式处理异步
+        handleParsedResult(
+          result,
+          res,
+          onParsed,
+          onError,
+          successMessage,
+          bucketName,
+          objectName,
+          fieldInfo,
+          chartType,
+          engineTypeCode,
+          additionalParams
+        );
       },
       error: (error) => {
         console.error("CSV 解析错误:", error);
-        if (onError) {
-          onError(error);
-        }
-        errorResponse(res, "CSV 解析失败", 500); // 发送错误响应
+        if (onError) onError(error);
+        errorResponse(res, "CSV 解析失败", 500);
       },
     });
   } catch (error) {
     console.error("获取 CSV 错误:", error);
-
     if (error.response) {
       errorResponse(
         res,
@@ -198,6 +270,67 @@ const fetchCsvAndParse = async (
     }
   }
 };
+// ✅ 2. 封装为 async 函数,处理完再统一 successResponse
+const handleParsedResult = async (
+  result,
+  res,
+  onParsed,
+  onError,
+  successMessage,
+  bucketName,
+  objectName,
+  fieldInfo,
+  chartType,
+  engineTypeCode,
+  additionalParams
+) => {
+  const data = result.data
+    .filter((row) => Object.keys(row).length)
+    .slice(0, result.data.length - 1);
+
+  console.log(data, "csv data 数据");
+
+  try {
+    let imageUrl = "";
+    let imageUrls = [];
+
+    if (typeof onParsed === "function") {
+      if (chartType === "radar") {
+        const results = await Promise.all(
+          data.map((val) =>
+            onParsed(
+              val,
+              data,
+              bucketName,
+              objectName,
+              fieldInfo,
+              engineTypeCode,
+              additionalParams
+            ).catch((err) => {
+              console.error("getRadarCharts failed:", err);
+              return null;
+            })
+          )
+        );
+        imageUrls.push(...results);
+        console.log(imageUrls, "img");
+      } else {
+        imageUrl = await onParsed(
+          data,
+          bucketName,
+          objectName,
+          fieldInfo,
+          additionalParams
+        );
+      }
+    }
+
+    successResponse(res, { data, imageUrl, imageUrls }, successMessage);
+  } catch (error) {
+    console.error("处理解析数据时出错:", error);
+    errorResponse(res, "处理数据失败", 500);
+  }
+};
 
 export const createBarChart = async (req, res) => {
   await handleChartGeneration(req, res, generateBarChart, "柱状图生成成功");
@@ -342,7 +475,7 @@ export const createCopyFileCsv = async (req, res) => {
   let tempFilePath = null;
 
   try {
-    const { fieldInfo, bucketName, objectName } = req.body;
+    const { fieldInfo, bucketName, objectName, dataTime } = req.body;
 
     // 1. 参数验证
     if (!fieldInfo || !bucketName || !objectName) {

+ 4 - 4
downLoadServer/src/server/utils/chartsCom/3DDrawingChart.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2025-04-14 16:09:13
- * @LastEditTime: 2025-05-26 10:55:37
+ * @LastEditTime: 2025-05-29 15:30:40
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /downLoadServer/src/server/utils/chartsCom/3DDrawingChart.js
@@ -78,7 +78,7 @@ export const generate3DDrawingChart = async (data, bucketName, objectName) => {
           xaxis: {
             gridcolor: "rgb(255,255,255)",
             tickcolor: "rgb(255,255,255)",
-            backgroundcolor: "#CFD4DC",
+            backgroundcolor: "#e0e7f1",
             showbackground: true,
             linecolor: "black", // 轴线颜色
             ticks: "outside", // 设置刻度线在轴线外
@@ -98,7 +98,7 @@ export const generate3DDrawingChart = async (data, bucketName, objectName) => {
             ticks: "outside",
             gridcolor: "rgb(255,255,255)",
             tickcolor: "rgb(255,255,255)",
-            backgroundcolor: "#CFD4DC",
+            backgroundcolor: "#e0e7f1",
             showbackground: true,
             tickcolor: "black",
             tickangle: 25,
@@ -109,7 +109,7 @@ export const generate3DDrawingChart = async (data, bucketName, objectName) => {
           zaxis: {
             gridcolor: "rgb(255,255,255)",
             tickcolor: "rgb(255,255,255)",
-            backgroundcolor: "#CFD4DC",
+            backgroundcolor: "#e0e7f1",
             showbackground: true,
             fixedrange: true, // 防止缩放
             linecolor: "black", // 轴线颜色

+ 9 - 6
downLoadServer/src/server/utils/chartsCom/Radar.js

@@ -30,7 +30,7 @@ const getHtmlContent = () => `
 <body>
   <div id="chart"></div>
   <script>
-    window.renderChart = function (chartData, itemCsvData) {
+    window.renderChart = function (chartData, itemCsvData,engineTypeCode) {
       function calcValues(data) {
         const matrix = data.map((item) => [
           item.TurbinePowerRate,
@@ -71,7 +71,7 @@ const getHtmlContent = () => `
       const chart = echarts.init(document.getElementById("chart"));
       chart.setOption({
         title: {
-          text: chartData.wind_turbine_name + "机组指标",
+          text:engineTypeCode+'机型'+ chartData.wind_turbine_name + "机组指标",
           left: "center",
         },
         radar: {
@@ -110,7 +110,9 @@ export const getRadarCharts = async (
   chartData,
   itemCsvData,
   bucketName,
-  objectName
+  objectName,
+  fieldInfo,
+  engineTypeCode
 ) => {
   const browser = await puppeteer.launch();
   const page = await browser.newPage();
@@ -129,11 +131,12 @@ export const getRadarCharts = async (
 
   // 调用渲染函数
   await page.evaluate(
-    (chartData, itemCsvData) => {
-      window.renderChart(chartData, itemCsvData);
+    (chartData, itemCsvData, engineTypeCode) => {
+      window.renderChart(chartData, itemCsvData, engineTypeCode);
     },
     chartData,
-    itemCsvData
+    itemCsvData,
+    engineTypeCode
   );
 
   // 再等待图表渲染完成(给 ECharts 时间)

+ 128 - 3
downLoadServer/src/server/utils/copyFileCsv.js

@@ -15,7 +15,6 @@ const getImageFromUrl = async (url) => {
   if (typeof url !== "string") {
     throw new TypeError(`图片 URL 应为字符串,但实际是 ${typeof url}`);
   }
-
   if (url.startsWith("http")) {
     const safeUrl = url.replace(/#/g, "%23"); // 处理 URL 中的 #
     const response = await axios.get(safeUrl, { responseType: "arraybuffer" });
@@ -129,8 +128,6 @@ export const copyFileDocx = async (fieldInfo, chartsImages) => {
         imageTagData[tag] = []; // 或 throw error
       }
     }
-    console.log(chartsImages.rows, "chartsImages");
-
     const renderData = {
       Year_now: year,
       Month_now: month,
@@ -151,6 +148,134 @@ export const copyFileDocx = async (fieldInfo, chartsImages) => {
       windTurbineRows: chartsImages.windTurbineRows,
       faultRows: chartsImages.faultRows,
       yawErrorRows: chartsImages.yawErrorRows,
+      engineTypeList: chartsImages.engineTypeList,
+      dataTime: chartsImages.dataTime,
+      "show-zn-techcn-replace-tags-data_integrity_minute-generalFiles":
+        imageTagData[
+          "zn-techcn-replace-tags-data_integrity_minute-generalFiles"
+        ]
+          ? true
+          : false,
+      "show-zn-techcn-replace-tags-data_integrity_second-generalFiles":
+        imageTagData[
+          "zn-techcn-replace-tags-data_integrity_second-generalFiles"
+        ]
+          ? true
+          : false,
+      "show-zn-techcn-replace-tags-production_indicator_unit-generalFiles":
+        imageTagData[
+          "zn-techcn-replace-tags-production_indicator_unit-generalFiles"
+        ]
+          ? true
+          : false,
+      "show-zn-techcn-replace-tags-yaw_error-generalFiles1": imageTagData[
+        "zn-techcn-replace-tags-yaw_error-generalFiles1"
+      ]
+        ? true
+        : false,
+      "show-zn-techcn-replace-tags-yaw_error-diagramRelations": imageTagData[
+        "zn-techcn-replace-tags-yaw_error-diagramRelations"
+      ]
+        ? true
+        : false,
+      "show-zn-techcn-replace-tags-fault_all-generalFiles": imageTagData[
+        "zn-techcn-replace-tags-fault_all-generalFiles"
+      ]
+        ? true
+        : false,
+      "show-zn-techcn-replace-tags-temperature_large_components_hig-generalFiles":
+        imageTagData[
+          "zn-techcn-replace-tags-temperature_large_components_hig-generalFiles"
+        ]
+          ? true
+          : false,
+      "show-zn-techcn-replace-tags-temperature_large_components_low-generalFiles":
+        imageTagData[
+          "zn-techcn-replace-tags-temperature_large_components_low-generalFiles"
+        ]
+          ? true
+          : false,
+      "show-zn-techcn-replace-tags-temperature_large_components_adriven-generalFiles":
+        imageTagData[
+          "zn-techcn-replace-tags-temperature_large_components_adriven-generalFiles"
+        ]
+          ? true
+          : false,
+      "show-zn-techcn-replace-tags-temperature_large_components_undriven-generalFiles":
+        imageTagData[
+          "zn-techcn-replace-tags-temperature_large_components_undriven-generalFiles"
+        ]
+          ? true
+          : false,
+      "show-zn-techcn-replace-tags-temperature_large_components_tem_deviation-diagramRelations":
+        imageTagData[
+          "zn-techcn-replace-tags-temperature_large_components_tem_deviation-diagramRelations"
+        ]
+          ? true
+          : false,
+      "show-zn-techcn-replace-tags-pitch_generator_speed-diagramRelations":
+        imageTagData[
+          "zn-techcn-replace-tags-pitch_generator_speed-diagramRelations"
+        ]
+          ? true
+          : false,
+      "show-zn-techcn-replace-tags-power_curve-generalFiles": imageTagData[
+        "zn-techcn-replace-tags-power_curve-generalFiles"
+      ]
+        ? true
+        : false,
+      "show-zn-techcn-replace-tags-power_scatter_2D-diagramRelations":
+        imageTagData["zn-techcn-replace-tags-power_scatter_2D-diagramRelations"]
+          ? true
+          : false,
+      "show-zn-techcn-replace-tags-cp-generalFiles": imageTagData[
+        "zn-techcn-replace-tags-cp-generalFiles"
+      ]
+        ? true
+        : false,
+      "show-zn-techcn-replace-tags-cp_trend-diagramRelations": imageTagData[
+        "zn-techcn-replace-tags-cp_trend-diagramRelations"
+      ]
+        ? true
+        : false,
+      "show-zn-techcn-replace-tags-tsr-generalFiles": imageTagData[
+        "zn-techcn-replace-tags-tsr-generalFiles"
+      ]
+        ? true
+        : false,
+      "show-zn-techcn-replace-tags-tsr_trend-diagramRelations": imageTagData[
+        "zn-techcn-replace-tags-tsr_trend-diagramRelations"
+      ]
+        ? true
+        : false,
+      "show-zn-techcn-replace-tags-min_pitch-diagramRelations": imageTagData[
+        "zn-techcn-replace-tags-min_pitch-diagramRelations"
+      ]
+        ? true
+        : false,
+      "show-zn-techcn-replace-tags-power_curve-generalFiles": imageTagData[
+        "zn-techcn-replace-tags-power_curve-generalFiles"
+      ]
+        ? true
+        : false,
+      "show-zn-techcn-replace-tags-power_scatter_2D-diagramRelations":
+        imageTagData["zn-techcn-replace-tags-power_scatter_2D-diagramRelations"]
+          ? true
+          : false,
+      // "": imageTagData[""] ? true : false,
+      "show-zn-techcn-replace-tags-fault_all-generalFiles&show-zn-techcn-replace-tags-temperature_large_components_hig-generalFiles":
+        imageTagData["zn-techcn-replace-tags-fault_all-generalFiles"] &&
+        imageTagData[
+          "zn-techcn-replace-tags-temperature_large_components_hig-generalFiles"
+        ]
+          ? true
+          : false,
+      "show-zn-techcn-replace-tags-yaw_error_density-diagramRelations":
+        imageTagData[
+          "zn-techcn-replace-tags-yaw_error_density-diagramRelations"
+        ]
+          ? true
+          : false,
     };
 
     // 渲染 Word 模板

+ 17 - 4
src/App.vue

@@ -7,7 +7,7 @@
 </template>
 <script>
 // import "@/assets/style/index.css";
-
+import { mapMutations } from "vuex";
 export default {
   created() {},
 
@@ -16,7 +16,19 @@ export default {
       return this.$store.state.settings.loading;
     },
   },
-  methods: {},
+  mounted() {
+    const navType = window.performance?.navigation?.type;
+    if (navType === 1) {
+      console.log("🔄 用户刷新了页面");
+      this.setDownloadDisabled(false);
+      // 你可以执行你想要的逻辑,比如记录日志、恢复状态等
+    } else {
+      console.log("✅ 正常进入页面(非刷新)");
+    }
+  },
+  methods: {
+    ...mapMutations("settings", ["setDownloadDisabled"]),
+  },
 };
 </script>
 <style lang="scss">
@@ -43,7 +55,9 @@ body {
   display: none;
 }
 
-html, body, #app {
+html,
+body,
+#app {
   height: 100%;
   overflow: hidden;
   overflow-y: auto;
@@ -60,5 +74,4 @@ body::-webkit-scrollbar,
   width: 0;
   height: 0;
 }
-
 </style>

+ 5 - 0
src/store/settings.js

@@ -3,6 +3,7 @@ const state = {
   title: "",
   theme: storageSetting.theme || "#409EFF",
   loading: false,
+  downloadDisabled: false,
 };
 const mutations = {
   CHANGE_SETTING: (state, { key, value }) => {
@@ -13,6 +14,10 @@ const mutations = {
   changeLoading(state, { key, value }) {
     state.loading = value;
   },
+  setDownloadDisabled(state, value) {
+    console.log("调用disabled 设置", value);
+    state.downloadDisabled = value;
+  },
 };
 
 const actions = {

+ 609 - 223
src/views/performance/assetssMag.vue

@@ -63,9 +63,17 @@
             v-hasPermi="['home:performance:autoAssetss']"
             >查看自动分析列表</el-button
           >
+
           <!-- <el-button @click="handleDownLoadChart" size="small">下载</el-button> -->
         </el-form-item>
       </el-form>
+      <!-- <div class="progress" v-if="downloadDisabled">
+        <div class="progressText">文档生成进度:</div>
+        <el-progress
+          :percentage="progressPercent"
+          :color="colors"
+        ></el-progress>
+      </div> -->
     </div>
     <div class="list-page">
       <el-table
@@ -306,6 +314,11 @@
               @click="handleDownLoadChart(scope.row)"
               type="text"
               size="small"
+              :disabled="downloadDisabled"
+              v-if="
+                (scope.row.errState == 1 && scope.row.analysisState == 30) ||
+                scope.row.analysisState == 30
+              "
             >
               下载报告
             </el-button>
@@ -471,12 +484,29 @@ import { getFieldInfo } from "@/api/overview";
 import axios from "axios";
 import pLimit from "p-limit";
 import { allAnalysisType } from "./js/allAnalysisType";
+import { mapMutations, mapState } from "vuex";
+import {
+  windEngineMillPage,
+  getWindEngineGroupByFieldCode,
+} from "@/api/ledger.js";
+
 export default {
   components: {
     MyDialog,
   },
   data() {
     return {
+      progress: {
+        current: 0,
+        total: 0,
+      },
+      colors: [
+        { color: "#f56c6c", percentage: 20 },
+        { color: "#e6a23c", percentage: 40 },
+        { color: "#5cb87a", percentage: 60 },
+        { color: "#1989fa", percentage: 80 },
+        { color: "#6f7ad3", percentage: 100 },
+      ],
       fileDataList: {},
       fieldInfo: {}, //风场信息
       firstLoad: false, // 是否是第一次加载
@@ -546,120 +576,365 @@ export default {
     window.addEventListener("message", this.handleMessage); //江
     this.fetchData();
   },
+  computed: {
+    ...mapState("settings", {
+      downloadDisabled: "downloadDisabled",
+    }),
+    progressPercent() {
+      if (this.progress.total === 0) return 0;
+      return Math.round((this.progress.current / this.progress.total) * 100);
+    },
+  },
   methods: {
+    ...mapMutations("settings", ["setDownloadDisabled"]),
     // async handleDownLoadChart(row) {
-    //   console.log(row.fieldCode, "row");
+    //   this.setDownloadDisabled(true);
+    //   this.$notify.warning("开始生成 Word 文档...");
     //   await this.getAllAnalysis(row.batchCode);
     //   await this.getFieldDetail(row.batchCode);
+    //   const limit = pLimit(5);
+    //   const tasks = [];
 
-    //   const diagramRelations = [
-    //     {
-    //       batchCode: "WOF039800012-WOB000001",
-    //       fieldEngineCode: "WOG00604",
-    //       fieldEngineName: "#01",
-    //       analysisTypeCode: "power_curve",
-    //       analysisTypeName: null,
-    //       fileAddr:
-    //         "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/power_curve/manual/power_curve-%2301.json",
-    //       autoAnalysis: null,
-    //       createTime: "2025-05-23 16:57:26",
-    //     },
-    //     {
-    //       batchCode: "WOF039800012-WOB000001",
-    //       fieldEngineCode: "WOG00604",
-    //       fieldEngineName: "#01",
-    //       analysisTypeCode: "power_curve",
-    //       analysisTypeName: null,
-    //       fileAddr:
-    //         "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/power_curve/manual/power_curve-%2301.json",
-    //       autoAnalysis: null,
-    //       createTime: "2025-05-23 16:57:26",
-    //     },
-    //     {
-    //       batchCode: "WOF039800012-WOB000001",
-    //       fieldEngineCode: "WOG00608",
-    //       fieldEngineName: "#05",
-    //       analysisTypeCode: "power_curve",
-    //       analysisTypeName: null,
-    //       fileAddr:
-    //         "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/power_curve/manual/power_curve-%2305.json",
-    //       autoAnalysis: null,
-    //       createTime: "2025-05-23 16:57:26",
-    //     },
-    //     {
-    //       batchCode: "WOF039800012-WOB000001",
-    //       fieldEngineCode: "WOG00613",
-    //       fieldEngineName: "#10",
-    //       analysisTypeCode: "power_curve",
-    //       analysisTypeName: null,
-    //       fileAddr:
-    //         "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/power_curve/manual/power_curve-%2310.json",
-    //       autoAnalysis: null,
-    //       createTime: "2025-05-23 16:57:26",
-    //     },
-    //   ];
-    //   diagramRelations.map(async (item) => {
-    //     const res = await axios.post(
-    //       "/downLoadChart/chartServer/charts/PlotlyChartsFen",
-    //       {
-    //         fieldEngineCode: item.fieldEngineCode ? item.fieldEngineCode : "", //lineChartFen
-    //         bucketName: "bucket-zhzn",
-    //         // row.fieldCode + "/" + row.batchCode + "/" + item.analysisTypeCode, //桶名称
-    //         objectName: "charts/111.jpg", //在 MinIO 中的文件名
-    //         fieldInfo: this.fieldInfo,
-    //         fileAddr: item.fileAddr,
-    //         // chartType: "radar",
-    //         chartType: "",
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/wind_speed_frequency/manual/wind_Speed_Frequency%2302.json", //barChart  url:bar
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/cp_windspeed/manual/%2319.json", //lineChartFen  url:line
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/cp/manual/WEM00013.json", //lineAndChartLine  url:lineAndChildLine
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/data_integrity_second/manual/Data_Integrity_Of_Second_Analyst.json", //HeatmapCharts  url:heatmap
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/speed_torque/manual/total_3D_WEM00012.json", //3DDrawingChart  url:3DDrawingChart
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/speed_torque/manual/3D_%2301.json", //Time3DChart  url:Time3DChart
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/tsr_cp_power_scatter/manual/%2301.json", //TwoDMarkersChart  url:TwoDMarkersChart
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/power_scatter_2D/manual/%2301-scatter.json", //TwoDMarkersChart1  url:TwoDMarkersChart1 2D有功功率散点图
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/min_pitch/manual/min_pitch%2301.json",
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/yaw_error_density/manual/%2304.json", //ColorbarInitTwoDmarkersChart  url:ColorbarInitTwoDmarkersChart 最小桨距角 、动态偏航误差
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/pitch_generator_speed/manual/pitch_GeneratorSpeed_Analyst%2301.json", //powerMarkers2DCharts url:powerMarkers2DCharts
-    //         // "", //radarChart url:radarChart
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/rated_power_windspeed/manual/total_less_25.json", //boxLineCharts
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/tsr_trend/manual/%2302.json", //boxMarkersCharts
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/temperature_large_components/manual/GeneratorTemperature/%2321.json", //generatorTemperature
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/wind_direction_frequency/manual/wind_direction_frequency%2318.json", //windRoseChart
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/yaw_error/manual/%2320.json", //yawErrorLine
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/fault/manual/total_fault_result.csv", //faultAllChart //全场故障
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/fault/manual/turbine_fault_result.csv", //faultUnitChart //机组故障
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/yaw_error/manual/yaw_error_result.csv", //静态偏航总图 //yawErrorBarSumChart
-    //         // "http://192.168.50.233:6900/wof039800012/WOF039800012-WOB000001/production_indicator/manual/production_indicator_total.csv", //全场指标 productionIndicatorTotal
-    //       }
+    //   for (const itemAnalysis of this.allAnalysis) {
+    //     const filterAnalysis = allAnalysisType.find(
+    //       (itemType) => itemType.typeName === itemAnalysis.analysisTypeName
     //     );
-    //   });
+    //     if (!filterAnalysis) continue;
+    //     const pushTask = (urlType, itemField, analysisType, sourceType) => {
+    //       //静态偏航误差 --通过allAnalysisType.js文件配置实现需求
+    //       if (Array.isArray(filterAnalysis.generalFiles.urlType)) {
+    //         filterAnalysis.generalFiles.urlType.map(
+    //           (itemUrlType, indUrlType) => {
+    //             tasks.push(
+    //               limit(async () => {
+    //                 await this.postChartData(
+    //                   itemUrlType,
+    //                   row,
+    //                   itemAnalysis,
+    //                   itemField,
+    //                   filterAnalysis,
+    //                   "generalFiles"
+    //                 );
+    //                 this.progress.current++;
+    //                 // 每完成 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} 张图表`
+    //                   );
+    //                 }
+    //               })
+    //             );
+    //           }
+    //         );
+    //       } else if (filterAnalysis.typeCode === "fault") {
+    //         if (itemField.fileAddr.includes("turbine_fault_result")) {
+    //           if (itemField.engineTypeCode === "turbine_fault_result") {
+    //             tasks.push(
+    //               limit(async () => {
+    //                 await this.postChartData(
+    //                   "faultUnitChart",
+    //                   row,
+    //                   itemAnalysis,
+    //                   itemField,
+    //                   filterAnalysis,
+    //                   "generalFiles"
+    //                 );
+    //                 this.progress.current++;
+    //                 // 每完成 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} 张图表`
+    //                   );
+    //                 }
+    //               })
+    //             );
+    //           }
+    //         } else {
+    //           if (itemField.engineTypeCode === "total_fault_result") {
+    //             tasks.push(
+    //               limit(async () => {
+    //                 await this.postChartData(
+    //                   "faultAllChart",
+    //                   row,
+    //                   itemAnalysis,
+    //                   itemField,
+    //                   filterAnalysis,
+    //                   "generalFiles"
+    //                 );
+    //                 this.progress.current++;
+    //                 // 每完成 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} 张图表`
+    //                   );
+    //                 }
+    //               })
+    //             );
+    //           }
+    //         }
+    //       } else if (filterAnalysis.typeCode === "production_indicator") {
+    //         //总图全场
+    //         if (
+    //           itemField.fileAddr.includes(
+    //             filterAnalysis.generalFiles.FileTypeFromUrl
+    //           )
+    //         ) {
+    //           tasks.push(
+    //             limit(() =>
+    //               this.postChartData(
+    //                 filterAnalysis.generalFiles.urlType,
+    //                 row,
+    //                 itemAnalysis,
+    //                 itemField,
+    //                 filterAnalysis,
+    //                 "generalFiles"
+    //               )
+    //             )
+    //           );
+    //         } else {
+    //           tasks.push(
+    //             limit(async () => {
+    //               await this.postChartData(
+    //                 "radarChart",
+    //                 row,
+    //                 itemAnalysis,
+    //                 itemField,
+    //                 filterAnalysis,
+    //                 "generalFiles"
+    //               );
+    //               this.progress.current++;
+    //               // 每完成 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} 张图表`
+    //                 );
+    //               }
+    //             })
+    //           );
+    //         }
+    //       } else {
+    //         tasks.push(
+    //           limit(async () => {
+    //             await this.postChartData(
+    //               urlType,
+    //               row,
+    //               itemAnalysis,
+    //               itemField,
+    //               filterAnalysis,
+    //               sourceType
+    //             );
+    //             this.progress.current++;
+    //             // 每完成 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} 张图表`
+    //               );
+    //             }
+    //           })
+    //         );
+    //       }
+    //     };
+    //     const processFiles = (source, sourceType) => {
+    //       const fileList = filterAnalysis.filterFileAddr
+    //         ? source
+    //             .filter((item) => item.fileAddr.endsWith(".json"))
+    //             .filter((item) =>
+    //               item.fileAddr.includes(filterAnalysis.filterFileAddr)
+    //             )
+    //         : source;
+    //       for (const itemField of fileList || []) {
+    //         // if (Array.isArray(filterAnalysis[sourceType]?.urlType)) {
+    //         //   filterAnalysis[sourceType].urlType.forEach((urlType) => {
+    //         //     pushTask(
+    //         //       urlType,
+    //         //       itemField,
+    //         //       filterAnalysis.typeName,
+    //         //       sourceType
+    //         //     );
+    //         //   });
+    //         // } else {
+    //         let urlType = filterAnalysis[sourceType]?.urlType;
+    //         if (sourceType === "diagramRelations" && Array.isArray(urlType)) {
+    //           const actualType = this.getFileTypeFromUrl(
+    //             itemField.fileAddr,
+    //             filterAnalysis.diagramRelations.FileTypeFromUrl
+    //           );
+    //           urlType =
+    //             actualType === filterAnalysis.diagramRelations.FileTypeFromUrl
+    //               ? urlType[0]
+    //               : urlType[1];
+    //         }
+
+    //         pushTask(urlType, itemField, filterAnalysis.typeName, sourceType);
+    //       }
+    //       // }
+    //     };
+    //     if (itemAnalysis.generalFiles) {
+    //       processFiles(itemAnalysis.generalFiles, "generalFiles");
+    //     }
+    //     if (itemAnalysis.diagramRelations) {
+    //       processFiles(itemAnalysis.diagramRelations, "diagramRelations");
+    //     }
+    //   }
+
+    //   this.progress.total = tasks.length;
+    //   this.progress.current = 0;
+    //   // console.log(`📝 总共要生成 ${this.progress.total} 张图表`);
+
+    //   await Promise.all(tasks);
+
+    //   this.$notify.success("✅ 图表全部生成完成,开始生成 Word 文档...");
 
-    //   // await axios.post("/downLoadChart/chartServer/charts/CopyFileCsv", {
-    //   //   fieldInfo: this.fieldInfo,
-    //   //   rows: [
-    //   //     {
-    //   //       Qdr: "-70352582.72",
-    //   //       Qp: "70352582.72",
-    //   //       Rdr: "0",
-    //   //       Thc: "1675.06",
-    //   //     },
-    //   //   ],
-    //   //   "zn-techcn-replace-tags-production_indicator_unit-generalFiles": [
-    //   //     "http://192.168.50.233:6900/bucket-zhzn/charts/#03.jpg",
-    //   //     "http://192.168.50.233:6900/bucket-zhzn/charts/#05.jpg",
-    //   //     "http://192.168.50.233:6900/bucket-zhzn/charts/#06.jpg",
-    //   //     "http://192.168.50.233:6900/bucket-zhzn/charts/#08.jpg",
-    //   //     "http://192.168.50.233:6900/bucket-zhzn/charts/#09.jpg",
-    //   //     "http://192.168.50.233:6900/bucket-zhzn/charts/#14.jpg",
-    //   //     "http://192.168.50.233:6900/bucket-zhzn/charts/#17.jpg",
-    //   //   ],
-    //   // });
+    //   const wordFilePath = await axios.post(
+    //     "/downLoadChart/chartServer/charts/CopyFileCsv",
+    //     {
+    //       fieldInfo: this.fieldInfo,
+    //       bucketName: "bucket-zhzn",
+    //       objectName: `charts/${row.fieldCode}/${row.batchCode}`,
+    //       ...this.fileDataList,
+    //     }
+    //   );
+
+    //   downloadDocx(wordFilePath.data.data.url, wordFilePath.data.data.fileName);
+
+    //   this.$notify.success("🎉 Word 文档生成并已下载!");
+    //   this.setDownloadDisabled(false);
     // },
+    async postChartData(
+      urlType,
+      row,
+      itemAnalysis,
+      itemField,
+      filterAnalysis,
+      typeChart
+    ) {
+      try {
+        const objectname =
+          itemAnalysis.analysisTypeCode === "temperature_large_components"
+            ? filterAnalysis.filterFileAddr +
+              "/" +
+              itemField.fieldEngineName +
+              ".jpg"
+            : urlType + itemField.fieldEngineName + ".jpg" ||
+              urlType + itemField.engineTypeCode + ".jpg";
 
-    // 获取 风机信息
+        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,
+          }
+        );
+        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);
+        }
+      } catch (err) {
+        console.error("生成失败:", err);
+      }
+    },
     async handleDownLoadChart(row) {
+      this.setDownloadDisabled(true);
+      this.$notify.warning("开始生成 Word 文档...");
       await this.getAllAnalysis(row.batchCode);
       await this.getFieldDetail(row.batchCode);
       this.$message.info("开始生成word文档");
@@ -683,16 +958,33 @@ export default {
               filterAnalysis.generalFiles.urlType.map(
                 (itemUrlType, indUrlType) => {
                   tasks.push(
-                    limit(() =>
-                      this.postChartData(
+                    limit(async () => {
+                      await this.postChartData(
                         itemUrlType,
                         row,
                         itemAnalysis,
                         itemField,
                         filterAnalysis,
                         "generalFiles"
-                      )
-                    )
+                      );
+                      this.progress.current++;
+                      // 每完成 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} 张图表`
+                        );
+                      }
+                    })
                   );
                 }
               );
@@ -700,31 +992,65 @@ export default {
               if (itemField.fileAddr.includes("turbine_fault_result")) {
                 if (itemField.engineTypeCode === "turbine_fault_result") {
                   tasks.push(
-                    limit(() =>
-                      this.postChartData(
+                    limit(async () => {
+                      await this.postChartData(
                         "faultUnitChart",
                         row,
                         itemAnalysis,
                         itemField,
                         filterAnalysis,
                         "generalFiles"
-                      )
-                    )
+                      );
+                      this.progress.current++;
+                      // 每完成 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} 张图表`
+                        );
+                      }
+                    })
                   );
                 }
               } else {
                 if (itemField.engineTypeCode === "total_fault_result") {
                   tasks.push(
-                    limit(() =>
-                      this.postChartData(
+                    limit(async () => {
+                      await this.postChartData(
                         "faultAllChart",
                         row,
                         itemAnalysis,
                         itemField,
                         filterAnalysis,
                         "generalFiles"
-                      )
-                    )
+                      );
+                      this.progress.current++;
+                      // 每完成 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} 张图表`
+                        );
+                      }
+                    })
                   );
                 }
               }
@@ -736,43 +1062,94 @@ export default {
                 )
               ) {
                 tasks.push(
-                  limit(() =>
-                    this.postChartData(
+                  limit(async () => {
+                    await this.postChartData(
                       filterAnalysis.generalFiles.urlType,
                       row,
                       itemAnalysis,
                       itemField,
                       filterAnalysis,
                       "generalFiles"
-                    )
-                  )
+                    );
+                    this.progress.current++;
+                    // 每完成 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} 张图表`
+                      );
+                    }
+                  })
                 );
               } else {
                 tasks.push(
-                  limit(() =>
-                    this.postChartData(
+                  limit(async () => {
+                    await this.postChartData(
                       "radarChart",
                       row,
                       itemAnalysis,
                       itemField,
                       filterAnalysis,
                       "generalFiles"
-                    )
-                  )
+                    );
+                    this.progress.current++;
+                    // 每完成 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} 张图表`
+                      );
+                    }
+                  })
                 );
               }
             } else {
               tasks.push(
-                limit(() =>
-                  this.postChartData(
+                limit(async () => {
+                  await this.postChartData(
                     filterAnalysis.generalFiles.urlType,
                     row,
                     itemAnalysis,
                     itemField,
                     filterAnalysis,
                     "generalFiles"
-                  )
-                )
+                  );
+                  this.progress.current++;
+                  // 每完成 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} 张图表`
+                    );
+                  }
+                })
               );
             }
           }
@@ -797,129 +1174,135 @@ export default {
               : filterAnalysis.diagramRelations.urlType;
             // console.log("urlType", filterAnalysis.typeName, urlType);
             tasks.push(
-              limit(() =>
-                this.postChartData(
+              limit(async () => {
+                await this.postChartData(
                   urlType,
                   row,
                   itemAnalysis,
                   itemField,
                   filterAnalysis,
                   "diagramRelations"
-                )
-              )
+                );
+                this.progress.current++;
+                // 每完成 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} 张图表`
+                  );
+                }
+              })
             );
           }
         }
       }
       await Promise.all(tasks);
 
+      const engineTypeList = await this.getEngineTypeList(
+        this.fieldInfo.engineMillTypes,
+        row.batchCode
+      );
+      console.log(engineTypeList, "engineTypeList");
+      this.$notify.success("✅ 图表全部生成完成,开始生成 Word 文档...");
       const wordFilePath = await axios.post(
         "/downLoadChart/chartServer/charts/CopyFileCsv",
         {
           fieldInfo: this.fieldInfo,
+          dataTime: `${this.analysisInfo.dataStartTime}-${this.analysisInfo.dataEndTime}`,
           bucketName: "bucket-zhzn",
           objectName: `charts/${row.fieldCode}/${row.batchCode}`,
+          // engineTypeList: [
+          //   {
+          //     machineTypeCode: "CCWE-1500/93.DF",
+          //     manufacturerName: "华创",
+          //     rotorDiameter: 93,
+          //     ratedWindSpeed: 11,
+          //     ratedCutInWindspeed: 3,
+          //     ratedCutOutWindspeed: 25,
+          //     ratedPower: 1500,
+          //     engineTypeCode: "aa",
+          //   },
+          //   {
+          //     machineTypeCode: "CCWE-1500/93.DF",
+          //     manufacturerName: "华创",
+          //     rotorDiameter: 93,
+          //     ratedWindSpeed: 11,
+          //     ratedCutInWindspeed: 3,
+          //     ratedCutOutWindspeed: 25,
+          //     ratedPower: 1700,
+          //     engineTypeCode: "bb",
+          //   },
+          // ],
+          engineTypeList: engineTypeList,
           ...this.fileDataList,
         }
       );
       // //下载minio 文件
       downloadDocx(wordFilePath.data.data.url, wordFilePath.data.data.fileName);
-
-      console.log("生成成功:", this.fileDataList);
-      console.log("全部图表生成请求已完成");
+      this.$notify.success("🎉 Word 文档生成并已下载!");
+      this.setDownloadDisabled(false);
     },
+    async getEngineTypeList(typeList, batchCode) {
+      return await Promise.all(
+        typeList.map((item) => this.getEngineMillList(item, batchCode))
+      );
+    },
+    // 查询
+    async getEngineMillList(machineTypeCode, batchCode) {
+      let dataArr = {
+        fieldCode: this.fieldInfo.fieldCode,
+        batchCode: batchCode,
+      };
+      const fieldRes = await getWindEngineGroupByFieldCode(dataArr);
+      const map = new Map();
+      const uniqueList = [];
 
-    async postChartData(
-      urlType,
-      row,
-      itemAnalysis,
-      itemField,
-      filterAnalysis,
-      typeChart
-    ) {
-      try {
-        const objectname =
-          itemAnalysis.analysisTypeCode === "temperature_large_components"
-            ? filterAnalysis.filterFileAddr +
-              "/" +
-              itemField.fieldEngineName +
-              ".jpg"
-            : urlType + itemField.fieldEngineName + ".jpg" ||
-              urlType + itemField.engineTypeCode + ".jpg";
-        const res = await axios.post(
-          `/downLoadChart/chartServer/charts/${urlType}`,
-          {
-            fieldEngineCode: itemField.fieldEngineCode,
-            bucketName: "bucket-zhzn",
-            objectName:
-              `charts/${row.fieldCode}/${row.batchCode}/${itemAnalysis.analysisTypeCode}/` +
-              objectname,
-            fieldInfo: this.fieldInfo,
-            fileAddr: itemField.fileAddr,
-            chartType:
-              filterAnalysis.typeDocxName === "production_indicator_unit"
-                ? "radar"
-                : urlType,
-          }
-        );
-        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;
+      for (const item of fieldRes.data.windEngineGroupVoList) {
+        if (!map.has(item.millTypeCode)) {
+          map.set(item.millTypeCode, true);
+          uniqueList.push(item);
         }
-        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);
       }
+      let paramsData = {
+        machineTypeCode: machineTypeCode || undefined,
+        pageNum: 1,
+        pageSize: 10,
+      };
+      this.loading = true;
+      const res = await windEngineMillPage(paramsData);
+      const filterMill = uniqueList.filter(
+        (item) => item.millTypeCode === res.data.list[0].millTypeCode
+      );
+      return { ...res.data.list[0], ratedPower: filterMill[0].ratedCapacity };
     },
+
+    // millTypeCode
+    // :
+    // "WEM00018"
+    // ratedCapacity
+    // :
+    // 2000
     getFileTypeFromUrl(url, keyword) {
       return url.includes(keyword) ? keyword : "Unknown";
     },
     async getFieldDetail(batchCode) {
       const res = await getFieldInfo({ batchCode });
       this.fieldInfo = res.data.fieldInfo; //风场信息
+      this.analysisInfo = res.data.analysisInfo;
     },
     //获取所有分析类型,分析结果接口
     async getAllAnalysis(batchCode) {
       const res = await analysisDetail({ batchCode });
-      console.log(res.data, "分析全部结果");
+      // console.log(res.data, "分析全部结果");
       this.allAnalysis = res.data;
     },
     //自动分析列表页面跳转
@@ -1131,13 +1514,6 @@ export default {
         this.formInline.errState = errState;
       }
       if (!this.loading) {
-        console.log(
-          "handleMessage",
-          this.firstLoad,
-          analysisState,
-          errState,
-          fieldName
-        );
         if (this.firstLoad && (analysisState || errState || fieldName)) {
           // this.getTableList();
           this.startPolling();
@@ -1168,15 +1544,12 @@ export default {
       ) {
         this.firstLoad = false;
       }
-      console.log("this.formInline");
       try {
         const result = await analysisResultList({
           ...this.formInline,
           totalSize: undefined,
         });
-        console.log(result, "result");
         this.tableData = result.data.list;
-        console.log(this.tableData, "this.tableData");
         this.formInline.totalSize = result.data.totalSize;
       } catch (error) {
         this.$message({
@@ -1271,7 +1644,20 @@ export default {
     }
   }
 }
-
+.progress {
+  display: flex;
+  align-items: center;
+  position: fixed;
+  top: 25px;
+  right: 300px;
+  .progressText {
+    font-size: 14px;
+    color: #606266;
+  }
+  .el-progress {
+    width: 300px;
+  }
+}
 .attachment {
   display: flex;
   padding-top: 10px;

+ 3 - 3
src/views/performance/components/chartsCom/3DDrawingChart.vue

@@ -244,7 +244,7 @@ export default {
             title: this.chartData.xaixs,
             gridcolor: "rgb(255,255,255)",
             tickcolor: "rgb(255,255,255)",
-            backgroundcolor: "#CFD4DC",
+            backgroundcolor: "#e0e7f1",
             showbackground: true,
             // linewidth: 2, // 轴线宽度
             linecolor: "black", // 轴线颜色
@@ -263,7 +263,7 @@ export default {
             ticktext: ticktext,
             gridcolor: "rgb(255,255,255)",
             tickcolor: "rgb(255,255,255)",
-            backgroundcolor: "#CFD4DC",
+            backgroundcolor: "#e0e7f1",
             showbackground: true,
             // linewidth: 2, // 轴线宽度
             linecolor: "black", // 轴线颜色
@@ -276,7 +276,7 @@ export default {
             title: this.chartData.zaixs,
             gridcolor: "rgb(255,255,255)",
             tickcolor: "rgb(255,255,255)",
-            backgroundcolor: "#CFD4DC",
+            backgroundcolor: "#e0e7f1",
             showbackground: true,
             fixedrange: true, // 防止缩放
             // linewidth: 2, // 轴线宽度