Переглянути джерело

'update_2020.12.16_21:11'

zhangyu 4 роки тому
батько
коміт
f43657a296

+ 2 - 4
src/components/editview/basePlanEditer.vue

@@ -309,8 +309,8 @@ export default {
             });
             // 手动添加设备实例
             bus.$off("addEquipment");
-            bus.$on("addEquipment", (val) => {
-                this.addEquipmentList(val);
+            bus.$on("addEquipment", (equipList) => {
+                this.mergeEquipData(equipList);
             });
             // 更改设备信息点
             bus.$off("changeEquipMsgPoint");
@@ -491,8 +491,6 @@ export default {
                     this.ADDEQUIP(equipItem);
                 }
             });
-            console.log(this.scene)
-            this.view.fitSceneToView();
         },
 
         // 生成快照并保存草稿

+ 22 - 20
src/components/editview/rightPropertyBar/BaseEquipment.vue

@@ -43,7 +43,8 @@
                 <div class="box-padding box-border-bottom">
                     <p class="box-title" style="padding-top: 0">公式</p>
                     <div class="textarea">
-                        <el-input type="textarea" disabled v-model="EquipItem.formula" :rows="2" placeholder="请输入内容"> </el-input>
+                        <el-input type="textarea" disabled v-model="EquipItem.formula" @change="setStyle" :rows="2" placeholder="请输入内容">
+                        </el-input>
                     </div>
                 </div>
                 <div class="box-padding box-border-bottom property">
@@ -51,13 +52,14 @@
                     <div class="base-property">
                         <div class="base-property-item">
                             <div class="cololorSelect">
-                                <el-color-picker show-alpha class="fix-box-1" v-model="color"></el-color-picker>
+                                <el-color-picker show-alpha class="fix-box-1" @change="setStyle" v-model="color"></el-color-picker>
                             </div>
                         </div>
-                        <div class="base-property-item" style="flex: 1;padding: 0;">
+                        <div class="base-property-item" style="flex: 1; padding: 0">
                             <el-input-number
-                                style="width: 100%;"
+                                style="width: 100%"
                                 v-model="size"
+                                @change="setStyle"
                                 controls-position="right"
                                 size="mini"
                                 :min="1"
@@ -74,13 +76,14 @@
                         action="https://jsonplaceholder.typicode.com/posts/"
                         :show-file-list="false"
                         :before-upload="beforeAvatarUpload"
+                        :on-success="setStyle"
                     >
                         <el-button type="small">替换图标</el-button>
                     </el-upload>
                 </div>
                 <div class="box-padding">
                     <p class="box-title">附加数据</p>
-                    <el-input type="textarea" v-model="EquipItem.anotherMsg" :rows="3" placeholder="请填写附加数据"> </el-input>
+                    <el-input type="textarea" v-model="EquipItem.anotherMsg" @change="setStyle" :rows="3" placeholder="请填写附加数据"> </el-input>
                 </div>
             </el-tab-pane>
         </el-tabs>
@@ -108,7 +111,6 @@ export default {
         };
     },
     computed: {
-
         color: {
             get: function () {
                 return this.EquipItem.color.toRgba();
@@ -127,23 +129,23 @@ export default {
             },
         },
     },
+    mounted() {
+        window.yu = this;
+    },
     methods: {
         ...mapMutations(["ADDSTYLE"]),
-        // 设置宽
-        changeWidth(val) {
-            bus.$emit("updateStyle", "sWidth", val);
-        },
-        // 设置高
-        changeHeight(val) {
-            bus.$emit("updateStyle", "sHeight", val);
-        },
-        // 设置附加信息
-        changeAnotherMsg(val) {
-            bus.$emit("updateStyle", "anotherMsg", val);
-        },
         // 修改样式信息
         setStyle() {
-            
+            const style = {
+                id: this.EquipItem.id,
+                style: {
+                    color: this.EquipItem.color.value,
+                    size: this.EquipItem.font.size,
+                    url: this.EquipItem.defaultUrl,
+                    formula: this.EquipItem.formula,
+                },
+            };
+            this.ADDSTYLE(style);
         },
         beforeAvatarUpload(file) {
             // eslint-disable-next-line @typescript-eslint/no-this-alias
@@ -294,7 +296,7 @@ export default {
             border-radius: 2px;
             overflow: hidden;
             position: relative;
-            
+
             .fix-box-1 {
                 margin-top: -8px;
                 margin-left: -8px;

+ 1 - 1
src/lib/item/SPlanEquipment.ts

@@ -122,7 +122,7 @@ export class SPlanEquipment extends SBaseIconTextEdit {
         }
 
         this.id = this.legendData.id ? this.legendData.id : "";
-        this.textItemList[0].text = this.legendData.codeName ? this.legendData.codeName : "";
+        // this.textItemList[0].text = this.legendData.codeName ? this.legendData.codeName : "";
         this.showAnchor = false;
         this.anotherMsg = this.legendData?.anotherMsg ? this.legendData.anotherMsg : "";
         this.x = this.legendData.pos.x;