liujiejie 3 місяців тому
батько
коміт
bd9e71171d
2 змінених файлів з 48 додано та 45 видалено
  1. 38 38
      src/components/map/index.vue
  2. 10 7
      src/views/performance/assetssMag.vue

+ 38 - 38
src/components/map/index.vue

@@ -270,45 +270,45 @@ export default {
     });
 
     // -------------【添加山西省真实边界线】------------- 定位全国的时候注释这个代码
-    // if (this.$route.path === "/home/cockpitManage") {
-    //   // 通过导入的 JSON 文件加载边界数据(GeoJSON 格式),并解析成矢量要素
-    //   const shanxiSource = new Vector({
-    //     features: new GeoJSON().readFeatures(shanxiBoundary, {
-    //       featureProjection: "EPSG:4326",
-    //     }),
-    //   });
-    //   // 创建矢量图层,仅显示边界线(填充颜色设为透明)
-    //   const shanxiLayer = new VectorLayer({
-    //     source: shanxiSource,
-    //     style: new Style({
-    //       stroke: new Stroke({
-    //         color: "rgba(59, 130, 246, 0.5)",
-    //         width: 3,
-    //       }),
-    //       fill: new Fill({
-    //         color: "rgba(59, 130, 246, 0.05)", // 透明填充
-    //       }),
-    //     }),
-    //   });
-    //   this.map.addLayer(shanxiLayer);
+    if (this.$route.path === "/home/cockpitManage") {
+      // 通过导入的 JSON 文件加载边界数据(GeoJSON 格式),并解析成矢量要素
+      const shanxiSource = new Vector({
+        features: new GeoJSON().readFeatures(shanxiBoundary, {
+          featureProjection: "EPSG:4326",
+        }),
+      });
+      // 创建矢量图层,仅显示边界线(填充颜色设为透明)
+      const shanxiLayer = new VectorLayer({
+        source: shanxiSource,
+        style: new Style({
+          stroke: new Stroke({
+            color: "rgba(59, 130, 246, 0.5)",
+            width: 3,
+          }),
+          fill: new Fill({
+            color: "rgba(59, 130, 246, 0.05)", // 透明填充
+          }),
+        }),
+      });
+      this.map.addLayer(shanxiLayer);
 
-    //   const markerLayer = this.map
-    //     .getLayers()
-    //     .getArray()
-    //     .find((layer) => {
-    //       return layer.get("id") === "marker";
-    //     });
-    //   if (markerLayer) {
-    //     markerLayer.setZIndex(10);
-    //   }
+      const markerLayer = this.map
+        .getLayers()
+        .getArray()
+        .find((layer) => {
+          return layer.get("id") === "marker";
+        });
+      if (markerLayer) {
+        markerLayer.setZIndex(10);
+      }
 
-    //   // 同时设置高亮图层 zIndex 较低
-    //   shanxiLayer.setZIndex(1);
-    //   // -------------【结束】-------------
-    //   // const targetExtent = [106.8, 34.3, 118.6, 41.2];//山西
-    //   const targetExtent = [119.65, 40.87, 131.31, 46.30];//吉林
-    //   this.map.getView().fit(targetExtent, { duration: 2000 });
-    // }
+      // 同时设置高亮图层 zIndex 较低
+      shanxiLayer.setZIndex(1);
+      // -------------【结束】-------------
+      const targetExtent = [106.8, 34.3, 118.6, 41.2]; //山西
+      // const targetExtent = [119.65, 40.87, 131.31, 46.30];//吉林
+      this.map.getView().fit(targetExtent, { duration: 2000 });
+    }
     // 这个放在外面
     this.initEvent();
   },
@@ -368,7 +368,7 @@ export default {
             anchor: [0.5, 1],
             opacity: 1,
           }),
-        })
+        }),
       );
 
       source.addFeature(feature);

+ 10 - 7
src/views/performance/assetssMag.vue

@@ -600,15 +600,18 @@ export default {
           console.log(itemField, "itemField");
         }
 
+        const chartFileStem =
+          (itemField.fieldEngineName &&
+            String(itemField.fieldEngineName).trim()) ||
+          itemField.engineTypeCode ||
+          itemField.fieldEngineCode ||
+          "chart";
         const objectname =
           itemAnalysis.analysisTypeCode === "temperature_large_components"
-            ? filterAnalysis.filterFileAddr +
-              "/" +
-              itemField.fieldEngineName +
-              ".jpg"
+            ? `${filterAnalysis.filterFileAddr}/${chartFileStem}.jpg`
             : itemField.engineTypeCode
-            ? urlType + itemField.engineTypeCode + ".jpg"
-            : urlType + itemField.fieldEngineName + ".jpg";
+            ? `${urlType}${itemField.engineTypeCode}.jpg`
+            : `${urlType}${chartFileStem}.jpg`;
 
         const res = await axios.post(
           `/downLoadChart/chartServer/charts/${urlType}`,
@@ -695,7 +698,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(