Browse Source

临时功能 -业务空间邻接关系

haojianlong 5 years ago
parent
commit
d19670eec3
3 changed files with 77 additions and 9 deletions
  1. 1 1
      package.json
  2. 12 0
      src/api/scan/request.js
  3. 64 8
      src/views/relation/overview/detail/index.vue

+ 1 - 1
package.json

@@ -36,7 +36,7 @@
     "@saga-web/base": "2.1.9",
     "@saga-web/draw": "2.1.71",
     "@saga-web/graphy": "2.1.34",
-    "@saga-web/cad-engine": "2.0.517"
+    "@saga-web/cad-engine": "2.0.522"
   },
   "devDependencies": {
     "ajv": "^6.9.1",

+ 12 - 0
src/api/scan/request.js

@@ -1527,6 +1527,18 @@ export function querySpaceNeighborhood(param, success) {
   http.postJson(url, param, success)
 }
 
+//查询邻接关系
+export function delSpaceNeighborhood(param, success) {
+  let url = `${baseUrl}/datacenter/relation/sp-rel/delete`;
+  http.postJson(url, param, success)
+}
+
+//查询邻接关系
+export function delFloorNeighborhood(param, success) {
+  let url = `${baseUrl}/datacenter/relation/sp-rel/delete-floor`;
+  http.postJson(url, param, success)
+}
+
 //项目关系类型查询
 export function getrelationTypeProject(param, success) {
     let url = `${baseUrl}/datacenter/graphic/relation_type_project`;

+ 64 - 8
src/views/relation/overview/detail/index.vue

@@ -11,13 +11,17 @@
       </el-col>
       <el-col :span="0.5">
         <span style="margin:0 10px;">业务空间类型</span>
-        <el-select placeholder="请选择" v-model="zoneType">
+        <el-select placeholder="请选择" v-model="zoneType" @change="getBusinessSpace">
           <el-option v-for="item in tabsList" :key="item.Code" :label="item.Name" :value="item.Code">
           </el-option>
         </el-select>
       </el-col>
-      <el-col :span="0.5" style="float:right;" v-show='0'>
-        <el-button @click="clearRelation">清除</el-button>
+      <el-col :span="0.5" style="float:right;" v-show='1'>
+        当前状态{{description}}
+        <el-button @click="cancel">取消</el-button>
+        <el-button @click="removeRelation">清除</el-button>
+        <el-button @click="removeAll">清除所有</el-button>
+        <el-button @click="addRelation">添加</el-button>
         <el-button type="primary" @click="saveRelation">保存</el-button>
       </el-col>
     </el-row>
@@ -45,6 +49,8 @@ import {
   queryDictionaryHead, //空间类型查询
   createSpaceNeighborhood, //创建邻接关系
   querySpaceNeighborhood, // 查询邻接关系
+  delSpaceNeighborhood, //删除选中
+  delFloorNeighborhood, //删除所有
 } from "@/api/scan/request";
 import { SColor, SPoint } from "@saga-web/draw/lib";
 import { RelationScene, FloorView } from "@saga-web/cad-engine/lib";
@@ -79,6 +85,7 @@ export default {
         divide: false,
         groupSelect: false
       },
+      description: '无'
     }
   },
   created() {
@@ -131,12 +138,45 @@ export default {
       this.createRela(pa)
     },
     clearRelation() {
-      console.log(355555555555)
       if (this.scene) {
         this.scene.removeAllRelation()
       }
     },
+    //
+    cancel() {
+      this.scene.removeRelationFlag = false;
+      this.scene.createRelateFlag = false;
+      this.scene.isAbsorbing = false;
+      this.description = '无'
+    },
+    //
+    removeRelation() {
+      this.scene.removeRelationFlag = true;
+      this.scene.createRelateFlag = false;
+      this.scene.isAbsorbing = false;
+      this.description = '清除'
+    },
+    //
+    addRelation() {
+      this.scene.createRelateFlag = true;
+      this.scene.removeRelationFlag = false;
+      this.scene.isAbsorbing = true;
+      this.description = '添加'
+    },
+    // 
+    removeAll() {
+      let temp = {
+        FloorId: this.buildFloor[1],
+        ZoneType: this.zoneType,
+        GraphType: this.type
+      }
+      delFloorNeighborhood(temp, res => {
+        this.$message.success('删除成功');
+        this.clearRelation();
+      })
+    },
     canvasClick(item, event) {
+      console.log(item);
       item.selected = false;
     },
     initGraphy() {
@@ -153,10 +193,7 @@ export default {
         this.view.scene = this.scene;
         this.view.fitSceneToView();
         this.scene.isSpaceSelectable = false;
-        this.scene.createRelateFlag = true;
         this.getBusinessSpace();
-        // 绘制关系
-        this.getRelations();
         this.view.minScale = this.view.scale;
         if (this.$refs.canvasFun) {
           this.$refs.canvasFun.everyScale = this.view.scale;
@@ -228,6 +265,7 @@ export default {
       let pa = {
         Filters: `FloorId='${this.buildFloor[1]}';GraphType='${this.type}';ZoneType='${this.zoneType}'`
       }
+      this.canvasLoading = true;
       querySpaceNeighborhood(pa, res => {
         let tempArr = res.Content.map(t => {
           let p1 = t.LocationOne.split(',');
@@ -241,6 +279,7 @@ export default {
         })
         this.clearRelation();
         this.scene.addAllRelaPoint(tempArr);
+        this.canvasLoading = false;
       })
     },
     // 获取当前分区下的业务空间
@@ -285,7 +324,9 @@ export default {
         }).filter(item => item)
         this.scene.removeAllZone();
         this.scene.addZoneList(tempArr);
-        // this.scene.click(this, this.canvasClick)
+        this.scene.click(this, this.canvasClick)
+        // 绘制关系
+        this.getRelations();
         this.canvasLoading = false;
       })
     },
@@ -309,6 +350,21 @@ export default {
           this.$refs.canvasFun.sliderVal = s > 1000 ? 1000 : s;
         }
       }
+    },
+    "scene.curRemoveItem": {
+      handler(n) {
+        if (n) {
+          let pa = [{
+            GraphType: this.type,
+            ZoneType: this.zoneType,
+            SpaceIdOne: n.startZone,
+            SpaceIdTwo: n.endZone
+          }]
+          delSpaceNeighborhood(pa, res => {
+            this.$message.success('删除成功');
+          })
+        }
+      }
     }
   }
 }