浏览代码

综合分析切换镇时清除所有图层数据; 自定义模型优化

Bella 2 年之前
父节点
当前提交
684f154ba3
共有 3 个文件被更改,包括 93 次插入18 次删除
  1. 11 4
      src/components/common/BottomForm/CustomModelDialog.vue
  2. 2 2
      src/utils/request.js
  3. 80 12
      src/views/ComprehensiveAnalysis.vue

+ 11 - 4
src/components/common/BottomForm/CustomModelDialog.vue

@@ -243,9 +243,7 @@ export default {
           });
         }
       }
-      // this.checkedList = node.data.data;
       this.inputName = node.data.label;
-      // this.overlayBtnShow = true;
       this.modelTitle = node.data.label;
       this.$store.state.modelStatus = "modify";
     });
@@ -431,6 +429,7 @@ export default {
       if (customModelIdMap.has(this.inputName)) {
         this.$message.info("该模型名称已存在");
       } else {
+        // debugger
         // 设置需要添加的参数
         this.createModelParams.title = this.inputName;
         this.createModelParams.content = this.inputName;
@@ -621,6 +620,14 @@ export default {
       this.$Post(this.urlsCollection.overlayAnalysis, overlayParams)
         .then((response) => {
           console.log(response, "创建模型时进行的叠置分析");
+          if (response.code === 203) {
+            this.layerLoading = false;
+            this.$message.error("叠置分析失败,将呈现默认选中的图层!");
+            this.$store.state.mapMethodsCollection
+              .get("METHODS")
+              .getMyModelData(true, modelId);
+            this.clearDialogVisible();
+          }
           if (response.message === "未申请任务权限") {
             this.layerLoading = false;
             this.$message.info(
@@ -629,7 +636,7 @@ export default {
             // 呈现默认选中的图层
             this.$store.state.mapMethodsCollection
               .get("METHODS")
-              .getMyModelData(false, "");
+              .getMyModelData(true, modelId);
             this.clearDialogVisible();
           }
           if (response.code === 200) {
@@ -648,7 +655,7 @@ export default {
           this.layerLoading = false;
           this.$store.state.mapMethodsCollection
             .get("METHODS")
-            .getMyModelData(false, "");
+            .getMyModelData(true, modelId);
           this.clearDialogVisible();
         });
     },

+ 2 - 2
src/utils/request.js

@@ -6,7 +6,7 @@ import { VueAxios } from "./axios";
 // 创建 axios 实例
 const service = axios.create({
   // baseURL: 'http://121.43.55.7:8888',
-  timeout: 60000, // 请求超时时间,
+  timeout: 40000, // 请求超时时间,
   headers: {
     "Content-Type": "application/form-data",
   },
@@ -14,7 +14,7 @@ const service = axios.create({
 
 const fileService = axios.create({
   baseURL: "",
-  timeout: 60000, // 请求超时时间,
+  timeout: 40000, // 请求超时时间,
   headers: {
     "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
   },

+ 80 - 12
src/views/ComprehensiveAnalysis.vue

@@ -854,6 +854,9 @@ export default {
             data: data.data,
             children: [],
           };
+
+          this.rightPanelDataMap.set(data.id, obj);
+
           this.uploadNodeChildren.push(obj);
           this.$refs.tree.updateKeyChildren(
             this.firstLevelIdMap.get("我的图层").id,
@@ -930,6 +933,23 @@ export default {
     this.$bus.$off("addUploadLayerEvent");
   },
   methods: {
+    /**
+     * 关闭所有图层数据 
+     * 
+     * 使用场景 -- 叠置分析,切换镇域
+     */
+    closeAllRelatedLayers() {
+      // 每次切换镇的时候都清空面板仅针对所有图层,预设模型
+      if (this.rightPanelDataMap.size > 0) {
+        this.rightPanelDataMap.forEach((v, i) => {
+          if (map2DViewer.analysisGroups[i]) {
+            this.handleCheckChange(v, false);
+            delete map2DViewer.analysisGroups[i]
+          }
+        });
+        this.$refs.tree.setCheckedKeys([]);
+      }
+    },
     /**
      * 疑点数据中增加数据来源以及id
      * @data
@@ -1152,6 +1172,7 @@ export default {
     },
     // 勾选镇时默认展开当前镇
     changeTownEvent(val) {
+      this.closeAllRelatedLayers()
       if (this.townSelectTreeMap.has(val)) {
         let children = [];
         let data = this.townSelectTreeMap.get(val).data;
@@ -1165,9 +1186,19 @@ export default {
                   ? []
                   : item1.columnList.map((item2) => {
                       this.rightPanelDataMap.set(`${item2.title}_${item2.id}`, {
-                        id: item2.id,
-                        mainType: "所有图层",
+                        // id: item2.id,
+                        // mainType: "所有图层",
+                        // sourceType: item1.title,
+                        id: `${item2.title}_${item2.id}`,
+                        label: item2.title,
+                        columnId: item2.id,
+                        townId: this.townSelectTreeMap.get(val).id,
+                        townType: val,
+                        sourceId: item1.id,
                         sourceType: item1.title,
+                        mainType: "所有图层",
+                        color: publicFun.getRGBColor(),
+                        children: [],
                       });
 
                       return {
@@ -1261,7 +1292,7 @@ export default {
     panelMouseEnter(val) {
       if (this.rightPanelDataMap.has(val)) {
         this.enteredPanelId = val;
-        this.enteredColumnId = this.rightPanelDataMap.get(val).id;
+        this.enteredColumnId = this.rightPanelDataMap.get(val).columnId;
         this.enteredMainType = this.rightPanelDataMap.get(val).mainType;
         this.enteredSourceType = this.rightPanelDataMap.get(val).sourceType;
       }
@@ -1631,9 +1662,16 @@ export default {
                                   this.rightPanelDataMap.set(
                                     `${item3.title}_${item3.id}`,
                                     {
-                                      id: item3.id,
-                                      mainType: item1.title,
+                                      // id: item3.id,
+                                      // mainType: item1.title,
+                                      // sourceType: item2.title,
+                                      id: `${item3.title}_${item3.id}`,
+                                      label: item3.title,
                                       sourceType: item2.title,
+                                      mainType: item1.title,
+                                      columnId: item3.id,
+                                      children: [],
+                                      disabled: false,
                                     }
                                   );
 
@@ -1689,6 +1727,18 @@ export default {
                           id: `${item2.title}_${item2.id}`,
                           label: item2.title,
                         });
+                        this.rightPanelDataMap.set(
+                          `${item2.title}_${item2.id}`,
+                          {
+                            id: `${item2.title}_${item2.id}`,
+                            label: item2.title,
+                            mainType: item1.title,
+                            columnId: item2.id,
+                            modelId: item2.modelId,
+                            sourceType: "土地资源",
+                            children: [],
+                          }
+                        );
                         return {
                           id: `${item2.title}_${item2.id}`,
                           label: item2.title,
@@ -1813,12 +1863,22 @@ export default {
                 mainType: "我的模型",
                 sourceType: "",
                 label: ele.title,
+                children: [],
+                column_id: ele.column_id,
+                model_name: ele.model_name,
+                model_id: ele.model_id,
+                state: ele.state,
+                mainType: "我的模型",
+                c_bind_layer: ele.c_bind_layer,
+                c_layer_name: ele.c_layer_name,
+                c_dzfx_file: ele.c_dzfx_file || "",
               });
               return {
                 id: `${ele.title}_${ele.id}`,
                 label: ele.title,
                 modelId: ele.id,
                 children: [],
+                sourceType: "",
                 column_id: ele.column_id,
                 model_name: ele.model_name,
                 model_id: ele.model_id,
@@ -1837,10 +1897,8 @@ export default {
                 );
 
                 if (isShow) {
-                  // 如果已显示过叠置分析数据,需要先删除图层
-                  if (map2DViewer.analysisGroups[uniqueKeyId]) {
-                    this.handleCheckChange(uniqueKeyChild, false);
-                  }
+                  // // 所有图层或预设模型全部删除 -- 同时删除所有相关内容
+                  this.closeAllRelatedLayers()
                   console.log("开始更新我的模型节点了!!!");
                   this.expandedKeys.push(
                     this.firstLevelIdMap.get("我的模型").id
@@ -1853,7 +1911,10 @@ export default {
                   console.log(uniqueKeyChild, "uniqueKeyChild");
                   this.$refs.tree.setCheckedKeys([uniqueKeyId]);
                   this.$refs.tree.setCurrentKey(uniqueKeyId);
-                  this.handleCheckChange(uniqueKeyChild, true);
+                  // 延迟显示数据
+                  setTimeout(() => {
+                    this.handleCheckChange(uniqueKeyChild, true);
+                  }, 800);
                 }
               }
             }
@@ -1968,10 +2029,13 @@ export default {
         columnId: 49,
         state: 4,
       };
+
       this.$Post(this.urlsCollection.updateAudit, deleteParams).then((res) => {
         if (res.code === 200) {
           this.$message.info("模型已删除!");
-
+          if (map2DViewer.analysisGroups[node.data.id]) {
+            this.handleCheckChange(node.data, false);
+          }
           this.getMyModelData(false, "");
         }
       });
@@ -2263,6 +2327,10 @@ export default {
           // 调用我的模型查看接口读取所有图层数据
           this.$Post(this.urlsCollection.getModelCoverAgeInfo, params).then(
             (res) => {
+              if(res.code !== 201 && res.code !== 200){
+                this.layerLoading = false
+                this.$message.info("数据请求失败,请重新请求!")
+              }
               if (res.code === 201 && res.message === "未申请任务权限") {
                 this.layerLoading = false;
                 this.$message.info("暂无数据!");
@@ -3048,7 +3116,7 @@ export default {
             width: 100%;
           }
           &-item {
-            max-width: 240px;
+            max-width: 220px;
             overflow: hidden;
             white-space: nowrap;
             text-overflow: ellipsis;