浏览代码

辅助屏

yangjunjing 5 年之前
父节点
当前提交
3d348a5e9c
共有 2 个文件被更改,包括 53 次插入18 次删除
  1. 1 1
      package.json
  2. 52 17
      src/views/screen/splitscreen/spaceledger/index.vue

+ 1 - 1
package.json

@@ -28,7 +28,7 @@
         "@saga-web/base": "2.1.9",
         "@saga-web/draw": "2.1.58",
         "@saga-web/graphy": "2.1.30",
-        "@saga-web/cad-engine": "2.0.385"
+        "@saga-web/cad-engine": "2.0.406"
     },
     "devDependencies": {
         "ajv": "^6.9.1",

+ 52 - 17
src/views/screen/splitscreen/spaceledger/index.vue

@@ -23,9 +23,9 @@
                 v-if="spaceDetails.RoomQRCode">
             </div>
           </div>
-          <div v-if="spaceDetails.Outline && spaceDetails.Outline.length">
+          <div v-show="spaceDetails.Outline && spaceDetails.Outline.length" id="graphy" ref="graphy" style="width:400px;height:400px;">
             <p><b>位置图片:</b></p>
-            <graphy ref="graphy"></graphy>
+            <canvas id="floorCanvas" :width="canvasWidth" :height="canvasHeight" ref="canvas" tabindex="0"></canvas>
           </div>
           <div class="space-img">
             <!-- 业务空间图片,后台未提供 -->
@@ -70,10 +70,10 @@
 <script>
 import { mapGetters } from 'vuex'
 import { queryZone, getAllbusiness, getDataDictionary, floorQuery, buildingQuery } from '@/api/scan/request'
-import graphy from "@/components/business_space/newGraphy/graphy";
 import eqToSpaceTable from '@/components/business_space/newTables/eqToSpaceTable'
 import syInSpaceTable from '@/components/business_space/newTables/syInSpaceTable'
 import handsontableMain from "@/components/business_space/business/handsontable";
+import { DivideFloorScene, SpaceItem, ZoneItem, FloorView } from "@saga-web/cad-engine/lib";
 
 export default {
   data() {
@@ -88,11 +88,14 @@ export default {
       spaceDetails: {},
       iframeSrc: '',
       projectId: '',
-      params: {}
+      params: {},
+      view: null,
+      scene: null,
+      canvasWidth: 410,
+      canvasHeight: 400,
     }
   },
   components: {
-    graphy,
     eqToSpaceTable,
     syInSpaceTable,
     handsontableMain
@@ -105,11 +108,11 @@ export default {
     }
   },
   updated() {
-    // if (this.activeTab === "dynamicData") {
-    //   this.$nextTick(() => {
-    //     this.initMessage();
-    //   })
-    // }
+    if (this.activeTab === "dynamicData") {
+      this.$nextTick(() => {
+        this.initMessage();
+      })
+    }
   },
   computed: {
     ...mapGetters('layout', ['userInfo', 'projects', 'userId', 'secret'])
@@ -124,8 +127,9 @@ export default {
         zone: this.$route.query.zone
       }
       queryZone(params, res => {
+        console.log(res, 111)
         this.spaceDetails = res.Content[0];
-        if(this.spaceDetails.Outline && this.spaceDetails.Outline.length){
+        if (this.spaceDetails.Outline && this.spaceDetails.Outline.length) {
           this.getSpaceFloor();
         }
       })
@@ -141,14 +145,44 @@ export default {
         Filters: `FloorID='${this.spaceDetails.FloorId}'`
       }
       floorQuery(params, res => {
-        this.FloorMap = res.Content[0];
-        this.getSpaceImg();
+        console.log(res, 23222)
+        this.FloorMap = res.Content[0].StructureInfo.FloorMap;
+        this.getGraphy();
+      })
+    },
+    getGraphy() {
+      let that = this;
+      that.clearGraphy()
+      that.scene = new DivideFloorScene();
+      that.canvasLoading = true;
+      that.scene.loadUrl(`/image-service/common/file_get?systemId=revit&key=${this.FloorMap}`).then(res => {
+        that.canvasLoading = false;
+        if (res == 'error') {
+          this.FloorMap = '';
+          this.$message.warning('数据解析异常');
+          return;
+        }
+        that.view.scene = that.scene;
+        that.view.fitSceneToView();
+        let tempArr = {
+          RoomLocalName: this.spaceDetails.RoomLocalName,
+          OutLine: this.spaceDetails.Outline,
+          RoomID: this.spaceDetails.RoomID,
+          Color: "#a384fc",
+        }
+        that.scene.addZoneList([tempArr]);
+        // that.scene.zoneList[0].selected = true;
+        // that.view.fitSelectedToView();
+        // this.scene.isZoneSelectable = false;
+        this.scene.isSpaceSelectable = true;
       })
     },
-    getSpaceImg() {
-      // 获取业务空间楼层图片
-      this.buildFloorSelectd = [this.FloorMap.BuildID,this.FloorMap.FloorID];
-      this.$refs.graphy.getData(this.buildFloorSelectd, this.FloorMap, {code: this.spaceDetails.ObjectType});
+    clearGraphy() {
+      if (this.view && this.view.scene) {
+        this.view.scene = null;
+        return
+      }
+      this.view = new FloorView('floorCanvas')
     },
     initMessage() {
       let params = {
@@ -160,6 +194,7 @@ export default {
         type: this.spaceDetails.ObjectType
       }
       getDataDictionary(params, res => {
+        console.log(res, 888)
         this.buildFloorSelectd = [this.spaceDetails.BuildingId, this.spaceDetails.FloorId];
         this.$refs.handsontable[0].getHeader(res.Content, this.buildFloorSelectd);
       })