Browse Source

修改名称报错问题

haojianlong 4 years ago
parent
commit
179e11f05b

+ 1 - 2
src/views/ready/buildfloor/index.vue

@@ -376,8 +376,7 @@ export default {
       if (3 == index) {
         this.modelId = "";
       } else if (index == 1) {
-        // this.modelId = row.infos.floorMap
-        this.modelId = row.modelId;
+        this.modelId = row.infos.floorMap
       } else {
         this.modelId = row.modelId;
       }

+ 9 - 5
src/views/ready/buildfloor/repetitionGraphy.vue

@@ -120,7 +120,6 @@ export default {
   mounted() {},
   methods: {
     init() {
-      this.getFileName(this.modelId)
       this.getFloorData()
     },
     // 返回路由
@@ -186,7 +185,6 @@ export default {
       const temp = this.modelId.split('.');
       if (temp[1] && temp[1].toLowerCase() != 'png' && temp[1].toLowerCase() != 'jpg') {
         this.key = '';
-        this.getFileName(this.modelId)
       }
     },
     // 获取文件夹名称
@@ -215,6 +213,7 @@ export default {
           this.sign = t.Sign > 0
           this.FloorName = t.localName || t.name
           this.$refs.drawFloor.buildFloorName = `${this.BuildName}-${this.FloorName}`
+          t.modelId && this.getFileName(t.modelId)
         }).filter((t) => t)
       })
     },
@@ -298,8 +297,12 @@ export default {
     // 根据modelid初始化
     initFromModelId(id) {
       const temp = id.split('.')[1];
-      if (temp && (temp.toLowerCase() == 'png' || temp.toLowerCase() == 'jpg')) {
-        this.$refs.drawFloor.initGraphy(id, 3)
+      if (temp) {
+        if (temp.toLowerCase() == 'png' || temp.toLowerCase() == 'jpg') {
+          this.$refs.drawFloor.initGraphy(id, 3)
+        } else {
+          this.$refs.drawFloor.initGraphy(id, 2)
+        }
       } else {
         this.$refs.drawFloor.initGraphy(id, 1)
       }
@@ -417,8 +420,9 @@ export default {
   },
   watch: {
     modelId(n, o) {
-      if (n != o) {
+      if (o && n != o) {
         if (n) {
+          // 只有替换的时候需要走
           this.$nextTick(()=>{
             this.initFromModelId(n)
           })