YaolongHan 4 years ago
parent
commit
23c484e384

+ 9 - 5
src/components/editClass/big-edit/items/SBaseEquipment.ts

@@ -99,7 +99,7 @@ export class SBaseEquipment extends SBaseIconTextEdit {
         }
         // 存储信息点
         if (this.legendData.properties && this.legendData.properties.infoPointList) {
-            const infoPointList = this.legendData.properties.infoPointList
+            const infoPointList = this.legendData.properties.infoPointList;
             if (infoPointList.length) {
                 this.infoPointList = infoPointList;
                 this.infoPointList.forEach((obj, i) => {
@@ -116,7 +116,7 @@ export class SBaseEquipment extends SBaseIconTextEdit {
         this.showAnchor = false;
         const url = this.legendData.style.default.base64Url ? this.legendData.style.default.base64Url : this.legendData.style.default.url
         svgTobase64(url).then((res) => {
-            this.img.url = res?res:'';
+            this.img.url = res ? res : '';
         }).catch((res) => {
             this.img.url = res;
         })
@@ -173,13 +173,14 @@ export class SBaseEquipment extends SBaseIconTextEdit {
             item.font.size = val.font ? val.font : 12;
             item.isTransform = false;
             item.showSelect = false;
-            item.color = val.strokeColor ? new SColor(val.strokeColor) : new SColor('#000000');
+            item.color = val.color ? new SColor(val.color) : new SColor('#000000');
             item.connect('textSelect', this, this.textSelectChange)
             this.textItemList.push(item)
         } else {
             this.textItemList.splice(index, 1)
             this.scene?.removeItem(this.textItemList[index]);
         }
+        console.log('setTextItem', this.textItemList)
         // do something
     }// Function setTextItem()
 
@@ -221,12 +222,15 @@ export class SBaseEquipment extends SBaseIconTextEdit {
                 let obj = Object.assign(item.propertyData, {
                     pos: { x: item.x, y: item.y },
                     font: item.font.size,
-                    strokeColor: item.strokeColor.value
+                    color: item.color.value
                 })
+                delete obj.currentEquipMsg
                 infoPoinList.push(obj)
-            })
+            });
             this.legendData.properties.infoPointList = infoPoinList;
             this.legendData.style.default.base64Url = "";
+            this.legendData
+            console.log('infoPoinList', this.legendData)
             return this.legendData
         }
     } // Function toData

+ 3 - 1
src/components/editview/baseTopoEditer.vue

@@ -144,7 +144,7 @@ export default {
       bus.$off("deleteItem");
       bus.$on("deleteItem", (val) => {
         this.scene.deleteItem([val]);
-        this.EDITEQUIPITEM()
+        this.EDITEQUIPITEM();
       });
       // 复制
       bus.$off("copy");
@@ -295,6 +295,7 @@ export default {
     // 保存草稿
     saveDraft(uuid) {
       const elements = this.scene.save();
+      console.log("elements", elements);
       const obj = {
         elements,
         name: this.topoContent.name, // 名称
@@ -319,6 +320,7 @@ export default {
           ],
         },
       };
+      console.log("elements", obj);
       return new Promise((resolve, reject) => {
         saveGroup(obj).then((res) => {
           // 如果是从已发布跳转过来

+ 26 - 11
src/components/editview/leftToolBar/addItemModel.vue

@@ -165,19 +165,17 @@ import {
 } from "@/api/editer";
 import bus from "@/bus/bus";
 export default {
-  props: ["showAddItemModel", "filtIdList"],
+  props: ["showAddItemModel"],
   computed: {
-    ...mapState(["editCmd", "projectId"]),
-    filtIdListString() {
-      const filtIdListString = this.filtIdList.length
-        ? ";not id in " + JSON.stringify(this.filtIdList)
-        : "";
-      return filtIdListString;
-    },
+    ...mapState([
+      "editCmd",
+      "projectId",
+      "equipmentItemNum",
+      "equipmentItemList",
+    ]),
   },
   data() {
     return {
-      inputVal2: "",
       isShowModel: false,
       equipTypeString: "", //设备类型选中条件
       buildIdString: "", //建筑id 类型string
@@ -194,6 +192,7 @@ export default {
       local: null, //table loading
       local2: null, // 全局 loading
       queryText: "", //搜索框数据
+      filtIdListString: "", // 要过滤的 id 字符串
     };
   },
   methods: {
@@ -337,14 +336,14 @@ export default {
             this.choiceEquipList = list;
           }
           // // 将选中的设备类存到vuex中
-          console.log('this.choiceEquipList',this.choiceEquipList)
+          console.log("this.choiceEquipList", this.choiceEquipList);
           this.SETEQUIPLIST(this.choiceEquipList);
           bus.$emit("addEquipment", this.choiceEquipList);
           this.$loading.close(this.local2);
           this.modalClose();
         })
         .catch((res) => {
-          console.log(res)
+          console.log(res);
           this.$loading.close(this.local2);
           this.modalClose();
         });
@@ -511,6 +510,22 @@ export default {
         this.initAddModel();
       }
     },
+    // 监听设备变化,获取设备时做相应的过滤
+    equipmentItemNum: {
+      handler: function (val) {
+        if (!val) return;
+        const idList = [];
+        this.equipmentItemList.forEach((item) => {
+          idList.push(item.legendData.attachObjectIds[0]);
+        });
+        const filtIdListString = idList.length
+          ? ";not id in " + JSON.stringify(idList)
+          : "";
+        this.filtIdListString = filtIdListString;
+      },
+      deep: true,
+      immediate: true,
+    },
   },
 };
 </script>

+ 1 - 17
src/components/editview/leftToolBar/legendList.vue

@@ -15,7 +15,6 @@
     <addItemModel
       @closeModel="showAddItemModel = false"
       :showAddItemModel="showAddItemModel"
-      :filtIdList="filtIdList"
     ></addItemModel>
   </div>
 </template>
@@ -31,24 +30,9 @@ export default {
   data() {
     return {
       showAddItemModel: false,
-      filtIdList: [], // 需要筛选得 id 数组
       // choiceLegend: "" //选中绘制类型
     };
-  },
-  watch: {
-    "$store.state.equipmentList": {
-      handler: function (val) {
-        if (!val.length) return;
-        const idList = [];
-        val.forEach((item) => {
-          idList.push(item.id);
-        });
-        this.filtIdList = idList;
-      },
-      deep: true,
-      immediate: true,
-    },
-  },
+  }
 };
 </script>
 <style scoped lang="less">

+ 1 - 0
src/components/editview/rightPropertyBar/BaseEquipment.vue

@@ -191,6 +191,7 @@ export default {
           // 勾选设备中选中的对象
           const msgData = res.content;
           // 设置已经勾选数据
+          console.log('勾选',this.InfoPointList)
           if (this.InfoPointList && this.InfoPointList.length) {
             msgData.map((item) => {
               item.checked = false;

+ 2 - 0
src/components/editview/rightPropertyBar/property.vue

@@ -180,7 +180,9 @@ export default {
         this.fillColor = item.fillColor.toRgba();
         // 填充色
       } else if (this.itemType == "BaseEquipment") {
+          console.log('BaseEquipment',item)
         if (item.infoPointList && item.infoPointList.length) {
+          console.log('BaseEquipment',item)
           this.infoPointList = item.infoPointList;
         } else {
           this.infoPointList = [];