Переглянути джерело

Merge branch 'develop' of http://39.106.8.246:3003/web/wanda-editer into develop

zhangyu 4 роки тому
батько
коміт
8b0707b788
2 змінених файлів з 122 додано та 106 видалено
  1. 120 104
      src/views/drafts.vue
  2. 2 2
      vue.config.js

+ 120 - 104
src/views/drafts.vue

@@ -89,7 +89,7 @@ import { uuid } from "@/components/mapClass/until";
 import { SImageItem } from "@saga-web/graph/lib";
 import store from "../store";
 import { Loading } from "element-ui";
-import {getUrlMsg}  from '@/components/urlMsg.js'
+import { getUrlMsg } from "@/components/urlMsg.js";
 let fengmap = null;
 export default {
   components: { Tree },
@@ -283,75 +283,80 @@ export default {
         spinner: "el-icon-loading",
         background: "rgba(0, 0, 0, 0.7)"
       });
-      queryDraftGroup({ projectId: this.projectId }).then(res => {
-        console.log(res);
-        loadings.close();
-        if (res.Result == "success") {
-          const data = res.Data;
-          this.systemName = '';
-          this.floorName = '';
-          this.floorId = '';
-          this.categoryId = '';
-          if(data.length){
-            (function recursion(newObj) {
-              newObj.map(function(item, index) {
-                item.id = item.Id || item.Gname;
-                item.name = item.Gcode;
+      queryDraftGroup({ projectId: this.projectId })
+        .then(res => {
+          console.log(res);
+          loadings.close();
+          if (res.Result == "success") {
+            const data = res.Data;
+            this.systemName = "";
+            this.floorName = "";
+            this.floorId = "";
+            this.categoryId = "";
+            if (data.length) {
+              (function recursion(newObj) {
+                newObj.map(function(item, index) {
+                  item.id = item.Id || item.Gname;
+                  item.name = item.Gcode;
 
-                item.checked = false;
-                if (item.Category && item.Category.length > 0) {
-                  item.children = item.Category;
-                  item.open = false;
-                  recursion(item.Category);
-                }
+                  item.checked = false;
+                  if (item.Category && item.Category.length > 0) {
+                    item.children = item.Category;
+                    item.open = false;
+                    recursion(item.Category);
+                  }
+                });
+              })(data);
+              data.forEach(ele => {
+                ele.children.forEach(item => {
+                  ele.open = true;
+                  if (item.children) {
+                    item.open = true;
+                    item.children.forEach(item1 => {
+                      item1.id = item.Id + item1.Gname;
+                    });
+                  } else {
+                    item.id = ele.Id + item.Gname;
+                  }
+                });
               });
-            })(data);
-            data.forEach(ele => {
-              ele.children.forEach(item => {
-                ele.open=true;
-                if (item.children) {
-                  item.open=true;
-                  item.children.forEach(item1 => {
-                    item1.id = item.Id + item1.Gname;
-                  });
-                } else {
-                  item.id = ele.Id + item.Gname;
-                }
-              });
-            });
-            this.treeData = data;
-            if ( this.treeData[0].children[0].children) {
-              this.treeData[0].open = true;
-              this.treeData[0].children[0].open = true;
-              this.treeData[0].children[0].children[0].checked = "checked";
-              this.systemName = this.treeData[0].children[0].Gcode;
-              this.floorName = this.treeData[0].children[0].children[0].Gcode;
-              this.floorId = this.treeData[0].children[0].children[0].Gname;
-              this.categoryId = this.treeData[0].children[0].Id;
-              // this.getLegend();
-              this.checkFloor(this.treeData[0].children[0].children[0].Gname);
+              this.treeData = data;
+              if (this.treeData[0].children[0].children) {
+                this.treeData[0].open = true;
+                this.treeData[0].children[0].open = true;
+                this.treeData[0].children[0].children[0].checked = "checked";
+                this.systemName = this.treeData[0].children[0].Gcode;
+                this.floorName = this.treeData[0].children[0].children[0].Gcode;
+                this.floorId = this.treeData[0].children[0].children[0].Gname;
+                this.categoryId = this.treeData[0].children[0].Id;
+                // this.getLegend();
+                this.checkFloor(this.treeData[0].children[0].children[0].Gname);
+              } else {
+                this.treeData[0].open = true;
+                this.treeData[0].children[0].checked = "checked";
+                this.systemName = this.treeData[0].Gcode;
+                this.floorName = this.treeData[0].children[0].Gcode;
+                this.floorId = this.treeData[0].children[0].Gname;
+                this.categoryId = this.treeData[0].Id;
+                // this.getLegend();
+                this.checkFloor(this.treeData[0].children[0].Gname);
+              }
             } else {
-              this.treeData[0].open = true;
-              this.treeData[0].children[0].checked = "checked";
-              this.systemName = this.treeData[0].Gcode;
-              this.floorName = this.treeData[0].children[0].Gcode;
-              this.floorId = this.treeData[0].children[0].Gname;
-              this.categoryId = this.treeData[0].Id;
-              // this.getLegend();
-              this.checkFloor(this.treeData[0].children[0].Gname);
+              this.treeData = data;
             }
-          }else{
-            this.treeData = data;
+          } else {
+            this.treeData = [];
+            this.$message.error("获取楼层结构失败");
           }
-
-        } else {
-          this.treeData = [];
-          this.$message.error("获取楼层结构失败");
-        }
-      }).catch(()=>{
-        loadings.close();
-        this.$message.error('请求失败')
-      });
+          // 如果没有楼层则底图清空
+          if (this.treeData.length == 0) {
+            this.checkFloor("");
+          }
+        })
+        .catch(() => {
+          loadings.close();
+          this.$message.error("请求失败");
+        });
     },
     //获取补充图例
     getLegend() {
@@ -360,7 +365,7 @@ export default {
       queryStatistic({
         projectId: this.projectId,
         graphId: this.graphId,
-        categoryId:this.categoryId
+        categoryId: this.categoryId
       }).then(res => {
         console.log(res);
         this.legendLoading = false;
@@ -468,7 +473,7 @@ export default {
     // 切换草稿箱楼层
     checkFloor(floorid) {
       this.scene = new EditScence();
-      this.scene.isEditStatus = false
+      this.scene.isEditStatus = false;
       this.clearGraphy();
       const loadings = Loading.service({
         lock: true,
@@ -476,48 +481,59 @@ export default {
         spinner: "el-icon-loading",
         background: "rgba(0, 0, 0, 0.7)"
       });
+      if(!floorid){
+        loadings.close();
+        this.view.fitSceneToView();
+        return
+      }
       setTimeout(() => {
         this.parserData(floorid);
         this.readGroup(floorid).then(data => {
-          this.graphId = data.Data[0].ID;
-          if (data.Data) {
+          if (data.Result == "success") {
+            this.graphId = data.Data[0].ID;
+            if (data.Data) {
+              loadings.close();
+              const parserData = new STopologyParser(null);
+              parserData.parseData(data.Data[0].Elements);
+              // 多边形
+              parserData.zoneLegendList.forEach(t => {
+                this.scene.addItem(t);
+                this.scene.Nodes.push(t);
+              });
+              // 增加文字
+              parserData.textMarkerList.forEach(t => {
+                this.scene.addItem(t);
+                this.scene.Markers.push(t);
+              });
+              // 增加图片
+              parserData.imageMarkerList.forEach(t => {
+                this.scene.addItem(t);
+                this.scene.Markers.push(t);
+              });
+              // 增加直线
+              parserData.lineMarkerList.forEach(t => {
+                this.scene.addItem(t);
+                this.scene.Markers.push(t);
+              });
+              // 增加图标类图例
+              parserData.imageLegendList.forEach(t => {
+                this.scene.addItem(t);
+                this.scene.Nodes.push(t);
+              });
+              // 增加管线类
+              // 增加图标类图例
+              parserData.relationList.forEach(t => {
+                this.scene.addItem(t);
+                this.scene.Relations.push(t);
+              });
+              this.view.fitSceneToView();
+              this.getLegend();
+            }
+          } else {
             loadings.close();
-            const parserData = new STopologyParser(null);
-            parserData.parseData(data.Data[0].Elements);
-            // 多边形
-            parserData.zoneLegendList.forEach(t => {
-              this.scene.addItem(t);
-              this.scene.Nodes.push(t);
-            });
-            // 增加文字
-            parserData.textMarkerList.forEach(t => {
-              this.scene.addItem(t);
-              this.scene.Markers.push(t);
-            });
-            // 增加图片
-            parserData.imageMarkerList.forEach(t => {
-              this.scene.addItem(t);
-              this.scene.Markers.push(t);
-            });
-            // 增加直线
-            parserData.lineMarkerList.forEach(t => {
-              this.scene.addItem(t);
-              this.scene.Markers.push(t);
-            });
-            // 增加图标类图例
-            parserData.imageLegendList.forEach(t => {
-              this.scene.addItem(t);
-              this.scene.Nodes.push(t);
-            });
-            // 增加管线类
-            // 增加图标类图例
-            parserData.relationList.forEach(t => {
-              this.scene.addItem(t);
-              this.scene.Relations.push(t);
-            });
-            this.view.fitSceneToView();
-            this.getLegend();
           }
+        }).catch(()=>{
+          loadings.close();
         });
       }, 100);
     }

+ 2 - 2
vue.config.js

@@ -15,9 +15,9 @@ module.exports = {
                 },
             },
             '/serve': {
-                // target: 'http://192.168.200.87:8088/',
+                target: 'http://192.168.200.87:8088/',
                 // target: 'http://192.168.200.83:8085/',
-                target: 'http://60.205.177.43:8080', //阿里云
+                // target: 'http://60.205.177.43:8080', //阿里云
                 changeOrigin: true,
                 secure: false,
                 pathRewrite: {