Commit fa346513db53567f6fb610b18889afc2ebbb1670

Authored by 648540858
1 parent 385fdb95

优化级联选择通道页面添加方式

src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
@@ -92,7 +92,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { @@ -92,7 +92,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
92 if (event.getDeviceChannels() != null) { 92 if (event.getDeviceChannels() != null) {
93 deviceChannelList.addAll(event.getDeviceChannels()); 93 deviceChannelList.addAll(event.getDeviceChannels());
94 } 94 }
95 - if (event.getGbStreams().size() > 0){ 95 + if (event.getGbStreams() != null && event.getGbStreams().size() > 0){
96 for (GbStream gbStream : event.getGbStreams()) { 96 for (GbStream gbStream : event.getGbStreams()) {
97 DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId()); 97 DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId());
98 deviceChannelList.add(deviceChannelByStream); 98 deviceChannelList.add(deviceChannelByStream);
@@ -131,7 +131,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { @@ -131,7 +131,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
131 if (event.getDeviceChannels() != null) { 131 if (event.getDeviceChannels() != null) {
132 deviceChannelList.addAll(event.getDeviceChannels()); 132 deviceChannelList.addAll(event.getDeviceChannels());
133 } 133 }
134 - if (event.getGbStreams().size() > 0){ 134 + if (event.getGbStreams() != null && event.getGbStreams().size() > 0){
135 for (GbStream gbStream : event.getGbStreams()) { 135 for (GbStream gbStream : event.getGbStreams()) {
136 DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId()); 136 DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId());
137 deviceChannelList.add(deviceChannelByStream); 137 deviceChannelList.add(deviceChannelByStream);
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java
@@ -466,4 +466,8 @@ public interface IVideoManagerStorager { @@ -466,4 +466,8 @@ public interface IVideoManagerStorager {
466 List<ParentPlatform> queryPlatFormListForStreamWithGBId(String app, String stream, List<String> platforms); 466 List<ParentPlatform> queryPlatFormListForStreamWithGBId(String app, String stream, List<String> platforms);
467 467
468 GbStream getGbStream(String app, String streamId); 468 GbStream getGbStream(String app, String streamId);
  469 +
  470 + void delCatalogByPlatformId(String serverGBId);
  471 +
  472 + void delRelationByPlatformId(String serverGBId);
469 } 473 }
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
@@ -88,4 +88,9 @@ public interface PlatformChannelMapper { @@ -88,4 +88,9 @@ public interface PlatformChannelMapper {
88 "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + 88 "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
89 "</script> ") 89 "</script> ")
90 List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms); 90 List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms);
  91 +
  92 + @Delete("<script> " +
  93 + "DELETE FROM platform_gb_channel WHERE platformId=#{serverGBId}" +
  94 + "</script>")
  95 + void delByPlatformId(String serverGBId);
91 } 96 }
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
@@ -52,7 +52,7 @@ public interface PlatformGbStreamMapper { @@ -52,7 +52,7 @@ public interface PlatformGbStreamMapper {
52 "from gb_stream gs\n" + 52 "from gb_stream gs\n" +
53 " left join platform_gb_stream pgs\n" + 53 " left join platform_gb_stream pgs\n" +
54 " on gs.app = pgs.app and gs.stream = pgs.stream\n" + 54 " on gs.app = pgs.app and gs.stream = pgs.stream\n" +
55 - "where and pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") 55 + "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}")
56 List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId); 56 List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId);
57 57
58 @Delete("DELETE FROM platform_gb_stream WHERE catalogId=#{id}") 58 @Delete("DELETE FROM platform_gb_stream WHERE catalogId=#{id}")
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
@@ -1044,4 +1044,15 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { @@ -1044,4 +1044,15 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
1044 public GbStream getGbStream(String app, String streamId) { 1044 public GbStream getGbStream(String app, String streamId) {
1045 return gbStreamMapper.selectOne(app, streamId); 1045 return gbStreamMapper.selectOne(app, streamId);
1046 } 1046 }
  1047 +
  1048 + @Override
  1049 + public void delCatalogByPlatformId(String serverGBId) {
  1050 + catalogMapper.delByPlatformId(serverGBId);
  1051 + }
  1052 +
  1053 + @Override
  1054 + public void delRelationByPlatformId(String serverGBId) {
  1055 + platformGbStreamMapper.delByPlatformId(serverGBId);
  1056 + platformChannelMapper.delByPlatformId(serverGBId);
  1057 + }
1047 } 1058 }
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
@@ -172,6 +172,8 @@ public class PlatformController { @@ -172,6 +172,8 @@ public class PlatformController {
172 })); 172 }));
173 173
174 boolean deleteResult = storager.deleteParentPlatform(parentPlatform); 174 boolean deleteResult = storager.deleteParentPlatform(parentPlatform);
  175 + storager.delCatalogByPlatformId(parentPlatform.getServerGBId());
  176 + storager.delRelationByPlatformId(parentPlatform.getServerGBId());
