Prechádzať zdrojové kódy

国标通道编辑支持选择现有的行政区划和虚拟组织

648540858 11 mesiacov pred
rodič
commit
1e8e3d729f

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java

@@ -156,7 +156,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
         }
         List<CommonGBChannel> onlineChannelList = commonGBChannelMapper.queryInListByStatus(commonGBChannelList, "ON");
         if (onlineChannelList.isEmpty()) {
-            log.warn("[多个通道离线] 更新失败, 参数内通道已经离线, 无需更新");
+            log.info("[多个通道离线] 更新失败, 参数内通道已经离线, 无需更新");
             return 0;
         }
         int limitCount = 1000;

+ 30 - 3
web_src/src/components/common/CommonChannelEdit.vue

@@ -7,7 +7,9 @@
         </el-form-item>
         <el-form-item label="编码" >
           <el-input v-model="form.gbDeviceId" placeholder="请输入通道编码">
-            <el-button slot="append" @click="buildDeviceIdCode(form.gbDeviceId)">生成</el-button>
+            <template v-slot:append>
+              <el-button  @click="buildDeviceIdCode(form.gbDeviceId)">生成</el-button>
+            </template>
           </el-input>
         </el-form-item>
         <el-form-item label="设备厂商" >
@@ -18,7 +20,11 @@
         </el-form-item>
 
         <el-form-item label="行政区域" >
-          <el-input v-model="form.gbCivilCode" placeholder="请输入行政区域"></el-input>
+          <el-input v-model="form.gbCivilCode" placeholder="请输入行政区域">
+            <template v-slot:append>
+              <el-button  @click="chooseCivilCode()">选择</el-button>
+            </template>
+          </el-input>
         </el-form-item>
 
         <el-form-item label="安装地址" >
@@ -31,7 +37,11 @@
           </el-select>
         </el-form-item>
         <el-form-item label="父节点编码" >
-          <el-input v-model="form.gbParentId" placeholder="请输入父节点编码"></el-input>
+          <el-input v-model="form.gbParentId" placeholder="请输入父节点编码">
+            <template v-slot:append>
+              <el-button  @click="chooseGroup()">选择</el-button>
+            </template>
+          </el-input>
         </el-form-item>
         <el-form-item label="设备状态" >
           <el-select v-model="form.gbStatus" style="width: 100%" placeholder="请选择设备状态">
@@ -202,16 +212,22 @@
 
     </el-form>
     <channelCode ref="channelCode"></channelCode>
+    <chooseCivilCode ref="chooseCivilCode"></chooseCivilCode>
+    <chooseGroup ref="chooseGroup"></chooseGroup>
   </div>
 </template>
 
 <script>
 import channelCode from './../dialog/channelCode'
+import ChooseCivilCode from "../dialog/chooseCivilCode.vue";
+import ChooseGroup from "../dialog/chooseGroup.vue";
 
 export default {
   name: "CommonChannelEdit",
   props: [ 'id', 'dataForm', 'saveSuccess', 'cancel'],
   components: {
+    ChooseCivilCode,
+    ChooseGroup,
     channelCode,
   },
   created() {
@@ -360,6 +376,17 @@ export default {
         console.log("code22===> " + code)
       }, deviceId);
     },
