haojianlong 4 лет назад
Родитель
Сommit
b040d5944a
2 измененных файлов с 46 добавлено и 14 удалено
  1. 2 2
      package.json
  2. 44 12
      src/views/ledger/facility/batchPoint.vue

+ 2 - 2
package.json

@@ -20,9 +20,9 @@
   },
   "dependencies": {
     "@saga-web/base": "2.1.27",
-    "@saga-web/cad-engine": "2.0.576",
+    "@saga-web/cad-engine": "2.0.578",
     "@saga-web/draw": "2.1.110",
-    "@saga-web/graph": "2.1.132",
+    "@saga-web/graph": "2.1.133",
     "@saga-web/topology": "1.0.85",
     "axios": "^0.18.0",
     "echarts": "^4.1.0",

+ 44 - 12
src/views/ledger/facility/batchPoint.vue

@@ -37,7 +37,7 @@
                                     @click="handleSelectIcon(item)"
                                 >
 									<p class="equip-item-text">{{item[showName] || '--'}}</p>
-									<i v-if="item.BIMLocation" class="iconfont icon-hook equip-item-icon" style="color: #67C23A;"></i>
+									<i v-if="item.hasLocation" class="iconfont icon-hook equip-item-icon" style="color: #67C23A;"></i>
 									<i v-else class="iconfont icon-cross equip-item-icon" style="color: #F56C6C;"></i>
 								</li>
 								<p style="text-align: center;" v-if="loading">加载中...</p>
@@ -149,7 +149,8 @@ export default {
 		pageNumber: 1,
 		pageSize: 50,
         total: 0,
-        isChange: false //平面图设备是否更改
+        isChange: false, //平面图设备是否更改
+        isMarking: false, // 标记是否选中的是无坐标的设备,true-打点,打完以后重置为false
 	};
   },
   computed: {
@@ -194,6 +195,8 @@ export default {
     },
     // 点击列表设备
     handleSelectIcon(equip) {
+        // 保存当前选中设备数据
+        this.equipData = equip;
         // 选中样式处理
         this.equipList.forEach(item => {
             if (equip.EquipID === item.EquipID) {
@@ -202,13 +205,21 @@ export default {
                 item.selected = false;
             }
         })
-        // 关联平面图设备选中
-        if (this.scene) {
-            this.scene.iconList.forEach(item => {
-                if (item.data.id === equip.EquipID) {
-                    this.scene.selectContainer.setItem(item);
-                }
-            })
+        // 有坐标 执行选中
+        if (equip.hasLocation) {
+            // 清除打点动作
+            this.isMarking = false;
+            // 关联平面图设备选中
+            if (this.scene) {
+                this.scene.iconList.forEach(item => {
+                    if (item.data.id === equip.EquipID) {
+                        this.scene.selectContainer.setItem(item);
+                    }
+                })
+            }
+        } else {
+            // 无坐标 执行打点
+            this.isMarking = true;
         }
     },
     handleClickIcon(item, events) {
@@ -285,7 +296,7 @@ export default {
 			}
 
 			queryEquip(params, (res) => {
-				this.equipList = this.equipList.concat(res.Content.map(item => {item.selected = false; return item;}));
+				this.equipList = this.equipList.concat(res.Content.map(item => {item.selected = false; item.hasLocation = !!item.BIMLocation; return item;}));
 				if (this.view && this.view.scene) {
 					res.Content.forEach(item =>{
 						if (item.LocationJson && item.LocationJson.X && item.LocationJson.Y) {
@@ -294,11 +305,12 @@ export default {
                                 X: item.LocationJson.X, 
                                 Y: -item.LocationJson.Y, 
                                 Z: item.LocationJson.Z,
-                                text: [`${item.EquipLocalName || '--'}\n${item.EquipLocalID || '--'}\n${item.LocationJson.Y || '--'}`]
+                                text: [`${item.EquipLocalName || '--'}\n${item.EquipLocalID || '--'}\n${item.CADID || '--'}`]
                             });
 						}
                     });
                     this.scene.iconMove(this, this.iconMove);
+                    this.scene.spaceClick(this, this.spaceClick);
                     this.scene.iconClick(this, this.handleClickIcon);
 					this.view.update();
 				}
@@ -314,6 +326,26 @@ export default {
     iconMove(item) {
         this.isChange = true;
     },
+    // 打点
+    spaceClick(item, e) {
+        if (this.isMarking) {
+            this.scene.addIconText({
+                id: this.equipData.EquipID,
+                X: e[0].x, 
+                Y: e[0].y, 
+                Z: 0,
+                text: [`${this.equipData.EquipLocalName || '--'}\n${this.equipData.EquipLocalID || '--'}\n${this.equipData.CADID || '--'}`]
+            });
+            // 保存按钮
+            this.isChange = true;
+            // 设置有坐标标识
+            this.equipData.hasLocation = true;
+            // 绑定事件
+            this.scene.iconClick(this, this.handleClickIcon)
+            // 重置打点动作
+            this.isMarking = false;
+        }
+    },
 	//初始化条件并查询设备
 	initParams() {
 		this.pageNumber = 1;
@@ -379,7 +411,7 @@ export default {
         if (this.scene && this.scene.iconList.length) {
             let param = {Content: []}
             this.scene.iconList.map((item) => {
-                if (item.data.id && item.data.Z) {
+                if (item.data.id) {
                     param.Content.push({
                         EquipID: item.data.id,
                         BIMLocation: `${item.x},${-item.y},${item.data.Z}`