Browse Source

修改业务空间无法读图

shaun-sheep 4 years ago
parent
commit
0a5e88fc8c
1 changed files with 97 additions and 86 deletions
  1. 97 86
      src/components/business_space/newGraphy/graphy.vue

+ 97 - 86
src/components/business_space/newGraphy/graphy.vue

@@ -115,69 +115,69 @@
   </div>
   </div>
 </template>
 </template>
 <script>
 <script>
-import canvasFun from "./canvasFun"
-import { mapGetters } from "vuex";
-import { SPoint, SColor } from "@saga-web/draw/lib";
-import { DivideFloorScene, FloorView, SpaceItem, ZoneItem, Opt } from "@saga-web/cad-engine/lib";
-import { colorArr } from "@/utils/spaceColor"
-import unRelateBSP from "./unRelateBSP";
-import createBSP from "./createBSP";
-import dialogZone from "../../ledger/addDialog/dialogZone";
-import {
-  createRelateInZoneAndISp,
-  getIspNotInSpace,
-  groupCreRelaZoneAndISp,
-  queryAllZoneType,
-  queryZone,
-  zoneCount,
-  zoneCreate,
-  zoneQueryOutline,
-  zoneUpdate,
-  zoneUpdateOutline,
-  handleZoneUpdateBd
-} from "@/api/scan/request"
+  import canvasFun from "./canvasFun"
+  import {mapGetters} from "vuex";
+  import {SColor, SPoint} from "@saga-web/draw/lib";
+  import {DivideFloorScene, FloorView, Opt, SpaceItem, ZoneItem} from "@saga-web/cad-engine/lib";
+  import {colorArr} from "@/utils/spaceColor"
+  import unRelateBSP from "./unRelateBSP";
+  import createBSP from "./createBSP";
+  import dialogZone from "../../ledger/addDialog/dialogZone";
+  import {
+    createRelateInZoneAndISp,
+    getIspNotInSpace,
+    groupCreRelaZoneAndISp,
+    handleZoneUpdateBd,
+    queryAllZoneType,
+    queryZone,
+    zoneCount,
+    zoneCreate,
+    zoneQueryOutline,
+    zoneUpdate,
+    zoneUpdateOutline
+  } from "@/api/scan/request"
 
 
-export default {
-  components: {
-    canvasFun,
-    unRelateBSP,
-    createBSP,
-    dialogZone
-  },
-  data() {
-    return {
-      canvasWidth: 800,
-      canvasHeight: 600,
-      type: 1, // 默认操作模式
-      search: '',//搜索
-      buildFloor: ['', ''],
-      FloorObj: {}, //楼层对象
-      FloorMap: '', //楼层底图
-      tab: {},
-      config: {
-        isEdit: false,
-        divide: true,
-        groupSelect: true
-      },
-      canvasLoading: false,
-      view: null,
-      scene: null,
-      Outline: [], // 当前选中的多个空间组成的轮廓线->三维数组
-      businessSpaceList: [], // 所有业务空间
-      num: 0, // 未关联元空间的业务空间统计
-      BSPRelaISPList: [], // 已关联元空间的业务空间
-      // 未关联元空间的业务空间弹窗
-      isAction: false,
-      curOutline: [],
-      BIMIDToSID: {}, //bimid映射元空间id
-      BIMIDToSIName: {}, //bimid映射元空间名称
-      curZoneItem: {}, //当前选中的业务空间item
-      allUnRelatISP: [], //
-      zoneList: [], // 业务空间-canvas图中
-      groupCreateDialogVis: false, //批量创建业务空间弹窗
-      groupCreateType: 1, //批量创建方式
-      zoneDisable: true, // 重新划分是否禁用
-      sourceIdToISP: {},
+  export default {
+    components: {
+      canvasFun,
+      unRelateBSP,
+      createBSP,
+      dialogZone
+    },
+    data() {
+      return {
+        canvasWidth: 800,
+        canvasHeight: 600,
+        type: 1, // 默认操作模式
+        search: '',//搜索
+        buildFloor: ['', ''],
+        FloorObj: {}, //楼层对象
+        FloorMap: '', //楼层底图
+        tab: {},
+        config: {
+          isEdit: false,
+          divide: true,
+          groupSelect: true
+        },
+        canvasLoading: false,
+        view: null,
+        scene: null,
+        Outline: [], // 当前选中的多个空间组成的轮廓线->三维数组
+        businessSpaceList: [], // 所有业务空间
+        num: 0, // 未关联元空间的业务空间统计
+        BSPRelaISPList: [], // 已关联元空间的业务空间
+        // 未关联元空间的业务空间弹窗
+        isAction: false,
+        curOutline: [],
+        BIMIDToSID: {}, //bimid映射元空间id
+        BIMIDToSIName: {}, //bimid映射元空间名称
+        curZoneItem: {}, //当前选中的业务空间item
+        allUnRelatISP: [], //
+        zoneList: [], // 业务空间-canvas图中
+        groupCreateDialogVis: false, //批量创建业务空间弹窗
+        groupCreateType: 1, //批量创建方式
+        zoneDisable: true, // 重新划分是否禁用
+        sourceIdToISP: {},
       areaValue: 40,
       areaValue: 40,
       areaMarks: { 0: '0m²', 100: '1m²' },
       areaMarks: { 0: '0m²', 100: '1m²' },
       options: [], //其他分区类型
       options: [], //其他分区类型
@@ -219,6 +219,7 @@ export default {
       if (this.buildFloor.indexOf('all') > -1 || this.buildFloor.indexOf('noKnow') > -1) {
       if (this.buildFloor.indexOf('all') > -1 || this.buildFloor.indexOf('noKnow') > -1) {
         return;
         return;
       }
       }
+
       if (initType == 1) {
       if (initType == 1) {
         // 底图
         // 底图
         this.getGraphy();
         this.getGraphy();
@@ -361,30 +362,40 @@ export default {
       that.clearGraphy()
       that.clearGraphy()
       that.scene = new DivideFloorScene();
       that.scene = new DivideFloorScene();
       that.canvasLoading = true;
       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;
-        // 蒙版
-        if (this.FloorObj.Outline) {
-          let newArr = this.FloorObj.Outline.map(t => {
-            return new SPoint(t.X, t.Y);
-          })
-          this.scene.addSceneMark(newArr)
-        }
-        this.scene.isSpaceSelectable = false;
-        // 绘制业务空间
-        that.getBusinessSpace();
-        that.fit();
-        that.view.minScale = that.view.scale;
-        if (that.$refs.canvasFun) {
-          that.$refs.canvasFun.everyScale = that.view.scale;
-        }
-      })
+      if (this.FloorMap.split('.')[1].toString() == 'png' || this.FloorMap.split('.')[1].toString() == 'jpg') {
+        that.scene.loadImg(`/image-service/common/image_get?systemId=dataPlatform&key=${this.FloorMap}`, res => {
+          this.getGraphtSuc(res)
+        })
+      } else {
+        that.scene.loadUrl(`/image-service/common/file_get?systemId=revit&key=${this.FloorMap}`).then(res => {
+          this.getGraphtSuc(res)
+        })
+      }
+    },
+    getGraphtSuc(res) {
+      let that = this
+      that.canvasLoading = false;
+      if (res == 'error') {
+        this.FloorMap = '';
+        this.$message.warning('数据解析异常');
+        return;
+      }
+      that.view.scene = that.scene;
+      // 蒙版
+      if (this.FloorObj.Outline) {
+        let newArr = this.FloorObj.Outline.map(t => {
+          return new SPoint(t.X, t.Y);
+        })
+        this.scene.addSceneMark(newArr)
+      }
+      this.scene.isSpaceSelectable = false;
+      // 绘制业务空间
+      that.getBusinessSpace();
+      that.fit();
+      that.view.minScale = that.view.scale;
+      if (that.$refs.canvasFun) {
+        that.$refs.canvasFun.everyScale = that.view.scale;
+      }
     },
     },
     // 获取当前分区下的业务空间
     // 获取当前分区下的业务空间
     getBusinessSpace() {
     getBusinessSpace() {