diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/CommonChannelController.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/CommonChannelController.java index 28a1b0b6..2c09df4b 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/CommonChannelController.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/CommonChannelController.java @@ -98,23 +98,40 @@ public class CommonChannelController { return channel; } - @Operation(summary = "获取通道列表", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Operation(summary = "获取关联行政区划通道列表", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "page", description = "当前页", required = true) @Parameter(name = "count", description = "每页查询数量", required = true) @Parameter(name = "query", description = "查询内容") @Parameter(name = "online", description = "是否在线") @Parameter(name = "civilCode", description = "行政区划") - @Parameter(name = "groupDeviceId", description = "业务分组下的父节点ID") - @GetMapping("/list") - public PageInfo queryList(int page, int count, + @GetMapping("/civilcode/list") + public PageInfo queryListByCivilCode(int page, int count, @RequestParam(required = false) String query, @RequestParam(required = false) Boolean online, - @RequestParam(required = false) String civilCode, + @RequestParam(required = false) Integer channelType, + @RequestParam(required = false) String civilCode){ + if (ObjectUtils.isEmpty(query)){ + query = null; + } + return channelService.queryListByCivilCode(page, count, query, online, channelType, civilCode); + } + + @Operation(summary = "获取关联业务分组通道列表", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "page", description = "当前页", required = true) + @Parameter(name = "count", description = "每页查询数量", required = true) + @Parameter(name = "query", description = "查询内容") + @Parameter(name = "online", description = "是否在线") + @Parameter(name = "groupDeviceId", description = "业务分组下的父节点ID") + @GetMapping("/parent/list") + public PageInfo queryListByParentId(int page, int count, + @RequestParam(required = false) String query, + @RequestParam(required = false) Boolean online, + @RequestParam(required = false) Integer channelType, @RequestParam(required = false) String groupDeviceId){ if (ObjectUtils.isEmpty(query)){ query = null; } - return channelService.queryList(page, count, query, online, civilCode, groupDeviceId); + return channelService.queryListByParentId(page, count, query, online, channelType, groupDeviceId); } @Operation(summary = "通道设置行政区划", security = @SecurityRequirement(name = JwtUtils.HEADER)) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/GroupController.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/GroupController.java index ef30624c..1284477a 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/GroupController.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/GroupController.java @@ -40,12 +40,13 @@ public class GroupController { @GetMapping("/tree/list") public List queryForTree( @RequestParam(required = false) String query, - @RequestParam(required = false) Integer parent + @RequestParam(required = false) Integer parent, + @RequestParam(required = false) Boolean hasChannel ){ if (ObjectUtils.isEmpty(query)) { query = null; } - return groupService.queryForTree(query, parent); + return groupService.queryForTree(query, parent, hasChannel); } @Operation(summary = "更新分组") @@ -68,6 +69,14 @@ public class GroupController { } } + @Operation(summary = "获取所属的行政区划下的行政区划") + @Parameter(name = "deviceId", description = "当前的行政区划", required = false) + @ResponseBody + @GetMapping("/path") + public List getPath(String deviceId, String businessGroup){ + return groupService.getPath(deviceId, businessGroup); + } + // @Operation(summary = "根据分组Id查询分组") // @Parameter(name = "groupDeviceId", description = "分组节点编号", required = true) // @ResponseBody diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java index 517ba4bc..caa8fa08 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java @@ -255,9 +255,17 @@ public interface CommonGBChannelMapper { @SelectProvider(type = ChannelProvider.class, method = "queryByStreamProxyId") CommonGBChannel queryByStreamProxyId(@Param("streamProxyId") Integer streamProxyId); - @SelectProvider(type = ChannelProvider.class, method = "queryList") - List queryList(@Param("query") String query, @Param("online") Boolean online, - @Param("civilCode") String civilCode, @Param("groupDeviceId") String groupDeviceId); + @SelectProvider(type = ChannelProvider.class, method = "queryListByCivilCode") + List queryListByCivilCode(@Param("query") String query, @Param("online") Boolean online, + @Param("channelType") Integer channelType, @Param("civilCode") String civilCode); + + + + @SelectProvider(type = ChannelProvider.class, method = "queryListByParentId") + List queryListByParentId(@Param("query") String query, @Param("online") Boolean online, + @Param("channelType") Integer channelType, @Param("groupDeviceId") String groupDeviceId); + + @Select(" diff --git a/web_src/src/components/group.vue b/web_src/src/components/group.vue index 5afa22b5..7faf082f 100755 --- a/web_src/src/components/group.vue +++ b/web_src/src/components/group.vue @@ -1,45 +1,54 @@ - - - - + @@ -93,10 +94,12 @@ import uiHeader from '../layout/UiHeader.vue' import DeviceService from "./service/DeviceService"; import GroupTree from "./common/GroupTree.vue"; +import GbChannelSelect from "./dialog/GbChannelSelect.vue"; export default { name: 'channelList', components: { + GbChannelSelect, uiHeader, GroupTree, }, @@ -116,6 +119,7 @@ export default { groupDeviceId: "", groupId: "", businessGroup: "", + regionParents: ["请选择虚拟组织"], multipleSelection: [] }; }, @@ -123,7 +127,8 @@ export default { created() { this.initData(); }, - destroyed() {}, + destroyed() { + }, methods: { initData: function () { this.getChannelList(); @@ -139,15 +144,16 @@ export default { getChannelList: function () { this.$axios({ method: 'get', - url: `/api/common/channel/list`, + url: `/api/common/channel/parent/list`, params: { page: this.currentPage, count: this.count, query: this.searchSrt, online: this.online, - hasGroup: this.hasGroup + channelType: this.channelType, + groupDeviceId: this.groupDeviceId } - }).then((res)=> { + }).then((res) => { if (res.data.code === 0) { this.total = res.data.data.total; this.channelList = res.data.data.list; @@ -157,77 +163,67 @@ export default { }) } - }).catch((error)=> { + }).catch((error) => { console.log(error); }); }, - handleSelectionChange: function (val){ + handleSelectionChange: function (val) { this.multipleSelection = val; }, - selectable: function (row, rowIndex) { - if (this.hasGroup === "") { - if (row.gbParentId) { - return false - }else { - return true - } - }else { - return true - } - }, rowDblclick: function (row, rowIndex) { }, add: function (row) { - if (!this.groupDeviceId) { + if (this.regionDeviceId === "") { this.$message.info({ showClose: true, - message: "请选择左侧行政区划节点" - }) - return; - } - let channels = [] - for (let i = 0; i < this.multipleSelection.length; i++) { - channels.push(this.multipleSelection[i].gbId) - } - if (channels.length === 0) { - this.$message.info({ - showClose: true, - message: "请选择右侧通道" + message: "请选择左侧虚拟组织节点" }) return; } + this.$refs.gbChannelSelect.openDialog((data) => { + console.log("选择的数据") + console.log(data) + this.addChannelToGroup(this.groupDeviceId, this.businessGroup, data) + }) + }, + addChannelToGroup: function (groupDeviceId, businessGroup, data) { + if (data.length === 0) { + return; + } + let channels = [] + for (let i = 0; i < data.length; i++) { + channels.push(data[i].gbId) + } this.loading = true this.$axios({ method: 'post', url: `/api/common/channel/group/add`, data: { - parentId: this.groupDeviceId, - businessGroup: this.businessGroup, + parentId: groupDeviceId, + businessGroup: businessGroup, channelIds: channels } - }).then((res)=> { + }).then((res) => { if (res.data.code === 0) { this.$message.success({ showClose: true, message: "保存成功" }) this.getChannelList() - // 刷新树节点 - this.$refs.groupTree.refresh(this.groupId) - }else { + } else { this.$message.error({ - showClose: true, - message: res.data.msg - }) + showClose: true, + message: res.data.msg + }) } this.loading = false - }).catch((error)=> { + }).catch((error) => { this.$message.error({ - showClose: true, - message: error - }) + showClose: true, + message: error + }) this.loading = false }); }, @@ -240,7 +236,7 @@ export default { if (channels.length === 0) { this.$message.info({ showClose: true, - message: "请选择右侧通道" + message: "请选择通道" }) return; } @@ -252,7 +248,7 @@ export default { data: { channelIds: channels } - }).then((res)=> { + }).then((res) => { if (res.data.code === 0) { this.$message.success({ showClose: true, @@ -261,18 +257,18 @@ export default { this.getChannelList() // 刷新树节点 this.$refs.groupTree.refresh(this.groupDeviceId) - }else { + } else { this.$message.error({ - showClose: true, - message: res.data.msg - }) + showClose: true, + message: res.data.msg + }) } this.loading = false - }).catch((error)=> { + }).catch((error) => { this.$message.error({ - showClose: true, - message: error - }) + showClose: true, + message: error + }) this.loading = false }); }, @@ -288,13 +284,38 @@ export default { refresh: function () { this.initData(); }, - treeNodeClickEvent: function (device, data, isCatalog) { + treeNodeClickEvent: function (group) { + if (group.deviceId === "" || group.deviceId === group.businessGroup) { + this.channelList = [] + this.regionParents = ["请选择虚拟组织"]; + return + } + this.groupDeviceId = group.deviceId; + this.businessGroup = group.businessGroup; + this.initData(); + // 获取regionDeviceId对应的节点信息 + this.$axios({ + method: 'get', + url: `/api/group/path`, + params: { + deviceId: this.groupDeviceId, + businessGroup: this.businessGroup, + } + }).then((res) => { + if (res.data.code === 0) { + let path = [] + for (let i = 0; i < res.data.data.length; i++) { + path.push(res.data.data[i].name) + } + this.regionParents = path; + } + }).catch((error) => { + console.log(error); + }); }, - chooseIdChange: function (id, deviceId, businessGroup) { - this.groupId = id; - this.groupDeviceId = deviceId; - this.businessGroup = businessGroup; + onChannelChange: function (deviceId) { + // }, } }; diff --git a/web_src/src/components/region.vue b/web_src/src/components/region.vue index cbfd715b..4c2b9ede 100755 --- a/web_src/src/components/region.vue +++ b/web_src/src/components/region.vue @@ -3,13 +3,13 @@ + :onChannelChange="onChannelChange" :addChannelToCivilCode="addChannelToCivilCode">