ソースを参照

模型质量报告

yangjunjing 5 年 前
コミット
b00bb28912
2 ファイル変更86 行追加62 行削除
  1. 40 25
      src/views/model/report/deleted.vue
  2. 46 37
      src/views/model/report/supplement.vue

+ 40 - 25
src/views/model/report/deleted.vue

@@ -1,7 +1,7 @@
 <template>
   <!-- 待删除页面 -->
   <div class="box">
-    <ul class="infinite-list" v-infinite-scroll="load" style="overflow:auto">
+    <ul class="infinite-list" style="overflow:auto">
       <li class="infinite-list-item" v-for="(item,index) in pageData" :key="index">
         <div class="content-box">
           <div class="content-top">
@@ -23,7 +23,8 @@
             <div class="plan">
               <p>平面图上的位置:<span>{{item.local | localTransformation}}</span></p>
               <div class="img-box">
-                <canvas id="floorCanvas" :width="canvasWidth" :height="canvasHeight" ref="canvas" tabindex="0"></canvas>
+                <canvas :id="'canvas'+index" :width="canvasWidth" :height="canvasHeight" ref="canvas" tabindex="0" :data-modelid="item.ModelId"
+                  :data-EquipID='item.EquipID' :data-x="item.local.X" :data-y="item.local.Y"></canvas>
               </div>
             </div>
           </div>
@@ -55,6 +56,7 @@
 <script>
 import { mapGetters } from "vuex";
 import { toBeDelEquipPage } from "@/api/scan/request.js";
+import { LocationPointScene, FloorView } from "@saga-web/cad-engine/lib";
 
 export default {
   components: {
@@ -72,12 +74,14 @@ export default {
         total: 0
       },
       canvasWidth: 400,
-      canvasHeight: 300,
+      canvasHeight: 280,
+      i: 0,
+      scene: '',
+      view: '',
     }
   },
   mounted() { },
   created() {
-    this.PageSetup();
     this.equipComDelList = decodeURIComponent(this.$route.query.equipComDelList);
     this.queryToBelDelEquip();
   },
@@ -119,9 +123,6 @@ export default {
     }
   },
   methods: {
-    load() {
-      this.count += 2
-    },
     copyContent(element) {
       // 双击复制
       let content = element.target.innerText;
@@ -191,41 +192,55 @@ export default {
             item.ScanTaskBase = item.ScanTaskBase.shift();
           }
         });
