临时提交

This commit is contained in:
648540858
2024-08-01 15:29:51 +08:00
parent 7ee3cdb801
commit f7c98301ac
14 changed files with 1674 additions and 409 deletions

View File

@@ -0,0 +1,357 @@
<template>
<div id="DeviceTree">
<div class="page-header" style="margin-bottom: 1rem;">
<div class="page-title">业务分组</div>
<div class="page-header-btn">
<div style="display: inline;">
<el-input @input="search" style="visibility:hidden; margin-right: 1rem; width: 12rem;" size="mini" placeholder="关键字"
prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
<el-checkbox v-model="showCode">显示编号</el-checkbox>
</div>
</div>
</div>
<div>
<vue-easy-tree
class="flow-tree"
ref="veTree"
node-key="id"
height="78vh"
lazy
style="padding: 2rem 0 2rem 0.5rem"
:load="loadNode"
:data="treeData"
:default-expanded-keys="['']"
@node-contextmenu="contextmenuEventHandler"
@node-click="nodeClickHandler"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<span @click.stop >
<el-radio v-if="node.data.type === 0 && node.level !== 1 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange" :label="node.data.id">{{''}}</el-radio>
</span>
<span v-if="node.data.type === 0" style="color: #409EFF" class="iconfont icon-bianzubeifen3"></span>
<span v-if="node.data.type === 1" style="color: #409EFF" class="iconfont icon-shexiangtou2"></span>
<span style=" padding-left: 1px" v-if="node.data.id !=='' && showCode" :title="node.data.id">{{ node.label }}编号{{ node.data.id }}</span>
<span style=" padding-left: 1px" v-if="node.data.id ==='' || !showCode" :title="node.data.id">{{ node.label }}</span>
</span>
</vue-easy-tree>
</div>
<regionCode ref="regionCode"></regionCode>
<gbDeviceSelect ref="gbDeviceSelect"></gbDeviceSelect>
</div>
</template>
<script>
import VueEasyTree from "@wchbrad/vue-easy-tree";
import regionCode from './../dialog/regionCode'
import gbDeviceSelect from './../dialog/GbDeviceSelect'
export default {
name: 'DeviceTree',
components: {
VueEasyTree, regionCode, gbDeviceSelect
},
data() {
return {
showCode: false,
searchSrt: "",
chooseId: "",
treeData: [],
}
},
props: ['edit', 'clickEvent', 'chooseIdChange', 'onChannelChange'],
created() {
},
methods: {
search() {
},
loadNode: function (node, resolve) {
if (node.level === 0) {
resolve([{
id: "",
label: "根资源组",
isLeaf: false,
type: 0
}]);
} else if (node.data.id.length <= 8) {
this.$axios({
method: 'get',
url: `/api/region/tree/list`,
params: {
query: this.searchSrt,
parent: node.data.id
}
}).then((res) => {
if (res.data.code === 0) {
resolve(res.data.data);
}
}).catch(function (error) {
console.log(error);
});
} else {
resolve([]);
}
},
reset: function () {
this.$forceUpdate();
},
contextmenuEventHandler: function (event, data, node, element) {
console.log(node.level)
if (node.data.type === 1) {
data.parentId = node.parent.data.id;
this.$contextmenu({
items: [
{
label: "移除通道",
icon: "el-icon-delete",
disabled: false,
onClick: () => {
console.log(data)
this.$axios({
method: "post",
url: `/api/common/channel/region/delete`,
data: {
channelIds: [data.dbId]
}
}).then((res) => {
console.log("移除成功")
if (this.onChannelChange) {
this.onChannelChange()
}
node.parent.loaded = false
node.parent.expand();
}).catch(function (error) {
console.log(error);
});
}
}
],
event, // 鼠标事件信息
customClass: "custom-class", // 自定义菜单 class
zIndex: 3000, // 菜单样式 z-index
});
} else if (node.data.type === 0) {
this.$contextmenu({
items: [
{
label: "刷新节点",
icon: "el-icon-refresh",
disabled: false,
onClick: () => {
this.refreshNode(node);
}
},
{
label: "新建节点",
icon: "el-icon-plus",
disabled: false,
onClick: () => {
this.addRegion(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.removeRegion(data.id, node)
}).catch(() => {
});
}
},
{
label: "添加设备",
icon: "el-icon-plus",
disabled: node.level === 1,
onClick: () => {
this.addChannelFormDevice(data.id, node)
}
},
{
label: "移除设备",
icon: "el-icon-delete",
disabled: node.level === 1,
onClick: () => {
this.removeChannelFormDevice(data.id, node)
}
},
// {
// label: "导出",
// icon: "el-icon-download",
// disabled: false,
// children: [
// {
// label: "导出到文件",
// onClick: () => {
//
// },
// },
// {
// label: "导出到其他平台",
// onClick: () => {
//
// },
// }
// ]
// },
],
event, // 鼠标事件信息
customClass: "custom-class", // 自定义菜单 class
zIndex: 3000, // 菜单样式 z-index
});
}
return false;
},
removeRegion: function (id, node) {
this.$axios({
method: "delete",
url: `/api/region/delete`,
params: {
deviceId: id,
}
}).then((res) => {
if (res.data.code === 0) {
console.log("移除成功")
node.parent.loaded = false
node.parent.expand();
}
}).catch(function (error) {
console.log(error);
});
},
addChannelFormDevice: function (id, node) {
this.$refs.gbDeviceSelect.openDialog((rows)=>{
let deviceIds = []
for (let i = 0; i < rows.length; i++) {
deviceIds.push(rows[i].id)
}
this.$axios({
method: 'post',
url: `/api/common/channel/region/device/add`,
data: {
civilCode: node.data.id,
deviceIds: deviceIds,
}
}).then((res)=> {
if (res.data.code === 0) {
this.$message.success("保存成功")
if (this.onChannelChange) {
this.onChannelChange()
}
node.loaded = false
node.expand();
}else {
this.$message.error(res.data.msg)
}
this.loading = false
}).catch((error)=> {
this.$message.error(error)
this.loading = false
});
})
},
removeChannelFormDevice: function (id, node) {
this.$refs.gbDeviceSelect.openDialog((rows)=>{
let deviceIds = []
for (let i = 0; i < rows.length; i++) {
deviceIds.push(rows[i].id)
}
this.$axios({
method: 'post',
url: `/api/common/channel/region/device/delete`,
data: {
deviceIds: deviceIds,
}
}).then((res)=> {
if (res.data.code === 0) {
this.$message.success("保存成功")
if (this.onChannelChange) {
this.onChannelChange()
}
node.loaded = false
node.expand();
}else {
this.$message.error(res.data.msg)
}
this.loading = false
}).catch((error)=> {
this.$message.error(error)
this.loading = false
});
})
},
refreshNode: function (node) {
node.loaded = false
node.expand();
},
refresh: function (id) {
// 查询node
let node = this.$refs.veTree.getNode(id)
node.loaded = false
node.expand();
},
addRegion: function (id, node) {
console.log(node)
this.$refs.regionCode.openDialog(form => {
node.loaded = false
node.expand();
}, id);
},
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);
}
},
destroyed() {
// if (this.jessibuca) {
// this.jessibuca.destroy();
// }
// this.playing = false;
// this.loaded = false;
// this.performance = "";
},
}
</script>
<style>
.device-tree-main-box {
text-align: left;
}
.device-online {
color: #252525;
}
.device-offline {
color: #727272;
}
.custom-tree-node .el-radio__label {
padding-left: 4px !important;
}
</style>

