Commit 9442c37ce73497a66d540f035e58201b54656e49

Authored by 648540858
1 parent d4fe0fb3

优化级联添加通道流程

src/main/java/com/genersoft/iot/vmp/service/IGbStreamService.java
... ... @@ -17,7 +17,7 @@ public interface IGbStreamService {
17 17 * @param count
18 18 * @return
19 19 */
20   - PageInfo<GbStream> getAll(Integer page, Integer count, String platFormId);
  20 + PageInfo<GbStream> getAll(Integer page, Integer count, String platFormId, String catalogId,String query,Boolean pushing,String mediaServerId);
21 21  
22 22  
23 23 /**
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
... ... @@ -52,9 +52,9 @@ public class GbStreamServiceImpl implements IGbStreamService {
52 52 private EventPublisher eventPublisher;
53 53  
54 54 @Override
55   - public PageInfo<GbStream> getAll(Integer page, Integer count, String platFormId) {
  55 + public PageInfo<GbStream> getAll(Integer page, Integer count, String platFormId, String catalogId, String query, Boolean pushing, String mediaServerId) {
56 56 PageHelper.startPage(page, count);
57   - List<GbStream> all = gbStreamMapper.selectAll(platFormId);
  57 + List<GbStream> all = gbStreamMapper.selectAll(platFormId, catalogId, query, pushing, mediaServerId);
58 58 return new PageInfo<>(all);
59 59 }
60 60  
... ... @@ -70,6 +70,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
70 70 boolean result = false;
71 71 TransactionStatus transactionStatus = dataSourceTransactionManager.getTransaction(transactionDefinition);
72 72 ParentPlatform parentPlatform = platformMapper.getParentPlatByServerGBId(platformId);
  73 + if (catalogId == null) catalogId = parentPlatform.getCatalogId();
73 74 try {
74 75 List<DeviceChannel> deviceChannelList = new ArrayList<>();
75 76 for (GbStream gbStream : gbStreams) {
... ...
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java
... ... @@ -239,7 +239,7 @@ public interface IVideoManagerStorager {
239 239 /**
240 240 * 查询通道信息,不区分设备(已关联平台或全部)
241 241 */
242   - PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online, Boolean channelType, String platformId, Boolean inPlatform);
  242 + PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online, Boolean channelType, String platformId, String catalogId);
243 243  
244 244 /**
245 245 * 查询设备的通道信息
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
... ... @@ -93,28 +93,31 @@ public interface DeviceChannelMapper {
93 93 void startPlay(String deviceId, String channelId, String streamId);
94 94  
95 95  
  96 +
96 97 @Select(value = {" <script>" +
97   - "SELECT * FROM ( "+
98   - " SELECT dc.channelId, dc.deviceId, dc.name, de.manufacturer, de.hostAddress, " +
99   - "(SELECT count(0) FROM device_channel WHERE parentId=dc.channelId) as subCount, " +
100   - "(SELECT pc.platformId FROM platform_gb_channel pc WHERE pc.deviceId=dc.deviceId AND pc.channelId = dc.channelId AND pc.platformId = #{platformId}) as platformId, " +
101   - "(SELECT pc.catalogId FROM platform_gb_channel pc WHERE pc.deviceId=dc.deviceId AND pc.channelId = dc.channelId AND pc.platformId = #{platformId} ) as catalogId " +
102   - "FROM device_channel dc " +
103   - "LEFT JOIN device de ON dc.deviceId = de.deviceId " +
104   - " WHERE 1=1 " +
105   - " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
106   - " <if test='online == true' > AND dc.status=1</if> " +
107   - " <if test='online == false' > AND dc.status=0</if> " +
108   - ") dcr" +
  98 + "SELECT dc.channelId, "+
  99 + "dc.deviceId, " +
  100 + "dc.name, " +
  101 + "de.manufacturer, " +
  102 + "de.hostAddress, " +
  103 + "(SELECT count(0) FROM device_channel WHERE parentId = dc.channelId) as subCount, " +
  104 + "pgc.platformId as platformId, " +
  105 + "pgc.catalogId as catalogId " +
  106 + "FROM device_channel dc " +
  107 + "LEFT JOIN device de ON dc.deviceId = de.deviceId " +
  108 + "LEFT JOIN platform_gb_channel pgc on de.deviceId = pgc.deviceId and pgc.channelId = dc.channelId " +
  109 + "LEFT JOIN device_channel dc2 ON dc2.deviceId = de.deviceId AND dc2.parentId = dc.channelId " +
109 110 " WHERE 1=1 " +
110   - " <if test='hasSubChannel!= null and hasSubChannel == true' > AND subCount >0</if> " +
111   - " <if test='hasSubChannel!= null and hasSubChannel == false' > AND subCount=0</if> " +
112   - " <if test='platformId != null and inPlatform == true ' > AND platformId='${platformId}'</if> " +
113   - " <if test='platformId != null and inPlatform == false ' > AND (platformId != '${platformId}' OR platformId is NULL ) </if> " +
114   - " ORDER BY deviceId, channelId ASC" +
  111 + " <if test='query != null'> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
  112 + " <if test='online == true' > AND dc.status=1</if> " +
  113 + " <if test='online == false' > AND dc.status=0</if> " +
  114 + " <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc2.channelId is not null</if> " +
  115 + " <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc2.channelId is null</if> " +
  116 + " <if test='catalogId == null ' > AND pgc.platformId is null AND pgc.catalogId is null</if> " +
  117 + " <if test='catalogId != null ' > AND pgc.platformId =#{platformId} AND pgc.catalogId = #{catalogId}</if> " +
  118 + " ORDER BY dc.deviceId, dc.channelId ASC" +
115 119 " </script>"})
116   -
117   - List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, Boolean inPlatform);
  120 + List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String platformId, String catalogId);
118 121  
119 122 @Select("SELECT * FROM device_channel WHERE channelId=#{channelId}")
120 123 List<DeviceChannel> queryChannelByChannelId( String channelId);
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
... ... @@ -37,10 +37,20 @@ public interface GbStreamMapper {
37 37 @Delete("DELETE FROM gb_stream WHERE app=#{app} AND stream=#{stream}")
38 38 int del(String app, String stream);
39 39  
40   - @Select("SELECT gs.*, pgs.platformId AS platformId, pgs.catalogId AS catalogId FROM gb_stream gs " +
41   - "LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream AND (pgs.platformId = #{platformId} OR pgs.platformId is null)" +
42   - "order by gs.id asc ")
43   - List<GbStream> selectAll(String platformId);
  40 + @Select("<script> "+
  41 + "SELECT gs.*, pgs.platformId AS platformId, pgs.catalogId AS catalogId FROM gb_stream gs " +
  42 + "LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream " +
  43 + "WHERE " +
  44 + "1=1 " +
  45 + " <if test='catalogId != null'> AND pgs.platformId = #{platformId} AND pgs.catalogId = #{catalogId}</if> " +
  46 + " <if test='catalogId == null'> AND pgs.platformId is null AND pgs.catalogId is null</if> " +
  47 + " <if test='query != null'> AND (gs.app LIKE '%${query}%' OR gs.stream LIKE '%${query}%' OR gs.gbId LIKE '%${query}%' OR gs.name LIKE '%${query}%')</if> " +
  48 + " <if test='pushing == true' > AND gs.status=1</if>" +
  49 + " <if test='pushing == false' > AND gs.status=0</if>" +
  50 + " <if test='mediaServerId != null' > AND gs.mediaServerId=#{mediaServerId} </if>" +
  51 + " order by gs.id asc " +
  52 + "</script>")
  53 + List<GbStream> selectAll(String platformId, String catalogId, String query, Boolean pushing, String mediaServerId);
44 54  
45 55 @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}")
46 56 StreamProxyItem selectOne(String app, String stream);
... ...
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
... ... @@ -575,16 +575,16 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
575 575  
576 576 @Override
577 577 public PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online,
578   - Boolean channelType, String platformId, Boolean inPlatform) {
  578 + Boolean channelType, String platformId, String catalogId) {
579 579 PageHelper.startPage(page, count);
580   - List<ChannelReduce> all = deviceChannelMapper.queryChannelListInAll(query, online, channelType, platformId, inPlatform);
  580 + List<ChannelReduce> all = deviceChannelMapper.queryChannelListInAll(query, online, channelType, platformId, catalogId);
581 581 return new PageInfo<>(all);
582 582 }
583 583  
584 584 @Override
585 585 public List<ChannelReduce> queryChannelListInParentPlatform(String platformId) {
586 586  
587   - return deviceChannelMapper.queryChannelListInAll(null, null, null, platformId, true);
  587 + return deviceChannelMapper.queryChannelListInAll(null, null, null, platformId, null);
588 588 }
589 589  
590 590 @Override
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java
... ... @@ -12,6 +12,7 @@ import io.swagger.annotations.ApiOperation;
12 12 import org.slf4j.Logger;
13 13 import org.slf4j.LoggerFactory;
14 14 import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.util.StringUtils;
15 16 import org.springframework.web.bind.annotation.*;
16 17  
17 18 @Api(tags = "视频流关联到级联平台")
... ... @@ -40,15 +41,33 @@ public class GbStreamController {
40 41 @ApiImplicitParams({
41 42 @ApiImplicitParam(name = "page", value = "当前页", required = true , dataTypeClass = Integer.class),
42 43 @ApiImplicitParam(name = "count", value = "每页条数", required = true , dataTypeClass = Integer.class),
43   - @ApiImplicitParam(name = "platformId", value = "平台ID", required = true , dataTypeClass = Integer.class),
  44 + @ApiImplicitParam(name = "platformId", value = "平台ID", required = true , dataTypeClass = String.class),
  45 + @ApiImplicitParam(name = "catalogId", value = "目录ID", required = false , dataTypeClass = String.class),
  46 + @ApiImplicitParam(name="query", value = "查询内容", required = false , dataTypeClass = String.class),
  47 + @ApiImplicitParam(name="pushing", value = "是否正在推流", required = false , dataTypeClass = Boolean.class),
  48 + @ApiImplicitParam(name="mediaServerId", value = "流媒体ID", required = false , dataTypeClass = String.class),
  49 +
44 50 })
45 51 @GetMapping(value = "/list")
46 52 @ResponseBody
47 53 public PageInfo<GbStream> list(@RequestParam(required = true)Integer page,
48 54 @RequestParam(required = true)Integer count,
49   - @RequestParam(required = true)String platformId){
  55 + @RequestParam(required = true)String platformId,
  56 + @RequestParam(required = false)String catalogId,
  57 + @RequestParam(required = false)String query,
  58 + @RequestParam(required = false)Boolean pushing,
  59 + @RequestParam(required = false)String mediaServerId){
  60 + if (StringUtils.isEmpty(catalogId)) {
  61 + catalogId = null;
  62 + }
  63 + if (StringUtils.isEmpty(query)) {
  64 + query = null;
  65 + }
  66 + if (StringUtils.isEmpty(mediaServerId)) {
  67 + mediaServerId = null;
  68 + }
50 69  
51   - return gbStreamService.getAll(page, count, platformId);
  70 + return gbStreamService.getAll(page, count, platformId, catalogId, query, pushing, mediaServerId);
52 71 }
53 72  
54 73  
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
... ... @@ -65,6 +65,25 @@ public class PlatformController {
65 65 result.put("password", sipConfig.getPassword());
66 66 return new ResponseEntity<>(result, HttpStatus.OK);
67 67 }
  68 + /**
  69 + * 获取级联服务器信息
  70 + * @return
  71 + */
  72 + @ApiOperation("获取国标服务的配置")
  73 + @GetMapping("/info/{id}")
  74 + public ResponseEntity<WVPResult<ParentPlatform>> getPlatform(@PathVariable String id) {
  75 + ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(id);
  76 + WVPResult<ParentPlatform> wvpResult = new WVPResult<>();
  77 + if (parentPlatform != null) {
  78 + wvpResult.setCode(0);
  79 + wvpResult.setMsg("success");
  80 + wvpResult.setData(parentPlatform);
  81 + }else {
  82 + wvpResult.setCode(-1);
  83 + wvpResult.setMsg("未查询到此平台");
  84 + }
  85 + return new ResponseEntity<>(wvpResult, HttpStatus.OK);
  86 + }
