Quellcode durchsuchen

修改柱状图单位; 添加overlayAnalysis, updateContent接口

Bella vor 2 Jahren
Ursprung
Commit
00af87bf1e

+ 7 - 3
src/api/url.js

@@ -21,9 +21,13 @@ export default {
   //   类别数据请求
   selectByCNameAType: "/dms/category/selectByCNameAType",
   // 获取分级栏目列表
-  getColumnList:"/dms/column/getColumnList",
-  //   插入数据
+  getColumnList: "/dms/column/getColumnList",
+  // 插入数据
   addContent: "/dms/content/addContent",
+  // 修改数据
+  updateContent:"/dms/content/updateContent",
   // 删除数据
-  updateAudit:"/dms/content/updateAudit"
+  updateAudit: "/dms/content/updateAudit",
+  // 叠置分析接口 - get
+  overlayAnalysis: "/audit/audit/overlayAnalysis",
 };

+ 5 - 1
src/components/chart/BarChart.vue

@@ -78,7 +78,11 @@ export default {
           formatter: function (params) {
             let relVal = params[0].name;
             for (let i = 0; i < params.length; i++) {
-              relVal += `<br/>${params[i].marker}${params[i].value}公顷`;
+              if (params[i].value === 0) {
+                relVal += `<br/>${params[i].marker}${params[i].seriesName}  ${params[i].value}`;
+              } else {
+                relVal += `<br/>${params[i].marker}${params[i].seriesName}  ${params[i].value}公顷`;
+              }
             }
             return relVal;
           },

+ 47 - 50
src/components/common/BottomForm/CustomModelDialog.vue

@@ -163,6 +163,7 @@ export default {
       filterText: "",
       createModelParams: {
         title: "",
+        content: "",
         // 叠置分析geojson附件
         // c_dzfx_file: "",
         // 类型 -- 公开:1; 私人: 0
@@ -183,6 +184,7 @@ export default {
       notAllowedStyle: {
         cursor: "pointer",
       },
+      currentModifiedModelId: "",
     };
   },
   watch: {
@@ -203,19 +205,15 @@ export default {
       let btn = document.getElementById("leftArrowBtn");
       if (btn) {
         if (val.length === this.checkArr.length) {
-          // btn.style.cursor = "not-allowed";
           this.isLeftTransferBtn = false;
         }
         if (val.length < this.checkArr.length) {
-          // btn.style.cursor = "pointer";
-
           this.isLeftTransferBtn = true;
         }
       }
 
-      console.log(val, "checkedList");
+      // console.log(val, "checkedList");
     },
-    
   },
   created() {
     this.checkedKeysArr = [];
@@ -238,6 +236,8 @@ export default {
     this.$bus.$on("updateModel", (node) => {
       console.log("监听模型中");
       console.log(node, "节点数据");
+      this.currentModifiedModelId = node.data.id;
+      this.overlayBtnChecked = false;
       this.$nextTick(() => {
         if (this.$refs.transferTree) {
           this.$refs.transferTree.setCheckedKeys([]);
@@ -428,24 +428,24 @@ export default {
                 console.log(err, "接口请求失败,我的任务 - selectContentList");
               });
           }
+
+          if (data.mainType === "预设模型") {
+            layerAuthorityMap.set(data.id, "有权限");
+          }
         } else {
-          console.log(data.id);
-          console.log(this.checkedKeysArr, "previous");
           if (this.checkedKeysArr.includes(data.id)) {
             this.checkedKeysArr = this.checkedKeysArr.filter((v) => {
               return v !== data.id;
             });
           }
-          console.log(this.checkedKeysArr, "checkedKeysArr");
         }
       }
-
-      // console.log(this.$refs.transferTree.getCheckedKeys(),"getCheckedKeys");
     },
     // 添加模型
     addModel() {
       // 设置需要添加的参数
       this.createModelParams.title = this.inputName;
+      this.createModelParams.content = this.inputName;
       this.createModelParams.c_user_id = localStorage.getItem("USER_ID") || 4;
 
       let newData = this.checkedList.filter((v) => {
@@ -478,53 +478,44 @@ export default {
           this.$message.info("模型保存失败");
         });
     },
-    // 修改模型 -- 需要先删除当前模型再添加新模型
+    // 修改模型 -- 直接调用修改模型接口
     modifyModel() {
       console.log("这一步是修改模型");
-      let deleteParams = {
-        id: customModelIdMap.get(this.inputName).id,
+      let newData = this.checkedList.filter((v) => {
+        if (layerAuthorityMap.has(v) && layerAuthorityMap.get(v) === "有权限") {
+          return v;
+        }
+      });
+      console.log(this.currentModifiedModelId, "model id");
+      let obj = {
+        id: this.currentModifiedModelId,
+        title: this.inputName,
+        content: this.inputName,
+        c_level: "1",
+        c_bind_layer: JSON.stringify(newData),
+        c_user_id: localStorage.getItem("USER_ID"),
+      };
+      let modifyParams = new FormData();
+      modifyParams = {
         columnId: 89,
-        state: 4,
+        modelId: 94,
+        content: JSON.stringify(obj),
       };
-      console.log(deleteParams);
-      this.$Post(this.urlsCollection.updateAudit, deleteParams).then((res) => {
-        if (res.code === 200) {
-          console.log("已删除当前模型");
-          if (this.$store.state.customModelsArr.length > 0) {
+      this.$Post(this.urlsCollection.updateContent, modifyParams).then(
+        (res) => {
+          if (res.code === 200) {
             this.$store.state.customModelsArr.filter((v) => {
               return v.name !== this.inputName;
             });
+            this.$store.state.customModelsArr.push({
+              name: this.inputName,
+              data: newData,
+            });
+            this.$message.success("模型修改成功");
+            this.clearDialogVisible();
           }
-
-          // 设置需要添加的参数
-          this.createModelParams.title = this.inputName;
-          this.createModelParams.c_user_id =
-            localStorage.getItem("USER_ID") || 4;
-
-          this.createModelParams.c_bind_layer = JSON.stringify(
-            this.checkedList
-          );
-          let modifyParams = new FormData();
-          modifyParams = {
-            columnId: 89,
-            modelId: 94,
-            content: JSON.stringify(this.createModelParams),
-          };
-
-          this.$Post(this.urlsCollection.addContent, modifyParams).then(
-            (modifyRes) => {
-              if (res.code === 200) {
-                this.$message.success("模型已修改");
-                this.$store.state.customModelsArr.push({
-                  name: this.inputName,
-                  data: this.checkedList,
-                });
-                this.clearDialogVisible();
-              }
-            }
-          );
         }
-      });
+      );
     },
     deleteCheckList() {
       // console.log("点击左侧按钮");
@@ -626,8 +617,14 @@ export default {
     // 执行叠置分析
     executeOverlay() {
       this.overlayBtnChecked = !this.overlayBtnChecked;
-      // alert("正在开发中");
-      // console.log("execute overlay");
+      if (this.overlayBtnChecked) {
+        this.clearDialogVisible();
+        this.$message.success("系统已完成叠置分析,数据已保存!");
+        let tagretUrl = `${this.urlsCollection.overlayAnalysis}?modelId=${this.currentModifiedModelId}`;
+        this.$Get(tagretUrl).then((res) => {
+          console.log(JSON.parse(res), "叠置分析的结果");
+        });
+      }
     },
   },
 };

+ 1 - 0
src/views/ComprehensiveAnalysis.vue

@@ -925,6 +925,7 @@ export default {
           }
 
           if (data.mainType === "预设模型") {
+            layerAuthorityMap.set(data.id, "有权限");
             this.rightPanelTitle = `${data.label}(${data.mainType})`;
             let params = new FormData();
             params = {

+ 4 - 1
vue.config.js

@@ -44,7 +44,10 @@ module.exports = {
         target: "http://121.43.55.7:10088",
         changeOrigin: true, // 允许跨域
       },
-      
+      "/audit": {
+        target: "http://121.43.55.7:10011",
+        changeOrigin: true, // 允许跨域
+      },
     },
   },
 };