287
web_src/src/components/group.vue Executable file
View File

@@ -0,0 +1,287 @@
<template>
<div id="region" style="width: 100%">
<el-container v-loading="loading" >
<el-aside width="400px" >
<GroupTree ref="groupTree" :edit="true" :clickEvent="treeNodeClickEvent" :chooseIdChange="chooseIdChange" :onChannelChange="getChannelList"></GroupTree>
</el-aside>
<el-main style="padding: 5px;">
<div class="page-header">
<div class="page-title">通道列表</div>
<div class="page-header-btn">
<div style="display: inline;">
搜索:
<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" style="width: 8rem; margin-right: 1rem;" @change="search" v-model="online" placeholder="请选择"
default-first-option>
<el-option label="全部" value=""></el-option>
<el-option label="在线" value="true"></el-option>
<el-option label="离线" value="false"></el-option>
</el-select>
添加状态:
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="search" v-model="hasCivilCode" 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 size="mini" type="primary" @click="add()">
添加
</el-button>
<el-button icon="el-icon-refresh-right" circle size="mini" @click="getChannelList()"></el-button>
</div>
</div>
</div>
<el-table ref="channelListTable" :data="channelList" :height="winHeight" style="width: 100%"
header-row-class-name="table-header" @selection-change="handleSelectionChange" @row-dblclick="rowDblclick">
<el-table-column type="selection" width="55" :selectable="selectable">
</el-table-column>
<el-table-column prop="gbName" label="名称" min-width="180">
</el-table-column>
<el-table-column prop="gbDeviceId" label="编号" min-width="180">
</el-table-column>
<el-table-column prop="gbManufacturer" label="厂家" min-width="100">
</el-table-column>
<el-table-column label="类型" min-width="100">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" v-if="scope.row.gbDeviceDbId">国标设备</el-tag>
<el-tag size="medium" v-if="scope.row.streamPushId">推流设备</el-tag>
<el-tag size="medium" v-if="scope.row.streamProxyId">拉流代理</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="状态" min-width="100">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" v-if="scope.row.gbStatus === 'ON'">在线</el-tag>
<el-tag size="medium" type="info" v-if="scope.row.gbStatus !== 'ON'">离线</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="添加状态" min-width="100">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" :title="scope.row.gbCivilCode" v-if="scope.row.gbCivilCode">已添加</el-tag>
<el-tag size="medium" type="info" v-if="!scope.row.gbCivilCode">未添加</el-tag>
</div>
</template>
</el-table-column>
</el-table>
<el-pagination
style="float: right"
@size-change="handleSizeChange"
@current-change="currentChange"
:current-page="currentPage"
:page-size="count"
:page-sizes="[15, 25, 35, 50]"
layout="total, sizes, prev, pager, next"
:total="total">
</el-pagination>
</el-main>
</el-container>
</div>
</template>
<script>
import uiHeader from '../layout/UiHeader.vue'
import DeviceService from "./service/DeviceService";
import GroupTree from "./common/GroupTree.vue";
export default {
name: 'channelList',
components: {
uiHeader,
GroupTree,
},
data() {
return {
channelList: [],
searchSrt: "",
channelType: "",
online: "",
hasCivilCode: "false",
winHeight: window.innerHeight - 180,
currentPage: 1,
count: 15,
total: 0,
loading: false,
loadSnap: {},
regionId: "",
multipleSelection: []
};
},
created() {
this.initData();
},
destroyed() {},
methods: {
initData: function () {
this.getChannelList();
},
currentChange: function (val) {
this.currentPage = val;
this.initData();
},
handleSizeChange: function (val) {
this.count = val;
this.getChannelList();
},
getChannelList: function () {
this.$axios({
method: 'get',
url: `/api/common/channel/list`,
params: {
page: this.currentPage,
count: this.count,
query: this.searchSrt,
online: this.online,
hasCivilCode: this.hasCivilCode
}
}).then((res)=> {
if (res.data.code === 0) {
this.total = res.data.data.total;
this.channelList = res.data.data.list;
// 防止出现表格错位
this.$nextTick(() => {
this.$refs.channelListTable.doLayout();
})
}
}).catch((error)=> {
console.log(error);
});
},
handleSelectionChange: function (val){
this.multipleSelection = val;
},
selectable: function (row, rowIndex) {
if (row.gbCivilCode) {
return false
}else {
return true
}
},
rowDblclick: function (row, rowIndex) {
if (row.gbCivilCode) {
this.$refs.groupTree.refresh(row.gbCivilCode)
}
},
add: function (row) {
if (!this.regionId) {
this.$message.info("请选择左侧行政区划节点")
return;
}
let channels = []
for (let i = 0; i < this.multipleSelection.length; i++) {
channels.push(this.multipleSelection[i].gbId)
}
if (channels.length === 0) {
this.$message.info("请选择右侧通道")
return;
}
this.loading = true
this.$axios({
method: 'post',
url: `/api/common/channel/region/add`,
data: {
civilCode: this.regionId,
channelIds: channels
}
}).then((res)=> {
if (res.data.code === 0) {
this.$message.success("保存成功")
this.getChannelList()
// 刷新树节点
this.$refs.groupTree.refresh(this.regionId)
}else {
this.$message.error(res.data.msg)
}
this.loading = false
}).catch((error)=> {
this.$message.error(error)
this.loading = false
});
},
remove: function (row) {
},
getSnap: function (row) {
let baseUrl = window.baseUrl ? window.baseUrl : "";
return ((process.env.NODE_ENV === 'development') ? process.env.BASE_API : baseUrl) + '/api/device/query/snap/' + this.deviceId + '/' + row.deviceId;
},
search: function () {
this.currentPage = 1;
this.total = 0;
this.initData();
},
refresh: function () {
this.initData();
},
treeNodeClickEvent: function (device, data, isCatalog) {
},
chooseIdChange: function (id) {
this.regionId = id;
},
}
};
</script>
<style>
.videoList {
display: flex;
flex-wrap: wrap;
align-content: flex-start;
}
.video-item {
position: relative;
width: 15rem;
height: 10rem;
margin-right: 1rem;
background-color: #000000;
}
.video-item-img {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 100%;
height: 100%;
}
.video-item-img:after {
content: "";
display: inline-block;
position: absolute;
z-index: 2;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 3rem;
height: 3rem;
background-image: url("../assets/loading.png");
background-size: cover;
background-color: #000000;
}
.video-item-title {
position: absolute;
bottom: 0;
color: #000000;
background-color: #ffffff;
line-height: 1.5rem;
padding: 0.3rem;
width: 14.4rem;
}
</style>