Bläddra i källkod

设备台账辅助屏

haojianlong 5 år sedan
förälder
incheckning
527e15777f

+ 6 - 0
src/api/model/file.js

@@ -291,4 +291,10 @@ export default api
 export function bindFloorModel(param, success) {
     let url = `${baseUrl}/model-floor/bind`;
     httputils.postJson(url, param, success)
+}
+
+//根据模型id 获取模型文件夹及文件名
+export function getFileNameById(param, success) {
+    let url = `${baseUrl}/model-folder/get-name`;
+    httputils.postJson(url, param, success)
 }

+ 2 - 0
src/components/ledger/handsontables/device.vue

@@ -125,6 +125,7 @@ import lookPic from "@/components/ledger/lib/lookImages"
 import Handsontable from "handsontable-pro"
 import 'handsontable-pro/dist/handsontable.full.css'
 import zhCN from 'handsontable-pro/languages/zh-CN'
+import lStorage from '@/utils/localStorage'
 //下拉插件
 // import "@/assets/js/chosen.jquery.min";
 // import "@/assets/js/handsontable-chosen-editor";
@@ -664,6 +665,7 @@ export default {
       let inputMode = this.inputMap[val];
       this.row = row.row;
       this.messKey = val;
+      lStorage.set('screen_data', { path: this.$route.path, data: { equip: infos } })
       switch (val) {
         //操作
         case 'caozuo':

+ 2 - 1
src/router/system.js

@@ -80,6 +80,7 @@ import supplier from '@/views/manufactor/supplier'
 /**  辅助屏 */
 import splitScreen from '@/views/screen/splitScreen'
 import spaceLedger from '@/views/screen/splitScreen/spaceledger'
+import equipLedger from '@/views/screen/splitScreen/equipledger'
 import integrateResults from '@/views/screen/splitScreen/integrateresults'
 
 /**  业务空间数据导入工具 */
@@ -110,8 +111,8 @@ export default [{
         component: splitScreen,
         children: [
             { path: 'spaceledger', name: 'spaceLedger', component: spaceLedger },
+            { path: 'equipledger', name: 'equipLedger', component: equipLedger },
             { path: 'integrateresults', name: 'integrateResults', component: integrateResults }
-
         ]
     },
     // 平台管理

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

@@ -7,6 +7,7 @@
       <el-button v-if="!isEdit" size="mini" @click="editGraphy">编辑平面图</el-button>
       <el-button v-if="isEdit" size="mini" @click="cancel">取消</el-button>
       <el-button v-if="isEdit" size="mini" @click="confirm" type="primary">确认</el-button>
+      <span style="float:right;" v-if="file.FolderName">当前对应的模型文件:{{file.FolderName}}{{file.FloorName}}</span>
     </div>
     <!-- 展示图片 -->
     <div class="drawImg">
@@ -20,6 +21,7 @@
 import drawFloor from "./drawGraphy/drawFloor";
 import checkGraphy from "./drawGraphy/checkGraphy"; //查看图片
 import { floorUpdate } from "@/api/scan/request";
+import { getFileNameById } from "@/api/model/file";
 export default {
   components: {
     drawFloor,
@@ -35,6 +37,7 @@ export default {
     this.modelId = this.$route.query.modelId;
     this.FloorID = this.$route.query.FloorID;
     this.BuildID = this.$route.query.BuildID;
+    this.getFileName(this.modelId)
   },
   mounted() { },
   methods: {
@@ -87,7 +90,18 @@ export default {
     },
     // 替换模型文件成功
     refresh(modelId) {
-      this.modelId = modelId
+      this.modelId = modelId;
+      this.getFileName(this.modelId)
+    },
+    // 获取文件夹名称
+    getFileName(modelId) {
+      if (!modelId) return
+      let pa = {
+        Id: modelId
+      }
+      getFileNameById(pa, res => {
+        this.file = res;
+      })
     }
   },
   watch: {

+ 138 - 0
src/views/screen/splitscreen/equipledger/index.vue

@@ -0,0 +1,138 @@
+<template>
+  <div>
+    <div class='page-bar'>
+      <span>设备名称:</span>
+      <span>{{equip.EquipLocalName || equip.EquipName}}</span>
+      <span>(位置图片)</span>
+    </div>
+    <div class="page-content" id="page-content">
+      <div v-show="showCanvas">
+        <p>{{file.FolderName}}{{file.FloorName}}</p>
+        <canvas :height="cadHeight" :width="cadWidth" id="floorCanvas" :k="refreshCanvas"></canvas>
+      </div>
+      <div class="no-data" v-show="!showCanvas">
+        <div class="position-icon">
+          <i class="icon-wushuju iconfont"></i>
+          数据暂无
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import { LocationPointScene, FloorView } from "@saga-web/cad-engine";
+import { getFileNameById } from "@/api/model/file";
+
+export default {
+  data() {
+    return {
+      equip: {},
+      file: {},
+      view: '',
+      scene: {},
+      cadWidth: 800,
+      cadHeight: 800,
+      showCanvas: true
+    }
+  },
+  mounted() {
+    this.cadWidth = document.getElementById('page-content').offsetWidth;
+    this.cadHeight = document.getElementById('page-content').offsetHeight;
+    this.equip = this.$route.query.equip;
+    this.init();
+  },
+  methods: {
+    init() {
+      if (this.equip.ModelId && this.equip.BIMLocation) {
+        this.showCanvas = true;
+        this.getGraphy();
+        this.getFileName();
+      } else {
+        this.showCanvas = false;
+      }
+    },
+    // 获取底图
+    getGraphy() {
+      this.clearGraphy();
+      this.scene = new LocationPointScene()
+      this.scene.getFloorData('/modelapi/base-graph/query', { ModelId: this.equip.ModelId }).then(res => {
+        this.getGraphtSuc(res)
+      })
+    },
+    getGraphtSuc(res) {
+      this.view.scene = this.scene;
+      this.view.fitSceneToView();
+      this.scene.isSpaceSelectable = false;
+      let obj = {
+        X: this.equip.LocationJson.X,
+        Y: -this.equip.LocationJson.Y
+      }
+      this.scene.addMarker(obj);
+    },
+    refreshCanvas() {
+      return new Date().getTime();
+    },
+    // 获取文件夹及文件名称
+    getFileName() {
+      let pa = { Id: this.equip.ModelId }
+      getFileNameById(pa, res => {
+        this.file = res
+      })
+    },
+    // 清空平面图
+    clearGraphy() {
+      if (this.view) {
+        this.view.scene = null;
+        return
+      }
+      let id = `floorCanvas`;
+      this.view = new FloorView(id)
+    },
+  },
+  watch: {
+    $route(to, from) {
+      let equip = this.$route.query.equip || {};
+      if (equip.EquipID && equip.EquipID != this.equip.EquipID) {
+        this.equip = equip;
+        this.init()
+      }
+    }
+  },
+}
+</script>
+
+<style lang="scss" scoped>
+$borderColor: rgba(201, 201, 201, 1);
+.page-bar {
+  flex-grow: 0;
+  flex-shrink: 0;
+  height: 24px;
+  padding: 0 10px;
+  margin-bottom: 10px;
+  border-bottom: 1px solid $borderColor;
+}
+.page-content {
+  position: relative;
+  height: 100%;
+  border: 1px solid $borderColor;
+  p {
+    padding: 10px 16px;
+  }
+  canvas {
+    top: 0;
+  }
+  .no-data {
+    height: 100%;
+    text-align: center;
+    box-sizing: border-box;
+    position: relative;
+    .position-icon {
+      position: absolute;
+      top: 50%;
+      left: 50%;
+      transform: translate(-50%, -50%);
+    }
+  }
+}
+</style>

+ 5 - 0
src/views/screen/splitscreen/index.vue

@@ -62,6 +62,11 @@ export default {
           path:'/splitScreen/integrateresults',
           query: data.data
         })
+      }  else if (data.path && data.path == '/ledger/facility') {//设备位置图
+        this.$router.push({
+          path:'/splitScreen/equipledger',
+          query: data.data
+        })
       } else {
         this.$router.push({
           path:'/splitScreen'