临时提交

pull/1642/head
648540858 2024-08-27 17:56:49 +08:00
parent b2b7426871
commit dd794d4868
23 changed files with 552 additions and 1257 deletions

View File

@ -422,12 +422,14 @@ public class CommonGBChannel {
// 业务分组
channel.setGbName(group.getName());
channel.setGbDeviceId(group.getDeviceId());
channel.setGbCivilCode(group.getCivilCode());
} else {
// 虚拟组织
channel.setGbName(group.getName());
channel.setGbDeviceId(group.getDeviceId());
channel.setGbParentId(group.getParentDeviceId());
channel.setGbBusinessGroupId(group.getBusinessGroup());
channel.setGbCivilCode(group.getCivilCode());
}
return channel;
}

View File

@ -58,6 +58,11 @@ public class Group implements Comparable<Group>{
*/
@Schema(description = "更新时间")
private String updateTime;
/**
*
*/
@Schema(description = "行政区划")
private String civilCode;
public static Group getInstance(DeviceChannel channel) {
GbCode gbCode = GbCode.decode(channel.getDeviceId());

View File

@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.gb28181.dao;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.Group;
import com.genersoft.iot.vmp.gb28181.bean.GroupTree;
import com.genersoft.iot.vmp.gb28181.bean.Platform;
import org.apache.ibatis.annotations.*;
import java.util.List;
@ -11,13 +12,13 @@ import java.util.Set;
@Mapper
public interface GroupMapper {
@Insert("INSERT INTO wvp_common_group (device_id, name, parent_id, parent_device_id, business_group, create_time, update_time) " +
"VALUES (#{deviceId}, #{name}, #{parentId}, #{parentDeviceId}, #{businessGroup}, #{createTime}, #{updateTime})")
@Insert("INSERT INTO wvp_common_group (device_id, name, parent_id, parent_device_id, business_group, create_time, update_time, civil_code) " +
"VALUES (#{deviceId}, #{name}, #{parentId}, #{parentDeviceId}, #{businessGroup}, #{createTime}, #{updateTime}, #{civilCode})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int add(Group group);
@Insert("INSERT INTO wvp_common_group (device_id, name, business_group, create_time, update_time) " +
"VALUES (#{deviceId}, #{name}, #{businessGroup}, #{createTime}, #{updateTime})")
@Insert("INSERT INTO wvp_common_group (device_id, name, business_group, create_time, update_time, civil_code) " +
"VALUES (#{deviceId}, #{name}, #{businessGroup}, #{createTime}, #{updateTime}, #{civilCode})")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
int addBusinessGroup(Group group);
@ -25,7 +26,8 @@ public interface GroupMapper {
int delete(@Param("id") int id);
@Update(" UPDATE wvp_common_group " +
" SET update_time=#{updateTime}, device_id=#{deviceId}, name=#{name}, parent_id=#{parentId}, parent_device_id=#{parentDeviceId}, business_group=#{businessGroup}" +
" SET update_time=#{updateTime}, device_id=#{deviceId}, name=#{name}, parent_id=#{parentId}, " +
" parent_device_id=#{parentDeviceId}, business_group=#{businessGroup}, civil_code=#{civilCode}" +
" WHERE id = #{id}")
int update(Group group);
@ -52,10 +54,11 @@ public interface GroupMapper {
" parent_id," +
" business_group," +
" create_time," +
" civil_code," +
" update_time) " +
" VALUES " +
" <foreach collection='groupList' index='index' item='item' separator=','> " +
" (#{item.deviceId}, #{item.name}, #{item.parentDeviceId}, #{item.parentId}, #{item.businessGroup},#{item.createTime},#{item.updateTime})" +
" (#{item.deviceId}, #{item.name}, #{item.parentDeviceId}, #{item.parentId}, #{item.businessGroup},#{item.createTime},#{item.civilCode},#{item.updateTime})" +
" </foreach> " +
" </script>")
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@ -210,4 +213,15 @@ public interface GroupMapper {
" </script>")
void updateParentIdWithBusinessGroup(List<Group> groupListForAdd);
@Select(" <script>" +
" SELECT " +
" wp.* " +
" from wvp_platform_group wpg " +
" left join wvp_platform wp on wp.id = wpg.platform_id " +
" where wpg.group_id = #{groupId} " +
"</script>")
List<Platform> queryForPlatformByGroupId(@Param("groupId") int groupId);
@Delete("DELETE FROM wvp_platform_group WHERE group_id = #{groupId}")
void deletePlatformGroup(@Param("groupId") int groupId);
}

View File

@ -339,7 +339,17 @@ public interface PlatformChannelMapper {
" </foreach> " +
"</if>" +
"</script>")
int removeChannels(@Param("platformId") Integer platformId, List<CommonGBChannel> channelList);
int removeChannelsWithPlatform(@Param("platformId") Integer platformId, List<CommonGBChannel> channelList);
@Delete("<script> " +
"DELETE from wvp_platform_channel WHERE " +
"<if test='channelList != null'> AND device_channel_id in " +
" <foreach item='item' index='index' collection='channelList' open='(' separator=',' close=')'>" +
" #{item.gbId} " +
" </foreach> " +
"</if>" +
"</script>")
int removeChannels(List<CommonGBChannel> channelList);
@Insert("<script> "+
"INSERT INTO wvp_platform_group (platform_id, group_id) VALUES " +
@ -406,4 +416,19 @@ public interface PlatformChannelMapper {
"<foreach collection='regionSet' item='item' open='(' separator=',' close=')' > #{item.parentId}</foreach>" +
" </script>")
Set<Region> queryShareParentRegionByRegionSet(Set<Region> regionSet, @Param("platformId") Integer platformId);
@Select("<script> " +
" SELECT " +
" pp.* " +
" FROM " +
" wvp_platform pp " +
" left join wvp_platform_channel pgc on " +
" pp.id = pgc.platform_id " +
" left join wvp_device_channel dc on " +
" dc.id = pgc.device_channel_id " +
" WHERE " +
" pgc.device_channel_id IN" +
"<foreach collection='channelList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" +
"</script> ")
List<Platform> queryPlatFormListByChannelList(List<CommonGBChannel> channelList);
}

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.gb28181.service;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.PlatformChannel;
import com.github.pagehelper.PageInfo;
@ -20,4 +21,6 @@ public interface IPlatformChannelService {
int addChannels(Integer platformId, List<Integer> channelIds);
int removeChannels(Integer platformId, List<Integer> channelIds);
void removeChannels(List<CommonGBChannel> channelList);
}

View File

@ -6,9 +6,11 @@ import com.genersoft.iot.vmp.common.InviteInfo;
import com.genersoft.iot.vmp.common.InviteSessionType;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.DeviceMapper;
import com.genersoft.iot.vmp.gb28181.dao.DeviceMobilePositionMapper;
@ -17,11 +19,11 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
import com.genersoft.iot.vmp.gb28181.service.IInviteStreamService;
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -68,6 +70,10 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
@Autowired
private IRedisCatchStorage redisCatchStorage;
@Autowired
private IPlatformChannelService platformChannelService;
@Override
public void updateChannel(String deviceId, DeviceChannel channel) {
String channelId = channel.getDeviceId();
@ -503,7 +509,6 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
return false;
}
int limitCount = 50;
boolean result = false;
if (!addChannels.isEmpty()) {
if (addChannels.size() > limitCount) {
for (int i = 0; i < addChannels.size(); i += limitCount) {
@ -511,39 +516,52 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
if (i + limitCount > addChannels.size()) {
toIndex = addChannels.size();
}
result = result || channelMapper.batchAdd(addChannels.subList(i, toIndex)) > 0;
channelMapper.batchAdd(addChannels.subList(i, toIndex));
}
}else {
result = channelMapper.batchAdd(addChannels) > 0;
channelMapper.batchAdd(addChannels);
}
}
if (!result && !updateChannels.isEmpty()) {
if (!updateChannels.isEmpty()) {
if (updateChannels.size() > limitCount) {
for (int i = 0; i < updateChannels.size(); i += limitCount) {
int toIndex = i + limitCount;
if (i + limitCount > updateChannels.size()) {
toIndex = updateChannels.size();
}
result = result || channelMapper.batchUpdate(updateChannels.subList(i, toIndex)) > 0;
channelMapper.batchUpdate(updateChannels.subList(i, toIndex));
}
}else {
result = channelMapper.batchUpdate(updateChannels) > 0;
channelMapper.batchUpdate(updateChannels);
}
// 不对收到的通道做比较,已确定是否真的发生变化,所以不发送更新通知
}
if (!result && !deleteChannels.isEmpty()) {
if (!deleteChannels.isEmpty()) {
if (deleteChannels.size() > limitCount) {
for (int i = 0; i < deleteChannels.size(); i += limitCount) {
int toIndex = i + limitCount;
if (i + limitCount > deleteChannels.size()) {
toIndex = deleteChannels.size();
}
result = result || channelMapper.batchDel(deleteChannels.subList(i, toIndex)) < 0;
channelMapper.batchDel(deleteChannels.subList(i, toIndex));
}
}else {
result = channelMapper.batchDel(deleteChannels) < 0;
channelMapper.batchDel(deleteChannels);
}
// 这些通道可能关联了,上级平台需要删除同时发送消息
List<CommonGBChannel> channelList = new ArrayList<>();
deleteChannels.stream().forEach(deviceChannel -> {
CommonGBChannel commonGBChannel = new CommonGBChannel();
commonGBChannel.setGbId(deviceChannel.getId());
commonGBChannel.setGbDeviceId(deviceChannel.getDeviceId());
commonGBChannel.setGbName(deviceChannel.getName());
channelList.add(commonGBChannel);
});
platformChannelService.removeChannels(channelList);
}
return result;
return true;
}

View File

@ -536,6 +536,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
return;
}
commonGBChannelMapper.removeParentIdByChannels(channelList);
// TODO 可能需要发送通道更新通知
}
@Override

View File

@ -1,9 +1,6 @@
package com.genersoft.iot.vmp.gb28181.service.impl;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.GbCode;
import com.genersoft.iot.vmp.gb28181.bean.Group;
import com.genersoft.iot.vmp.gb28181.bean.GroupTree;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.GroupMapper;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
@ -202,14 +199,22 @@ public class GroupServiceImpl implements IGroupService {
gbChannelService.removeParentIdByGroupList(groupListForDelete);
}
groupManager.batchDelete(groupListForDelete);
for (Group groupForDelete : groupListForDelete) {
// 将变化信息发送通知
CommonGBChannel channel = CommonGBChannel.build(groupForDelete);
try {
// 发送catalog
eventPublisher.catalogEventPublish(null, channel, CatalogEvent.DEL);
}catch (Exception e) {
log.warn("[业务分组/虚拟组织删除] 发送失败,{}", groupForDelete.getDeviceId(), e);
// 删除平台关联的分组信息。同时发送通知
List<Platform> platformList = groupManager.queryForPlatformByGroupId(groupForDelete.getId());
if ( !platformList.isEmpty()) {
groupManager.deletePlatformGroup(groupForDelete.getId());
// 将变化信息发送通知
CommonGBChannel channel = CommonGBChannel.build(groupForDelete);
for (Platform platform : platformList) {
try {
// 发送catalog
eventPublisher.catalogEventPublish(platform.getId(), channel, CatalogEvent.DEL);
}catch (Exception e) {
log.warn("[业务分组/虚拟组织删除] 发送失败,{}", groupForDelete.getDeviceId(), e);
}
}
}
}
return true;

View File

@ -1,10 +1,7 @@
package com.genersoft.iot.vmp.gb28181.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.Group;
import com.genersoft.iot.vmp.gb28181.bean.PlatformChannel;
import com.genersoft.iot.vmp.gb28181.bean.Region;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
import com.genersoft.iot.vmp.gb28181.dao.GroupMapper;
import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
@ -273,7 +270,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
public int removeAllChannel(Integer platformId) {
List<CommonGBChannel> channelListShare = platformChannelMapper.queryShare(platformId, null);
Assert.notEmpty(channelListShare, "未共享任何通道");
int result = platformChannelMapper.removeChannels(platformId, channelListShare);
int result = platformChannelMapper.removeChannelsWithPlatform(platformId, channelListShare);
if (result > 0) {
// 查询通道相关的分组信息
Set<Region> regionSet = regionMapper.queryByChannelList(channelListShare);
@ -308,7 +305,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
public int removeChannels(Integer platformId, List<Integer> channelIds) {
List<CommonGBChannel> channelList = platformChannelMapper.queryShare(platformId, channelIds);
Assert.notEmpty(channelList, "所选通道未共享");
int result = platformChannelMapper.removeChannels(platformId, channelList);
int result = platformChannelMapper.removeChannelsWithPlatform(platformId, channelList);
if (result > 0) {
// 查询通道相关的分组信息
Set<Region> regionSet = regionMapper.queryByChannelList(channelList);
@ -337,4 +334,46 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
}
return result;
}
@Override
public void removeChannels(List<CommonGBChannel> channelList) {
List<Platform> platformList = platformChannelMapper.queryPlatFormListByChannelList(channelList);
if (platformList.isEmpty()) {
return;
}
// TODO 不对呀
for (Platform platform : platformList) {
int result = platformChannelMapper.removeChannelsWithPlatform(platform.getId(), channelList);
if (result > 0) {
// 查询通道相关的分组信息
Set<Region> regionSet = regionMapper.queryByChannelList(channelList);
Set<Region> deleteRegion = deleteEmptyRegion(regionSet, platform.getId());
if (!deleteRegion.isEmpty()) {
for (Region region : deleteRegion) {
channelList.add(0, CommonGBChannel.build(region));
}
}
// 查询通道相关的分组信息
Set<Group> groupSet = groupMapper.queryByChannelList(channelList);
Set<Group> deleteGroup = deleteEmptyGroup(groupSet, platform.getId());
if (!deleteGroup.isEmpty()) {
for (Group group : deleteGroup) {
channelList.add(0, CommonGBChannel.build(group));
}
}
}
// 发送消息
try {
// 发送catalog
eventPublisher.catalogEventPublish(platform.getId(), channelList, CatalogEvent.DEL);
} catch (Exception e) {
log.warn("[移除关联通道] 发送失败,数量:{}", channelList.size(), e);
}
}
}
}

View File

@ -60,7 +60,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
return;
}
SIPRequest request = (SIPRequest) evt.getRequest();
log.info("[收到心跳] device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId());
log.debug("[收到心跳] device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId());
if (userSetting.getGbDeviceOnline() == 0 && !device.isOnLine()) {
log.warn("[收到心跳] 设备离线,心跳不进行回复, device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId());
return;

View File

@ -105,7 +105,7 @@ public class ZLMMediaServerStatusManger {
if (serverItem == null) {
return;
}
log.info("[ZLM-HOOK事件-心跳] ID" + event.getMediaServerItem().getId());
log.debug("[ZLM-HOOK事件-心跳] ID" + event.getMediaServerItem().getId());
online(serverItem, null);
}

View File

@ -238,12 +238,10 @@ export default {
type: 'error'
});
} else {
// that.$message({
// showClose: true,
// message: res.data.msg,
// type: 'success'
// });
this.$refs.syncChannelProgress.openDialog(itemData.deviceId)
this.$refs.syncChannelProgress.openDialog(itemData.deviceId, ()=>{
console.log(32322)
this.initData()
})
}
that.initData()
}).catch((e) => {

View File

@ -339,6 +339,7 @@ export default {
id: 0,
name: "",
deviceId: "",
civilCode: "",
parentDeviceId: node.level > 2 ? node.data.deviceId:"",
parentId: node.data.id,
businessGroup: node.level > 2 ? node.data.businessGroup: node.data.deviceId,

View File

@ -37,20 +37,20 @@
</span>
</vue-easy-tree>
</div>
<regionCode ref="regionCode"></regionCode>
<regionEdit ref="regionEdit"></regionEdit>
<gbDeviceSelect ref="gbDeviceSelect"></gbDeviceSelect>
</div>
</template>
<script>
import VueEasyTree from "@wchbrad/vue-easy-tree";
import regionCode from './../dialog/regionCode'
import regionEdit from './../dialog/regionEdit'
import gbDeviceSelect from './../dialog/GbDeviceSelect'
export default {
name: 'DeviceTree',
components: {
VueEasyTree, regionCode, gbDeviceSelect
VueEasyTree, regionEdit, gbDeviceSelect
},
data() {
return {
@ -336,7 +336,7 @@ export default {
console.log(node)
this.$refs.regionCode.openDialog(form => {
this.$refs.regionEdit.openDialog(form => {
node.loaded = false
node.expand();
}, {
@ -348,7 +348,7 @@ export default {
},
editCatalog: function (data, node){
//
this.$refs.regionCode.openDialog(form => {
this.$refs.regionEdit.openDialog(form => {
node.loaded = false
node.expand();
}, node.data);

View File

@ -27,6 +27,7 @@ export default {
created() {},
data() {
return {
endCallBack: null,
syncStatus: null,
percentage: 0,
total: 0,
@ -40,7 +41,7 @@ export default {
};
},
methods: {
openDialog: function (deviceId) {
openDialog: function (deviceId, endCallBack) {
console.log("deviceId: " + deviceId)
this.deviceId = deviceId;
this.showDialog = true;
@ -50,6 +51,7 @@ export default {
this.current= 0;
this.syncFlag= false;
this.syncStatus = null;
this.endCallBack = endCallBack;
this.getProgress()
},
getProgress(){
@ -105,6 +107,9 @@ export default {
});
},
close: function (){
if (this.endCallBack) {
this.endCallBack()
}
window.clearTimeout(this.timmer)
}
},

View File

@ -1,313 +0,0 @@
<template>
<div id="chooseChannelForCatalog" >
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
<el-tree class="el-scrollbar"
ref="tree"
id="catalogTree"
empty-text="未知节点"
node-key="id"
default-expand-all
:highlight-current="false"
:expand-on-click-node="false"
:props="props"
:load="loadNode"
@node-contextmenu="contextmenuEventHandler"
@node-click="nodeClickHandler"
lazy>
<span class="custom-tree-node" slot-scope="{ node, data }" style="width: 100%">
<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>
<span v-if="node.data.type === -1 && node.level === 1" style="font-size: 12px" class="iconfont icon-ziyuan"></span>
<span v-if="node.data.type === 0 && node.level === 1" class="el-icon-s-home"></span>
<span v-if="node.data.type === 0 && node.level > 1" class="el-icon-folder-opened"></span>
<span v-if="node.data.type === 1" class="iconfont icon-shexiangtou"></span>
<span v-if="node.data.type === 2" class="iconfont icon-zhibo"></span>
<span style=" padding-left: 1px">{{ node.label }}</span>
<span>
<i style="margin-left: 5rem; color: #9d9d9d; padding-right: 20px" v-if="node.data.id === defaultCatalogIdSign"></i>
</span>
</span>
</el-tree>
</div>
<catalogEdit ref="catalogEdit" :platformId="platformId" :platformDeviceId="platformDeviceId"></catalogEdit>
</div>
</template>
<script>
import catalogEdit from './catalogEdit.vue'
export default {
name: 'chooseChannelForCatalog',
props: ['platformId', 'platformDeviceId', 'platformName', 'defaultCatalogId', 'catalogIdChange'],
created() {
this.chooseId = this.defaultCatalogId;
this.defaultCatalogIdSign = this.defaultCatalogId;
this.initData();
setTimeout(()=>{
if (this.catalogIdChange)this.catalogIdChange(this.defaultCatalogId, this.platformName);
}, 100)
},
components: {
catalogEdit,
},
data() {
return {
props: {
label: 'name',
children: 'children',
isLeaf: 'leaf'
},
defaultCatalogIdSign: null,
chooseNode: null,
chooseId: "",
chooseName: "",
catalogTree: null,
contextmenuShow: false
};
},
watch:{
platformId(newData, oldData){
console.log(newData)
this.initData()
},
},
methods: {
initData: function () {
this.getCatalog();
},
getCatalog: function(parentId, callback) {
let that = this;
this.$axios({
method:"get",
url:`/api/platform/catalog`,
params: {
platformId: that.platformId,
parentId: parentId
}
}).then((res)=> {
if (res.data.code === 0) {
if (typeof(callback) === 'function') {
callback(res.data.data)
}
}
})
.catch(function (error) {
console.log(error);
});
},
addCatalog: function (parentId, node){
//
this.$refs.catalogEdit.openDialog(false, null, null, parentId, node.level, ()=>{
node.loaded = false
node.expand();
});
},
refreshCatalog: function (node){
node.loaded = false
node.expand();
},
refreshCatalogById: function (id) {
if (id) {
let node = this.$refs.tree.getNode(id);
this.refreshCatalog(node);
}
},
editCatalog: function (data, node){
//
this.$refs.catalogEdit.openDialog(true, data.id, data.name, data.parentId, node.level, (newData)=>{
node.parent.loaded = false
node.parent.expand();
if (data.id === this.chooseId && newData.name !== data.name) {
if (this.catalogIdChange)this.catalogIdChange(this.chooseId, newData.name);
}
});
},
removeCatalog: function (id, node){
this.$axios({
method:"delete",
url:`/api/platform/catalog/del`,
params: {
id: id,
platformId: this.platformId,
}
}).then((res) => {
if (res.data.code === 0) {
console.log("移除成功")
node.parent.loaded = false
node.parent.expand();
if (res.data.data) {
this.defaultCatalogIdSign = res.data.data;
}
}
})
.catch(function (error) {
console.log(error);
});
},
setDefaultCatalog: function (id){
this.$axios({
method:"post",
url:`/api/platform/catalog/default/update`,
params: {
platformId: this.platformId,
catalogId: id,
}
}).then((res)=> {
if (res.data.code === 0) {
this.defaultCatalogIdSign = id;
}
})
.catch(function (error) {
console.log(error);
});
},
loadNode: function(node, resolve){
console.log("this.platformDeviceId " + this.platformDeviceId)
if (node.level === 0) {
resolve([
{
name: "未分配",
id: null,
type: -1
},{
name: this.platformName,
id: this.platformDeviceId,
type: 0
}
]);
}
if (node.level >= 1){
this.getCatalog(node.data.id, resolve)
}
},
contextmenuEventHandler: function (event,data,node,element){
if (node.data.type !== 0) {
data.parentId = node.parent.data.id;
this.$contextmenu({
items: [
{
label: "移除通道",
icon: "el-icon-delete",
disabled: false,
onClick: () => {
this.$axios({
method:"delete",
url:"/api/platform/catalog/relation/del",
data: data
}).then((res)=>{
console.log("移除成功")
node.parent.loaded = false
node.parent.expand();
}).catch(function (error) {
console.log(error);
});
}
}
],
event, //
customClass: "custom-class", // class
zIndex: 3000, // z-index
});
}else {
this.$contextmenu({
items: [
{
label: "刷新节点",
icon: "el-icon-refresh",
disabled: false,
onClick: () => {
this.refreshCatalog(node);
}
},
{
label: "新建节点",
icon: "el-icon-plus",
disabled: false,
onClick: () => {
this.addCatalog(data.id, node);
}
},
{
label: "修改节点",
icon: "el-icon-edit",
disabled: node.level === 1,
onClick: () => {
this.editCatalog(data, node);
}
},
{
label: "删除节点",
icon: "el-icon-delete",
disabled: node.level === 1,
divided: true,
onClick: () => {
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.removeCatalog(data.id, node)
}).catch(() => {
});
}
},
{
label: "设为默认",
icon: "el-icon-folder-checked",
disabled: node.data.id === this.defaultCatalogIdSign,
onClick: () => {
this.setDefaultCatalog(data.id)
},
},
// {
// label: "",
// icon: "el-icon-download",
// disabled: false,
// children: [
// {
// label: "",
// onClick: () => {
//
// },
// },
// {
// label: "",
// onClick: () => {
//
// },
// }
// ]
// },
],
event, //
customClass: "custom-class", // class
zIndex: 3000, // z-index
});
}
return false;
},
nodeClickHandler: function (data, node, tree){
console.log(data)
console.log(node)
this.chooseId = data.id;
this.chooseName = data.name;
if (this.catalogIdChange)this.catalogIdChange(this.chooseId, this.chooseName);
}
}
};
</script>
<style>
#catalogTree{
display: inline-block;
}
</style>

View File

@ -1,351 +0,0 @@
<template>
<div id="chooseChannelForGb" v-loading="loading">
<div style="font-size: 17px; color: #606060; white-space: nowrap; line-height: 30px; font-family: monospace;">
<span v-if="catalogId == null">{{catalogName}}</span>
<span v-if="catalogId != null">{{catalogName}}({{catalogId}})</span>
</div>
<div style="background-color: #FFFFFF; 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; width:6rem" 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; width:6rem" @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>
<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 size="medium" ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" :height="winHeight" :row-key="(row)=> row.deviceId + row.channelId" @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" :reserve-selection="true" width="55">
</el-table-column>
<el-table-column prop="channelId" label="通道编号" width="180" align="center">
</el-table-column>
<el-table-column prop="name" label="通道名称" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="deviceId" label="设备编号" width="180" align="center">
</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-column label="操作" width="100" align="center" fixed="right">
<template slot-scope="scope">
<el-button-group>
<el-button size="mini" icon="el-icon-plus" v-if="catalogId === null" @click="add(scope.row)"></el-button>
<el-button size="mini" icon="el-icon-delete" v-if="catalogId !== null" type="danger" @click="remove(scope.row)"></el-button>
</el-button-group>
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align: 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">
</el-pagination>
<getCatalog ref="getCatalog" :platformId="platformId" ></getCatalog>
</div>
</template>
<script>
import getCatalog from './getCatalog'
export default {
name: 'chooseChannelForGb',
computed: {
// getPlayerShared: function () {
// return {
// sharedUrl: window.location.host + '/' + this.videoUrl,
// sharedIframe: '<iframe src="' + window.location.host + '/' + this.videoUrl + '"></iframe>',
// sharedRtmp: this.videoUrl
// };
// }
},
props: ['platformId','catalogId', 'catalogName'],
created() {
this.initData();
},
components: {
getCatalog,
},
data() {
return {
loading: false,
gbChannels: [],
gbChoosechannel:{},
searchSrt: "",
channelType: "",
online: "",
choosed: "",
currentPage: 1,
count: 10,
total: 0,
eventEnable: false,
multipleSelection: [],
winHeight: window.innerHeight - 400,
};
},
watch:{
platformId(newData, oldData){
console.log(newData)
this.getChannelList()
},
catalogId(newData, oldData){
this.getChannelList()
},
},
methods: {
initData: function() {
this.getChannelList();
},
currentChange: function (val) {
this.currentPage = val;
this.initData();
},
handleSizeChange: function (val) {
this.count = val;
console.log(val)
this.initData();
},
add: function (row) {
let all = typeof(row) === "undefined"
this.getCatalogFromUser((catalogId)=> {
let task = null;
this.$axios({
method:"post",
url:"/api/platform/update_channel_for_gb",
data:{
platformId: this.platformId,
all: all,
channelReduces: all?[]:[row],
catalogId: catalogId
}
}).then((res)=>{
console.log("保存成功")
window.clearTimeout(task);
this.loading = false;
this.getChannelList();
}).catch((error)=> {
window.clearTimeout(task);
this.loading = false;
console.log(error);
});
task= setTimeout(()=>{
this.loading = true;
}, 200)
})
},
remove: function (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(() => {
});
},
// checkedChange: function (val) {
// let that = this;
// if (!that.eventEnable) {
// return;
// }
// let newData = {};
// let addData = [];
// let delData = [];
// if (val.length > 0) {
// for (let i = 0; i < val.length; i++) {
// const element = val[i];
// let key = element.deviceId + "_" + element.channelId;
// newData[key] = element;
// if (!!!that.gbChoosechannel[key]){
// addData.push(element)
// }else{
// delete that.gbChoosechannel[key]
// }
// }
//
// let oldKeys = Object.keys(that.gbChoosechannel);
// if (oldKeys.length > 0) {
// for (let i = 0; i < oldKeys.length; i++) {
// const key = oldKeys[i];
// delData.push(that.gbChoosechannel[key])
// }
// }
//
// }else{
// let oldKeys = Object.keys(that.gbChoosechannel);
// if (oldKeys.length > 0) {
// for (let i = 0; i < oldKeys.length; i++) {
// const key = oldKeys[i];
// delData.push(that.gbChoosechannel[key])
// }
// }
// }
//
// that.gbChoosechannel = newData;
// if (Object.keys(addData).length >0) {
// that.$axios({
// method:"post",
// url:"/api/platform/update_channel_for_gb",
// data:{
// platformId: that.platformId,
// channelReduces: addData,
// catalogId: that.catalogId
// }
// }).then((res)=>{
// console.log("")
// }).catch(function (error) {
// console.log(error);
// });
// }
// if (delData.length >0) {
// that.$axios({
// method:"delete",
// url:"/api/platform/del_channel_for_gb",
// data:{
// platformId: that.platformId,
// channelReduces: delData
// }
// }).then((res)=>{
// console.log("")
// let nodeIds = new Array();
// for (let i = 0; i < delData.length; i++) {
// nodeIds.push(delData[i].channelId)
// }
// }).catch(function (error) {
// console.log(error);
// });
// }
// },
// shareAllCheckedChange: function (val) {
//
// },
getChannelList: function () {
let that = this;
this.$axios({
method:"get",
url:`/api/platform/channel_list`,
params: {
page: that.currentPage,
count: that.count,
query: that.searchSrt,
online: that.online,
catalogId: that.catalogId,
platformId: that.platformId,
channelType: that.channelType
}
})
.then(function (res) {
if (res.data.code === 0 ) {
that.total = res.data.data.total;
that.gbChannels = res.data.data.list;
that.gbChoosechannel = {};
}
//
that.$nextTick(() => {
that.$refs.gbChannelsTable.doLayout();
that.eventEnable = true;
})
})
.catch(function (error) {
console.log(error);
});
},
search: function() {
this.initData();
},
handleGBSelectionChange: function() {
this.initData();
},
batchDel: function() {
this.$confirm(`确认这${this.multipleSelection.length}个通道吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$axios({
method:"delete",
url:"/api/platform/del_channel_for_gb",
data:{
platformId: this.platformId,
channelReduces: this.multipleSelection
}
}).then((res)=>{
console.log("移除成功")
this.$refs.gbChannelsTable.clearSelection()
this.getChannelList();
}).catch(function (error) {
console.log(error);
});
}).catch(() => {
});
},
batchAdd: function() {
this.getCatalogFromUser((catalogId)=> {
this.$axios({
method: "post",
url: "/api/platform/update_channel_for_gb",
data: {
platformId: this.platformId,
channelReduces: this.multipleSelection,
catalogId: catalogId,
}
}).then((res) => {
console.log("保存成功")
this.$refs.gbChannelsTable.clearSelection()
this.getChannelList();
}).catch(function (error) {
console.log(error);
});
});
},
handleSelectionChange: function (val) {
this.multipleSelection = val;
},
getCatalogFromUser(callback){
this.$refs.getCatalog.openDialog(callback)
},
}
};
</script>
<style>
</style>

View File

@ -1,281 +0,0 @@
<template>
<div id="chooseChannelFoStream" v-loading="loading">
<div style="font-size: 17px; color: #606060; white-space: nowrap; line-height: 30px; font-family: monospace;">
<span v-if="catalogId == null">{{catalogName}}</span>
<span v-if="catalogId != null">{{catalogName}}({{catalogId}})</span>
</div>
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
搜索: <el-input @input="getChannelList" 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="getChannelList" style="margin-right: 1rem;" v-model="mediaServerId" placeholder="请选择" default-first-option>-->
<!-- <el-option label="全部" value=""></el-option>-->
<!-- <el-option-->
<!-- v-for="item in mediaServerList"-->
<!-- :key="item.id"-->
<!-- :label="item.id"-->
<!-- :value="item.id">-->
<!-- </el-option>-->
<!-- </el-select>-->
推流状态: <el-select size="mini" style="margin-right: 1rem;" @change="getChannelList" v-model="pushing" 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>
<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 size="medium" 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">
</el-table-column>
<el-table-column prop="name" label="名称" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="app" label="应用名" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="stream" label="流ID" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="gbId" label="国标编码" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column label="流来源" width="100" align="center">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" v-if="scope.row.streamType == 'proxy'"></el-tag>
<el-tag size="medium" v-if="scope.row.streamType == 'push'"></el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="100" align="center" fixed="right" >
<template slot-scope="scope">
<el-button-group>
<el-button size="mini" icon="el-icon-plus" v-if="catalogId === null" @click="add(scope.row, scope)"></el-button>
<el-button size="mini" icon="el-icon-delete" v-if="catalogId !== null" type="danger" @click="remove(scope.row, scope)"></el-button>
</el-button-group>
</template>
</el-table-column>
</el-table>
<el-pagination style="text-align: 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">
</el-pagination>
<getCatalog ref="getCatalog" :platformId="platformId" ></getCatalog>
</div>
</template>
<script>
import MediaServer from './../service/MediaServer'
import getCatalog from './getCatalog'
export default {
name: 'chooseChannelFoStream',
computed: {
// getPlayerShared: function () {
// return {
// sharedUrl: window.location.host + '/' + this.videoUrl,
// sharedIframe: '<iframe src="' + window.location.host + '/' + this.videoUrl + '"></iframe>',
// sharedRtmp: this.videoUrl
// };
// }
},
props: ['platformId', 'catalogId', 'catalogName'],
created() {
this.initData();
console.log(this.catalogId)
},
components: {
getCatalog,
},
data() {
return {
loading: false,
gbStreams: [],
gbChoosechannel:{},
channelType: "",
online: "",
choosed: "",
currentPage: 1,
count: 10,
total: 0,
searchSrt: "",
pushing: "",
mediaServerId: "",
mediaServerList: [],
mediaServerObj : new MediaServer(),
eventEnable: false,
multipleSelection: [],
winHeight: window.innerHeight - 350,
};
},
watch:{
platformId(newData, oldData){
this.getChannelList()
},
catalogId(newData, oldData){
this.getChannelList()
},
},
methods: {
initData: function() {
this.mediaServerObj.getOnlineMediaServerList((data)=>{
this.mediaServerList = data.data;
})
this.getChannelList();
},
currentChange: function (val) {
this.currentPage = val;
this.getChannelList();
},
handleSizeChange: function (val) {
this.count = val;
console.log(val)
this.getChannelList();
},
add: function (row, scope) {
let all = typeof(row) === "undefined"
this.getCatalogFromUser((catalogId)=>{
let task = null;
this.$axios({
method:"post",
url:"/api/gbStream/add",
data:{
platformId: this.platformId,
catalogId: catalogId,
all: all,
gbStreams: all?[]:[row],
}
}).then((res)=>{
console.log("保存成功")
window.clearTimeout(task);
this.loading = false;
// this.gbStreams.splice(scope.$index,1)
this.getChannelList();
}).catch(function (error) {
window.clearTimeout(task);
this.loading = false;
console.log(error);
});
task= setTimeout(()=>{
this.loading = true;
}, 200)
})
},
remove: function (row, scope) {
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;
this.$axios({
method: 'get',
url:`/api/gbStream/list`,
params: {
page: that.currentPage,
count: that.count,
query: that.searchSrt,
platformId: that.platformId,
catalogId: that.catalogId,
mediaServerId: that.mediaServerId
}
})
.then(function (res) {
if (res.data.code === 0) {
that.total = res.data.data.total;
that.gbStreams = res.data.data.list;
that.gbChoosechannel = {};
//
that.$nextTick(() => {
that.$refs.gbStreamsTable.doLayout();
//
that.eventEnable = true;
})
}
})
.catch(function (error) {
console.log(error);
});
},
batchDel: function() {
this.$confirm(`确认这${this.multipleSelection.length}个通道吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$axios({
method:"delete",
url:"/api/gbStream/del",
data:{
platformId: this.platformId,
gbStreams: this.multipleSelection,
}
}).then((res)=>{
console.log("移除成功")
this.$refs.gbStreamsTable.clearSelection()
this.getChannelList();
}).catch(function (error) {
console.log(error);
});
}).catch(() => {
});
},
batchAdd: function() {
this.getCatalogFromUser((catalogId)=>{
this.$axios({
method:"post",
url:"/api/gbStream/add",
data:{
platformId: this.platformId,
catalogId: catalogId,
gbStreams: this.multipleSelection,
}
}).then((res)=>{
console.log("保存成功")
this.$refs.gbStreamsTable.clearSelection()
this.getChannelList();
}).catch(function (error) {
console.log(error);
});
})
},
getCatalogFromUser(callback){
this.$refs.getCatalog.openDialog(callback)
},
handleSelectionChange: function (val) {
this.multipleSelection = val;
},
}
};
</script>
<style>
</style>

View File

@ -1,167 +0,0 @@
<template>
<div id="getCatalog" >
<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>
<div>
<el-tree class="el-scrollbar"
ref="tree"
id="catalogTree"
empty-text="未知节点"
node-key="id"
default-expand-all
:highlight-current="false"
:expand-on-click-node="false"
:props="props"
:load="loadNode"
@node-click="nodeClickHandler"
lazy>
<span class="custom-tree-node" slot-scope="{ node, data }" style="width: 100%">
<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>
<span v-if="node.data.type === -1 && node.level === 1" style="font-size: 12px" class="iconfont icon-ziyuan"></span>
<span v-if="node.data.type === 0 && node.level === 1" class="el-icon-s-home"></span>
<span v-if="node.data.type === 0 && node.level > 1" class="el-icon-folder-opened"></span>
<span v-if="node.data.type === 1" class="iconfont icon-shexiangtou"></span>
<span v-if="node.data.type === 2" class="iconfont icon-zhibo"></span>
<span style=" padding-left: 1px">{{ node.label }}</span>
<span>
<i style="margin-left: 5rem; color: #9d9d9d; padding-right: 20px" v-if="node.data.id === defaultCatalogIdSign"></i>
</span>
</span>
</el-tree>
</div>
<div style="float: right; height: 13rem">
<el-button type="primary" size="mini" @click="submit()" >确认</el-button>
<el-button @click="close()" size="mini">取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'getCatalog',
beforeCreate(){
},
created() {
this.chooseId = this.defaultCatalogId;
this.defaultCatalogIdSign = this.defaultCatalogId;
this.initData();
setTimeout(()=>{
if (this.catalogIdChange)this.catalogIdChange(this.defaultCatalogId);
}, 100)
},
props: ['platformId'],
data() {
return {
props: {
label: 'name',
children: 'children',
isLeaf: 'leaf'
},
platformName: null,
defaultCatalogId: null,
catalogIdResult: null,
showDialog: false,
defaultCatalogIdSign: null,
chooseNode: null,
chooseId: "",
catalogTree: null,
contextmenuShow: false,
};
},
methods: {
openDialog(catalogIdResult) {
console.log(this.chooseId)
this.showDialog = true
this.catalogIdResult = catalogIdResult
},
initData: function () {
this.getCatalog();
},
getCatalog: function(parentId, callback) {
let that = this;
this.$axios({
method:"get",
url:`/api/platform/catalog`,
params: {
platformId: that.platformId,
parentId: parentId
}
})
.then((res)=> {
if (res.data.code === 0) {
if (typeof(callback) === 'function') {
callback(res.data.data)
}
}
})
.catch(function (error) {
console.log(error);
});
},
loadNode: function(node, resolve){
if (node.level === 0) {
this.$axios({
method:"get",
url:`/api/platform/info/` + this.platformId,
})
.then((res)=> {
if (res.data.code === 0) {
this.platformName = res.data.data.name;
this.defaultCatalogId = res.data.data.catalogId;
this.defaultCatalogIdSign = res.data.data.catalogId;
this.chooseId = res.data.data.catalogId;
resolve([
{
name: this.platformName,
id: res.data.data.deviceGBId,
type: 0
}
]);
}
})
.catch(function (error) {
console.log(error);
});
}
if (node.level >= 1){
this.getCatalog(node.data.id, resolve)
}
},
nodeClickHandler: function (data, node, tree){
this.chooseId = data.id;
},
close: function() {
this.chooseId = null;
this.showDialog = false;
},
submit: function() {
console.log(this.chooseId)
if (this.chooseId === null) {
this.$message({
showClose: true,
message: '未选择任何节点,',
type: 'warning'
});
return;
}
if (this.catalogIdResult)this.catalogIdResult(this.chooseId)
this.showDialog = false;
},
}
};
</script>
<style>
#catalogTree{
display: inline-block;
}
</style>

View File

@ -20,6 +20,11 @@
<el-form-item label="节点名称" prop="name">
<el-input v-model="group.name" clearable></el-input>
</el-form-item>
<el-form-item label="行政区划" prop="name">
<el-input v-model="group.civilCode" >
<el-button slot="append" @click="buildCivilCode(group.civilCode)"></el-button>
</el-input>
</el-form-item>
<el-form-item>
<div style="float: right;">
@ -32,15 +37,17 @@
</div>
</el-dialog>
<channelCode ref="channelCode"></channelCode>
<regionCode ref="regionCode"></regionCode>
</div>
</template>
<script>
import channelCode from "./channelCode.vue";
import regionCode from "./regionCode.vue";
export default {
name: "groupEdit",
components: {channelCode},
components: {channelCode, regionCode},
computed: {},
props: [],
created() {},
@ -56,6 +63,7 @@ export default {
name: "",
parentDeviceId: "",
businessGroup: "",
civilCode: "",
platformId: "",
},
@ -107,6 +115,13 @@ export default {
this.group.deviceId = code;
}, deviceId, 5 , lockContent);
},
buildCivilCode: function (deviceId){
this.$refs.regionCode.openDialog(code=>{
console.log("2222")
console.log(code)
this.group.civilCode = code;
}, deviceId)
},
close: function () {
this.showDialog = false;
console.log(this.group)

View File

@ -60,13 +60,8 @@
</el-input>
</el-tab-pane>
</el-tabs>
<el-form ref="form" style=" display: grid; padding: 1rem 2rem 0 2rem;grid-template-columns: 1fr 1fr 1fr; gap: 1rem;">
<el-form-item label="名称" prop="name" size="mini" >
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="编号" prop="deviceId" size="mini" >
<el-input v-model="form.deviceId" autocomplete="off"></el-input>
</el-form-item>
<el-form style="">
<el-form-item style="margin-top: 22px; margin-bottom: 0;">
<div style="float:right;">
<el-button type="primary" @click="handleOk"></el-button>
@ -86,11 +81,6 @@ export default {
return {
showVideoDialog: false,
activeKey: '0',
form: {
name: "",
deviceId: "",
parentId: ""
},
allVal: [
{
id: [1, 2],
@ -129,11 +119,10 @@ export default {
};
},
methods: {
openDialog: function (endCallBck, region, code, lockContent) {
openDialog: function (endCallBck, code, lockContent) {
this.showVideoDialog = true
this.activeKey= '0';
this.regionList = []
this.form = region
this.allVal = [
{
id: [1, 2],
@ -164,38 +153,23 @@ export default {
lock: false,
}
]
if (this.form.deviceId) {
if (this.form.deviceId.length >= 2) {
this.allVal[0].val = this.form.deviceId.substring(0, 2)
if (code) {
if (code.length >= 2) {
this.allVal[0].val = code.substring(0, 2)
this.activeKey = "0"
}
if (this.form.deviceId.length >= 4) {
this.allVal[1].val = this.form.deviceId.substring(2, 4)
if (code.length >= 4) {
this.allVal[1].val = code.substring(2, 4)
this.activeKey = "1"
}
if (this.form.deviceId.length >= 6) {
this.allVal[2].val = this.form.deviceId.substring(4, 6)
if (code.length >= 6) {
this.allVal[2].val = code.substring(4, 6)
this.activeKey = "2"
}
if (this.form.deviceId.length === 8) {
this.allVal[3].val = this.form.deviceId.substring(6, 8)
if (code.length === 8) {
this.allVal[3].val = code.substring(6, 8)
this.activeKey = "3"
}
}else {
if (this.form.parentDeviceId) {
if (this.form.parentDeviceId.length >= 2) {
this.allVal[0].val = this.form.parentDeviceId.substring(0, 2)
this.activeKey = "1"
}
if (this.form.parentDeviceId.length >= 4) {
this.allVal[1].val = this.form.parentDeviceId.substring(2, 4)
this.activeKey = "2"
}
if (this.form.parentDeviceId.length >= 6) {
this.allVal[2].val = this.form.parentDeviceId.substring(4, 6)
this.activeKey = "3"
}
}
}
this.getRegionList()
@ -256,6 +230,18 @@ export default {
});
});
},
handleOk: function (){
const code =
this.allVal[0].val +
this.allVal[1].val +
this.allVal[2].val +
this.allVal[3].val
console.log(code)
if (this.endCallBck) {
this.endCallBck(code)
}
this.showVideoDialog = false
},
closeModel: function (){
this.showVideoDialog = false
},
@ -276,63 +262,7 @@ export default {
this.allVal[2].val = ""
this.allVal[3].val = ""
}
this.form.deviceId = code
if (item) {
this.form.name = item.name
}
},
handleOk: function() {
if (this.form.id) {
this.$axios({
method: 'post',
url: "/api/region/update",
data: this.form
}).then((res) => {
if (res.data.code === 0) {
if (typeof this.endCallBck == "function") {
this.endCallBck(this.form)
}
this.showVideoDialog = false
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
});
});
}else {
this.$axios({
method: 'post',
url: "/api/region/add",
data: this.form
}).then((res) => {
if (res.data.code === 0) {
if (typeof this.endCallBck == "function") {
this.endCallBck(this.form)
}
this.showVideoDialog = false
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
});
});
}
}
},
};
</script>

View File

@ -0,0 +1,345 @@
<template>
<el-dialog
title="生成行政区划编码"
width="65rem"
top="2rem"
center
:close-on-click-modal="false"
:visible.sync="showVideoDialog"
:destroy-on-close="false"
>
<el-tabs v-model="activeKey" style="padding: 0 1rem; margin: auto 0" @tab-click="getRegionList">
<el-tab-pane name="0" >
<div slot="label" >
<div class="show-code-item">{{ allVal[0].val }}</div>
<div style="text-align: center">{{ allVal[0].meaning }}</div>
</div>
<el-radio v-for="item in regionList" v-model="allVal[0].val" :key="item.deviceId" :name="item.name" :label="item.deviceId" @input="deviceChange(item)" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId }}
</el-radio>
</el-tab-pane>
<el-tab-pane name="1">
<div slot="label">
<div class="show-code-item">{{ allVal[1].val?allVal[1].val:"--" }}</div>
<div style="text-align: center">{{ allVal[1].meaning }}</div>
</div>
<el-radio :key="-1" v-model="allVal[1].val" @input="deviceChange" label="" style="line-height: 2rem">
不添加
</el-radio>
<el-radio v-for="item in regionList" v-model="allVal[1].val" @input="deviceChange(item)" :key="item.deviceId" :label="item.deviceId.substring(2)" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId.substring(2) }}
</el-radio>
</el-tab-pane>
<el-tab-pane name="2">
<div slot="label">
<div class="show-code-item">{{ allVal[2].val?allVal[2].val:"--" }}</div>
<div style="text-align: center">{{ allVal[2].meaning }}</div>
</div>
<el-radio :key="-1" label="" v-model="allVal[2].val" style="line-height: 2rem" @input="deviceChange">
不添加
</el-radio>
<el-radio v-for="item in regionList" v-model="allVal[2].val" @input="deviceChange(item)" :key="item.deviceId" :label="item.deviceId.substring(4)" style="line-height: 2rem">
{{ item.name }} - {{ item.deviceId.substring(4) }}
</el-radio>
</el-tab-pane>
<el-tab-pane name="3">
请手动输入基层接入单位编码,两位数字
<div slot="label">
<div class="show-code-item">{{ allVal[3].val?allVal[3].val:"--" }}</div>
<div style="text-align: center">{{ allVal[3].meaning }}</div>
</div>
<el-input
type="text"
placeholder="请输入内容"
v-model="allVal[3].val"
maxlength="2"
:disabled="allVal[3].lock"
show-word-limit
@input="deviceChange"
>
</el-input>
</el-tab-pane>
</el-tabs>
<el-form ref="form" style=" display: grid; padding: 1rem 2rem 0 2rem;grid-template-columns: 1fr 1fr 1fr; gap: 1rem;">
<el-form-item label="名称" prop="name" size="mini" >
<el-input v-model="form.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="编号" prop="deviceId" size="mini" >
<el-input v-model="form.deviceId" autocomplete="off"></el-input>
</el-form-item>
<el-form-item style="margin-top: 22px; margin-bottom: 0;">
<div style="float:right;">
<el-button type="primary" @click="handleOk"></el-button>
<el-button @click="closeModel"></el-button>
</div>
</el-form-item>
</el-form>
</el-dialog>
</template>
<script>
export default {
props: {},
computed: {},
data() {
return {
showVideoDialog: false,
activeKey: '0',
form: {
name: "",
deviceId: "",
parentId: ""
},
allVal: [
{
id: [1, 2],
meaning: '省级编码',
val: '11',
type: '中心编码',
lock: false,
},
{
id: [3, 4],
meaning: '市级编码',
val: '',
type: '中心编码',
lock: false,
},
{
id: [5, 6],
meaning: '区级编码',
val: '',
type: '中心编码',
lock: false,
},
{
id: [7, 8],
meaning: '基层接入单位编码',
val: '',
type: '中心编码',
lock: false,
}
],
regionList: [],
deviceTypeList: [],
industryCodeTypeList: [],
networkIdentificationTypeList: [],
endCallBck: null,
};
},
methods: {
openDialog: function (endCallBck, region, code, lockContent) {
this.showVideoDialog = true
this.activeKey= '0';
this.regionList = []
this.form = region
this.allVal = [
{
id: [1, 2],
meaning: '省级编码',
val: '11',
type: '中心编码',
lock: false,
},
{
id: [3, 4],
meaning: '市级编码',
val: '',
type: '中心编码',
lock: false,
},
{
id: [5, 6],
meaning: '区级编码',
val: '',
type: '中心编码',
lock: false,
},
{
id: [7, 8],
meaning: '基层接入单位编码',
val: '',
type: '中心编码',
lock: false,
}
]
if (this.form.deviceId) {
if (this.form.deviceId.length >= 2) {
this.allVal[0].val = this.form.deviceId.substring(0, 2)
this.activeKey = "0"
}
if (this.form.deviceId.length >= 4) {
this.allVal[1].val = this.form.deviceId.substring(2, 4)
this.activeKey = "1"
}
if (this.form.deviceId.length >= 6) {
this.allVal[2].val = this.form.deviceId.substring(4, 6)
this.activeKey = "2"
}
if (this.form.deviceId.length === 8) {
this.allVal[3].val = this.form.deviceId.substring(6, 8)
this.activeKey = "3"
}
}else {
if (this.form.parentDeviceId) {
if (this.form.parentDeviceId.length >= 2) {
this.allVal[0].val = this.form.parentDeviceId.substring(0, 2)
this.activeKey = "1"
}
if (this.form.parentDeviceId.length >= 4) {
this.allVal[1].val = this.form.parentDeviceId.substring(2, 4)
this.activeKey = "2"
}
if (this.form.parentDeviceId.length >= 6) {
this.allVal[2].val = this.form.parentDeviceId.substring(4, 6)
this.activeKey = "3"
}
}
}
this.getRegionList()
this.endCallBck = endCallBck;
},
getRegionList: function() {
console.log("getRegionList")
if (this.activeKey === '0' ) {
this.queryChildList();
}else if (this.activeKey === '1' || this.activeKey === '2') {
let parent = ''
if (this.activeKey === '1') {
parent = this.allVal[0].val
}
if (this.activeKey === '2') {
if (this.allVal[1].val === ""){
parent = ""
} else {
parent = this.allVal[0].val + this.allVal[1].val
}
}
if (this.activeKey !== '0' && parent === '') {
this.$message.error({
showClose: true,
message: "请先选择上级行政区划"
})
}
if (parent !== "") {
this.queryChildList(parent);
}else {
this.regionList = []
}
}
},
queryChildList: function(parent){
console.log("queryChildList")
this.regionList = []
this.$axios({
method: 'get',
url: "/api/region/base/child/list",
params: {
parent: parent,
}
}).then((res) => {
if (res.data.code === 0) {
this.regionList = res.data.data
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
});
});
},
closeModel: function (){
this.showVideoDialog = false
},
deviceChange: function (item){
console.log(item)
let code = this.allVal[0].val
if (this.allVal[1].val) {
code += this.allVal[1].val
if (this.allVal[2].val) {
code += this.allVal[2].val
if (this.allVal[3].val) {
code += this.allVal[3].val
}
}else {
this.allVal[3].val = ""
}
}else {
this.allVal[2].val = ""
this.allVal[3].val = ""
}
this.form.deviceId = code
if (item) {
this.form.name = item.name
}
},
handleOk: function() {
if (this.form.id) {
this.$axios({
method: 'post',
url: "/api/region/update",
data: this.form
}).then((res) => {
if (res.data.code === 0) {
if (typeof this.endCallBck == "function") {
this.endCallBck(this.form)
}
this.showVideoDialog = false
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
});
});
}else {
this.$axios({
method: 'post',
url: "/api/region/add",
data: this.form
}).then((res) => {
if (res.data.code === 0) {
if (typeof this.endCallBck == "function") {
this.endCallBck(this.form)
}
this.showVideoDialog = false
} else {
this.$message.error({
showClose: true,
message: res.data.msg
})
}
}).catch((error) => {
this.$message.error({
showClose: true,
message: error
});
});
}
}
},
};
</script>
<style>
.show-code-item {
text-align: center;
font-size: 3rem;
}
</style>

View File

@ -145,7 +145,7 @@ create table wvp_device_channel
has_audio bool default false,
gps_time character varying(50),
stream_identification character varying(50),
channel_type int default 0 not null,
channel_type int default 0 not null,
gb_device_id character varying(50),
gb_name character varying(255),
gb_manufacturer character varying(255),
@ -462,6 +462,7 @@ CREATE TABLE wvp_common_group
business_group varchar(50) NOT NULL,
create_time varchar(50) NOT NULL,
update_time varchar(50) NOT NULL,
civil_code varchar(50) default null,
UNIQUE KEY common_group_device_platform (device_id)
);