浏览代码

修改不存在此模型bug;增加curmodelid传参

haojianlong 4 年之前
父节点
当前提交
1df1cead12
共有 2 个文件被更改,包括 27 次插入16 次删除
  1. 2 1
      src/views/ready/buildfloor/drawGraphy/checkGraphy.vue
  2. 25 15
      src/views/ready/buildfloor/repetitionGraphy.vue

+ 2 - 1
src/views/ready/buildfloor/drawGraphy/checkGraphy.vue

@@ -120,13 +120,14 @@ export default {
                 FloorId: this.floor.FloorID,
                 BuildingId: this.floor.BuildID,
                 Cover: true,
+                CurrentModelId: this.floor.CurrentModelId
             }
             if (this.jsonKey) {
                 pa.Id = this.modelIdToFloorId[this.jsonKey]
                 bindFloorModel(pa, (res) => {
                     this.$message.success('更新成功')
                     this.handleClose()
-                    this.$emit('refresh', this.jsonKey)
+                    this.$emit('refresh', this.jsonKey, pa)
                 })
             }
             if (this.key) {

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

@@ -87,6 +87,7 @@ export default {
       modelId: '', //
       isEdit: false, // 是否编辑模式
       FloorID: '',
+      currentModelId: null, // 当前楼层
       file: {},
       alreadyRelatedModel: [],
       sign: false,
@@ -149,7 +150,7 @@ export default {
     },
     // 替换模型文件
     changeGraphy() {
-      this.$refs.checkGraphy.showDialog({ FloorID: this.FloorID, BuildID: this.BuildID })
+      this.$refs.checkGraphy.showDialog({ FloorID: this.FloorID, BuildID: this.BuildID, CurrentModelId: this.currentModelId })
     },
     // 确认保存
     confirm() {
@@ -191,14 +192,22 @@ export default {
     editGraphy() {
       this.isEdit = true
     },
-    // 替换模型文件成功
-    refresh(modelId) {
+    // 替换模型文件成功.第二个参数只在替换模型文件的时候会有
+    refresh(modelId, pa) {
+        // 替换成图片或者模型 模型应该是模型id不会有json的
       this.modelId = modelId
       this.hasGraph = true;
       const temp = this.modelId.split('.');
-      if (temp[1] && temp[1].toLowerCase() != 'png' && temp[1].toLowerCase() != 'jpg') {
+      if (temp[1]) { 
+          if (temp[1].toLowerCase() != 'png' && temp[1].toLowerCase() != 'jpg') {
+              // do nothing
+          } else {
+              // do nothing
+          }
+      } else {
         this.key = '';
-        this.getFileName(this.modelId)
+        pa && pa.Id && this.getFileName(pa.Id)
+        this.initFromModelId(this.modelId)
       }
     },
     // 获取文件夹名称
@@ -230,6 +239,7 @@ export default {
         this.alreadyRelatedModel = res.Content.map((t) => {
           if (t.FloorID != this.FloorID) return t.ModelId
           this.sign = t.Sign > 0
+          this.currentModelId = t.ModelId;
           t.ModelId && this.getFileName(t.ModelId)
         }).filter((t) => t)
       })
@@ -469,16 +479,16 @@ export default {
     }
   },
   watch: {
-    modelId(n, o) {
-      if (n != o) {
-        if (n) {
-          // 替换的时候需要走
-          this.$nextTick(() => {
-            this.initFromModelId(n)
-          })
-        }
-      }
-    },
+    // modelId(n, o) {
+    //   if (n != o) {
+    //     if (n) {
+    //         //   替换的时候需要走
+    //       this.$nextTick(() => {
+    //         this.initFromModelId(n)
+    //       })
+    //     }
+    //   }
+    // },
   },
 }
 </script>