+        this.$nextTick(() => {
+          this.getGraphy();
+        })
       })
     },
     getGraphy() {// 绘制空间位置图片
+      console.log(this.i, 39)
+      let can = this.$refs.canvas;
       let that = this;
-      that.clearGraphy()
-      that.scene = new DivideFloorScene();
+      that.clearGraphy(this.i)
+      that.scene = new LocationPointScene();
       this.canvasLoading = true;
-      that.scene.loadUrl(`/image-service/common/file_get?systemId=revit&key=${this.FloorMap}`).then(res => {
+      that.scene.getFloorData('/modelapi/base-graph/query', { ModelId: can[this.i].dataset.modelid }).then(res => {
         that.canvasLoading = false;
         if (res == 'error') {
           this.FloorMap = '';
           this.$message.warning('数据解析异常');
           return;
         }
+        let modelID = can[this.i].dataset.modelid
+        let EquipID = can[this.i].dataset.equipid;
+        let X = Number(can[this.i].dataset.x);
+        let Y = can[this.i].dataset.y * -1;
+        console.log(X, Y)
         that.view.scene = that.scene;
+        this.scene.addMarker({
+          Id: EquipID,
+          X: X,
+          Y: Y
+        })
         that.view.fitSceneToView();
-        let tempArr = {
-          RoomLocalName: this.spaceDetails.RoomLocalName,
-          OutLine: this.spaceDetails.Outline,
-          RoomID: this.spaceDetails.RoomID,
-          Color: "#a384fc",
-        }
-        that.scene.addZoneList([tempArr]);
         this.scene.isSpaceSelectable = false;
+        this.i++;
       })
     },
-    clearGraphy() {
-      if (this.view && this.view.scene) {
-        this.view.scene = null;
-        return
+    clearGraphy(i) {
+      // if (this.view && this.view.scene) {
+      //   this.view.scene = null;
+      //   return
+      // }
+      this.view = new FloorView(`canvas${i}`)
+    }
+  },
+  watch: {
+    i() {
+      if (this.i >= this.pageData.length) {
+        return;
       }
-      this.view = new FloorView('floorCanvas')
-    },
-    PageSetup() {
-
+      this.getGraphy();
     }
   }
 }

+ 46 - 37
src/views/model/report/supplement.vue

@@ -21,8 +21,8 @@
             <div class="plan">
               <p>平面图上的位置:<span>{{item.local | localTransformation}}</span></p>
               <div class="img-box">
-                <canvas :id="'canvas'+index" :width="canvasWidth" :height="canvasHeight" ref="canvas" tabindex="0"
-                  :data-modelid="item.ModelId"></canvas>
+                <canvas :id="'canvas'+index" :width="canvasWidth" :height="canvasHeight" ref="canvas" tabindex="0" :data-modelid="item.ModelId"
+                  :data-EquipID='item.EquipID' :data-x="item.local.X" :data-y="item.local.Y"></canvas>
               </div>
             </div>
           </div>
@@ -70,9 +70,10 @@ export default {
         total: 0
       },
       canvasWidth: 400,
-      canvasHeight: 300,
+      canvasHeight: 280,
       scene: '',
-      view: ''
+      view: '',
+      i: 0
     }
   },
   filters: {
@@ -80,7 +81,7 @@ export default {
       num = Number(num + 1)
       return (Array(length).join('0') + num).slice(-length);
     },
-    localTransformation(local) {
+    localTransformation(local) {// 坐标转换
       let str = "";
       for (let key in local) {
         if (key !== "Z") {
@@ -91,7 +92,7 @@ export default {
       }
       return str;
     },
-    timeTransformation(time) {
+    timeTransformation(time) {// 时间转换
       time = time.replace(/(\d+)\-(\d+)\-(\d+)\ (\d+)\:(\d+)\:(\d+)/, function () {
         let str = '';
         let ary = ['年', '月', '日', '时', '分'];
@@ -116,9 +117,6 @@ export default {
     ...mapGetters('layout', ['projectId'])
   },
   methods: {
-    load() {
-      this.count += 2
-    },
     copyContent(element) {
       // 双击复制
       let content = element.target.innerText;
@@ -162,7 +160,6 @@ export default {
         PageSize: this.page.pageSize
       }
       toBeSupplementEquip(params, res => {
-        console.log(res, 39)
         this.pageData = res.Content;
         this.pageData.forEach(item => {
           if (item.BIMLocation) {
@@ -194,37 +191,49 @@ export default {
       })
     },
     getGraphy() {// 绘制空间位置图片
-      this.pageData.forEach((item, index) => {
-        let that = this;
-        that.clearGraphy()
-        that.scene = new LocationPointScene();
-        this.canvasLoading = true;
-        that.scene.getFloorData('/modelapi/base-graph/query', { ModelId: item.ModelId }).then(res => {
-          that.canvasLoading = false;
-          console.log(res, 2847)
-          if (res == 'error') {
-            this.FloorMap = '';
-            this.$message.warning('数据解析异常');
-            return;
-          }
-          that.view.scene = that.scene;
-          this.scene.addMarker({
-            Id: 'Eq420105000136d2753ce7b94f5b98496e51fa89379a',
-            X: -35559.48,
-            Y: 16647.19
-          })
-          that.view.fitSceneToView();
-          this.scene.isSpaceSelectable = false;
+      console.log(this.i, 39)
+      let can = this.$refs.canvas;
+      let that = this;
+      that.clearGraphy(this.i)
+      that.scene = new LocationPointScene();
+      this.canvasLoading = true;
+      that.scene.getFloorData('/modelapi/base-graph/query', { ModelId: can[this.i].dataset.modelid }).then(res => {
+        that.canvasLoading = false;
+        if (res == 'error') {
+          this.FloorMap = '';
+          this.$message.warning('数据解析异常');
+          return;
+        }
+        let modelID = can[this.i].dataset.modelid
+        let EquipID = can[this.i].dataset.equipid;
+        let X = Number(can[this.i].dataset.x);
+        let Y = can[this.i].dataset.y * -1;
+        console.log(X, Y)
+        that.view.scene = that.scene;
+        this.scene.addMarker({
+          Id: EquipID,
+          X: X,
+          Y: Y
         })
+        that.view.fitSceneToView();
+        this.scene.isSpaceSelectable = false;
+        this.i++;
       })
     },
-    clearGraphy() {
-      if (this.view && this.view.scene) {
-        this.view.scene = null;
-        return
+    clearGraphy(i) {
+      // if (this.view && this.view.scene) {
+      //   this.view.scene = null;
+      //   return
+      // }
+      this.view = new FloorView(`canvas${i}`)
+    }
+  },
+  watch: {
+    i() {
+      if (this.i >= this.pageData.length) {
+        return;
       }
-      console.log(document.getElementById('canvas0'))
-      this.view = new FloorView('canvas0')
+      this.getGraphy();
     }
   }
 }