yx 4 年之前
父節點
當前提交
54504c7133

+ 23 - 5
src/components/baseEditer.vue

@@ -23,6 +23,7 @@ import { Loading } from 'element-ui'
 import { Message } from 'element-ui'
 // import { SEquipParser } from "../../../sagacloud-web/saga-web-big/src";
 import { SEquipmentParser } from '../lib/parsers/SEquipmentParser'
+import { SInfoParser } from '../lib/parsers/SInfoParser'
 import { saveJSON } from '../utils/util'
 import { SEquipmentItem } from '@/lib/items/SEquipmentItem' // 设备类
 
@@ -162,8 +163,8 @@ export default {
             const itemMap = {}
             // 使用 SEquipmentParser 解析器增加设备
             let parserData1 = new SEquipmentParser(null)
-            let Equipmnet = Nodes.filter((node) => node.GraphElementType === 'Equipment')
-            parserData1.parseData(Equipmnet)
+            let Equipment = Nodes.filter((node) => node.GraphElementType === 'Equipment')
+            parserData1.parseData(Equipment)
             parserData1.equipmentItem.map((item) => {
                 item.selectable = true
                 item.connect('equipImgLoadOver', this, () => {
@@ -175,6 +176,17 @@ export default {
                 console.log(item)
                 itemMap[item.id] = item
             })
+            // 使用信息点解析器,解析信息点数据, 添加信息点
+            let InfoParser = new SInfoParser(null)
+            let InfoItem = Nodes.filter((node) => node.GraphElementType === 'Info')
+            InfoParser.parseData(InfoItem)
+            InfoParser.infoItem.map((item) => {
+                item.selectable = true
+                item.moveable = true
+                this.scene.addItem(item)
+                this.scene.Nodes.push(item)
+                itemMap[item.id] = item
+            })
             // 使用STopologyParser 解析器 增加直线,管线桥线
             // 多边形(此item需在直线item添加之前添加)
             parserData.zoneLegendList.forEach((t) => {
@@ -417,7 +429,7 @@ export default {
         },
         // 监听变化
         emitChange(itemMsg) {
-            console.log('itemMsg', itemMsg)
+            // console.log('itemMsg', itemMsg)
             this.chiceItemList = itemMsg.itemList
             this.$emit('changeFocusItem', itemMsg)
             bus2.$emit('FocusItemChanged', itemMsg)
@@ -641,9 +653,9 @@ export default {
                 console.log('%c========', 'color:blue')
                 // 保存json文件到本地
                 let jsonData = JSON.stringify(data, null, 2)
-                console.log(jsonData)
+                // console.log(jsonData)
                 let name = `${new Date().getTime()}.json`
-                // saveJSON(jsonData, name)
+                saveJSON(jsonData, name)
                 return true
                 saveGroup(data)
                     .then((res) => {
@@ -750,6 +762,12 @@ export default {
             bus.$on('changeInfoProperties', (Properties) => {
                 this.scene.updateInfoProperties(Properties)
             })
+            bus.$on('addInfoAttachObjectIds', () => {
+                this.scene.addInfoAttachObjectIds()
+            })
+            bus.$on('deleteInfoAttachObjectIds', () => {
+                this.scene.deleteInfoAttachObjectIds()
+            })
             /** ---------------------信息点Item属性修改--------------------- */
 
             // 改变图例名称

+ 5 - 5
src/components/edit/attrInfo.vue

@@ -16,8 +16,8 @@
         </div>
         <div class='row'>
             <div class='row-tit'>背景色</div>
-            <div class='color-choice '>
-                <swatches v-model='infoData.Properties.Background'  :swatches="swatches" popover-x='left' @close='changeInfoProperties' />
+            <div class='color-choice'>
+                <swatches v-model='infoData.Properties.Background' :swatches='swatches' popover-x='left' @close='changeInfoProperties' />
             </div>
         </div>
         <a-divider />
@@ -36,7 +36,7 @@
         <div class='row'>
             <span>操作工程信息化对象</span>
             <a-button @click='handleAttach(1)' size='small' type='primary'>添加</a-button>
-            <a-button @click='handleAttach(-1)' size='small' v-show='AttachObjectIds.length' type='danger'>删除</a-button>
+            <a-button @click='handleAttach(-1)' size='small' v-show='infoData.AttachObjectIds.length' type='danger'>删除</a-button>
         </div>
     </div>
 </template>
@@ -77,10 +77,10 @@ export default {
         handleAttach(flag) {
             switch (flag) {
                 case -1:
-                    // bus.$emit('deleteAttachObjectIds')
+                    bus.$emit('deleteInfoAttachObjectIds')
                     break
                 default:
-                    // bus.$emit('addAttachObjectIds')
+                    bus.$emit('addInfoAttachObjectIds')
                     break
             }
             this.init()

+ 4 - 4
src/components/edit/right_toolbar.vue

@@ -121,7 +121,7 @@ export default {
             bus2.$off('elementDataChange')
             bus2.$on("elementDataChange", val => {
                 this.elementData = [];
-                console.log(val);
+                // console.log(val);
                 if (val.Nodes.length) {
                     // 过滤掉 设备类 SEquipmentItem,不在右侧组件中暂时组件类
                     let data = val.Nodes.filter(item => !item instanceof SEquipmentItem);
@@ -133,7 +133,7 @@ export default {
                 if (val.Relations.length) {
                     this.elementData = this.elementData.concat(val.Relations);
                 }
-                console.log(this.elementData);
+                // console.log(this.elementData);
             });
         },
         callback(key) {
@@ -194,8 +194,8 @@ export default {
     },
     watch: {
         focusItemList: function(newVal) {
-            console.log('=================')
-            console.log('focusItemList',newVal)
+            // console.log('=================')
+            // console.log('focusItemList',newVal)
             this.attrType = newVal.itemType;
             this.infoKey++
             this.eqKey++

+ 1 - 1
src/components/edit/top_toolbar.vue

@@ -356,7 +356,7 @@ export default {
         console.log('dsafadsfasdfas')
         bus2.$off("FocusItemChanged")
         bus2.$on("FocusItemChanged", itemMsg => {
-            console.log("itemMsg", itemMsg);
+            // console.log("itemMsg", itemMsg);
             this.FocusItemChanged(itemMsg);
         });
         // 获取底图加载完成后的初始sacle

+ 17 - 1
src/components/mapClass/EditScence.ts

@@ -2112,9 +2112,25 @@ export class EditScence extends SGraphScene {
             let font = new SFont(this.focusItem.font);
             font.size = FontSize;
             this.focusItem.font = font
-            this.focusItem.color = Color;
+            this.focusItem.color = new SColor(Color);
             this.focusItem.backgroundColor = new SColor(Background);
             this.scenceUpdate(this);
         }
     }
+    /**
+     * @description 信息点item 添加工程信息化对象
+     */
+    addInfoAttachObjectIds() {
+        if (this.focusItem) {
+            this.focusItem.AttachObjectIds.push('请输入')
+            this.scenceUpdate(this);
+        }
+    }
+    /**
+     * @description 信息点item 删除工程信息化对象
+     */
+    deleteInfoAttachObjectIds() {
+        this.focusItem.AttachObjectIds.pop()
+        this.scenceUpdate(this);
+    }
 }

+ 26 - 0
src/lib/parsers/SInfoParser.ts

@@ -0,0 +1,26 @@
+import { SParser } from "@saga-web/big/lib";
+import { SInfoItem } from "../items/SInfoItem";
+import { Info } from "../types/Info";
+
+/**
+ * 设备信息解析器
+ */
+export class SInfoParser extends SParser {
+    /** 设备list   */
+    infoItem: SInfoItem[] = [];
+    /**
+     * 解析数据
+     *
+     * @param   data    设备数据
+     * */
+    parseData(data: Info[]): void {
+        if (data) {
+            data.map((t: Info): void => {
+                let info = new SInfoItem(null, t);
+                this.infoItem.push(info);
+            });
+        }
+    } // Function parseData()
+
+    // private addEquipment(): void {} // Function addEquipment()
+} // class SEquipmentParser

+ 1 - 1
src/views/systemMap.vue

@@ -75,7 +75,7 @@ export default {
             this.cmdType = cmdType;
         },
         changeFocusItem(item) {
-            console.log(78,item)
+            // console.log(78,item)
             this.focusItemList = item;
         }
     }