合并主分支

This commit is contained in:
648540858
2022-01-13 16:39:32 +08:00
70 changed files with 2811 additions and 14551 deletions

View File

@@ -138,7 +138,7 @@ export default {
});
},
chooseChannel: function(platform) {
this.$refs.chooseChannelDialog.openDialog(platform.serverGBId, this.initData)
this.$refs.chooseChannelDialog.openDialog(platform.serverGBId, platform.name, platform.catalogId, this.initData)
},
initData: function() {
this.getPlatformList();

View File

@@ -0,0 +1,101 @@
<template>
<div id="catalogEdit" v-loading="isLoging">
<el-dialog
title="节点编辑"
width="40%"
top="2rem"
:append-to-body="true"
:close-on-click-modal="false"
:visible.sync="showDialog"
:destroy-on-close="true"
@close="close()"
>
<div id="shared" style="margin-top: 1rem;margin-right: 100px;">
<el-form ref="form" :rules="rules" :model="form" label-width="140px" >
<el-form-item label="节点编号" prop="id" >
<el-input v-model="form.id" :disabled="isEdit"></el-input>
</el-form-item>
<el-form-item label="节点名称" prop="name">
<el-input v-model="form.name" clearable></el-input>
</el-form-item>
<el-form-item>
<div style="float: right;">
<el-button type="primary" @click="onSubmit" >确认</el-button>
<el-button @click="close">取消</el-button>
</div>
</el-form-item>
</el-form>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: "catalogEdit",
computed: {},
props: ['platformId'],
created() {},
data() {
return {
submitCallback: null,
showDialog: false,
isLoging: false,
isEdit: false,
form: {
id: null,
name: null,
platformId: null,
parentId: null,
},
rules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
id: [{ required: true, message: "请输入id", trigger: "blur" }]
},
};
},
methods: {
openDialog: function (isEdit, id, name, parentId, callback) {
console.log("parentId: " + parentId)
this.isEdit = isEdit;
this.form.id = id;
this.form.name = name;
this.form.platformId = this.platformId;
this.form.parentId = parentId;
this.showDialog = true;
this.submitCallback = callback;
},
onSubmit: function () {
console.log("onSubmit");
console.log(this.form);
this.$axios({
method:"post",
url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`,
data: this.form
})
.then((res)=> {
if (res.data.code === 0) {
console.log("添加/修改成功")
if (this.submitCallback)this.submitCallback()
}else {
this.$message({
showClose: true,
message: res.data.msg,
type: "error",
});
}
this.close();
})
.catch((error)=> {
console.log(error);
});
},
close: function () {
this.showDialog = false;
this.$refs.form.resetFields();
},
},
};
</script>

View File

@@ -1,25 +1,40 @@
<template>
<div id="chooseChannel" v-loading="isLoging">
<el-dialog title="选择通道" v-if="showDialog" top="2rem" width="70%" :close-on-click-modal="false" :visible.sync="showDialog" :destroy-on-close="true" @close="close()">
<el-tabs v-model="tabActiveName" >
<el-dialog title="选择通道" v-if="showDialog" top="2rem" width="90%" :close-on-click-modal="false" :visible.sync="showDialog" :destroy-on-close="true" @close="close()">
<el-row>
<el-col :span="10">
<el-tabs v-model="catalogTabActiveName" >
<el-tab-pane label="目录结构" name="catalog">
<el-container>
<el-main style="background-color: #FFF;">
<chooseChannelForCatalog ref="chooseChannelForCatalog" :platformId=platformId :platformName=platformName :defaultCatalogId=defaultCatalogId :catalogIdChange="catalogIdChange"></chooseChannelForCatalog>
</el-main>
</el-container>
</el-tab-pane>
</el-tabs>
</el-col>
<el-col :span="14">
<el-tabs v-model="tabActiveName" @tab-click="tabClick">
<el-tab-pane label="国标通道" name="gbChannel">
<el-container>
<el-main style="background-color: #FFF;">
<chooseChannelForGb :platformId=platformId ></chooseChannelForGb>
</el-main>
</el-container>
<el-container>
<el-main style="background-color: #FFF;">
<chooseChannelForGb ref="chooseChannelForGb" :platformId=platformId :updateChoosedCallback="updateChooseChannelCallback"></chooseChannelForGb>
</el-main>
</el-container>
</el-tab-pane>
<el-tab-pane label="直播流通道" name="streamchannel">
<el-container>
<el-main style="background-color: #FFF;">
<chooseChannelFoStream :platformId=platformId ></chooseChannelFoStream>
</el-main>
</el-container>
<el-container>
<el-main style="background-color: #FFF;">
<chooseChannelFoStream ref="chooseChannelFoStream" :platformId=platformId :updateChoosedCallback="updateChooseChannelCallback"></chooseChannelFoStream>
</el-main>
</el-container>
</el-tab-pane>
</el-tabs>
</el-tabs>
</el-col>
</el-row>
</el-dialog>
</div>
</template>
@@ -27,12 +42,14 @@
<script>
import chooseChannelForGb from '../dialog/chooseChannelForGb.vue'
import chooseChannelFoStream from '../dialog/chooseChannelForStream.vue'
import chooseChannelForCatalog from '../dialog/chooseChannelForCatalog.vue'
export default {
name: 'chooseChannel',
props: {},
components: {
chooseChannelForGb,
chooseChannelFoStream,
chooseChannelForCatalog,
},
computed: {
// getPlayerShared: function () {
@@ -47,20 +64,35 @@ export default {
return {
isLoging: false,
tabActiveName: "gbChannel",
catalogTabActiveName: "catalog",
platformId: "",
isLoging: false,
catalogId: "",
platformName: "",
defaultCatalogId: "",
showDialog: false,
chooseData: {}
};
},
methods: {
openDialog: function (platformId, closeCallback) {
console.log(platformId)
openDialog(platformId, platformName, defaultCatalogId, closeCallback) {
this.platformId = platformId
this.platformName = platformName
this.defaultCatalogId = defaultCatalogId
this.showDialog = true
this.closeCallback = closeCallback
},
tabClick (tab, event){
console.log(tab.label)
if (tab.label === "gbChannel") {
this.$refs.chooseChannelForGb.catalogIdChange(this.catalogId);
this.$refs.chooseChannelForGb.initData();
}else {
this.$refs.chooseChannelFoStream.catalogIdChange(this.catalogId);
this.$refs.chooseChannelFoStream.initData();
}
},
close: function() {
this.closeCallback()
},
@@ -88,6 +120,21 @@ export default {
}).catch(function (error) {
console.log(error);
});
},
catalogIdChange: function (id) {
console.log("中间模块收到: " + id)
this.catalogId = id;
if (this.tabActiveName === "gbChannel") {
this.$refs.chooseChannelForGb.catalogIdChange(id);
}else {
this.$refs.chooseChannelFoStream.catalogIdChange(id);
}
},
updateChooseChannelCallback (id, nodeIds){
console.log("中间模块收到选择通道变化: " + id)
console.log("中间模块收到选择通道变化: " + nodeIds)
console.log("中间模块收到选择通道变化: " + typeof (nodeIds))
this.$refs.chooseChannelForCatalog.refreshCatalogById(id, nodeIds)
}
}
};

View File

@@ -0,0 +1,311 @@
<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="true"
:expand-on-click-node="false"
:props="props"
:load="loadNode"
@node-contextmenu="contextmenuEventHandler"
lazy>
<span class="custom-tree-node" slot-scope="{ node, data }" style="width: 100%">
<el-radio v-if="node.data.type === 0" style="margin-right: 0" v-model="chooseId" :label="node.data.id">{{''}}</el-radio>
<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 === defaultCatalogId">默认</i>
</span>
</span>
</el-tree>
</div>
<catalogEdit ref="catalogEdit" :platformId="platformId"></catalogEdit>
</div>
</template>
<script>
import catalogEdit from './catalogEdit.vue'
export default {
name: 'chooseChannelForCatalog',
props: ['platformId', 'platformName', 'defaultCatalogId', 'catalogIdChange'],
created() {
this.initData();
setTimeout(()=>{
if (this.catalogIdChange)this.catalogIdChange(this.defaultCatalogId);
}, 100)
},
components: {
catalogEdit,
},
data() {
return {
props: {
label: 'name',
children: 'children',
isLeaf: 'leaf'
},
chooseNode: null,
chooseId: this.defaultCatalogId,
catalogTree: null,
contextmenuShow: false
};
},
watch:{
platformId(newData, oldData){
console.log(newData)
this.initData()
},
chooseId(newData, oldData){
console.log("发送: " + newData)
if (this.catalogIdChange)this.catalogIdChange(newData);
},
},
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)
}
//
// if (typeof (this.$refs.tree.setCurrentKey) == "undefined") {
// this.$refs.tree.setCurrentKey(this.defaultCatalogId)
// let data = this.$refs.tree.getCurrentNode()
// if (data != null && data.id === this.defaultCatalogId) {
// this.currentCatalogChange(data, this.$refs.tree.getNode(data.id))
// }
// }
}
})
.catch(function (error) {
console.log(error);
});
},
addCatalog: function (parentId, node){
let that = this;
// 打开添加弹窗
that.$refs.catalogEdit.openDialog(false, null, null, parentId, ()=>{
node.loaded = false
node.expand();
});
},
refreshCatalog: function (node){
node.loaded = false
node.expand();
},
refreshCatalogById: function (id, nodeIds) {
if (id) {
console.log("refreshCatalogById: " + id)
let node = this.$refs.tree.getNode(id);
console.log(node)
this.refreshCatalog(node);
}
if (nodeIds !== null) {
let refreshNode = {}
for (let i = 0; i < nodeIds.length; i++) {
let node = this.$refs.tree.getNode(nodeIds[i]);
refreshNode[node.parent.data.id] = node.parent
}
if (Object.values(refreshNode).length > 0) {
for (let j = 0; j < Object.values(refreshNode).length; j++) {
this.refreshCatalog(Object.values(refreshNode)[j]);
}
}
}
},
editCatalog: function (data, node){
let that = this;
// 打开添加弹窗
that.$refs.catalogEdit.openDialog(true, data.id, data.name, data.parentId, (data)=>{
node.parent.loaded = false
node.parent.expand();
});
},
removeCatalog: function (id, node){
this.$axios({
method:"delete",
url:`/api/platform/catalog/del`,
params: {
id: id,
}
})
.then((res) => {
if (res.data.code === 0) {
console.log("移除成功")
node.parent.loaded = false
node.parent.expand();
}
})
.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.defaultCatalogId = id;
}
})
.catch(function (error) {
console.log(error);
});
},
loadNode: function(node, resolve){
if (node.level === 0) {
resolve([{
name: this.platformName,
id: this.platformId,
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.removeCatalog(data.id, node)
}
},
{
label: "设为默认",
icon: "el-icon-folder-checked",
disabled: node.data.id === this.defaultCatalogId,
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;
},
}
};
</script>
<style>
#catalogTree{
display: inline-block;
}
</style>

View File

@@ -21,9 +21,9 @@
<el-option label="离线" value="false"></el-option>
</el-select>
<el-checkbox @change="shareAllCheckedChanage">全部共享</el-checkbox>
<el-checkbox @change="shareAllCheckedChange">全部共享</el-checkbox>
</div>
<el-table ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" @selection-change="checkedChanage" >
<el-table ref="gbChannelsTable" :data="gbChannels" border style="width: 100%" @selection-change="checkedChange" >
<el-table-column type="selection" width="55" align="center" fixed > </el-table-column>
<el-table-column prop="channelId" label="通道编号" width="210">
</el-table-column>
@@ -49,7 +49,6 @@
<script>
export default {
name: 'chooseChannelForGb',
props: {},
computed: {
// getPlayerShared: function () {
// return {
@@ -59,7 +58,7 @@ export default {
// };
// }
},
props: ['platformId'],
props: ['platformId', 'updateChoosedCallback'],
created() {
this.initData();
},
@@ -71,6 +70,7 @@ export default {
channelType: "",
online: "",
choosed: "",
catalogId: null,
currentPage: 1,
count: 10,
total: 0,
@@ -97,28 +97,28 @@ export default {
this.count = val;
console.log(val)
this.initData();
},
rowcheckedChanage: function (val, row) {
rowcheckedChange: function (val, row) {
console.log(val)
console.log(row)
},
checkedChanage: function (val) {
var that = this;
// selectDisable: function (){
// if (this.catalogId == null) {
// return false;
// }
// },
checkedChange: function (val) {
let that = this;
if (!that.eventEnanle) {
return;
}
var tabelData = JSON.parse(JSON.stringify(this.$refs.gbChannelsTable.data));
console.log("checkedChanage")
console.log(val)
var newData = {};
var addData = [];
var delData = [];
let newData = {};
let addData = [];
let delData = [];
if (val.length > 0) {
for (let i = 0; i < val.length; i++) {
const element = val[i];
var key = element.deviceId + "_" + element.channelId;
let key = element.deviceId + "_" + element.channelId;
newData[key] = element;
if (!!!that.gbChoosechannel[key]){
addData.push(element)
@@ -127,7 +127,7 @@ export default {
}
}
var oldKeys = Object.keys(that.gbChoosechannel);
let oldKeys = Object.keys(that.gbChoosechannel);
if (oldKeys.length > 0) {
for (let i = 0; i < oldKeys.length; i++) {
const key = oldKeys[i];
@@ -136,7 +136,7 @@ export default {
}
}else{
var oldKeys = Object.keys(that.gbChoosechannel);
let oldKeys = Object.keys(that.gbChoosechannel);
if (oldKeys.length > 0) {
for (let i = 0; i < oldKeys.length; i++) {
const key = oldKeys[i];
@@ -152,15 +152,17 @@ export default {
url:"/api/platform/update_channel_for_gb",
data:{
platformId: that.platformId,
channelReduces: addData
channelReduces: addData,
catalogId: that.catalogId
}
}).then((res)=>{
console.log("保存成功")
if(that.updateChoosedCallback)that.updateChoosedCallback(that.catalogId)
}).catch(function (error) {
console.log(error);
});
}
if (Object.keys(delData).length >0) {
if (delData.length >0) {
that.$axios({
method:"delete",
url:"/api/platform/del_channel_for_gb",
@@ -170,13 +172,18 @@ export default {
}
}).then((res)=>{
console.log("移除成功")
let nodeIds = new Array();
for (let i = 0; i < delData.length; i++) {
nodeIds.push(delData[i].channelId)
}
if(that.updateChoosedCallback)that.updateChoosedCallback(null, nodeIds)
}).catch(function (error) {
console.log(error);
});
}
},
shareAllCheckedChanage: function (val) {
shareAllCheckedChange: function (val) {
this.chooseChanage(null, val)
},
getChannelList: function () {
@@ -215,7 +222,7 @@ export default {
}
}
that.eventEnanle = true;
// that.checkedChanage(chooseGBS)
// that.checkedChange(chooseGBS)
})
console.log(that.gbChoosechannel)
})
@@ -230,6 +237,10 @@ export default {
handleGBSelectionChange: function() {
this.initData();
},
catalogIdChange: function(id) {
this.catalogId = id;
console.log("通道选择模块收到: " + id)
},
}
};
</script>

View File

@@ -27,7 +27,6 @@
<script>
export default {
name: 'chooseChannelFoStream',
props: {},
computed: {
// getPlayerShared: function () {
// return {
@@ -37,7 +36,7 @@ export default {
// };
// }
},
props: ['platformId'],
props: ['platformId', 'updateChoosedCallback'],
created() {
this.initData();
},
@@ -49,6 +48,7 @@ export default {
channelType: "",
online: "",
choosed: "",
catalogId: null,
currentPage: 1,
count: 10,
total: 0,
@@ -131,10 +131,12 @@ export default {
url:"/api/gbStream/add",
data:{
platformId: that.platformId,
catalogId: that.catalogId,
gbStreams: addData,
}
}).then((res)=>{
console.log("保存成功")
if(this.updateChoosedCallback)this.updateChoosedCallback(this.catalogId)
}).catch(function (error) {
console.log(error);
});
@@ -149,6 +151,7 @@ export default {
}
}).then((res)=>{
console.log("移除成功")
if(this.updateChoosedCallback)this.updateChoosedCallback(this.catalogId)
}).catch(function (error) {
console.log(error);
});
@@ -207,6 +210,10 @@ export default {
handleGBSelectionChange: function() {
this.initData();
},
catalogIdChange: function(id) {
this.catalogId = id;
console.log("直播通道选择模块收到: " + id)
},
}
};
</script>

View File

@@ -196,6 +196,7 @@ export default {
this.platform.transport = platform.transport;
this.platform.characterSet = platform.characterSet;
this.platform.shareAllLiveStream = platform.shareAllLiveStream;
this.platform.catalogId = platform.catalogId;
this.onSubmit_text = "保存";
}
this.showDialog = true;