Browse Source

修改建筑楼层报错问题

haojianlong 4 years ago
parent
commit
4ba61a2940
1 changed files with 30 additions and 24 deletions
  1. 30 24
      src/views/ready/buildfloor/repetitionGraphy.vue

+ 30 - 24
src/views/ready/buildfloor/repetitionGraphy.vue

@@ -198,7 +198,8 @@ export default {
       })
     },
     // 获取楼层
-    getFloorData() {
+    // 标识 无值:初始化进入 有值'next': 下一步进入
+    getFloorData(flag) {
       let floorParam = {
         pageSize: 1000,
         filters: `buildingId='${this.BuildID}'`,
@@ -207,8 +208,10 @@ export default {
       floorQueryAndSign(floorParam, (res) => {
         this.floorList = res.content.filter(t => t.infos && t.infos.floorMap || t.id == this.FloorID);
         // todo
-        this.floorRadio = this.floorList[0];
-        this.loadOtherImg(this.floorRadio)
+        if (flag && flag == 'next') {
+          this.floorRadio = this.floorList[0];
+          this.loadOtherImg(this.floorRadio)
+        }
         this.alreadyRelatedModel = res.content.map((t) => {
           if (t.floorID != this.FloorID) return t.modelId
           this.sign = t.Sign > 0
@@ -330,7 +333,7 @@ export default {
         this.step = 1;
         this.$refs.drawFloor.scaleItem.hide();
         // 获取楼层列表
-        this.getFloorData()
+        this.getFloorData('next')
       } else if (this.step == 1) {
         // 保存
         this.updateFloorKey();
@@ -368,29 +371,32 @@ export default {
     // 加载其他楼层图片
     loadOtherImg(v){
       if (v.infos && v.infos.floorMap) {
-        const url = this.imgService + v.infos.floorMap
-        this.curImgItem = new SImageItem(null, url);
-        this.curImgItem.enabled = false;
-        this.curImgItem.showType = SImageShowType.AutoFit;
-        if (v.properties) {
-          try {
-            // 计算两个比例尺差距
-            const scaleItem = this.$refs.drawFloor.scaleItem
-            this.curImgItem.zOrder = scaleItem.zOrder - 1;
-            const r = this.calScaleGap(v.properties, scaleItem);
-            if (r != 1) {
-              this.$message.warning('比例尺相差较大,可以返回上一步修改比例尺')
+        const temp = this.modelId.split('.');
+        if (temp[1] && (temp[1].toLowerCase() == 'png' || temp[1].toLowerCase() == 'jpg')) {
+          const url = this.imgService + v.infos.floorMap
+          this.curImgItem = new SImageItem(null, url);
+          this.curImgItem.enabled = false;
+          this.curImgItem.showType = SImageShowType.AutoFit;
+          if (v.properties) {
+            try {
+              // 计算两个比例尺差距
+              const scaleItem = this.$refs.drawFloor.scaleItem
+              this.curImgItem.zOrder = scaleItem.zOrder - 1;
+              const r = this.calScaleGap(v.properties, scaleItem);
+              if (r != 1) {
+                this.$message.warning('比例尺相差较大,可以返回上一步修改比例尺')
+              }
+              this.curImgItem.showType == SImageShowType.Full;
+              this.curImgItem.moveTo(v.properties.x, v.properties.y);
+              // this.curImgItem.width = v.Properties.width;
+              // this.curImgItem.height = v.Properties.height;
+            } catch (err) {
+              console.log(err);
             }
-            this.curImgItem.showType == SImageShowType.Full;
-            this.curImgItem.moveTo(v.properties.x, v.properties.y);
-            // this.curImgItem.width = v.Properties.width;
-            // this.curImgItem.height = v.Properties.height;
-          } catch (err) {
-            console.log(err);
           }
+          this.$refs.drawFloor.drawMainScene.addItem(this.curImgItem);
+          this.$refs.drawFloor.fit()
         }
-        this.$refs.drawFloor.drawMainScene.addItem(this.curImgItem);
-        this.$refs.drawFloor.fit()
       }
     },
     // 清除上一张底图