Browse Source

建筑楼层图片问题

haojianlong 4 years ago
parent
commit
4811dd8be4

+ 2 - 2
src/views/ready/buildfloor/drawGraphy/drawFloor.vue

@@ -126,8 +126,8 @@ export default {
         this.addScaleItem(this.floorData.properties)
         this.$emit('getGraphSuc');
         if (this.floorData.properties) {
-          const x = this.floorData.properties.X;
-          const y = this.floorData.properties.Y;
+          const x = this.floorData.properties.x;
+          const y = this.floorData.properties.y;
           if (x != 0 || y != 0) {
             this.drawMainScene.imgList[0].moveTo(x, y);
           }

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

@@ -161,8 +161,8 @@ export default {
         })
       }
       let pa = {
-        Content: [{ id: this.FloorID, outline: Outline }],
-        Projection: ['Outline'],
+        content: [{ id: this.FloorID, outline: Outline }],
+        projection: ['Outline'],
       }
       floorUpdateOutline(pa, (res) => {
         this.isEdit = false
@@ -208,6 +208,7 @@ export default {
         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)
         this.alreadyRelatedModel = res.content.map((t) => {
           if (t.floorID != this.FloorID) return t.modelId
           this.sign = t.Sign > 0
@@ -257,6 +258,10 @@ export default {
                 vm.refresh(uploadKey + '.' + type)
                 // 设置步骤为第一步
                 vm.step = 0;
+                // watch中不会走到initGraph,所以手动触发
+                vm.$nextTick(()=>{
+                  vm.initFromModelId(uploadKey + '.' + type)
+                })
               }
             }
           }
@@ -276,10 +281,10 @@ export default {
           id: this.FloorID,
           infos: { floorMap: this.key },
           properties: {
-            X: this.baseImgItem.x,
-            Y: this.baseImgItem.y,
-            Line: line,
-            Text: scaleItem.text
+            x: this.baseImgItem.x,
+            y: this.baseImgItem.y,
+            line: line,
+            text: scaleItem.text
           }
         }],
         // projection: ['infos', 'properties'],
@@ -312,6 +317,7 @@ export default {
       this.step = 0;
       this.$refs.drawFloor.scaleItem.show()
       this.baseImgItem.globalAlpha = 1
+      this.baseImgItem.moveable = false;
       this.removeLast()
     },
     // 下一步||保存
@@ -357,22 +363,26 @@ export default {
     changeFloor(v) {
       // v->当前改为的楼层对象
       this.removeLast();
-      if (v.StructureInfo && v.StructureInfo.FloorMap) {
-        const url = this.imgService + v.StructureInfo.FloorMap
+      this.loadOtherImg(v)
+    },
+    // 加载其他楼层图片
+    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) {
+        if (v.properties) {
           try {
             // 计算两个比例尺差距
             const scaleItem = this.$refs.drawFloor.scaleItem
             this.curImgItem.zOrder = scaleItem.zOrder - 1;
-            const r = this.calScaleGap(v.Properties, scaleItem);
+            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.moveTo(v.properties.x, v.properties.y);
             // this.curImgItem.width = v.Properties.width;
             // this.curImgItem.height = v.Properties.height;
           } catch (err) {
@@ -402,10 +412,10 @@ export default {
       // pro -> 楼层的properties
       // item -> 当前的比例尺item
       let result = 1
-      if (pro.Line.length && pro.Text) {
+      if (pro.line.length && pro.text) {
         try {
-          const proDis = SMathUtil.pointDistance(pro.Line[0].x, pro.Line[0].y, pro.Line[1].x, pro.Line[1].y)
-          const proText = pro.Text.substring(0, pro.Text.length - 3);
+          const proDis = SMathUtil.pointDistance(pro.line[0].x, pro.line[0].y, pro.line[1].x, pro.line[1].y)
+          const proText = pro.Text.substring(0, pro.text.length - 3);
           const proScale = proDis / proText;
           const itemDis = SMathUtil.pointDistance(item.line[0].x, item.line[0].y, item.line[1].x, item.line[1].y)
           const itemText = item.text.substring(0, item.text.length - 3);
@@ -422,7 +432,7 @@ export default {
     modelId(n, o) {
       if (o && n != o) {
         if (n) {
-          // 只有替换的时候需要走
+          // 替换的时候需要走
           this.$nextTick(()=>{
             this.initFromModelId(n)
           })