国标级联->选择通道支持移除目前下所有以及全部添加到目录下
This commit is contained in:
parent
1e7ce98967
commit
c43fbab56f
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.service;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -38,4 +39,11 @@ public interface IDeviceChannelService {
|
||||
* @return
|
||||
*/
|
||||
ResourceBaceInfo getOverview();
|
||||
|
||||
/**
|
||||
* 查询所有未分配的通道
|
||||
* @param platformId
|
||||
* @return
|
||||
*/
|
||||
List<ChannelReduce> queryAllChannelList(String platformId);
|
||||
}
|
||||
|
@ -55,4 +55,18 @@ public interface IGbStreamService {
|
||||
int updateGbIdOrName(List<StreamPushItem> streamPushItemForUpdate);
|
||||
|
||||
DeviceChannel getDeviceChannelListByStreamWithStatus(GbStream gbStream, String catalogId, ParentPlatform platform);
|
||||
|
||||
/**
|
||||
* 查询所有未分配的通道
|
||||
* @param platformId
|
||||
* @return
|
||||
*/
|
||||
List<GbStream> getAllGBChannels(String platformId);
|
||||
|
||||
/**
|
||||
* 移除所有关联的通道
|
||||
* @param platformId
|
||||
* @param catalogId
|
||||
*/
|
||||
void delAllPlatformInfo(String platformId, String catalogId);
|
||||
}
|
||||
|
@ -19,4 +19,11 @@ public interface IPlatformChannelService {
|
||||
*/
|
||||
int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId);
|
||||
|
||||
/**
|
||||
* 移除目录下的所有通道
|
||||
* @param platformId
|
||||
* @param catalogId
|
||||
* @return
|
||||
*/
|
||||
int delAllChannelForGB(String platformId, String catalogId);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -168,4 +169,12 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||
public ResourceBaceInfo getOverview() {
|
||||
return channelMapper.getOverview();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ChannelReduce> queryAllChannelList(String platformId) {
|
||||
return channelMapper.queryChannelListInAll(null, null, null, platformId, null);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,11 +4,11 @@ import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.PlatformCatalogMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.slf4j.Logger;
|
||||
@ -19,7 +19,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -230,4 +229,35 @@ public class GbStreamServiceImpl implements IGbStreamService {
|
||||
deviceChannel.setSecrecy("0");
|
||||
return deviceChannel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GbStream> getAllGBChannels(String platformId) {
|
||||
|
||||
return gbStreamMapper.selectAll(platformId, null, null, null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delAllPlatformInfo(String platformId, String catalogId) {
|
||||
if (platformId == null) {
|
||||
return ;
|
||||
}
|
||||
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
|
||||
if (platform == null) {
|
||||
return ;
|
||||
}
|
||||
if (ObjectUtils.isEmpty(catalogId)) {
|
||||
catalogId = platform.getDeviceGBId();
|
||||
}
|
||||
if (platformGbStreamMapper.delByPlatformAndCatalogId(platformId, catalogId) > 0) {
|
||||
List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId);
|
||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
||||
for (GbStream gbStream : gbStreams) {
|
||||
DeviceChannel deviceChannel = new DeviceChannel();
|
||||
deviceChannel.setChannelId(gbStream.getGbId());
|
||||
deviceChannelList.add(deviceChannel);
|
||||
}
|
||||
eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -105,4 +106,26 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
||||
}
|
||||
return deviceChannelList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delAllChannelForGB(String platformId, String catalogId) {
|
||||
|
||||
int result;
|
||||
if (platformId == null) {
|
||||
return 0;
|
||||
}
|
||||
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
|
||||
if (platform == null) {
|
||||
return 0;
|
||||
}
|
||||
if (ObjectUtils.isEmpty(catalogId)) {
|
||||
catalogId = platform.getDeviceGBId();
|
||||
}
|
||||
|
||||
if ((result = platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId)) > 0) {
|
||||
List<DeviceChannel> deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId);
|
||||
eventPublisher.catalogEventPublish(platformId, deviceChannels, CatalogEvent.DEL);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.genersoft.iot.vmp.storager.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannelInPlatform;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaceInfo;
|
||||
|
@ -5,7 +5,6 @@ import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@ -169,4 +168,5 @@ public interface GbStreamMapper {
|
||||
|
||||
@Select("SELECT status FROM stream_push WHERE app=#{app} AND stream=#{stream}")
|
||||
Boolean selectStatusForPush(String app, String stream);
|
||||
|
||||
}
|
||||
|
@ -57,6 +57,9 @@ public interface PlatformChannelMapper {
|
||||
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE dc.channelId='${channelId}' and pgc.platformId='${platformId}'")
|
||||
List<DeviceChannel> queryChannelInParentPlatform(String platformId, String channelId);
|
||||
|
||||
@Select("SELECT dc.* FROM platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId WHERE pgc.platformId='${platformId}' and pgc.catalogId=#{catalogId}")
|
||||
List<DeviceChannel> queryAllChannelInCatalog(String platformId, String catalogId);
|
||||
|
||||
@Select(" select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " +
|
||||
" from device_channel dc left join platform_gb_channel pgc on dc.id = pgc.deviceChannelId " +
|
||||
" where pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}")
|
||||
@ -99,4 +102,9 @@ public interface PlatformChannelMapper {
|
||||
"DELETE FROM platform_gb_channel WHERE platformId=#{serverGBId}" +
|
||||
"</script>")
|
||||
void delByPlatformId(String serverGBId);
|
||||
|
||||
@Delete("<script> " +
|
||||
"DELETE FROM platform_gb_channel WHERE platformId=#{platformId} and catalogId=#{catalogId}" +
|
||||
"</script>")
|
||||
int delChannelForGBByCatalogId(String platformId, String catalogId);
|
||||
}
|
||||
|
@ -105,4 +105,7 @@ public interface PlatformGbStreamMapper {
|
||||
"</foreach>" +
|
||||
"</script>")
|
||||
void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId);
|
||||
|
||||
@Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId} and catalogId=#{catalogId}")
|
||||
int delByPlatformAndCatalogId(String platformId, String catalogId);
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
package com.genersoft.iot.vmp.storager.impl;
|
||||
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
@ -28,7 +26,6 @@ import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -761,18 +758,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||
return gbStreamMapper.updateStreamGPS(gpsMsgInfos);
|
||||
}
|
||||
|
||||
private List<DeviceChannel> getDeviceChannelListByChannelReduceList(List<ChannelReduce> channelReduces, String catalogId) {
|
||||
List<DeviceChannel> deviceChannelList = new ArrayList<>();
|
||||
if (channelReduces.size() > 0){
|
||||
for (ChannelReduce channelReduce : channelReduces) {
|
||||
DeviceChannel deviceChannel = queryChannel(channelReduce.getDeviceId(), channelReduce.getChannelId());
|
||||
deviceChannel.setParental(1);
|
||||
deviceChannel.setParentId(catalogId);
|
||||
deviceChannelList.add(deviceChannel);
|
||||
}
|
||||
}
|
||||
return deviceChannelList;
|
||||
}
|
||||
|
||||
private DeviceChannel getDeviceChannelByCatalog(PlatformCatalog catalog) {
|
||||
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(catalog.getPlatformId());
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.genersoft.iot.vmp.vmanager.gb28181.gbStream;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -12,9 +12,10 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "视频流关联到级联平台")
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@ -76,11 +77,14 @@ public class GbStreamController {
|
||||
@Operation(summary = "移除国标关联")
|
||||
@DeleteMapping(value = "/del")
|
||||
@ResponseBody
|
||||
public Object del(@RequestBody GbStreamParam gbStreamParam){
|
||||
if (gbStreamService.delPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getGbStreams())) {
|
||||
return "success";
|
||||
public void del(@RequestBody GbStreamParam gbStreamParam){
|
||||
|
||||
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) {
|
||||
if (gbStreamParam.isAll()) {
|
||||
gbStreamService.delAllPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
|
||||
}
|
||||
}else {
|
||||
return "fail";
|
||||
gbStreamService.delPlatformInfo(gbStreamParam.getPlatformId(), gbStreamParam.getGbStreams());
|
||||
}
|
||||
|
||||
}
|
||||
@ -93,11 +97,14 @@ public class GbStreamController {
|
||||
@Operation(summary = "保存国标关联")
|
||||
@PostMapping(value = "/add")
|
||||
@ResponseBody
|
||||
public Object add(@RequestBody GbStreamParam gbStreamParam){
|
||||
if (gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId())) {
|
||||
return "success";
|
||||
public void add(@RequestBody GbStreamParam gbStreamParam){
|
||||
if (gbStreamParam.getGbStreams() == null || gbStreamParam.getGbStreams().size() == 0) {
|
||||
if (gbStreamParam.isAll()) {
|
||||
List<GbStream> allGBChannels = gbStreamService.getAllGBChannels(gbStreamParam.getPlatformId());
|
||||
gbStreamService.addPlatformInfo(allGBChannels, gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
|
||||
}
|
||||
}else {
|
||||
return "fail";
|
||||
gbStreamService.addPlatformInfo(gbStreamParam.getGbStreams(), gbStreamParam.getPlatformId(), gbStreamParam.getCatalogId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,9 @@ public class GbStreamParam {
|
||||
@Schema(description = "目录ID")
|
||||
private String catalogId;
|
||||
|
||||
@Schema(description = "关联所有通道")
|
||||
private boolean all;
|
||||
|
||||
@Schema(description = "流国标信息列表")
|
||||
private List<GbStream> gbStreams;
|
||||
|
||||
@ -40,4 +43,12 @@ public class GbStreamParam {
|
||||
public void setGbStreams(List<GbStream> gbStreams) {
|
||||
this.gbStreams = gbStreams;
|
||||
}
|
||||
|
||||
public boolean isAll() {
|
||||
return all;
|
||||
}
|
||||
|
||||
public void setAll(boolean all) {
|
||||
this.all = all;
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,7 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||
import com.genersoft.iot.vmp.service.IPlatformChannelService;
|
||||
import com.genersoft.iot.vmp.service.IPlatformService;
|
||||
import com.genersoft.iot.vmp.service.*;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
@ -72,6 +71,12 @@ public class PlatformController {
|
||||
@Autowired
|
||||
private IPlatformService platformService;
|
||||
|
||||
@Autowired
|
||||
private IDeviceChannelService deviceChannelService;
|
||||
|
||||
@Autowired
|
||||
private IGbStreamService gbStreamService;
|
||||
|
||||
/**
|
||||
* 获取国标服务的配置
|
||||
*
|
||||
@ -379,7 +384,16 @@ public class PlatformController {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("给上级平台添加国标通道API调用");
|
||||
}
|
||||
int result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId());
|
||||
int result = 0;
|
||||
if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) {
|
||||
if (param.isAll()) {
|
||||
logger.info("[国标级联]添加所有通道到上级平台, {}", param.getPlatformId());
|
||||
List<ChannelReduce> allChannelForDevice = deviceChannelService.queryAllChannelList(param.getPlatformId());
|
||||
result = platformChannelService.updateChannelForGB(param.getPlatformId(), allChannelForDevice, param.getCatalogId());
|
||||
}
|
||||
}else {
|
||||
result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId());
|
||||
}
|
||||
if (result <= 0) {
|
||||
throw new ControllerException(ErrorCode.ERROR100);
|
||||
}
|
||||
@ -399,8 +413,15 @@ public class PlatformController {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("给上级平台删除国标通道API调用");
|
||||
}
|
||||
int result = storager.delChannelForGB(param.getPlatformId(), param.getChannelReduces());
|
||||
|
||||
int result = 0;
|
||||
if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) {
|
||||
if (param.isAll()) {
|
||||
logger.info("[国标级联]移除所有通道,上级平台, {}", param.getPlatformId());
|
||||
result = platformChannelService.delAllChannelForGB(param.getPlatformId(), param.getCatalogId());
|
||||
}
|
||||
}else {
|
||||
result = storager.delChannelForGB(param.getPlatformId(), param.getChannelReduces());
|
||||
}
|
||||
if (result <= 0) {
|
||||
throw new ControllerException(ErrorCode.ERROR100);
|
||||
}
|
||||
|
@ -17,6 +17,9 @@ public class UpdateChannelParam {
|
||||
@Schema(description = "目录的国标编号")
|
||||
private String catalogId;
|
||||
|
||||
@Schema(description = "处理所有通道")
|
||||
private boolean all;
|
||||
|
||||
@Schema(description = "")
|
||||
private List<ChannelReduce> channelReduces;
|
||||
|
||||
@ -43,4 +46,12 @@ public class UpdateChannelParam {
|
||||
public void setCatalogId(String catalogId) {
|
||||
this.catalogId = catalogId;
|
||||
}
|
||||
|
||||
public boolean isAll() {
|
||||
return all;
|
||||
}
|
||||
|
||||
public void setAll(boolean all) {
|
||||
this.all = all;
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +134,6 @@ public class PlayController {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "停止点播")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@ -171,7 +170,6 @@ public class PlayController {
|
||||
json.put("deviceId", deviceId);
|
||||
json.put("channelId", channelId);
|
||||
return json;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18,8 +18,10 @@
|
||||
<el-option label="在线" value="true"></el-option>
|
||||
<el-option label="离线" value="false"></el-option>
|
||||
</el-select>
|
||||
<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>
|
||||
<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>
|
||||
<el-button v-if="catalogId !== null" icon="el-icon-delete" size="mini" :disabled="gbChannels.length === 0 || multipleSelection.length === 0" type="danger" @click="batchDel">批量移除</el-button>
|
||||
<el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" :disabled="gbChannels.length === 0 || multipleSelection.length === 0" @click="batchAdd">批量添加</el-button>
|
||||
<el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" @click="add()">全部添加</el-button>
|
||||
<el-button v-if="catalogId !== null" type="danger" icon="el-icon-delete" size="mini" @click="remove()">全部移除</el-button>
|
||||
</div>
|
||||
|
||||
<el-table ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" :height="winHeight" :row-key="(row)=> row.deviceId + row.channelId" @selection-change="handleSelectionChange">
|
||||
@ -115,13 +117,15 @@ export default {
|
||||
this.initData();
|
||||
},
|
||||
add: function (row) {
|
||||
let all = typeof(row) === "undefined"
|
||||
this.getCatalogFromUser((catalogId)=> {
|
||||
this.$axios({
|
||||
method:"post",
|
||||
url:"/api/platform/update_channel_for_gb",
|
||||
data:{
|
||||
platformId: this.platformId,
|
||||
channelReduces: [row],
|
||||
all: all,
|
||||
channelReduces: all?[]:[row],
|
||||
catalogId: catalogId
|
||||
}
|
||||
}).then((res)=>{
|
||||
@ -134,21 +138,34 @@ export default {
|
||||
|
||||
},
|
||||
remove: function (row) {
|
||||
console.log(row)
|
||||
let all = typeof(row) === "undefined"
|
||||
this.$confirm(`确定移除${all?"所有通道":""}吗?`, '提示', {
|
||||
dangerouslyUseHTMLString: true,
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
console.log(row)
|
||||
|
||||
this.$axios({
|
||||
method:"delete",
|
||||
url:"/api/platform/del_channel_for_gb",
|
||||
data:{
|
||||
platformId: this.platformId,
|
||||
all: all,
|
||||
channelReduces: all?[]:[row],
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log("移除成功")
|
||||
this.getChannelList();
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}).catch(() => {
|
||||
|
||||
this.$axios({
|
||||
method:"delete",
|
||||
url:"/api/platform/del_channel_for_gb",
|
||||
data:{
|
||||
platformId: this.platformId,
|
||||
channelReduces: [row]
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log("移除成功")
|
||||
this.getChannelList();
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
// checkedChange: function (val) {
|
||||
// let that = this;
|
||||
|
@ -24,6 +24,8 @@
|
||||
</el-select>
|
||||
<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>
|
||||
<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>
|
||||
<el-button v-if="catalogId === null" icon="el-icon-plus" size="mini" style="margin-right: 1rem;" @click="add()">全部添加</el-button>
|
||||
<el-button v-if="catalogId !== null" type="danger" icon="el-icon-delete" size="mini" style="margin-right: 1rem;" @click="remove()">全部移除</el-button>
|
||||
</div>
|
||||
<el-table ref="gbStreamsTable" :data="gbStreams" border style="width: 100%" :height="winHeight" :row-key="(row)=> row.app + row.stream" @selection-change="handleSelectionChange">
|
||||
<el-table-column align="center" type="selection" :reserve-selection="true" width="55">
|
||||
@ -128,6 +130,7 @@ export default {
|
||||
|
||||
},
|
||||
add: function (row, scope) {
|
||||
let all = typeof(row) === "undefined"
|
||||
this.getCatalogFromUser((catalogId)=>{
|
||||
this.$axios({
|
||||
method:"post",
|
||||
@ -135,7 +138,8 @@ export default {
|
||||
data:{
|
||||
platformId: this.platformId,
|
||||
catalogId: catalogId,
|
||||
gbStreams: [row],
|
||||
all: all,
|
||||
gbStreams: all?[]:[row],
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log("保存成功")
|
||||
@ -149,20 +153,33 @@ export default {
|
||||
|
||||
},
|
||||
remove: function (row, scope) {
|
||||
this.$axios({
|
||||
method:"delete",
|
||||
url:"/api/gbStream/del",
|
||||
data:{
|
||||
platformId: this.platformId,
|
||||
gbStreams: [row],
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log("移除成功")
|
||||
// this.gbStreams.splice(scope.$index,1)
|
||||
this.getChannelList();
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
let all = typeof(row) === "undefined"
|
||||
this.$confirm(`确定移除${all?"所有通道":""}吗?`, '提示', {
|
||||
dangerouslyUseHTMLString: true,
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
|
||||
this.$axios({
|
||||
method:"delete",
|
||||
url:"/api/gbStream/del",
|
||||
data:{
|
||||
platformId: this.platformId,
|
||||
all: all,
|
||||
gbStreams: all?[]:[row],
|
||||
}
|
||||
}).then((res)=>{
|
||||
console.log("移除成功")
|
||||
// this.gbStreams.splice(scope.$index,1)
|
||||
this.getChannelList();
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
getChannelList: function () {
|
||||
let that = this;
|
||||
|
Loading…
Reference in New Issue
Block a user