Browse Source

修复行政区划树以及业务分组树的自动展开

648540858 1 year ago
parent
commit
726380cec4

+ 0 - 1
src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamResponseListener.java

@@ -29,7 +29,6 @@ public class RedisPushStreamResponseListener implements MessageListener {
     @Autowired
     private ThreadPoolTaskExecutor taskExecutor;
 
-
     private Map<String, PushStreamResponseEvent> responseEvents = new ConcurrentHashMap<>();
 
     public interface PushStreamResponseEvent{

+ 12 - 3
web_src/src/components/common/GroupTree.vue

@@ -29,7 +29,7 @@
       >
         <span class="custom-tree-node" slot-scope="{ node, data }">
           <span @click.stop v-if="edit">
-            <el-radio v-if="node.data.type === 0 && node.level > 2" style="margin-right: 0" v-model="chooseId" @input="chooseIdChange(node.data.deviceId, node.data.businessGroup)" :label="node.data.deviceId">{{''}}</el-radio>
+            <el-radio v-if="node.data.type === 0 && node.level > 2" style="margin-right: 0" v-model="chooseId" @input="chooseIdChange(node.data.treeId, node.data.deviceId, node.data.businessGroup)" :label="node.data.deviceId">{{''}}</el-radio>
           </span>
           <span v-if="node.data.type === 0" style="color: #409EFF" class="iconfont icon-bianzubeifen3"></span>
           <span v-if="node.data.type === 1" style="color: #409EFF" class="iconfont icon-shexiangtou2"></span>
@@ -57,6 +57,7 @@ export default {
     return {
       props: {
         label: "name",
+        id: "treeId"
       },
       showCode: false,
       searchSrt: "",
@@ -128,6 +129,7 @@ export default {
                   }
                 }).then((res) => {
                   console.log("移除成功")
+                  console.log(node)
                   if (this.onChannelChange) {
                     this.onChannelChange()
                   }
@@ -275,6 +277,7 @@ export default {
             if (this.onChannelChange) {
               this.onChannelChange()
             }
+            console.log(node)
             node.loaded = false
             node.expand();
           }else {
@@ -333,14 +336,18 @@ export default {
       })
     },
     refreshNode: function (node) {
+      console.log(node)
       node.loaded = false
       node.expand();
     },
     refresh: function (id) {
+      console.log("刷新节点: " + id)
       // 查询node
       let node = this.$refs.veTree.getNode(id)
-      node.loaded = false
-      node.expand();
+      if (node) {
+        node.loaded = false
+        node.expand();
+      }
     },
     addGroup: function (id, node) {
       this.$refs.groupEdit.openDialog({
@@ -352,6 +359,7 @@ export default {
         parentId: node.data.id,
         businessGroup: node.level > 2 ? node.data.businessGroup: node.data.deviceId,
       },form => {
+        console.log(node)
         node.loaded = false
         node.expand();
       }, id);
@@ -359,6 +367,7 @@ export default {
     editGroup: function (id, node) {
       console.log(node)
       this.$refs.groupEdit.openDialog(node.data,form => {
+        console.log(node)
         node.parent.loaded = false
         node.parent.expand();
       }, id);

+ 6 - 3
web_src/src/components/common/RegionTree.vue

@@ -29,7 +29,7 @@
       >
         <span class="custom-tree-node" slot-scope="{ node, data }">
           <span @click.stop v-if="edit">
-            <el-radio v-if="node.data.type === 0 && node.level !== 1 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange" :label="node.data.deviceId">{{''}}</el-radio>
+            <el-radio v-if="node.data.type === 0 && node.level !== 1 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange(node.data.treeId, node.data.deviceId)" :label="node.data.deviceId">{{''}}</el-radio>
           </span>
           <span v-if="node.data.type === 0" style="color: #409EFF" class="iconfont icon-bianzubeifen3"></span>
           <span v-if="node.data.type === 1" style="color: #409EFF" class="iconfont icon-shexiangtou2"></span>
@@ -337,8 +337,11 @@ export default {
     refresh: function (id) {
       // 查询node
       let node = this.$refs.veTree.getNode(id)
-      node.loaded = false
-      node.expand();
+      if (node) {
+        node.loaded = false
+        node.expand();
+      }
+
     },
     addRegion: function (id, node) {
 

+ 7 - 7
web_src/src/components/group.vue

@@ -113,6 +113,7 @@ export default {
       total: 0,
       loading: false,
       loadSnap: {},
+      groupDeviceId: "",
       groupId: "",
       businessGroup: "",
       multipleSelection: []
@@ -175,12 +176,10 @@ export default {
       }
     },
     rowDblclick: function (row, rowIndex) {
-      if (row.gbParentId) {
-        this.$refs.groupTree.refresh(row.gbParentId)
-      }
+
     },
     add: function (row) {
-      if (!this.groupId) {
+      if (!this.groupDeviceId) {
         this.$message.info({
           showClose: true,
           message: "请选择左侧行政区划节点"
@@ -204,7 +203,7 @@ export default {
         method: 'post',
         url: `/api/common/channel/group/add`,
         data: {
-          parentId: this.groupId,
+          parentId: this.groupDeviceId,
           businessGroup: this.businessGroup,
           channelIds: channels
         }
@@ -261,7 +260,7 @@ export default {
           })
           this.getChannelList()
           // 刷新树节点
-          this.$refs.groupTree.refresh(this.groupId)
+          this.$refs.groupTree.refresh(this.groupDeviceId)
         }else {
           this.$message.error({
               showClose: true,
@@ -292,8 +291,9 @@ export default {
     treeNodeClickEvent: function (device, data, isCatalog) {
 
     },
-    chooseIdChange: function (id, businessGroup) {
+    chooseIdChange: function (id, deviceId, businessGroup) {
       this.groupId = id;
+      this.groupDeviceId = deviceId;
       this.businessGroup = businessGroup;
     },
   }

+ 8 - 6
web_src/src/components/region.vue

@@ -114,6 +114,7 @@ export default {
       loading: false,
       loadSnap: {},
       regionId: "",
+      regionDeviceId: "",
       multipleSelection: []
     };
   },
@@ -175,12 +176,12 @@ export default {
       }
     },
     rowDblclick: function (row, rowIndex) {
-      if (row.gbCivilCode) {
-        this.$refs.regionTree.refresh(row.gbCivilCode)
-      }
+      // if (row.gbCivilCode) {
+      //   this.$refs.regionTree.refresh(row.gbCivilCode)
+      // }
     },
     add: function (row) {
-      if (!this.regionId) {
+      if (!this.regionDeviceId) {
         this.$message.info({
           showClose: true,
           message: "请选择左侧行政区划节点"
@@ -204,7 +205,7 @@ export default {
         method: 'post',
         url: `/api/common/channel/region/add`,
         data: {
-          civilCode: this.regionId,
+          civilCode: this.regionDeviceId,
           channelIds: channels
         }
       }).then((res)=> {
@@ -290,7 +291,8 @@ export default {
     treeNodeClickEvent: function (device, data, isCatalog) {
 
     },
-    chooseIdChange: function (id) {
+    chooseIdChange: function (id, deviceId) {
+      this.regionDeviceId = deviceId;
       this.regionId = id;
     },
   }