Browse Source

修改楼层绑定模型bug

haojianlong 5 years ago
parent
commit
9ca1c44831

+ 9 - 0
src/views/ready/buildfloor/drawGraphy/checkGraphy.vue

@@ -30,6 +30,11 @@ export default {
   computed: {
     ...mapGetters("layout", ["projectId"])
   },
+  props: {
+    alreadyRelatedModel: {
+      default: []
+    }
+  },
   data() {
     return {
       casVal: [],
@@ -58,6 +63,10 @@ export default {
         this.$message.warning("请选择模型文件");
         return
       }
+      if (this.alreadyRelatedModel.indexOf(this.jsonKey) > -1) {
+        this.$message.warning('此模型已关联该建筑下的楼层');
+        return;
+      }
       let pa = {
         FloorId: this.floor.FloorID,
         Id: this.modelIdToFloorId[this.jsonKey],

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

@@ -83,7 +83,7 @@
     <!-- 添加贯通关系弹窗 -->
     <addConnectivity ref="addConnectivity" @refresh="refresh"></addConnectivity>
     <!-- 查看图片弹窗 -->
-    <checkGraphy ref="checkGraphy" @refresh="refresh"></checkGraphy>
+    <checkGraphy ref="checkGraphy" @refresh="refresh" :alreadyRelatedModel='alreadyRelatedModel'></checkGraphy>
   </div>
 </template>
 
@@ -125,6 +125,7 @@ export default {
       curBuildId: "", //当前选中的建筑id
       curFloorId: "", //当前选中的楼层id
       modelId: "",
+      alreadyRelatedModel: []
     };
   },
   computed: {
@@ -201,6 +202,9 @@ export default {
       floorQueryAndSign(floorParam, res => {
         this.tableData = res.Content;
         this.page.total = res.Total;
+        this.alreadyRelatedModel = res.Content.map(t => {
+          return t.ModelId
+        }).filter(t => t);
       });
     },
     // 创建楼层成功-修改关系成功

+ 23 - 6
src/views/ready/buildfloor/repetitionGraphy.vue

@@ -14,13 +14,13 @@
       <drawFloor ref="drawFloor" :isEdit="isEdit" :showTools="true" :id="1"></drawFloor>
     </div>
     <!-- 查看图片弹窗 -->
-    <checkGraphy ref="checkGraphy" @refresh="refresh"></checkGraphy>
+    <checkGraphy ref="checkGraphy" @refresh="refresh" :alreadyRelatedModel='alreadyRelatedModel'></checkGraphy>
   </div>
 </template>
 <script>
 import drawFloor from "./drawGraphy/drawFloor";
 import checkGraphy from "./drawGraphy/checkGraphy"; //查看图片
-import { floorUpdate } from "@/api/scan/request";
+import { floorUpdate, floorQueryAndSign } from "@/api/scan/request";
 import { getFileNameById } from "@/api/model/file";
 export default {
   components: {
@@ -31,17 +31,22 @@ export default {
     return {
       modelId: "", // 
       isEdit: false, // 是否编辑模式
-      file: {}
+      file: {},
+      alreadyRelatedModel: []
     };
   },
   created() {
     this.modelId = this.$route.query.modelId;
     this.FloorID = this.$route.query.FloorID;
     this.BuildID = this.$route.query.BuildID;
-    this.getFileName(this.modelId)
+    this.init();
   },
   mounted() { },
   methods: {
+    init() {
+      this.getFileName(this.modelId)
+      this.getFloorData()
+    },
     // 返回路由
     backRouter() {
       this.$router.push({ name: 'buildFloor' })
@@ -103,12 +108,24 @@ export default {
       getFileNameById(pa, res => {
         this.file = res;
       })
-    }
+    },
+    // 获取楼层
+    getFloorData() {
+      let floorParam = {
+        PageSize: 1000,
+        Filters: `BuildID='${this.BuildID}'`
+      };
+      floorQueryAndSign(floorParam, res => {
+        this.alreadyRelatedModel = res.Content.map(t => {
+          if (t.FloorID != this.FloorID) return t.ModelId
+        }).filter(t => t);
+      });
+    },
   },
   watch: {
     modelId(n, o) {
       if (o && n != o) {
-        this.$refs.drawFloor.initGraphy(n, 1)
+        this.$refs.drawFloor.initGraphy(n, 1);
       }
     }
   }