Преглед изворни кода

图层构成显示数据优化

Bella пре 2 година
родитељ
комит
e2b198269b
1 измењених фајлова са 26 додато и 30 уклоњено
  1. 26 30
      src/views/ComprehensiveAnalysis.vue

+ 26 - 30
src/views/ComprehensiveAnalysis.vue

@@ -239,7 +239,11 @@
                     <el-tooltip class="item" effect="light" placement="top-end">
                       <div slot="content">
                         模型名称:{{ node.data.label }}<br /><br />
-                        图层构成:{{ layerToCompObj[node.data.id] || "--" }}
+                        图层构成:{{
+                          preLayerCompMap.get(node.data.label)
+                            .c_layer_component || "--"
+                        }}<br /><br />
+                        备注: {{ preLayerCompMap.get(node.data.label).c_extra }}
                       </div>
                       <div class="custom-tree-node-item">
                         {{ node.data.label }}
@@ -446,7 +450,6 @@ export default {
       isSortCaseObj: {},
       // 存储图层构成信息
       preLayerCompMap: new Map(),
-      layerToCompObj: {},
       displaySortSelect: false,
       basemapName: "",
       caseAuditEventStatus: false,
@@ -914,7 +917,7 @@ export default {
      * @mainType 判断是主目录类型
      * @uniqueId id
      */
-    addLayerDataSource(data, mainType, uniqueId) {
+    addLayerDataSource(data, mainType, layerName) {
       let targetGeometry = JSON.parse(data);
       if (targetGeometry) {
         let properties = targetGeometry.properties;
@@ -929,12 +932,12 @@ export default {
 
         if (
           mainType === "预设模型" &&
-          uniqueId &&
-          this.layerToCompObj[uniqueId]
+          layerName &&
+          this.preLayerCompMap.has(layerName)
         ) {
           if (!targetGeometry.properties["图层构成"]) {
             targetGeometry.properties["图层构成"] =
-              this.layerToCompObj[uniqueId];
+              this.preLayerCompMap.get(layerName).c_layer_component;
           }
         }
         return JSON.stringify(targetGeometry);
@@ -943,25 +946,23 @@ export default {
     // 获取预设模型图层构成接口数据
     getPreLayerApi() {
       let params = new FormData();
-      params.append("columnId", 1403);
+      params.append("columnId", 1404);
       params.append("states", "0,1,2,3");
-      params.append("pageSize", 1000);
+      params.append("pageSize", 100);
       params.append("page", 0);
       this.$Post(this.urlsCollection.selectContentList, params).then((res) => {
         if (res.code === 200 && res.content.data.length > 0) {
           res.content.data.forEach((v, i) => {
-            let key = `${v.c_model_name}-${v.c_town}`;
-            if (!this.preLayerCompMap.has(key)) {
-              this.preLayerCompMap.set(key, {
+            if (!this.preLayerCompMap.has(v.c_layer_name)) {
+              this.preLayerCompMap.set(v.c_layer_name, {
                 c_first_level: v.c_first_level,
                 c_layer_component: v.c_layer_component,
                 c_town: v.c_town,
                 c_model_name: v.c_model_name,
+                c_extra: v.c_extra,
               });
             }
           });
-          // console.log("preLayerCompMap");
-          // console.log(this.preLayerCompMap);
         }
       });
     },
@@ -1207,7 +1208,7 @@ export default {
         this.enteredColumnId
       );
     },
-    getMapData(uniqueId, columnId, mainType, sourceType) {
+    getMapData(uniqueId, columnId, mainType, sourceType, layerName) {
       let layerParams = new FormData();
       layerParams = {
         columnId: columnId,
@@ -1310,7 +1311,7 @@ export default {
                 let geometry = this.addLayerDataSource(
                   ele.c_content,
                   mainType,
-                  uniqueId
+                  layerName
                 );
                 let defaultStatus = ele.c_boolean;
                 let modelId = ele.model_id;
@@ -1381,8 +1382,9 @@ export default {
      * @id label_columnId
      * @mainType  所有图层/预设模型
      * @sourceType 土地资源/林地资源/生态资源/水资源/全部
+     * @layerName 图层名称
      */
-    displaySingleLayer(columnId, id, mainType, sourceType) {
+    displaySingleLayer(columnId, id, mainType, sourceType, layerName) {
       let uniqueId = id;
       this.layerIdMap.set(uniqueId, uniqueId);
 
@@ -1396,7 +1398,7 @@ export default {
         if (!this.layerLoading && this.targetLayerPage[uniqueId] === 0) {
           this.layerLoading = true;
         }
-        this.getMapData(uniqueId, columnId, mainType, sourceType);
+        this.getMapData(uniqueId, columnId, mainType, sourceType, layerName);
       }
     },
     /**
@@ -1573,15 +1575,6 @@ export default {
             }
           });
 
-          // 将预设模型的图层与图层构成数据进行匹配
-          defaultModelNameMap.forEach((v, i) => {
-            let key = `${i.split("-")[0]}-${i.split("-")[1]}`;
-            if (this.preLayerCompMap.has(key)) {
-              this.layerToCompObj[v] =
-                this.preLayerCompMap.get(key).c_layer_component;
-            }
-          });
-
           // 获取我的模型数据
           let oldOptions = [];
           this.getMyModelData();
@@ -1885,7 +1878,8 @@ export default {
                   data.columnId,
                   data.id,
                   data.mainType,
-                  data.sourceType ? data.sourceType : ""
+                  data.sourceType ? data.sourceType : "",
+                  data.label
                 );
                 // if (res.code === 202 && res.content === "数据不存在") {
                 //   this.$message.info("当前用户无权限!");
@@ -1907,7 +1901,8 @@ export default {
               data.columnId,
               data.id,
               data.mainType,
-              data.sourceType ? data.sourceType : ""
+              data.sourceType ? data.sourceType : "",
+              data.label
             );
           }
           // 第一级菜单是疑点问题
@@ -1918,7 +1913,8 @@ export default {
               data.columnId,
               data.id,
               data.mainType,
-              data.sourceType ? data.sourceType : ""
+              data.sourceType ? data.sourceType : "",
+              data.label
             );
           }
         } else {
@@ -2151,7 +2147,7 @@ export default {
                     let geometry = this.addLayerDataSource(
                       ele.c_content,
                       data.mainType,
-                      uniqueId
+                      data.label
                     );
 
                     let modelId = ele.model_id;