Browse Source

Merge remote-tracking branch 'upstream/wvp-28181-2.0' into wvp-28181-2.0

pull/29/head
Lawrence 4 years ago
parent
commit
625842fd0d
  1. 18
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
  2. 12
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
  3. 18
      src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java
  4. 20
      src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
  5. 7
      src/main/java/com/genersoft/iot/vmp/storager/dao/patformChannelMapper.java
  6. 18
      src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
  7. 7
      src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceController.java
  8. 35
      src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java
  9. 78
      src/main/java/com/genersoft/iot/vmp/vmanager/platform/bean/ChannelReduce.java
  10. 24
      src/main/java/com/genersoft/iot/vmp/vmanager/platform/bean/UpdateChannelParam.java
  11. 7
      src/main/resources/application-dev.yml
  12. BIN
      src/main/resources/wvp.sqlite
  13. 5
      web_src/src/components/ParentPlatformList.vue
  14. 115
      web_src/src/components/gb28181/chooseChannel.vue
  15. 120
      web_src/src/components/gb28181/chooseChannelForGb.vue

18
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java

@ -77,6 +77,9 @@ public class SIPCommander implements ISIPCommander {
@Value("${media.seniorSdp}") @Value("${media.seniorSdp}")
private boolean seniorSdp; private boolean seniorSdp;
@Value("${media.autoApplyPlay}")
private boolean autoApplyPlay;
@Autowired @Autowired
private ZLMHttpHookSubscribe subscribe; private ZLMHttpHookSubscribe subscribe;
@ -287,8 +290,12 @@ public class SIPCommander implements ISIPCommander {
@Override @Override
public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event errorEvent) { public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event errorEvent) {
try { try {
String ssrc = "";
String ssrc = streamSession.createPlaySsrc(); if (rtpEnable) {
ssrc = String.format("gb_play_%s_%s", device.getDeviceId(), channelId);
}else {
ssrc = streamSession.createPlaySsrc();
}
String streamId = null; String streamId = null;
if (rtpEnable) { if (rtpEnable) {
streamId = String.format("gb_play_%s_%s", device.getDeviceId(), channelId); streamId = String.format("gb_play_%s_%s", device.getDeviceId(), channelId);
@ -408,7 +415,12 @@ public class SIPCommander implements ISIPCommander {
, SipSubscribe.Event errorEvent) { , SipSubscribe.Event errorEvent) {
try { try {
MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
String ssrc = streamSession.createPlayBackSsrc(); String ssrc = null;
if (rtpEnable) {
ssrc = String.format("gb_playback_%s_%s", device.getDeviceId(), channelId);
}else {
ssrc = streamSession.createPlayBackSsrc();
}
String streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase(); String streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase();
// 添加订阅 // 添加订阅
JSONObject subscribeKey = new JSONObject(); JSONObject subscribeKey = new JSONObject();

12
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java

@ -83,12 +83,9 @@ public class ZLMHttpHookListener {
@PostMapping(value = "/on_flow_report", produces = "application/json;charset=UTF-8") @PostMapping(value = "/on_flow_report", produces = "application/json;charset=UTF-8")
public ResponseEntity<String> onFlowReport(@RequestBody JSONObject json){ public ResponseEntity<String> onFlowReport(@RequestBody JSONObject json){
if (logger.isDebugEnabled()) { logger.debug("ZLM HOOK on_flow_report API调用,参数:" + json.toString());
logger.debug("ZLM HOOK on_flow_report API调用,参数:" + json.toString());
}
// TODO Auto-generated method stub // TODO Auto-generated method stub
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
ret.put("code", 0); ret.put("code", 0);
ret.put("msg", "success"); ret.put("msg", "success");
@ -234,7 +231,12 @@ public class ZLMHttpHookListener {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("ZLM HOOK on_shell_login API调用,参数:" + json.toString()); logger.debug("ZLM HOOK on_shell_login API调用,参数:" + json.toString());
} }
// TODO Auto-generated method stub // TODO 如果是带有rtpstream则开启按需拉流
String app = json.getString("app");
String stream = json.getString("stream");
ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json);
if (subscribe != null) subscribe.response(json);
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
ret.put("code", 0); ret.put("code", 0);

18
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java

@ -7,7 +7,11 @@ import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import gov.nist.javax.sip.stack.NioTcpMessageProcessor;
import javax.swing.event.ChangeEvent;
/** /**
* @Description:视频设备数据存储接口 * @Description:视频设备数据存储接口
@ -200,4 +204,18 @@ public interface IVideoManagerStorager {
* 所有平台离线 * 所有平台离线
*/ */
void outlineForAllParentPlatform(); void outlineForAllParentPlatform();
/**
* 查询通道信息 不区分设备
*/
PageInfo<ChannelReduce> queryChannelListInAll(int page, int count, String query, Boolean online, Boolean channelType, String parentChannelId);
/**
* 更新上级平台的通道信息
* @param platformId
* @param channelReduces
* @return
*/
int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces);
} }

20
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java

@ -1,6 +1,8 @@
package com.genersoft.iot.vmp.storager.dao; package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import java.util.List; import java.util.List;
@ -82,4 +84,22 @@ public interface DeviceChannelMapper {
@Update(value = {"UPDATE device_channel SET streamId=#{streamId} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) @Update(value = {"UPDATE device_channel SET streamId=#{streamId} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
void startPlay(String deviceId, String channelId, String streamId); void startPlay(String deviceId, String channelId, String streamId);
@Select(value = {" <script>" +
"SELECT * FROM ( "+
" SELECT dc.channelId, dc.deviceId, dc.name, de.manufacturer, de.hostAddress, " +
"(SELECT count(0) FROM device_channel WHERE parentId=dc.channelId) as subCount " +
"FROM device_channel dc LEFT JOIN device de ON dc.deviceId = de.deviceId" +
" WHERE 1=1 " +
" <if test=\"query != null\"> AND (dc.channelId LIKE '%${query}%' OR dc.name LIKE '%${query}%' OR dc.name LIKE '%${query}%')</if> " +
" <if test=\"parentChannelId != null\"> AND dc.parentId=#{parentChannelId} </if> " +
" <if test=\"online == true\" > AND dc.status=1</if>" +
" <if test=\"online == false\" > AND dc.status=0</if>) dcr" +
" WHERE 1=1 " +
" <if test=\"hasSubChannel == true\" > AND subCount >0</if>" +
" <if test=\"hasSubChannel == false\" > AND subCount=0</if>" +
" </script>"})
List<ChannelReduce> queryChannelListInAll(String query, Boolean online, Boolean hasSubChannel, String parentChannelId);
} }

7
src/main/java/com/genersoft/iot/vmp/storager/dao/patformChannelMapper.java

@ -0,0 +1,7 @@
package com.genersoft.iot.vmp.storager.dao;
import org.mapstruct.Mapper;
@Mapper
public interface patformChannelMapper {
}

18
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java

@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
import com.genersoft.iot.vmp.storager.dao.DeviceMapper; import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper; import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -16,6 +17,7 @@ import org.springframework.stereotype.Component;
import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager; import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import org.springframework.transaction.annotation.Transactional;
/** /**
* @Description:视频设备数据存储-jdbc实现 * @Description:视频设备数据存储-jdbc实现
@ -270,4 +272,20 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
public void outlineForAllParentPlatform() { public void outlineForAllParentPlatform() {
platformMapper.outlineForAllParentPlatform(); platformMapper.outlineForAllParentPlatform();
} }
@Override
public PageInfo<ChannelReduce> queryChannelListInAll(int page, int count, String query, Boolean online,
Boolean channelType, String parentChannelId) {
PageHelper.startPage(page, count);
List<ChannelReduce> all = deviceChannelMapper.queryChannelListInAll(query, online, channelType, parentChannelId);
return new PageInfo<>(all);
}
@Transactional
@Override
public int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces) {
return 0;
}
} }

7
src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceController.java

@ -61,13 +61,6 @@ public class DeviceController {
return storager.queryVideoDeviceList(page, count); return storager.queryVideoDeviceList(page, count);
} }
/**
* 分页查询通道数
* @param deviceId 设备id
* @param page 当前页
* @param count 每页条数
* @return 通道列表
*/
/** /**
* 分页查询通道数 * 分页查询通道数
* *

35
src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java

@ -1,10 +1,13 @@
package com.genersoft.iot.vmp.vmanager.platform; package com.genersoft.iot.vmp.vmanager.platform;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager; import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
import com.genersoft.iot.vmp.vmanager.platform.bean.UpdateChannelParam;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -15,6 +18,9 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.genersoft.iot.vmp.conf.SipConfig; import com.genersoft.iot.vmp.conf.SipConfig;
import java.util.List;
import java.util.Map;
@CrossOrigin @CrossOrigin
@RestController @RestController
@ -142,5 +148,34 @@ public class PlatformController {
return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK); return new ResponseEntity<>(String.valueOf(parentPlatform != null), HttpStatus.OK);
} }
@RequestMapping("/platforms/channelList")
@ResponseBody
public PageInfo<ChannelReduce> channelList(int page, int count,
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Boolean channelType){
if (logger.isDebugEnabled()) {
logger.debug("查询所有所有通道API调用");
}
PageInfo<ChannelReduce> channelReduces = storager.queryChannelListInAll(page, count, query, online, channelType, null);
return channelReduces;
}
@RequestMapping("/platforms/updateChannelForGB")
@ResponseBody
public ResponseEntity<String> updateChannelForGB(@RequestBody UpdateChannelParam param){
if (logger.isDebugEnabled()) {
logger.debug("给上级平台添加国标通道API调用");
}
int result = storager.updateChannelForGB(param.getPlatformId(), param.getChannelReduces());
return new ResponseEntity<>(String.valueOf(result > 0), HttpStatus.OK);
}
} }

78
src/main/java/com/genersoft/iot/vmp/vmanager/platform/bean/ChannelReduce.java

@ -0,0 +1,78 @@
package com.genersoft.iot.vmp.vmanager.platform.bean;
/**
* 精简的channel信息展示主要是选择通道的时候展示列表使用
*/
public class ChannelReduce {
/**
* 通道id
*/
private String channelId;
/**
* 设备id
*/
private String deviceId;
/**
* 通道名
*/
private String name;
/**
* 生产厂商
*/
private String manufacturer;
/**
* wan地址
*/
private String hostAddress;
/**
* 子节点数
*/
private int subCount;
public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getHostAddress() {
return hostAddress;
}
public void setHostAddress(String hostAddress) {
this.hostAddress = hostAddress;
}
}

24
src/main/java/com/genersoft/iot/vmp/vmanager/platform/bean/UpdateChannelParam.java

@ -0,0 +1,24 @@
package com.genersoft.iot.vmp.vmanager.platform.bean;
import java.util.List;
public class UpdateChannelParam {
private String platformId;
private List<ChannelReduce> channelReduces;
public String getPlatformId() {
return platformId;
}
public void setPlatformId(String platformId) {
this.platformId = platformId;
}
public List<ChannelReduce> getChannelReduces() {
return channelReduces;
}
public void setChannelReduces(List<ChannelReduce> channelReduces) {
this.channelReduces = channelReduces;
}
}

7
src/main/resources/application-dev.yml

@ -1,11 +1,4 @@
spring: spring:
# [不需要改]
application:
name: iot-vmp-vmanager
# [不需要改] 影子数据存储方式,支持redis、jdbc,暂不支持mysql,
database: redis
# [不需要改] 通信方式,支持kafka、http
communicate: http
# REDIS数据库配置 # REDIS数据库配置
redis: redis:
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1

BIN
src/main/resources/wvp.sqlite

Binary file not shown.

5
web_src/src/components/ParentPlatformList.vue

@ -95,7 +95,6 @@ export default {
} }
}, },
mounted() { mounted() {
this.$refs.chooseChannelDialog.openDialog()
this.initData(); this.initData();
this.updateLooper = setInterval(this.initData, 10000); this.updateLooper = setInterval(this.initData, 10000);
}, },
@ -138,7 +137,9 @@ export default {
}); });
}, },
chooseChannel: function(platform) { chooseChannel: function(platform) {
this.$refs.chooseChannelDialog.openDialog() this.$refs.chooseChannelDialog.openDialog(platform.deviceGBId, ()=>{
this.initData()
})
}, },
initData: function() { initData: function() {
this.getPlatformList(); this.getPlatformList();

115
web_src/src/components/gb28181/chooseChannel.vue

@ -1,63 +1,36 @@
<template> <template>
<div id="chooseChannel" v-loading="isLoging"> <div id="chooseChannel" v-loading="isLoging">
<el-dialog title="选择通道" top="0" :close-on-click-modal="false" :visible.sync="showDialog" :destroy-on-close="true" @close="close()"> <el-dialog title="选择通道" top="2rem" width="70%" :close-on-click-modal="false" :visible.sync="showDialog" :destroy-on-close="true" @close="close()">
<el-container> <el-tabs v-model="tabActiveName" >
<el-main style="background-color: #FFF;"> <el-tab-pane label="国标通道" name="gbChannel">
<el-tabs v-model="tabActiveName" >
<el-tab-pane label="国标通道" name="gbChannel"> <el-container>
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;"> <el-main style="background-color: #FFF;">
搜索: <el-input @input="search" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字" prefix-icon="el-icon-search" v-model="searchSrt" clearable> </el-input> <chooseChannelForGb :chooseChanage=chooseChanage ></chooseChannelForGb>
</el-main>
<el-footer>
<el-button size="mini" type="primary" style="float: right" @click="save()">保存</el-button>
</el-footer>
</el-container>
通道类型: <el-select size="mini" @change="search" style="margin-right: 1rem;" v-model="channelType" placeholder="请选择" default-first-option>
<el-option label="全部" value=""></el-option>
<el-option label="设备" value="false"></el-option>
<el-option label="子目录" value="true"></el-option>
</el-select>
在线状态: <el-select size="mini" style="margin-right: 1rem;" @change="search" v-model="online" placeholder="请选择" default-first-option>
<el-option label="全部" value=""></el-option>
<el-option label="在线" value="true"></el-option>
<el-option label="离线" value="false"></el-option>
</el-select>
</div>
<el-table :data="gbChannels" border style="width: 100%" @selection-change="handleGBSelectionChange" >
<el-table-column type="selection" width="55" align="center" fixed> </el-table-column>
<el-table-column prop="devicelId" label="设备编号" width="210" >
</el-table-column>
<el-table-column prop="channelId" label="通道编号" width="210">
</el-table-column>
<el-table-column prop="channelName" label="通道名称">
</el-table-column>
<el-table-column label="地址" width="180" align="center">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium">{{ scope.row.hostAddress }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column prop="manufacturer" label="厂家" align="center">
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="直播流通道" name="streamchannel">
<!-- TODO -->
</el-tab-pane>
</el-tabs>
</el-main> </el-tab-pane>
</el-container> <el-tab-pane label="直播流通道" name="streamchannel">
<!-- TODO -->
</el-tab-pane>
</el-tabs>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
// import player from './player.vue' import chooseChannelForGb from './chooseChannelForGb.vue'
export default { export default {
name: 'chooseChannel', name: 'chooseChannel',
props: {}, props: {},
components: { components: {
// player, chooseChannelForGb,
}, },
computed: { computed: {
// getPlayerShared: function () { // getPlayerShared: function () {
@ -73,37 +46,20 @@ export default {
return { return {
isLoging: false, isLoging: false,
tabActiveName: "gbChannel", tabActiveName: "gbChannel",
platformId: "",
isLoging: false, isLoging: false,
showDialog: false, showDialog: false,
chooseChanageCallback: null, chooseData: []
closeCallback: null,
gbChannels: [
{
devicelId: "34000000000200001",
channelId: "34000000000200001",
channelName: "test",
hostAddress: "192.168.1.1:5060",
manufacturer: "大华"
},{
devicelId: "34000000000200001",
channelId: "34000000000200001",
channelName: "test",
hostAddress: "192.168.1.1:5060",
manufacturer: "大华"
}
],
searchSrt: "",
channelType: "",
online: "",
}; };
}, },
methods: { methods: {
openDialog: function (chooseChanageCallback, closeCallback) { openDialog: function (platformId, closeCallback) {
console.log(platformId)
this.platformId = platformId
this.showDialog = true this.showDialog = true
this.closeCallback = closeCallback this.closeCallback = closeCallback
this.chooseChanageCallback = chooseChanageCallback
}, },
close: function() { close: function() {
@ -111,8 +67,31 @@ export default {
search: function() { search: function() {
}, },
handleGBSelectionChange: function() { save: function() {
var that = this;
this.$axios({
method:"post",
url:"/api/platforms/updateChannelForGB",
data:{
platformId: that.platformId,
channelReduces: that.chooseData
}
}).then((res)=>{
if (res.data == true) {
that.$message({
showClose: true,
message: '保存成功,',
type: 'success'
});
}
}).catch(function (error) {
console.log(error);
});
},
chooseChanage: function(val) {
console.log(val)
this.chooseData = val;
} }
} }
}; };

120
web_src/src/components/gb28181/chooseChannelForGb.vue

@ -0,0 +1,120 @@
<template>
<div id="chooseChannelForGb" >
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
搜索: <el-input @input="search" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字" prefix-icon="el-icon-search" v-model="searchSrt" clearable> </el-input>
通道类型: <el-select size="mini" @change="search" style="margin-right: 1rem;" v-model="channelType" placeholder="请选择" default-first-option>
<el-option label="全部" value=""></el-option>
<el-option label="设备" value="false"></el-option>
<el-option label="子目录" value="true"></el-option>
</el-select>
在线状态: <el-select size="mini" style="margin-right: 1rem;" @change="search" v-model="online" placeholder="请选择" default-first-option>
<el-option label="全部" value=""></el-option>
<el-option label="在线" value="true"></el-option>
<el-option label="离线" value="false"></el-option>
</el-select>
</div>
<el-table ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" @selection-change="chooseChanage" >
<el-table-column type="selection" width="55" align="center" fixed> </el-table-column>
<el-table-column prop="channelId" label="通道编号" width="210">
</el-table-column>
<el-table-column prop="name" label="通道名称">
</el-table-column>
<el-table-column prop="deviceId" label="设备编号" width="210" >
</el-table-column>
<el-table-column label="设备地址" width="180" align="center">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium">{{ scope.row.hostAddress }}</el-tag>
</div>
</template>
</el-table-column>
<el-table-column prop="manufacturer" label="厂家" align="center">
</el-table-column>
</el-table>
<el-pagination style="float: right;margin-top: 1rem;" @size-change="handleSizeChange" @current-change="currentChange" :current-page="currentPage" :page-size="count" :page-sizes="[15, 20, 30, 50]" layout="total, sizes, prev, pager, next" :total="total">
</el-pagination>
</div>
</template>
<script>
export default {
name: 'chooseChannelForGb',
props: {},
computed: {
// getPlayerShared: function () {
// return {
// sharedUrl: window.location.host + '/' + this.videoUrl,
// sharedIframe: '<iframe src="' + window.location.host + '/' + this.videoUrl + '"></iframe>',
// sharedRtmp: this.videoUrl
// };
// }
},
props: ['chooseChanage'],
created() {
this.initData();
},
data() {
return {
gbChannels: [],
searchSrt: "",
channelType: "",
online: "",
currentPage: parseInt(this.$route.params.page),
count: parseInt(this.$route.params.count),
total: 0
};
},
methods: {
initData: function() {
this.getChannelList();
},
currentChange: function (val) {
this.currentPage = val;
this.initData();
},
handleSizeChange: function (val) {
this.count = val;
this.initData();
},
getChannelList: function () {
let that = this;
this.$axios.get(`/api/platforms/channelList`, {
params: {
page: that.currentPage - 1,
count: that.count,
query: that.searchSrt,
online: that.online,
channelType: that.channelType
}
})
.then(function (res) {
console.log(res);
that.total = res.data.total;
that.gbChannels = res.data.list;
//
that.$nextTick(() => {
that.$refs.gbChannelsTable.doLayout();
})
})
.catch(function (error) {
console.log(error);
});
},
search: function() {
this.initData();
},
handleGBSelectionChange: function() {
this.initData();
},
}
};
</script>
<style>
</style>
Loading…
Cancel
Save