Browse Source

business space modify

haojianlong 5 years ago
parent
commit
0f2254be91

+ 3 - 2
package.json

@@ -5,6 +5,7 @@
     "author": "yaoll <yaolinlin@sagacloud.cn>",
     "private": true,
     "scripts": {
+        "i": "npm install",
         "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
         "start": "npm run dev",
         "build": "node build/build.js"
@@ -12,7 +13,7 @@
     "dependencies": {
         "@sybotan-web/base": "2.1.5",
         "@sybotan-web/draw": "2.1.56",
-        "@sybotan-web/graphy": "2.1.18",
+        "@sybotan-web/graphy": "2.1.27",
         "axios": "^0.18.0",
         "echarts": "^4.1.0",
         "element-ui": "^2.11.0",
@@ -23,7 +24,7 @@
         "vue-axios": "^2.1.4",
         "vue-router": "^3.0.1",
         "vuex": "^3.1.0",
-        "cad-engine": "2.0.214"
+        "cad-engine": "2.0.231"
     },
     "devDependencies": {
         "ajv": "^6.9.1",

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

@@ -1301,4 +1301,14 @@ export function notSyInSpaceQuery(param, success) {
 export function createRelateInZoneAndISp(param, success) {
     let url = `${baseUrl}/datacenter/sp-in-si-zone-general/link-sp`;
     http.postJson(url, param, success)
+}
+//关系-----空间内没有和空间关联的设备 根据坐标计算(专用接口)
+export function getEqNotInSpace(param, success) {
+    let url = `${baseUrl}/equip-component/space/unspace-fIn-eq-point?spaceId=${param.spaceId}&type=${param.type}`;
+    http.postJson(url, param.data, success)
+}
+//关系-----空间内没有服务空间的设备 根据坐标计算(专用接口)
+export function getEqNotForSpace(param, success) {
+    let url = `${baseUrl}/equip-component/space/unspace-for-eq-point?spaceId=${param.spaceId}&type=${param.type}`;
+    http.postJson(url, param.data, success)
 }

+ 34 - 10
src/components/business_space/newAddDialogs/addEquipDialog.vue

@@ -9,7 +9,7 @@
       <el-col :span="15">
         <span style="margin-left:10px;">所属楼层</span>
         <el-cascader @change="getTableData" v-model="floor" :options="options" :props="props"></el-cascader>
-        <el-checkbox style="margin-left:10px;" @change="getTableData" :checked="showType" label="只显示在当前业务空间中的设备"></el-checkbox>
+        <el-checkbox style="margin-left:10px;" @change="getTableData" v-model="showType" label="只显示在当前业务空间中的设备"></el-checkbox>
       </el-col>
     </el-row>
     <div class="table-box">
@@ -52,6 +52,8 @@ import {
   notEqForSpaceQuery, //未服务当前空间的设备
   eqInSpaceCreate, //设备所在业务空间--创建关系
   eqForSpaceCreate, //设备服务业务空间--创建关系
+  getEqNotInSpace, //空间内没有和空间关联的设备
+  getEqNotForSpace, //空间内没有服务空间的设备
 } from "@/api/scan/request";
 import { mapGetters } from "vuex";
 export default {
@@ -142,16 +144,33 @@ export default {
       if (this.keycode != '') {
         pa.data.Filters += `;EquipName contain "${this.keycode}" or EquipLocalName contain "${this.keycode}" or EquipLocalID contain "${this.keycode}"`
       }
-      if (this.type == "Equipment") {
-        pa.data.Cascade.push({ Name: "zoneSpaceInBase" })
-        notEqInSpaceQuery(pa, res => {
-          this.getDataSuc(res, 'ZoneSpaceBaseIn')
-        })
+      console.log(this.showType)
+      if (this.showType) {
+        if (this.type == "Equipment") {
+          // pa.data.Cascade.push({ Name: "zoneSpaceInBase" })
+          delete pa.data.Cascade;
+          getEqNotInSpace(pa, res => {
+            this.getDataSuc(res, 'ZoneSpaceBaseIn')
+          })
+        } else {
+          // pa.data.Cascade.push({ Name: "zoneSpaceForBase" })
+          delete pa.data.Cascade;
+          getEqNotForSpace(pa, res => {
+            this.getDataSuc(res, 'ZoneSpaceBaseFor')
+          })
+        }
       } else {
-        pa.data.Cascade.push({ Name: "zoneSpaceForBase" })
-        notEqForSpaceQuery(pa, res => {
-          this.getDataSuc(res, 'ZoneSpaceBaseFor')
-        })
+        if (this.type == "Equipment") {
+          pa.data.Cascade.push({ Name: "zoneSpaceInBase" })
+          notEqInSpaceQuery(pa, res => {
+            this.getDataSuc(res, 'ZoneSpaceBaseIn')
+          })
+        } else {
+          pa.data.Cascade.push({ Name: "zoneSpaceForBase" })
+          notEqForSpaceQuery(pa, res => {
+            this.getDataSuc(res, 'ZoneSpaceBaseFor')
+          })
+        }
       }
     },
     // 获取列表成功回调
@@ -216,6 +235,11 @@ export default {
       this.$message('开发中')
     }
   },
+  watch: {
+    showType(n) {
+
+    }
+  }
 };
 </script>
 <style lang="less" scoped>

+ 62 - 22
src/components/business_space/newGraphy/graphy.vue

@@ -29,7 +29,7 @@
           </div>
           <!-- 点击已经关联的业务空间 -->
           <div v-show="type==2">
-            <el-button type="primary" plain>重新划分业务空间</el-button>
+            <el-button type="primary" plain @click="refactorBSP">重新划分业务空间</el-button>
             <el-button type="primary" @click="editeSpaceDetail">编辑空间详情</el-button>
             <el-button plain @click="cancelGraphy">取 消</el-button>
           </div>
@@ -42,7 +42,7 @@
           <!-- 重新划分业务空间 -->
           <div v-show="type==4">
             <el-button plain @click="cancelGraphy">取 消</el-button>
-            <el-button type="primary">保存</el-button>
+            <el-button type="primary" @click="saveRefactorBSP">保存</el-button>
           </div>
         </div>
         <div style="position: absolute;right: 0;">
@@ -120,6 +120,7 @@ export default {
       isAction: false,
       curOutline: [],
       BIMIDToSID: {}, //bimid映射元空间id
+      curZoneItem: {}, //当前选中的业务空间item
     }
   },
   computed: {
@@ -260,11 +261,21 @@ export default {
     // canvas点击事件
     canvasClick(item, event) {
       console.log(arguments)
-      if (item instanceof SpaceItem) {
-        this.type = 3;
-      }
-      if (item instanceof ZoneItem) {
-        this.type = 2;
+      this.scene.setSpaceSelectable(true);
+      this.scene.setZoneSelectable(true);
+      if (this.type == 4) {
+
+      } else {
+        if (item instanceof SpaceItem) {
+          this.type = 3;
+          this.curZoneItem = {};
+          this.scene.setZoneSelectable(false);
+        }
+        if (item instanceof ZoneItem) {
+          this.type = 2;
+          this.curZoneItem = item;
+          this.scene.setSpaceSelectable(false);
+        }
       }
     },
     // 编辑平面图
@@ -360,14 +371,7 @@ export default {
         }
       }
       createZone(pa, res => {
-        let params = {
-          SpaceId: res.EntityList[0].RoomID,
-          IspaceIdList: IspaceIdList
-        }
-        createRelateInZoneAndISp(params, res => {
-          this.$message.success('创建成功');
-          this.init();
-        })
+        this.relationInBSPandISP(res.EntityList[0].RoomID, IspaceIdList)
       })
     },
     // 从未关联平面图的业务空间中选择--按钮返回关联信号
@@ -391,12 +395,48 @@ export default {
     },
     // 编辑空间详情
     editeSpaceDetail() {
+      let item = this.curZoneItem.data;
+      this.$router.push({
+        path: "/ledger/spaceDetail",
+        query: { RoomID: item.RoomID, zone: this.zoneCode, isMyTab: 1 }
+      })
+    },
+    // 重新划分业务空间
+    refactorBSP() {
+      this.type = 4;
+      // 设置空间可选
+      this.scene.setSpaceSelectable(true);
+      // 将已关联的设置不可选,并将当前选的隐藏
+      this.scene.changeSelectZone(this.curZoneItem);
+    },
+    // 重新划分--保存
+    saveRefactorBSP() {
       let arr = this.scene.getSelectedSpaces();
-      console.log(arr)
-      // this.$router.push({
-      //   path: "/ledger/spaceDetail",
-      //   query: { RoomID: infos.RoomID, zone: this.zoneCode, isMyTab: 2 }
-      // })
+      //更新业务空间
+      let zoneObj = { Outline: [] }, IspaceIdList = [];
+      arr.map(t => {
+        zoneObj.Outline.push(t.data.OutLine);
+        IspaceIdList.push(this.BIMIDToSID[t.data.SourceId])
+      })
+      zoneObj.RoomID = this.curZoneItem.data.RoomID;
+      let pa = {
+        zone: this.tab.code,
+        data: {
+          Content: [zoneObj]
+        },
+        Projection: ['Outline']
+      }
+      updateZone(pa, res => {
+        this.relationInBSPandISP(zoneObj.RoomID, IspaceIdList)
+      })
+    },
+    // 更新业务空间和元空间的关系
+    relationInBSPandISP(SpaceId, IspaceIdList) {
+      let pa = { SpaceId: SpaceId, IspaceIdList: IspaceIdList }
+      createRelateInZoneAndISp(pa, res => {
+        this.$message.success('创建成功');
+        this.init();
+      })
     },
     // canvas 获取焦点
     focus() {
@@ -449,8 +489,8 @@ export default {
     redo() { },
     // 缩放
     scale(val) {
-      let scale = this.view.scale
-      this.view.scaleByPoint(val / scale, this.cadWidth / 2, this.cadHeight / 2)
+      // let scale = this.view.scale
+      // this.view.scaleByPoint(val / scale, this.cadWidth / 2, this.cadHeight / 2)
     },
   },
   filters: {

+ 5 - 2
src/views/ledger/spacelist/index.vue

@@ -98,7 +98,7 @@ export default {
         buildCode: ""
       },
       isMyTab: 1,
-      activeName: "GeneralZone",
+      activeName: "0",
       tabsList: [],
       activeTabType: {
         "code": "GeneralZone",
@@ -166,6 +166,9 @@ export default {
       }
       queryDictionaryHead(pa, res => {
         this.tabsList = res.Content;
+        console.log(this.activeName == '0')
+        console.log(this.activeName == '0' ? 'GeneralZone' : this.activeName)
+        this.activeName = this.activeName == '0' ? 'GeneralZone' : this.activeName;
       })
     },
     // 通过选中的tab-Code 获取选中的tab的所有数据
@@ -220,7 +223,7 @@ export default {
       })
     },
     // 批量创建业务空间
-    groupCreateBSpace(){
+    groupCreateBSpace() {
       this.$refs.graphy.groupCreateBSpace()
     },
     checkSpace(list, build, graphyId) {

+ 1 - 6
src/views/ready/buildfloor/drawGraphy/drawFloor.vue

@@ -60,12 +60,6 @@ export default {
       that.view = new SGraphyView(id)
       that.drawMainScene = new DivideFloorScene();
       that.canvasLoading = true;
-      // base/a12a88d1d92411e98e2ded11576ff4c3.jsonz
-      // that.drawMainScene.loadUrl(`/image-service/common/file_get?systemId=revit&key=base/a12a88d1d92411e98e2ded11576ff4c3.jsonz`).then(res=>{
-      //   console.log(res)
-      //   that.view.scene = that.drawMainScene
-      //   that.view.fitSceneToView();
-      // })
       that.drawMainScene.getFloorData('/modelapi/base-graph/query', { ModelId: ModelId }).then(res => {
         let Elements = res.EntityList[0].Elements;
         let flag = false;
@@ -138,6 +132,7 @@ export default {
     },
     // 清除切割划分
     clearDivide() {
+      console.log(this.drawMainScene)
       this.drawMainScene.clearSceneMark()
     },
     // 撤销

+ 2 - 2
src/views/ready/buildfloor/index.vue

@@ -38,7 +38,7 @@
             </el-table-column>
             <el-table-column prop="Datasource" label="平面图">
               <template slot-scope="scope">
-                <p v-if="scope.row.ModeId" @click="checkDrawImg(scope.row,1)">
+                <p v-if="scope.row.ModelId" @click="checkDrawImg(scope.row,1)">
                   <i class="iconfont icon-floorplan"></i>
                   查看平面图
                 </p>
@@ -236,7 +236,7 @@ export default {
         this.$refs.checkGraphy.showDialog(row)
         this.modelId = "";
       } else {
-        this.modelId = row.ModeId;
+        this.modelId = row.ModelId;
         let pa = { modelId: this.modelId, FloorID: row.FloorID }
         if (row.Outline && row.Outline.length) {
           pa.OutlineFlag = true;

+ 1 - 1
src/views/ready/buildfloor/repetitionGraphy.vue

@@ -71,7 +71,7 @@ export default {
     // 取消
     cancel() {
       this.isEdit = false;
-      this.$refs.drawFloor.clearDivide();
+      this.$refs.drawFloor.initGraphy(this.modelId)
     },
     // 编辑平面图
     editGraphy() {