175 177
176 178
177 if (deleteResult) { 179 if (deleteResult) {
web_src/src/components/dialog/chooseChannel.vue
@@ -131,11 +131,9 @@ export default { @@ -131,11 +131,9 @@ export default {
131 this.$refs.chooseChannelFoStream.catalogIdChange(id); 131 this.$refs.chooseChannelFoStream.catalogIdChange(id);
132 } 132 }
133 }, 133 },
134 - updateChooseChannelCallback (id, nodeIds){ 134 + updateChooseChannelCallback (id){
135 console.log("中间模块收到选择通道变化: " + id) 135 console.log("中间模块收到选择通道变化: " + id)
136 - console.log("中间模块收到选择通道变化: " + nodeIds)  
137 - console.log("中间模块收到选择通道变化: " + typeof (nodeIds))  
138 - this.$refs.chooseChannelForCatalog.refreshCatalogById(id, nodeIds) 136 + this.$refs.chooseChannelForCatalog.refreshCatalogById(id)
139 } 137 }
140 } 138 }
141 }; 139 };
web_src/src/components/dialog/chooseChannelForCatalog.vue
@@ -121,25 +121,23 @@ export default { @@ -121,25 +121,23 @@ export default {
121 node.loaded = false 121 node.loaded = false
122 node.expand(); 122 node.expand();
123 }, 123 },
124 - refreshCatalogById: function (id, nodeIds) { 124 + refreshCatalogById: function (id) {
125 if (id) { 125 if (id) {
126 - console.log("refreshCatalogById: " + id)  
127 let node = this.$refs.tree.getNode(id); 126 let node = this.$refs.tree.getNode(id);
128 - console.log(node)  
129 this.refreshCatalog(node); 127 this.refreshCatalog(node);
130 } 128 }
131 - if (nodeIds !== null) {  
132 - let refreshNode = {}  
133 - for (let i = 0; i < nodeIds.length; i++) {  
134 - let node = this.$refs.tree.getNode(nodeIds[i]);  
135 - refreshNode[node.parent.data.id] = node.parent  
136 - }  
137 - if (Object.values(refreshNode).length > 0) {  
138 - for (let j = 0; j < Object.values(refreshNode).length; j++) {  
139 - this.refreshCatalog(Object.values(refreshNode)[j]);  
140 - }  
141 - }  
142 - } 129 + // if (nodeIds !== null) {
  130 + // let refreshNode = {}
  131 + // for (let i = 0; i < nodeIds.length; i++) {
  132 + // let node = this.$refs.tree.getNode(nodeIds[i]);
  133 + // refreshNode[node.parent.data.id] = node.parent
  134 + // }
  135 + // if (Object.values(refreshNode).length > 0) {
  136 + // for (let j = 0; j < Object.values(refreshNode).length; j++) {
  137 + // this.refreshCatalog(Object.values(refreshNode)[j]);
  138 + // }
  139 + // }
  140 + // }
143 }, 141 },
144 editCatalog: function (data, node){ 142 editCatalog: function (data, node){
145 let that = this; 143 let that = this;
web_src/src/components/dialog/chooseChannelForGb.vue
@@ -21,10 +21,9 @@ @@ -21,10 +21,9 @@
21 <el-option label="离线" value="false"></el-option> 21 <el-option label="离线" value="false"></el-option>
22 </el-select> 22 </el-select>
23 23
24 - <el-checkbox @change="shareAllCheckedChange">全部共享</el-checkbox> 24 +<!-- <el-checkbox @change="shareAllCheckedChange">全部共享</el-checkbox>-->
25 </div> 25 </div>
26 - <el-table ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" @selection-change="checkedChange" :height="winHeight">  
27 - <el-table-column type="selection" width="55" align="center" fixed > </el-table-column> 26 + <el-table ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" :height="winHeight">
28 <el-table-column prop="channelId" label="通道编号" width="210"> 27 <el-table-column prop="channelId" label="通道编号" width="210">
29 </el-table-column> 28 </el-table-column>
30 <el-table-column prop="name" label="通道名称" show-overflow-tooltip> 29 <el-table-column prop="name" label="通道名称" show-overflow-tooltip>
@@ -40,6 +39,14 @@ @@ -40,6 +39,14 @@
40 </el-table-column> 39 </el-table-column>
41 <el-table-column prop="manufacturer" label="厂家" align="center"> 40 <el-table-column prop="manufacturer" label="厂家" align="center">
42 </el-table-column> 41 </el-table-column>
  42 + <el-table-column label="操作" width="100" align="center" fixed="right">
  43 + <template slot-scope="scope">
  44 + <el-button-group>
  45 + <el-button size="mini" icon="el-icon-plus" v-if="!scope.row.platformId" @click="add(scope.row)">添加</el-button>
  46 + <el-button size="mini" icon="el-icon-delete" v-if="scope.row.platformId" type="danger" @click="remove(scope.row)">移除</el-button>
  47 + </el-button-group>
  48 + </template>
  49 + </el-table-column>
43 </el-table> 50 </el-table>
44 <el-pagination style="float: right;margin-top: 1rem;" @size-change="handleSizeChange" @current-change="currentChange" :current-page="currentPage" :page-size="count" :page-sizes="[10, 20, 30, 50]" layout="total, sizes, prev, pager, next" :total="total"> 51 <el-pagination style="float: right;margin-top: 1rem;" @size-change="handleSizeChange" @current-change="currentChange" :current-page="currentPage" :page-size="count" :page-sizes="[10, 20, 30, 50]" layout="total, sizes, prev, pager, next" :total="total">
45 </el-pagination> 52 </el-pagination>
@@ -108,6 +115,45 @@ export default { @@ -108,6 +115,45 @@ export default {
108 // return false; 115 // return false;
109 // } 116 // }
110 // }, 117 // },
  118 + add: function (row) {
  119 + console.log(row)
  120 + row.catalogId = this.catalogId
  121 + row.platformId = this.platformId
  122 + this.$axios({
  123 + method:"post",
  124 + url:"/api/platform/update_channel_for_gb",
  125 + data:{
  126 + platformId: this.platformId,
  127 + channelReduces: [row],
  128 + catalogId: this.catalogId
  129 + }
  130 + }).then((res)=>{
  131 + console.log("保存成功")
  132 + if(this.updateChoosedCallback)this.updateChoosedCallback(this.catalogId)
  133 + }).catch(function (error) {
  134 + console.log(error);
  135 + });
  136 + },
  137 + remove: function (row) {
  138 + console.log(row)
  139 +
  140 + this.$axios({
  141 + method:"delete",
  142 + url:"/api/platform/del_channel_for_gb",
  143 + data:{
  144 + platformId: this.platformId,
  145 + channelReduces: [row]
  146 + }
  147 + }).then((res)=>{
  148 + console.log("移除成功")
  149 + let nodeIds = new Array();
  150 + if(this.updateChoosedCallback)this.updateChoosedCallback(row.catalogId)
  151 + row.platformId = null;
  152 + row.catalogId = null
  153 + }).catch(function (error) {
  154 + console.log(error);
  155 + });
  156 + },
111 checkedChange: function (val) { 157 checkedChange: function (val) {
112 let that = this; 158 let that = this;
113 if (!that.eventEnanle) { 159 if (!that.eventEnanle) {
@@ -182,10 +228,9 @@ export default { @@ -182,10 +228,9 @@ export default {
182 console.log(error); 228 console.log(error);
183 }); 229 });
184 } 230 }
185 -  
186 }, 231 },
187 shareAllCheckedChange: function (val) { 232 shareAllCheckedChange: function (val) {
188 - this.chooseChanage(null, val) 233 +
189 }, 234 },
190 getChannelList: function () { 235 getChannelList: function () {
191 let that = this; 236 let that = this;
web_src/src/components/dialog/chooseChannelForStream.vue
1 <template> 1 <template>
2 <div id="chooseChannelFoStream" > 2 <div id="chooseChannelFoStream" >
3 - <el-table ref="gbStreamsTable" :data="gbStreams" border style="width: 100%" @selection-change="checkedChanage" :height="winHeight">  
4 - <el-table-column type="selection" width="55" align="center" fixed > </el-table-column> 3 + <el-table ref="gbStreamsTable" :data="gbStreams" border style="width: 100%" :height="winHeight">
5 <el-table-column prop="name" label="名称" show-overflow-tooltip> 4 <el-table-column prop="name" label="名称" show-overflow-tooltip>
6 </el-table-column> 5 </el-table-column>
7 <el-table-column prop="app" label="应用名" show-overflow-tooltip> 6 <el-table-column prop="app" label="应用名" show-overflow-tooltip>
@@ -18,6 +17,14 @@ @@ -18,6 +17,14 @@
18 </div> 17 </div>
19 </template> 18 </template>
20 </el-table-column> 19 </el-table-column>
  20 + <el-table-column label="操作" width="100" align="center" fixed="right">
  21 + <template slot-scope="scope">
  22 + <el-button-group>
  23 + <el-button size="mini" icon="el-icon-plus" v-if="!scope.row.platformId" @click="add(scope.row)">添加</el-button>
  24 + <el-button size="mini" icon="el-icon-delete" v-if="scope.row.platformId" type="danger" @click="remove(scope.row)">移除</el-button>
  25 + </el-button-group>
  26 + </template>
  27 + </el-table-column>
21 </el-table> 28 </el-table>
22 <el-pagination style="float: right;margin-top: 1rem;" @size-change="handleSizeChange" @current-change="currentChange" :current-page="currentPage" :page-size="count" :page-sizes="[10, 20, 30, 50]" layout="total, sizes, prev, pager, next" :total="total"> 29 <el-pagination style="float: right;margin-top: 1rem;" @size-change="handleSizeChange" @current-change="currentChange" :current-page="currentPage" :page-size="count" :page-sizes="[10, 20, 30, 50]" layout="total, sizes, prev, pager, next" :total="total">
23 </el-pagination> 30 </el-pagination>
@@ -82,14 +89,49 @@ export default { @@ -82,14 +89,49 @@ export default {
82 console.log(val) 89 console.log(val)
83 console.log(row) 90 console.log(row)
84 }, 91 },
  92 + add: function (row) {
  93 + console.log(row)
  94 + row.catalogId = this.catalogId
  95 + row.platformId = this.platformId
  96 + this.$axios({
  97 + method:"post",
  98 + url:"/api/gbStream/add",
  99 + data:{
  100 + platformId: this.platformId,
  101 + catalogId: this.catalogId,
  102 + gbStreams: [row],
  103 + }
  104 + }).then((res)=>{
  105 + console.log("保存成功")
  106 + if(this.updateChoosedCallback)this.updateChoosedCallback(this.catalogId)
  107 + }).catch(function (error) {
  108 + console.log(error);
  109 + });
  110 + },
  111 + remove: function (row) {
  112 + console.log(row)
  113 +
  114 + this.$axios({
  115 + method:"delete",
  116 + url:"/api/gbStream/del",
  117 + data:{
  118 + platformId: this.platformId,
  119 + gbStreams: [row],
  120 + }
  121 + }).then((res)=>{
  122 + console.log("移除成功")
  123 + if(this.updateChoosedCallback)this.updateChoosedCallback(row.catalogId)
  124 + row.platformId = null;
  125 + row.catalogId = null
  126 + }).catch(function (error) {
  127 + console.log(error);
  128 + });
  129 + },
85 checkedChanage: function (val) { 130 checkedChanage: function (val) {
86 var that = this; 131 var that = this;
87 if (!that.eventEnanle) { 132 if (!that.eventEnanle) {
88 return; 133 return;
89 } 134 }
90 - var tabelData = JSON.parse(JSON.stringify(this.$refs.gbStreamsTable.data));  
91 - console.log("checkedChanage")  
92 - console.log(val)  
93 135
94 var newData = {}; 136 var newData = {};
95 var addData = []; 137 var addData = [];