68 87  
69 88 /**
70 89 * 分页查询级联平台
... ... @@ -282,29 +301,33 @@ public class PlatformController {
282 301 @ApiImplicitParam(name = "page", value = "当前页", dataTypeClass = Integer.class),
283 302 @ApiImplicitParam(name = "count", value = "每页条数", dataTypeClass = Integer.class),
284 303 @ApiImplicitParam(name = "platformId", value = "上级平台ID", dataTypeClass = String.class),
  304 + @ApiImplicitParam(name = "catalogId", value = "目录ID", dataTypeClass = String.class),
285 305 @ApiImplicitParam(name = "query", value = "查询内容", dataTypeClass = String.class),
286 306 @ApiImplicitParam(name = "online", value = "是否在线", dataTypeClass = Boolean.class),
287   - @ApiImplicitParam(name = "choosed", value = "是否已选中", dataTypeClass = Boolean.class),
288 307 @ApiImplicitParam(name = "channelType", value = "通道类型", dataTypeClass = Boolean.class),
289 308 })
290 309 @GetMapping("/channel_list")
291 310 @ResponseBody
292 311 public PageInfo<ChannelReduce> channelList(int page, int count,
293 312 @RequestParam(required = false) String platformId,
  313 + @RequestParam(required = false) String catalogId,
294 314 @RequestParam(required = false) String query,
295 315 @RequestParam(required = false) Boolean online,
296   - @RequestParam(required = false) Boolean choosed,
297 316 @RequestParam(required = false) Boolean channelType){
298 317  
299 318 // if (logger.isDebugEnabled()) {
300 319 // logger.debug("查询所有所有通道API调用");
301 320 // }
302   - PageInfo<ChannelReduce> channelReduces = null;
303   - if (platformId != null ) {
304   - channelReduces = storager.queryAllChannelList(page, count, query, online, channelType, platformId, choosed);
305   - }else {
306   - channelReduces = storager.queryAllChannelList(page, count, query, online, channelType, null, false);
  321 + if(StringUtils.isEmpty(platformId)) {
  322 + platformId = null;
  323 + }
  324 + if(StringUtils.isEmpty(query)) {
  325 + query = null;
  326 + }
  327 + if(StringUtils.isEmpty(platformId) || StringUtils.isEmpty(catalogId)) {
  328 + catalogId = null;
307 329 }
  330 + PageInfo<ChannelReduce> channelReduces = storager.queryAllChannelList(page, count, query, online, channelType, platformId, catalogId);
308 331  
309 332 return channelReduces;
310 333 }
... ... @@ -371,11 +394,11 @@ public class PlatformController {
371 394 }
372 395 List<PlatformCatalog> platformCatalogList = storager.getChildrenCatalogByPlatform(platformId, parentId);
373 396 // 查询下属的国标通道
374   - List<PlatformCatalog> catalogsForChannel = storager.queryChannelInParentPlatformAndCatalog(platformId, parentId);
  397 +// List<PlatformCatalog> catalogsForChannel = storager.queryChannelInParentPlatformAndCatalog(platformId, parentId);
375 398 // 查询下属的直播流通道
376   - List<PlatformCatalog> catalogsForStream = storager.queryStreamInParentPlatformAndCatalog(platformId, parentId);
377   - platformCatalogList.addAll(catalogsForChannel);
378   - platformCatalogList.addAll(catalogsForStream);
  399 +// List<PlatformCatalog> catalogsForStream = storager.queryStreamInParentPlatformAndCatalog(platformId, parentId);
  400 +// platformCatalogList.addAll(catalogsForChannel);
  401 +// platformCatalogList.addAll(catalogsForStream);
379 402 WVPResult<List<PlatformCatalog>> result = new WVPResult<>();
380 403 result.setCode(0);
381 404 result.setMsg("success");
... ...
web_src/index.html
... ... @@ -4,6 +4,7 @@
4 4 <meta charset="utf-8">
5 5 <meta name="viewport" content="width=device-width,initial-scale=1.0">
6 6 <title>国标28181</title>
  7 + <link rel="shortcut icon" href="static/favicon.ico" type="image/x-icon">
7 8 <link rel="stylesheet" type="text/css" href="./static/css/iconfont.css">
8 9 <link rel="stylesheet" type="text/css" href="./static/css/login.css">
9 10 </head>
... ...
web_src/src/components/PushVideoList.vue
... ... @@ -35,11 +35,7 @@
35 35 <devicePlayer ref="devicePlayer"></devicePlayer>
36 36 <addStreamTOGB ref="addStreamTOGB"></addStreamTOGB>
37 37 <el-table ref="pushListTable" :data="pushList" border style="width: 100%" :height="winHeight" @selection-change="handleSelectionChange" :row-key="(row)=> row.app + row.stream">
38   - <el-table-column
39   - align="center"
40   - type="selection"
41   - :reserve-selection="true"
42   - width="55">
  38 + <el-table-column align="center" type="selection" :reserve-selection="true" width="55">
43 39 </el-table-column>
44 40 <el-table-column prop="name" label="名称" align="center">
45 41 </el-table-column>
... ...
web_src/src/components/UiHeader.vue
... ... @@ -3,7 +3,7 @@
3 3 <el-menu router :default-active="activeIndex" menu-trigger="click" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" mode="horizontal">
4 4 <el-menu-item index="/">控制台</el-menu-item>
5 5 <el-menu-item index="/live">实时监控</el-menu-item>
6   - <el-menu-item index="/deviceList">设备列表</el-menu-item>
  6 + <el-menu-item index="/deviceList">国标设备</el-menu-item>
7 7 <el-menu-item index="/pushVideoList">推流列表</el-menu-item>
8 8 <el-menu-item index="/streamProxyList">拉流代理</el-menu-item>
9 9 <el-menu-item index="/cloudRecord">云端录像</el-menu-item>
... ...
web_src/src/components/dialog/catalogEdit.vue
... ... @@ -77,8 +77,7 @@ export default {
77 77 })
78 78 .then((res)=> {
79 79 if (res.data.code === 0) {
80   - console.log("添加/修改成功")
81   - if (this.submitCallback)this.submitCallback()
  80 + if (this.submitCallback)this.submitCallback(this.form)
82 81 }else {
83 82 this.$message({
84 83 showClose: true,
... ...
web_src/src/components/dialog/chooseChannel.vue
... ... @@ -8,7 +8,7 @@
8 8 <el-tab-pane label="目录结构" name="catalog">
9 9 <el-container>
10 10 <el-main v-bind:style="{backgroundColor: '#FFF', maxHeight: winHeight + 'px'}">
11   - <chooseChannelForCatalog ref="chooseChannelForCatalog" :platformId=platformId :platformName=platformName :defaultCatalogId=defaultCatalogId :catalogIdChange="catalogIdChange"></chooseChannelForCatalog>
  11 + <chooseChannelForCatalog ref="chooseChannelForCatalog" :platformId=platformId :platformName=platformName :defaultCatalogId=defaultCatalogId :catalogIdChange="catalogIdChange" ></chooseChannelForCatalog>
12 12 </el-main>
13 13 </el-container>
14 14 </el-tab-pane>
... ... @@ -20,14 +20,14 @@
20 20 <el-tab-pane label="国标通道" name="gbChannel">
21 21 <el-container>
22 22 <el-main style="background-color: #FFF;">
23   - <chooseChannelForGb ref="chooseChannelForGb" :catalogId="catalogId" :platformId=platformId :updateChoosedCallback="updateChooseChannelCallback"></chooseChannelForGb>
  23 + <chooseChannelForGb ref="chooseChannelForGb" :catalogId="catalogId" :catalogName="catalogName" :platformId=platformId ></chooseChannelForGb>
24 24 </el-main>
25 25 </el-container>
26 26 </el-tab-pane>
27 27 <el-tab-pane label="直播流通道" name="streamchannel">
28 28 <el-container>
29 29 <el-main style="background-color: #FFF;">
30   - <chooseChannelFoStream ref="chooseChannelFoStream" :catalogId="catalogId" :platformId=platformId :updateChoosedCallback="updateChooseChannelCallback"></chooseChannelFoStream>
  30 + <chooseChannelFoStream ref="chooseChannelFoStream" :catalogId="catalogId" :catalogName="catalogName" :currentCatalogId="currentCatalogId" :platformId=platformId ></chooseChannelFoStream>
31 31 </el-main>
32 32 </el-container>
33 33 </el-tab-pane>
... ... @@ -61,6 +61,8 @@ export default {
61 61 catalogTabActiveName: "catalog",
62 62 platformId: "",
63 63 catalogId: "",
  64 + catalogName: "",
  65 + currentCatalogId: "",
64 66 platformName: "",
65 67 defaultCatalogId: "",
66 68 showDialog: false,
... ... @@ -108,14 +110,10 @@ export default {
108 110 console.log(error);
109 111 });
110 112 },
111   - catalogIdChange: function (id) {
112   - console.log("中间模块收到: " + id)
  113 + catalogIdChange: function (id, name) {
113 114 this.catalogId = id;
  115 + this.catalogName = name;
114 116 },
115   - updateChooseChannelCallback (id){
116   - console.log("中间模块收到选择通道变化: " + id)
117   - this.$refs.chooseChannelForCatalog.refreshCatalogById(id)
118   - }
119 117 }
120 118 };
121 119 </script>
... ...
web_src/src/components/dialog/chooseChannelForCatalog.vue
... ... @@ -7,19 +7,21 @@
7 7 empty-text="未知节点"
8 8 node-key="id"
9 9 default-expand-all
10   - :highlight-current="true"
  10 + :highlight-current="false"
11 11 :expand-on-click-node="false"
12 12 :props="props"
13 13 :load="loadNode"
14 14 @node-contextmenu="contextmenuEventHandler"
  15 + @node-click="nodeClickHandler"
15 16 lazy>
16 17 <span class="custom-tree-node" slot-scope="{ node, data }" style="width: 100%">
17   - <el-radio v-if="node.data.type === 0" style="margin-right: 0" v-model="chooseId" :label="node.data.id">{{''}}</el-radio>
  18 + <el-radio v-if="node.data.type === 0 || node.data.type === -1" style="margin-right: 0" v-model="chooseId" :label="node.data.id">{{''}}</el-radio>
  19 + <span v-if="node.data.type === -1 && node.level === 1" style="font-size: 12px" class="iconfont icon-ziyuan"></span>
18 20 <span v-if="node.data.type === 0 && node.level === 1" class="el-icon-s-home"></span>
19 21 <span v-if="node.data.type === 0 && node.level > 1" class="el-icon-folder-opened"></span>
20 22 <span v-if="node.data.type === 1" class="iconfont icon-shexiangtou"></span>
21 23 <span v-if="node.data.type === 2" class="iconfont icon-zhibo"></span>
22   - <span style="padding-left: 1px">{{ node.label }}</span>
  24 + <span style=" padding-left: 1px">{{ node.label }}</span>
23 25 <span>
24 26 <i style="margin-left: 5rem; color: #9d9d9d; padding-right: 20px" v-if="node.data.id === defaultCatalogIdSign">默认</i>
25 27 </span>
... ... @@ -42,7 +44,7 @@ export default {
42 44 this.defaultCatalogIdSign = this.defaultCatalogId;
43 45 this.initData();
44 46 setTimeout(()=>{
45   - if (this.catalogIdChange)this.catalogIdChange(this.defaultCatalogId);
  47 + if (this.catalogIdChange)this.catalogIdChange(this.defaultCatalogId, this.platformName);
46 48 }, 100)
47 49  
48 50 },
... ... @@ -59,6 +61,7 @@ export default {
59 61 defaultCatalogIdSign: null,
60 62 chooseNode: null,
61 63 chooseId: "",
  64 + chooseName: "",
62 65 catalogTree: null,
63 66 contextmenuShow: false
64 67  
... ... @@ -69,10 +72,6 @@ export default {
69 72 console.log(newData)
70 73 this.initData()
71 74 },
72   - chooseId(newData, oldData){
73   - console.log("发送: " + newData)
74   - if (this.catalogIdChange)this.catalogIdChange(newData);
75   - },
76 75 },
77 76 methods: {
78 77 initData: function () {
... ... @@ -123,9 +122,12 @@ export default {
123 122 editCatalog: function (data, node){
124 123 let that = this;
125 124 // 打开添加弹窗
126   - that.$refs.catalogEdit.openDialog(true, data.id, data.name, data.parentId, (data)=>{
  125 + that.$refs.catalogEdit.openDialog(true, data.id, data.name, data.parentId, (newData)=>{
127 126 node.parent.loaded = false
128 127 node.parent.expand();
  128 + if (data.id === this.chooseId && newData.name !== data.name) {
  129 + if (this.catalogIdChange)this.catalogIdChange(this.chooseId, newData.name);
  130 + }
129 131 });
130 132  
131 133 },
... ... @@ -172,11 +174,17 @@ export default {
172 174 },
173 175 loadNode: function(node, resolve){
174 176 if (node.level === 0) {
175   - resolve([{
176   - name: this.platformName,
177   - id: this.platformId,
178   - type: 0
179   - }]);
  177 + resolve([
  178 + {
  179 + name: "未分配",
  180 + id: null,
  181 + type: -1
  182 + },{
  183 + name: this.platformName,
  184 + id: this.platformId,
  185 + type: 0
  186 + }
  187 + ]);
180 188 }
181 189 if (node.level >= 1){
182 190 this.getCatalog(node.data.id, resolve)
... ... @@ -291,6 +299,11 @@ export default {
291 299  
292 300 return false;
293 301 },
  302 + nodeClickHandler: function (data, node, tree){
  303 + this.chooseId = data.id;
  304 + this.chooseName = data.name;
  305 + if (this.catalogIdChange)this.catalogIdChange(this.chooseId, this.chooseName);
  306 + }
294 307 }
295 308 };
296 309 </script>
... ...
web_src/src/components/dialog/chooseChannelForGb.vue
1 1 <template>
2 2 <div id="chooseChannelForGb" >
3   - <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
  3 + <div style="font-size: 17px; color: #606060; white-space: nowrap; line-height: 30px; font-family: monospace;">
  4 + <span v-if="catalogId == null">{{catalogName}}的直播流</span>
  5 + <span v-if="catalogId != null">{{catalogName}}({{catalogId}})的直播流</span>
  6 + </div>
  7 + <div style="background-color: #FFFFFF; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
4 8 搜索: <el-input @input="search" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字" prefix-icon="el-icon-search" v-model="searchSrt" clearable> </el-input>
5 9  
6 10 通道类型: <el-select size="mini" @change="search" style="margin-right: 1rem; width:6rem" v-model="channelType" placeholder="请选择" default-first-option>
... ... @@ -9,21 +13,18 @@
9 13 <el-option label="子目录" value="true"></el-option>
10 14 </el-select>
11 15  
12   - 选择状态: <el-select size="mini" style="margin-right: 1rem; width:6rem" v-model="choosed" @change="search" placeholder="请选择" default-first-option>
13   - <el-option label="全部" value=""></el-option>
14   - <el-option label="已选择" value="true"></el-option>
15   - <el-option label="未选择" value="false"></el-option>
16   - </el-select>
17   -
18 16 在线状态: <el-select size="mini" style="margin-right: 1rem; width:6rem" @change="search" v-model="online" placeholder="请选择" default-first-option>
19 17 <el-option label="全部" value=""></el-option>
20 18 <el-option label="在线" value="true"></el-option>
21 19 <el-option label="离线" value="false"></el-option>
22 20 </el-select>
23   -
24   -<!-- <el-checkbox @change="shareAllCheckedChange">全部共享</el-checkbox>-->
  21 + <el-button v-if="catalogId !== null" icon="el-icon-delete" size="mini" style="margin-right: 1rem;" :disabled="gbChannels.length === 0 || multipleSelection.length === 0" type="danger" @click="batchDel">批量移除</el-button>
  22 + <el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" style="margin-right: 1rem;" :disabled="gbChannels.length === 0 || multipleSelection.length === 0" @click="batchAdd">批量添加</el-button>
25 23 </div>
26   - <el-table ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" :height="winHeight">
  24 +
  25 + <el-table ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" :height="winHeight" :row-key="(row)=> row.deviceId + row.channelId" @selection-change="handleSelectionChange">
  26 + <el-table-column align="center" type="selection" :reserve-selection="true" width="55">
  27 + </el-table-column>
27 28 <el-table-column prop="channelId" label="通道编号" width="180" align="center">
28 29 </el-table-column>
29 30 <el-table-column prop="name" label="通道名称" show-overflow-tooltip align="center">
... ... @@ -50,10 +51,12 @@
50 51 </el-table>
51 52 <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">
52 53 </el-pagination>
  54 + <getCatalog ref="getCatalog" :platformId="platformId" ></getCatalog>
53 55 </div>
54 56 </template>
55 57  
56 58 <script>
  59 +import getCatalog from './getCatalog'
57 60 export default {
58 61 name: 'chooseChannelForGb',
59 62 computed: {
... ... @@ -65,10 +68,13 @@ export default {
65 68 // };
66 69 // }
67 70 },
68   - props: ['platformId','catalogId', 'updateChoosedCallback'],
  71 + props: ['platformId','catalogId', 'catalogName'],
69 72 created() {
70 73 this.initData();
71 74 },
  75 + components: {
  76 + getCatalog,
  77 + },
72 78 data() {
73 79 return {
74 80 gbChannels: [],
... ... @@ -80,7 +86,8 @@ export default {
80 86 currentPage: 1,
81 87 count: 10,
82 88 total: 0,
83   - eventEnanle: false,
  89 + eventEnable: false,
  90 + multipleSelection: [],
84 91 winHeight: window.innerHeight - 400,
85 92  
86 93 };
... ... @@ -88,8 +95,10 @@ export default {
88 95 watch:{
89 96 platformId(newData, oldData){
90 97 console.log(newData)
91   - this.initData()
92   -
  98 + this.getChannelList()
  99 + },
  100 + catalogId(newData, oldData){
  101 + this.getChannelList()
93 102 },
94 103 },
95 104 methods: {
... ... @@ -105,28 +114,24 @@ export default {
105 114 console.log(val)
106 115 this.initData();
107 116 },
108   - rowcheckedChange: function (val, row) {
109   - console.log(val)
110   - console.log(row)
111   - },
112 117 add: function (row) {
113   - console.log(row)
114   - row.catalogId = this.catalogId
115   - row.platformId = this.platformId
116   - this.$axios({
117   - method:"post",
118   - url:"/api/platform/update_channel_for_gb",
119   - data:{
120   - platformId: this.platformId,
121   - channelReduces: [row],
122   - catalogId: this.catalogId
123   - }
124   - }).then((res)=>{
125   - console.log("保存成功")
126   - if(this.updateChoosedCallback)this.updateChoosedCallback(this.catalogId)
127   - }).catch(function (error) {
128   - console.log(error);
129   - });
  118 + this.getCatalogFromUser((catalogId)=> {
  119 + this.$axios({
  120 + method:"post",
  121 + url:"/api/platform/update_channel_for_gb",
  122 + data:{
  123 + platformId: this.platformId,
  124 + channelReduces: [row],
  125 + catalogId: catalogId
  126 + }
  127 + }).then((res)=>{
  128 + console.log("保存成功")
  129 + this.getChannelList();
  130 + }).catch(function (error) {
  131 + console.log(error);
  132 + });
  133 + })
  134 +
130 135 },
131 136 remove: function (row) {
132 137 console.log(row)
... ... @@ -140,91 +145,87 @@ export default {
140 145 }
141 146 }).then((res)=>{
142 147 console.log("移除成功")
143   - if(this.updateChoosedCallback)this.updateChoosedCallback(row.catalogId)
144   - row.platformId = null;
145   - row.catalogId = null
  148 + this.getChannelList();
146 149 }).catch(function (error) {
147 150 console.log(error);
148 151 });
149 152 },
150   - checkedChange: function (val) {
151   - let that = this;
152   - if (!that.eventEnanle) {
153   - return;
154   - }
155   - let newData = {};
156   - let addData = [];
157   - let delData = [];
158   - if (val.length > 0) {
159   - for (let i = 0; i < val.length; i++) {
160   - const element = val[i];
161   - let key = element.deviceId + "_" + element.channelId;
162   - newData[key] = element;
163   - if (!!!that.gbChoosechannel[key]){
164   - addData.push(element)
165   - }else{
166   - delete that.gbChoosechannel[key]
167   - }
168   - }
169   -
170   - let oldKeys = Object.keys(that.gbChoosechannel);
171   - if (oldKeys.length > 0) {
172   - for (let i = 0; i < oldKeys.length; i++) {
173   - const key = oldKeys[i];
174   - delData.push(that.gbChoosechannel[key])
175   - }
176   - }
177   -
178   - }else{
179   - let oldKeys = Object.keys(that.gbChoosechannel);
180   - if (oldKeys.length > 0) {
181   - for (let i = 0; i < oldKeys.length; i++) {
182   - const key = oldKeys[i];
183   - delData.push(that.gbChoosechannel[key])
184   - }
185   - }
186   - }
187   -
188   - that.gbChoosechannel = newData;
189   - if (Object.keys(addData).length >0) {
190   - that.$axios({
191   - method:"post",
192   - url:"/api/platform/update_channel_for_gb",
193   - data:{
194   - platformId: that.platformId,
195   - channelReduces: addData,
196   - catalogId: that.catalogId
197   - }
198   - }).then((res)=>{
199   - console.log("保存成功")
200   - if(that.updateChoosedCallback)that.updateChoosedCallback(that.catalogId)
201   - }).catch(function (error) {
202   - console.log(error);
203   - });
204   - }
205   - if (delData.length >0) {
206   - that.$axios({
207   - method:"delete",
208   - url:"/api/platform/del_channel_for_gb",
209   - data:{
210   - platformId: that.platformId,
211   - channelReduces: delData
212   - }
213   - }).then((res)=>{
214   - console.log("移除成功")
215   - let nodeIds = new Array();
216   - for (let i = 0; i < delData.length; i++) {
217   - nodeIds.push(delData[i].channelId)
218   - }
219   - if(that.updateChoosedCallback)that.updateChoosedCallback(null, nodeIds)
220   - }).catch(function (error) {
221   - console.log(error);
222   - });
223   - }
224   - },
225   - shareAllCheckedChange: function (val) {
226   -
227   - },
  153 + // checkedChange: function (val) {
  154 + // let that = this;
  155 + // if (!that.eventEnable) {
  156 + // return;
  157 + // }
  158 + // let newData = {};
  159 + // let addData = [];
  160 + // let delData = [];
  161 + // if (val.length > 0) {
  162 + // for (let i = 0; i < val.length; i++) {
  163 + // const element = val[i];
  164 + // let key = element.deviceId + "_" + element.channelId;
  165 + // newData[key] = element;
  166 + // if (!!!that.gbChoosechannel[key]){
  167 + // addData.push(element)
  168 + // }else{
  169 + // delete that.gbChoosechannel[key]
  170 + // }
  171 + // }
  172 + //
  173 + // let oldKeys = Object.keys(that.gbChoosechannel);
  174 + // if (oldKeys.length > 0) {
  175 + // for (let i = 0; i < oldKeys.length; i++) {
  176 + // const key = oldKeys[i];
  177 + // delData.push(that.gbChoosechannel[key])
  178 + // }
  179 + // }
  180 + //
  181 + // }else{
  182 + // let oldKeys = Object.keys(that.gbChoosechannel);
  183 + // if (oldKeys.length > 0) {
  184 + // for (let i = 0; i < oldKeys.length; i++) {
  185 + // const key = oldKeys[i];
  186 + // delData.push(that.gbChoosechannel[key])
  187 + // }
  188 + // }
  189 + // }
  190 + //
  191 + // that.gbChoosechannel = newData;
  192 + // if (Object.keys(addData).length >0) {
  193 + // that.$axios({
  194 + // method:"post",
  195 + // url:"/api/platform/update_channel_for_gb",
  196 + // data:{
  197 + // platformId: that.platformId,
  198 + // channelReduces: addData,
  199 + // catalogId: that.catalogId
  200 + // }
  201 + // }).then((res)=>{
  202 + // console.log("保存成功")
  203 + // }).catch(function (error) {
  204 + // console.log(error);
  205 + // });
  206 + // }
  207 + // if (delData.length >0) {
  208 + // that.$axios({
  209 + // method:"delete",
  210 + // url:"/api/platform/del_channel_for_gb",
  211 + // data:{
  212 + // platformId: that.platformId,
  213 + // channelReduces: delData
  214 + // }
  215 + // }).then((res)=>{
  216 + // console.log("移除成功")
  217 + // let nodeIds = new Array();
  218 + // for (let i = 0; i < delData.length; i++) {
  219 + // nodeIds.push(delData[i].channelId)
  220 + // }
  221 + // }).catch(function (error) {
  222 + // console.log(error);
  223 + // });
  224 + // }
  225 + // },
  226 + // shareAllCheckedChange: function (val) {
  227 + //
  228 + // },
228 229 getChannelList: function () {
229 230 let that = this;
230 231  
... ... @@ -236,7 +237,7 @@ export default {
236 237 count: that.count,
237 238 query: that.searchSrt,
238 239 online: that.online,
239   - choosed: that.choosed,
  240 + catalogId: that.catalogId,
240 241 platformId: that.platformId,
241 242 channelType: that.channelType
242 243 }
... ... @@ -248,20 +249,7 @@ export default {
248 249 // 防止出现表格错位
249 250 that.$nextTick(() => {
250 251 that.$refs.gbChannelsTable.doLayout();
251   - // 默认选中
252   - var chooseGBS = [];
253   - for (let i = 0; i < res.data.list.length; i++) {
254   - const row = res.data.list[i];
255   - console.log(row.platformId)
256   - if (row.platformId == that.platformId) {
257   - that.$refs.gbChannelsTable.toggleRowSelection(row, true);
258   - chooseGBS.push(row)
259   - that.gbChoosechannel[row.deviceId+ "_" + row.channelId] = row;
260   -
261   - }
262   - }
263   - that.eventEnanle = true;
264   - // that.checkedChange(chooseGBS)
  252 + that.eventEnable = true;
265 253 })
266 254 console.log(that.gbChoosechannel)
267 255 })
... ... @@ -276,10 +264,55 @@ export default {
276 264 handleGBSelectionChange: function() {
277 265 this.initData();
278 266 },
279   - // catalogIdChange: function(id) {
280   - // this.catalogId = id;
281   - // console.log("通道选择模块收到: " + id)
282   - // },
  267 + batchDel: function() {
  268 + this.$confirm(`确认这${this.multipleSelection.length}个通道吗?`, '提示', {
  269 + confirmButtonText: '确定',
  270 + cancelButtonText: '取消',
  271 + type: 'warning'
  272 + }).then(() => {
  273 + this.$axios({
  274 + method:"delete",
  275 + url:"/api/platform/del_channel_for_gb",
  276 + data:{
  277 + platformId: this.platformId,
  278 + channelReduces: this.multipleSelection
  279 + }
  280 + }).then((res)=>{
  281 + console.log("移除成功")
  282 + this.$refs.gbChannelsTable.clearSelection()
  283 + this.getChannelList();
  284 + }).catch(function (error) {
  285 + console.log(error);
  286 + });
  287 + }).catch(() => {
  288 + });
  289 + },
  290 + batchAdd: function() {
  291 + this.getCatalogFromUser((catalogId)=> {
  292 +
  293 + this.$axios({
  294 + method: "post",
  295 + url: "/api/platform/update_channel_for_gb",
  296 + data: {
  297 + platformId: this.platformId,
  298 + channelReduces: this.multipleSelection,
  299 + catalogId: catalogId,
  300 + }
  301 + }).then((res) => {
  302 + console.log("保存成功")
  303 + this.$refs.gbChannelsTable.clearSelection()
  304 + this.getChannelList();
  305 + }).catch(function (error) {
  306 + console.log(error);
  307 + });
  308 + });
  309 + },
  310 + handleSelectionChange: function (val) {
  311 + this.multipleSelection = val;
  312 + },
  313 + getCatalogFromUser(callback){
  314 + this.$refs.getCatalog.openDialog(callback)
  315 + },
283 316 }
284 317 };
285 318 </script>
... ...
web_src/src/components/dialog/chooseChannelForStream.vue
1 1 <template>
2 2 <div id="chooseChannelFoStream" >
3   - <el-table ref="gbStreamsTable" :data="gbStreams" border style="width: 100%" :height="winHeight">
  3 + <div style="font-size: 17px; color: #606060; white-space: nowrap; line-height: 30px; font-family: monospace;">
  4 + <span v-if="catalogId == null">{{catalogName}}的直播流</span>
  5 + <span v-if="catalogId != null">{{catalogName}}({{catalogId}})的直播流</span>
  6 + </div>
  7 + <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
  8 +
  9 + 搜索: <el-input @input="getChannelList" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字" prefix-icon="el-icon-search" v-model="searchSrt" clearable> </el-input>
  10 +
  11 +<!-- 流媒体: <el-select size="mini" @change="getChannelList" style="margin-right: 1rem;" v-model="mediaServerId" placeholder="请选择" default-first-option>-->
  12 +<!-- <el-option label="全部" value=""></el-option>-->
  13 +<!-- <el-option-->
  14 +<!-- v-for="item in mediaServerList"-->
  15 +<!-- :key="item.id"-->
  16 +<!-- :label="item.id"-->
  17 +<!-- :value="item.id">-->
  18 +<!-- </el-option>-->
  19 +<!-- </el-select>-->
  20 + 推流状态: <el-select size="mini" style="margin-right: 1rem;" @change="getChannelList" v-model="pushing" placeholder="请选择" default-first-option>
  21 + <el-option label="全部" value=""></el-option>
  22 + <el-option label="推流进行中" value="true"></el-option>
  23 + <el-option label="推流未进行" value="false"></el-option>
  24 + </el-select>
  25 + <el-button v-if="catalogId !== null" icon="el-icon-delete" size="mini" style="margin-right: 1rem;" :disabled="gbStreams.length === 0 || multipleSelection.length === 0" type="danger" @click="batchDel">批量移除</el-button>
  26 + <el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" style="margin-right: 1rem;" :disabled="gbStreams.length === 0 || multipleSelection.length === 0" @click="batchAdd">批量添加</el-button>
  27 + </div>
  28 + <el-table ref="gbStreamsTable" :data="gbStreams" border style="width: 100%" :height="winHeight" :row-key="(row)=> row.app + row.stream" @selection-change="handleSelectionChange">
  29 + <el-table-column align="center" type="selection" :reserve-selection="true" width="55">
  30 + </el-table-column>
4 31 <el-table-column prop="name" label="名称" show-overflow-tooltip align="center">
5 32 </el-table-column>
6 33 <el-table-column prop="app" label="应用名" show-overflow-tooltip align="center">
... ... @@ -20,18 +47,21 @@
20 47 <el-table-column label="操作" width="100" align="center" fixed="right" >
21 48 <template slot-scope="scope">
22 49 <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>
  50 + <el-button size="mini" icon="el-icon-plus" v-if="!scope.row.platformId" @click="add(scope.row, scope)">添加</el-button>
  51 + <el-button size="mini" icon="el-icon-delete" v-if="scope.row.platformId" type="danger" @click="remove(scope.row, scope)">移除</el-button>
25 52 </el-button-group>
26 53 </template>
27 54 </el-table-column>
28 55 </el-table>
29 56 <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">
30 57 </el-pagination>
  58 + <getCatalog ref="getCatalog" :platformId="platformId" ></getCatalog>
31 59 </div>
32 60 </template>
33 61  
34 62 <script>
  63 +import MediaServer from './../service/MediaServer'
  64 +import getCatalog from './getCatalog'
35 65 export default {
36 66 name: 'chooseChannelFoStream',
37 67 computed: {
... ... @@ -43,73 +73,81 @@ export default {
43 73 // };
44 74 // }
45 75 },
46   - props: ['platformId', 'catalogId', 'updateChoosedCallback'],
  76 + props: ['platformId', 'catalogId', 'catalogName'],
47 77 created() {
48 78 this.initData();
49 79 },
  80 + components: {
  81 + getCatalog,
  82 + },
50 83 data() {
51 84 return {
52 85 gbStreams: [],
53 86 gbChoosechannel:{},
54   - searchSrt: "",
55 87 channelType: "",
56 88 online: "",
57 89 choosed: "",
58 90 currentPage: 1,
59 91 count: 10,
60 92 total: 0,
61   - eventEnanle: false,
  93 + searchSrt: "",
  94 + pushing: "",
  95 + mediaServerId: "",
  96 + mediaServerList: [],
  97 + mediaServerObj : new MediaServer(),
  98 + eventEnable: false,
  99 + multipleSelection: [],
62 100 winHeight: window.innerHeight - 350,
63 101  
64 102 };
65 103 },
66 104 watch:{
67 105 platformId(newData, oldData){
68   - console.log(newData)
69   - this.initData()
70   -
  106 + this.getChannelList()
  107 + },
  108 + catalogId(newData, oldData){
  109 + this.getChannelList()
71 110 },
72 111 },
73 112 methods: {
74 113 initData: function() {
  114 + this.mediaServerObj.getOnlineMediaServerList((data)=>{
  115 + this.mediaServerList = data.data;
  116 + })
75 117 this.getChannelList();
76 118 },
77 119 currentChange: function (val) {
78 120 this.currentPage = val;
79   - this.initData();
  121 + this.getChannelList();
80 122 },
81 123 handleSizeChange: function (val) {
82 124 this.count = val;
83 125 console.log(val)
84   - this.initData();
  126 + this.getChannelList();
85 127  
86 128 },
87   - rowcheckedChanage: function (val, row) {
88   - console.log(val)
89   - console.log(row)
90   - },
91   - add: function (row) {
92   - console.log(row)
93   - row.catalogId = this.catalogId
94   - row.platformId = this.platformId
95   - this.$axios({
96   - method:"post",
97   - url:"/api/gbStream/add",
98   - data:{
99   - platformId: this.platformId,
100   - catalogId: this.catalogId,
101   - gbStreams: [row],
102   - }
103   - }).then((res)=>{
104   - console.log("保存成功")
105   - if(this.updateChoosedCallback)this.updateChoosedCallback(this.catalogId)
106   - }).catch(function (error) {
107   - console.log(error);
108   - });
109   - },
110   - remove: function (row) {
111   - console.log(row)
  129 + add: function (row, scope) {
  130 + this.getCatalogFromUser((catalogId)=>{
  131 + this.$axios({
  132 + method:"post",
  133 + url:"/api/gbStream/add",
  134 + data:{
  135 + platformId: this.platformId,
  136 + catalogId: catalogId,
  137 + gbStreams: [row],
  138 + }
  139 + }).then((res)=>{
  140 + console.log("保存成功")
  141 + // this.gbStreams.splice(scope.$index,1)
  142 + this.getChannelList();
  143 + }).catch(function (error) {
  144 + console.log(error);
  145 + });
  146 + })
  147 +
112 148  
  149 + },
  150 + remove: function (row, scope) {
113 151 this.$axios({
114 152 method:"delete",
115 153 url:"/api/gbStream/del",
... ... @@ -119,92 +157,12 @@ export default {
119 157 }
120 158 }).then((res)=>{
121 159 console.log("移除成功")
122   - if(this.updateChoosedCallback)this.updateChoosedCallback(row.catalogId)
123   - row.platformId = null;
124   - row.catalogId = null
  160 + // this.gbStreams.splice(scope.$index,1)
  161 + this.getChannelList();
125 162 }).catch(function (error) {
126 163 console.log(error);
127 164 });
128 165 },
129   - checkedChanage: function (val) {
130   - var that = this;
131   - if (!that.eventEnanle) {
132   - return;
133   - }
134   -
135   - var newData = {};
136   - var addData = [];
137   - var delData = [];
138   - if (val.length > 0) {
139   - for (let i = 0; i < val.length; i++) {
140   - const element = val[i];
141   - var key = element.app + "_" + element.stream;
142   - newData[key] = element;
143   - if (!!!that.gbChoosechannel[key]){
144   - addData.push(element)
145   - }else{
146   - delete that.gbChoosechannel[key]
147   - }
148   - }
149   -
150   - var oldKeys = Object.keys(that.gbChoosechannel);
151   - if (oldKeys.length > 0) {
152   - for (let i = 0; i < oldKeys.length; i++) {
153   - const key = oldKeys[i];
154   - delData.push(that.gbChoosechannel[key])
155   - }
156   - }
157   -
158   - }else{
159   - var oldKeys = Object.keys(that.gbChoosechannel);
160   - if (oldKeys.length > 0) {
161   - for (let i = 0; i < oldKeys.length; i++) {
162   - const key = oldKeys[i];
163   - delData.push(that.gbChoosechannel[key])
164   - }
165   - }
166   - }
167   -
168   - that.gbChoosechannel = newData;
169   - if (Object.keys(addData).length >0) {
170   - console.log(addData)
171   - that.$axios({
172   - method:"post",
173   - url:"/api/gbStream/add",
174   - data:{
175   - platformId: that.platformId,
176   - catalogId: that.catalogId,
177   - gbStreams: addData,
178   - }
179   - }).then((res)=>{
180   - console.log("保存成功")
181   - if(this.updateChoosedCallback)this.updateChoosedCallback(this.catalogId)
182   - }).catch(function (error) {
183   - console.log(error);
184   - });
185   - }
186   - if (Object.keys(delData).length >0) {
187   - console.log(delData)
188   - that.$axios({
189   - method:"delete",
190   - url:"/api/gbStream/del",
191   - data:{
192   - platformId: that.platformId,
193   - gbStreams: delData,
194   - }
195   - }).then((res)=>{
196   - console.log("移除成功")
197   - if(this.updateChoosedCallback)this.updateChoosedCallback(this.catalogId)
198   - }).catch(function (error) {
199   - console.log(error);
200   - });
201   -
202   - }
203   -
204   - },
205   - shareAllCheckedChanage: function (val) {
206   - this.chooseChanage(null, val)
207   - },
208 166 getChannelList: function () {
209 167 let that = this;
210 168  
... ... @@ -215,10 +173,10 @@ export default {
215 173 page: that.currentPage,
216 174 count: that.count,
217 175 query: that.searchSrt,
218   - online: that.online,
219   - choosed: that.choosed,
  176 + pushing: that.online,
220 177 platformId: that.platformId,
221   - channelType: that.channelType
  178 + catalogId: that.catalogId,
  179 + mediaServerId: that.mediaServerId
222 180 }
223 181 })
224 182 .then(function (res) {
... ... @@ -229,29 +187,62 @@ export default {
229 187 that.$nextTick(() => {
230 188 that.$refs.gbStreamsTable.doLayout();
231 189 // 默认选中
232   - var chooseGBS = [];
233   - for (let i = 0; i < res.data.list.length; i++) {
234   - const row = res.data.list[i];
235   - console.log(row.platformId)
236   - if (row.platformId == that.platformId) {
237   - that.$refs.gbStreamsTable.toggleRowSelection(row, true);
238   - chooseGBS.push(row)
239   - that.gbChoosechannel[row.app+ "_" + row.stream] = row;
240   -
241   - }
242   - }
243   - that.eventEnanle = true;
244   - // that.checkedChanage(chooseGBS)
  190 + that.eventEnable = true;
245 191 })
246   - console.log(that.gbChoosechannel)
247 192 })
248 193 .catch(function (error) {
249 194 console.log(error);
250 195 });
251 196  
252 197 },
253   - handleGBSelectionChange: function() {
254   - this.initData();
  198 + batchDel: function() {
  199 + this.$confirm(`确认这${this.multipleSelection.length}个通道吗?`, '提示', {
  200 + confirmButtonText: '确定',
  201 + cancelButtonText: '取消',
  202 + type: 'warning'
  203 + }).then(() => {
  204 + this.$axios({
  205 + method:"delete",
  206 + url:"/api/gbStream/del",
  207 + data:{
  208 + platformId: this.platformId,
  209 + gbStreams: this.multipleSelection,
  210 + }
  211 + }).then((res)=>{
  212 + console.log("移除成功")
  213 + this.$refs.gbStreamsTable.clearSelection()
  214 + this.getChannelList();
  215 + }).catch(function (error) {
  216 + console.log(error);
  217 + });
  218 + }).catch(() => {
  219 + });
  220 +
  221 + },
  222 + batchAdd: function() {
  223 + this.getCatalogFromUser((catalogId)=>{
  224 + this.$axios({
  225 + method:"post",
  226 + url:"/api/gbStream/add",
  227 + data:{
  228 + platformId: this.platformId,
  229 + catalogId: catalogId,
  230 + gbStreams: this.multipleSelection,
  231 + }
  232 + }).then((res)=>{
  233 + console.log("保存成功")
  234 + this.$refs.gbStreamsTable.clearSelection()
  235 + this.getChannelList();
  236 + }).catch(function (error) {
  237 + console.log(error);
  238 + });
  239 + })
  240 + },
  241 + getCatalogFromUser(callback){
  242 + this.$refs.getCatalog.openDialog(callback)
  243 + },
  244 + handleSelectionChange: function (val) {
  245 + this.multipleSelection = val;
255 246 },
256 247 }
257 248 };
... ...
web_src/src/components/dialog/getCatalog.vue 0 → 100644
  1 +<template>
  2 +<div id="getCatalog" >
  3 +
  4 + <el-dialog title="选择要添加到的节点" v-if="showDialog" width="50%" :append-to-body="true" :close-on-click-modal="false" :visible.sync="showDialog" :destroy-on-close="true" @close="close()" center>
  5 + <div>
  6 + <el-tree class="el-scrollbar"
  7 + ref="tree"
  8 + id="catalogTree"
  9 + empty-text="未知节点"
  10 + node-key="id"
  11 + default-expand-all
  12 + :highlight-current="false"
  13 + :expand-on-click-node="false"
  14 + :props="props"
  15 + :load="loadNode"
  16 + @node-click="nodeClickHandler"
  17 + lazy>
  18 + <span class="custom-tree-node" slot-scope="{ node, data }" style="width: 100%">
  19 + <el-radio v-if="node.data.type === 0 || node.data.type === -1" style="margin-right: 0" v-model="chooseId" :label="node.data.id">{{''}}</el-radio>
  20 + <span v-if="node.data.type === -1 && node.level === 1" style="font-size: 12px" class="iconfont icon-ziyuan"></span>
  21 + <span v-if="node.data.type === 0 && node.level === 1" class="el-icon-s-home"></span>
  22 + <span v-if="node.data.type === 0 && node.level > 1" class="el-icon-folder-opened"></span>
  23 + <span v-if="node.data.type === 1" class="iconfont icon-shexiangtou"></span>
  24 + <span v-if="node.data.type === 2" class="iconfont icon-zhibo"></span>
  25 + <span style=" padding-left: 1px">{{ node.label }}</span>
  26 + <span>
  27 + <i style="margin-left: 5rem; color: #9d9d9d; padding-right: 20px" v-if="node.data.id === defaultCatalogIdSign">默认</i>
  28 + </span>
  29 + </span>
  30 + </el-tree>
  31 + </div>
  32 + <div style="float: right; height: 13rem">
  33 + <el-button type="primary" size="mini" @click="submit()" >确认</el-button>
  34 + <el-button @click="close()" size="mini">取消</el-button>
  35 + </div>
  36 + </el-dialog>
  37 +
  38 +</div>
  39 +</template>
  40 +
  41 +
  42 +<script>
  43 +
  44 +export default {
  45 + name: 'getCatalog',
  46 + beforeCreate(){
  47 +
  48 + },
  49 + created() {
  50 + this.chooseId = this.defaultCatalogId;
  51 + this.defaultCatalogIdSign = this.defaultCatalogId;
  52 + this.initData();
  53 + setTimeout(()=>{
  54 + if (this.catalogIdChange)this.catalogIdChange(this.defaultCatalogId);
  55 + }, 100)
  56 +
  57 + },
  58 + props: ['platformId'],
  59 + data() {
  60 + return {
  61 + props: {
  62 + label: 'name',
  63 + children: 'children',
  64 + isLeaf: 'leaf'
  65 + },
  66 + platformName: null,
  67 + defaultCatalogId: null,
  68 + catalogIdResult: null,
  69 + showDialog: false,
  70 + defaultCatalogIdSign: null,
  71 + chooseNode: null,
  72 + chooseId: "",
  73 + catalogTree: null,
  74 + contextmenuShow: false,
  75 +
  76 + };
  77 + },
  78 + methods: {
  79 + openDialog(catalogIdResult) {
  80 + this.showDialog = true
  81 + this.catalogIdResult = catalogIdResult
  82 + },
  83 + initData: function () {
  84 + this.getCatalog();
  85 + },
  86 +
  87 + getCatalog: function(parentId, callback) {
  88 + let that = this;
  89 + this.$axios({
  90 + method:"get",
  91 + url:`/api/platform/catalog`,
  92 + params: {
  93 + platformId: that.platformId,
  94 + parentId: parentId
  95 + }
  96 + })
  97 + .then((res)=> {
  98 + if (res.data.code === 0) {
  99 + if (typeof(callback) === 'function') {
  100 + callback(res.data.data)
  101 + }
  102 + }
  103 + })
  104 + .catch(function (error) {
  105 + console.log(error);
  106 + });
  107 +
  108 + },
  109 + loadNode: function(node, resolve){
  110 +
  111 +
  112 +
  113 + if (node.level === 0) {
  114 + this.$axios({
  115 + method:"get",
  116 + url:`/api/platform/info/` + this.platformId,
  117 + })
  118 + .then((res)=> {
  119 + if (res.data.code === 0) {
  120 + this.platformName = res.data.data.name;
  121 + this.defaultCatalogId = res.data.data.catalogId;
  122 + resolve([
  123 + {
  124 + name: "未分配",
  125 + id: null,
  126 + type: -1
  127 + },{
  128 + name: this.platformName,
  129 + id: this.platformId,
  130 + type: 0
  131 + }
  132 + ]);
  133 + }
  134 + })
  135 + .catch(function (error) {
  136 + console.log(error);
  137 + });
  138 + }
  139 + if (node.level >= 1){
  140 + this.getCatalog(node.data.id, resolve)
  141 + }
  142 + },
  143 + nodeClickHandler: function (data, node, tree){
  144 + this.chooseId = data.id;
  145 + },
  146 + close: function() {
  147 + this.showDialog = false;
  148 + },
  149 + submit: function() {
  150 + if (this.catalogIdResult)this.catalogIdResult(this.chooseId)
  151 + this.showDialog = false;
  152 + },
  153 + }
  154 +};
  155 +</script>
  156 +
  157 +<style>
  158 +#catalogTree{
  159 + display: inline-block;
  160 +}
  161 +</style>
... ...
web_src/static/css/iconfont.css
1 1 @font-face {
2 2 font-family: "iconfont"; /* Project id 1291092 */
3   - src: url('iconfont.woff2?t=1640922722742') format('woff2'),
4   - url('iconfont.woff?t=1640922722742') format('woff'),
5   - url('iconfont.ttf?t=1640922722742') format('truetype');
  3 + src: url('iconfont.woff2?t=1644809302709') format('woff2'),
  4 + url('iconfont.woff?t=1644809302709') format('woff'),
  5 + url('iconfont.ttf?t=1644809302709') format('truetype');
6 6 }
7 7  
8 8 .iconfont {
... ... @@ -13,6 +13,14 @@
13 13 -moz-osx-font-smoothing: grayscale;
14 14 }
15 15  
  16 +.icon-ziyuan:before {
  17 + content: "\e7d5";
  18 +}
  19 +
  20 +.icon-shexiangtou1:before {
  21 + content: "\e7d4";
  22 +}
  23 +
16 24 .icon-wxbzhuye:before {
17 25 content: "\e7d1";
18 26 }
... ...
web_src/static/css/iconfont.woff2
No preview for this file type
web_src/static/favicon.ico 0 → 100644
No preview for this file type