+    chooseCivilCode: function (){
+      this.$refs.chooseCivilCode.openDialog(code=>{
+          this.form.gbCivilCode = code;
+      });
+    },
+    chooseGroup: function (){
+      this.$refs.chooseGroup.openDialog((deviceId, businessGroupId)=>{
+          this.form.gbBusinessGroupId = businessGroupId;
+          this.form.gbParentId = deviceId;
+      });
+    },
     cancelSubmit: function (){
       if(this.cancel) {
         this.cancel()

+ 55 - 64
web_src/src/components/common/GroupTree.vue

@@ -18,7 +18,7 @@
         class="flow-tree"
         ref="veTree"
         node-key="treeId"
-        height="78vh"
+        :height="treeHeight?treeHeight:'78vh'"
         lazy
         style="padding: 0 0 2rem 0.5rem"
         :load="loadNode"
@@ -70,7 +70,7 @@ export default {
       treeData: [],
     }
   },
-  props: ['edit', 'clickEvent', 'onChannelChange', 'showHeader', 'hasChannel', 'addChannelToGroup'],
+  props: ['edit','enableAddChannel', 'clickEvent', 'onChannelChange', 'showHeader', 'hasChannel', 'addChannelToGroup', 'treeHeight'],
   created() {
   },
   methods: {
@@ -117,49 +117,52 @@ export default {
         return;
       }
       if (node.data.type === 0) {
-        this.$contextmenu({
-          items: [
-            {
-              label: "刷新节点",
-              icon: "el-icon-refresh",
-              disabled: false,
-              onClick: () => {
-                this.refreshNode(node);
-              }
-            },
-            {
-              label: "新建节点",
-              icon: "el-icon-plus",
-              disabled: false,
-              onClick: () => {
-                this.addGroup(data.id, node);
-              }
-            },
-            {
-              label: "编辑节点",
-              icon: "el-icon-edit",
-              disabled: node.level === 1,
-              onClick: () => {
-                this.editGroup(data, node);
-              }
-            },
-            {
-              label: "删除节点",
-              icon: "el-icon-delete",
-              disabled: node.level === 1,
-              divided: true,
-              onClick: () => {
-                this.$confirm('确定删除?', '提示', {
-                  confirmButtonText: '确定',
-                  cancelButtonText: '取消',
-                  type: 'warning'
-                }).then(() => {
-                  this.removeGroup(data.id, node)
-                }).catch(() => {
+        let menuItem = [
+          {
+            label: "刷新节点",
+            icon: "el-icon-refresh",
+            disabled: false,
+            onClick: () => {
+              this.refreshNode(node);
+            }
+          },
+          {
+            label: "新建节点",
+            icon: "el-icon-plus",
+            disabled: false,
+            onClick: () => {
+              this.addGroup(data.id, node);
+            }
+          },
+          {
+            label: "编辑节点",
+            icon: "el-icon-edit",
+            disabled: node.level === 1,
+            onClick: () => {
+              this.editGroup(data, node);
+            }
+          },
+          {
+            label: "删除节点",
+            icon: "el-icon-delete",
+            disabled: node.level === 1,
+            divided: true,
+            onClick: () => {
+              this.$confirm('确定删除?', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+              }).then(() => {
+                this.removeGroup(data.id, node)
+              }).catch(() => {
 
-                });
-              }
-            },
+              });
+            }
+          },
+        ]
+
+        if (this.enableAddChannel) {
+          menuItem.push(
             {
               label: "添加设备",
               icon: "el-icon-plus",
@@ -168,6 +171,8 @@ export default {
                 this.addChannelFormDevice(data.id, node)
               }
             },
+          )
+          menuItem.push(
             {
               label: "移除设备",
               icon: "el-icon-delete",
@@ -177,6 +182,8 @@ export default {
                 this.removeChannelFormDevice(data.id, node)
               }
             },
+          )
+          menuItem.push(
             {
               label: "添加通道",
               icon: "el-icon-plus",
@@ -185,27 +192,11 @@ export default {
                 this.addChannel(data.id, node)
               }
             },
-            // {
-            //   label: "导出",
-            //   icon: "el-icon-download",
-            //   disabled: false,
-            //   children: [
-            //     {
-            //       label: "导出到文件",
-            //       onClick: () => {
-            //
-            //       },
-            //     },
-            //     {
-            //       label: "导出到其他平台",
-            //       onClick: () => {
-            //
-            //       },
-            //     }
-            //   ]
-            // },
+          )
+        }
 
-          ],
+        this.$contextmenu({
+          items: menuItem,
           event, // 鼠标事件信息
           customClass: "custom-class", // 自定义菜单 class
           zIndex: 3000, // 菜单样式 z-index

+ 58 - 67
web_src/src/components/common/RegionTree.vue

@@ -17,7 +17,7 @@
         class="flow-tree"
         ref="veTree"
         node-key="treeId"
-        height="78vh"
+        :height="treeHeight?treeHeight:'78vh'"
         lazy
         style="padding: 0 0 2rem 0.5rem"
         :load="loadNode"
@@ -68,7 +68,7 @@ export default {
       treeData: [],
     }
   },
-  props: ['edit', 'clickEvent', 'onChannelChange', 'showHeader', 'hasChannel', 'addChannelToCivilCode'],
+  props: ['edit', 'enableAddChannel', 'clickEvent', 'onChannelChange', 'showHeader', 'hasChannel', 'addChannelToCivilCode', 'treeHeight'],
   created() {
   },
   methods: {
@@ -118,49 +118,51 @@ export default {
       }
       console.log(node.level)
       if (node.data.type === 0) {
-        this.$contextmenu({
-          items: [
-            {
-              label: "刷新节点",
-              icon: "el-icon-refresh",
-              disabled: false,
-              onClick: () => {
-                this.refreshNode(node);
-              }
-            },
-            {
-              label: "新建节点",
-              icon: "el-icon-plus",
-              disabled: false,
-              onClick: () => {
-                this.addRegion(data.id, node);
-              }
-            },
-            {
-              label: "编辑节点",
-              icon: "el-icon-edit",
-              disabled: node.level === 1,
-              onClick: () => {
-                this.editCatalog(data, node);
-              }
-            },
-            {
-              label: "删除节点",
-              icon: "el-icon-delete",
-              disabled: node.level === 1,
-              divided: true,
-              onClick: () => {
-                this.$confirm('确定删除?', '提示', {
-                  confirmButtonText: '确定',
-                  cancelButtonText: '取消',
-                  type: 'warning'
-                }).then(() => {
-                  this.removeRegion(data.id, node)
-                }).catch(() => {
+        let menuItem = [
+          {
+            label: "刷新节点",
+            icon: "el-icon-refresh",
+            disabled: false,
+            onClick: () => {
+              this.refreshNode(node);
+            }
+          },
+          {
+            label: "新建节点",
+            icon: "el-icon-plus",
+            disabled: false,
+            onClick: () => {
+              this.addRegion(data.id, node);
+            }
+          },
+          {
+            label: "编辑节点",
+            icon: "el-icon-edit",
+            disabled: node.level === 1,
+            onClick: () => {
+              this.editCatalog(data, node);
+            }
+          },
+          {
+            label: "删除节点",
+            icon: "el-icon-delete",
+            disabled: node.level === 1,
+            divided: true,
+            onClick: () => {
+              this.$confirm('确定删除?', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+              }).then(() => {
+                this.removeRegion(data.id, node)
+              }).catch(() => {
 
-                });
-              }
-            },
+              });
+            }
+          },
+        ]
+        if (this.enableAddChannel) {
+          menuItem.push(
             {
               label: "添加设备",
               icon: "el-icon-plus",
@@ -168,7 +170,9 @@ export default {
               onClick: () => {
                 this.addChannelFormDevice(data.id, node)
               }
-            },
+            }
+          )
+          menuItem.push(
             {
               label: "移除设备",
               icon: "el-icon-delete",
@@ -177,7 +181,9 @@ export default {
               onClick: () => {
                 this.removeChannelFormDevice(data.id, node)
               }
-            },
+            }
+          )
+          menuItem.push(
             {
               label: "添加通道",
               icon: "el-icon-plus",
@@ -185,28 +191,13 @@ export default {
               onClick: () => {
                 this.addChannel(data.id, node)
               }
-            },
-            // {
-            //   label: "导出",
-            //   icon: "el-icon-download",
-            //   disabled: false,
-            //   children: [
-            //     {
-            //       label: "导出到文件",
-            //       onClick: () => {
-            //
-            //       },
-            //     },
-            //     {
-            //       label: "导出到其他平台",
-            //       onClick: () => {
-            //
-            //       },
-            //     }
-            //   ]
-            // },
+            }
+          )
+        }
+
 
-          ],
+        this.$contextmenu({
+          items: menuItem,
           event, // 鼠标事件信息
           customClass: "custom-class", // 自定义菜单 class
           zIndex: 3000, // 菜单样式 z-index

+ 65 - 0
web_src/src/components/dialog/chooseCivilCode.vue

@@ -0,0 +1,65 @@
+<template>
+  <div id="chooseCivilCode" >
+    <el-dialog
+      title="选择行政区划"
+      width="30%"
+      top="5rem"
+      :close-on-click-modal="false"
+      :visible.sync="showDialog"
+      :destroy-on-close="true"
+      @close="close()"
+    >
+      <RegionTree ref="regionTree" :showHeader=true :edit="true" :enableAddChannel="false"  :clickEvent="treeNodeClickEvent"
+                  :onChannelChange="onChannelChange" :treeHeight="'45vh'"></RegionTree>
+      <el-form>
+        <el-form-item>
+          <div style="text-align: right">
+            <el-button type="primary" @click="onSubmit">保存</el-button>
+            <el-button @click="close">取消</el-button>
+          </div>
+        </el-form-item>
+      </el-form>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+
+import RegionTree from "../common/RegionTree.vue";
+
+export default {
+  name: "chooseCivilCode",
+  components: {RegionTree},
+  props: {},
+  computed: {},
+  created() {},
+  data() {
+    return {
+      showDialog: false,
+      endCallback: false,
+      regionDeviceId: "",
+    };
+  },
+  methods: {
+    openDialog: function (callback) {
+      this.showDialog = true;
+      this.endCallback = callback;
+    },
+    onSubmit: function () {
+      if (this.endCallback) {
+        this.endCallback(this.regionDeviceId)
+      }
+      this.close();
+    },
+    close: function () {
+      this.showDialog = false;
+    },
+    treeNodeClickEvent: function (region) {
+      this.regionDeviceId = region.deviceId;
+    },
+    onChannelChange: function (deviceId) {
+      //
+    },
+  },
+};
+</script>

+ 70 - 0
web_src/src/components/dialog/chooseGroup.vue

@@ -0,0 +1,70 @@
+<template>
+  <div id="chooseGroup" >
+    <el-dialog
+      title="选择虚拟组织"
+      width="30%"
+      top="5rem"
+      :close-on-click-modal="false"
+      :visible.sync="showDialog"
+      :destroy-on-close="true"
+      @close="close()"
+    >
+      <GroupTree ref="regionTree" :showHeader=true :edit="true" :enableAddChannel="false"  :clickEvent="treeNodeClickEvent"
+                  :onChannelChange="onChannelChange" :treeHeight="'45vh'"></GroupTree>
+      <el-form>
+        <el-form-item>
+          <div style="text-align: right">
+            <el-button type="primary" @click="onSubmit">保存</el-button>
+            <el-button @click="close">取消</el-button>
+          </div>
+        </el-form-item>
+      </el-form>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+
+import GroupTree from "../common/GroupTree.vue";
+
+export default {
+  name: "chooseCivilCode",
+  components: {GroupTree},
+  props: {},
+  computed: {},
+  created() {},
+  data() {
+    return {
+      showDialog: false,
+      endCallback: false,
+      groupDeviceId: "",
+      businessGroup: "",
+    };
+  },
+  methods: {
+    openDialog: function (callback) {
+      this.showDialog = true;
+      this.endCallback = callback;
+    },
+    onSubmit: function () {
+      if (this.endCallback) {
+        this.endCallback(this.groupDeviceId, this.businessGroup)
+      }
+      this.close();
+    },
+    close: function () {
+      this.showDialog = false;
+    },
+    treeNodeClickEvent: function (group) {
+      if (group.deviceId === "" || group.deviceId === group.businessGroup) {
+        return
+      }
+      this.groupDeviceId = group.deviceId;
+      this.businessGroup = group.businessGroup;
+    },
+    onChannelChange: function (deviceId) {
+      //
+    },
+  },
+};
+</script>

+ 3 - 1
web_src/src/components/group.vue

@@ -3,7 +3,7 @@
     <el-container v-loading="loading">
       <el-aside width="400px">
         <GroupTree ref="groupTree" :show-header="true" :edit="true" :clickEvent="treeNodeClickEvent"
-                   :onChannelChange="onChannelChange" :addChannelToGroup="addChannelToGroup"></GroupTree>
+                   :onChannelChange="onChannelChange" :enableAddChannel="true" :addChannelToGroup="addChannelToGroup"></GroupTree>
       </el-aside>
       <el-main style="padding: 5px;">
         <div class="page-header">
@@ -95,10 +95,12 @@ import uiHeader from '../layout/UiHeader.vue'
 import DeviceService from "./service/DeviceService";
 import GroupTree from "./common/GroupTree.vue";
 import GbChannelSelect from "./dialog/GbChannelSelect.vue";
+import RegionTree from "./common/RegionTree.vue";
 
 export default {
   name: 'channelList',
   components: {
+    RegionTree,
     GbChannelSelect,
     uiHeader,
     GroupTree,

+ 1 - 1
web_src/src/components/region.vue

@@ -3,7 +3,7 @@
     <el-container v-loading="loading">
       <el-aside width="400px">
         <RegionTree ref="regionTree" :showHeader=true :edit="true" :clickEvent="treeNodeClickEvent"
-                    :onChannelChange="onChannelChange" :addChannelToCivilCode="addChannelToCivilCode"></RegionTree>
+                    :onChannelChange="onChannelChange" :enableAddChannel="true" :addChannelToCivilCode="addChannelToCivilCode"></RegionTree>
       </el-aside>
       <el-main style="padding: 5px;">
         <div class="page-header">