2024-07-23 18:00:47 +08:00
|
|
|
<template>
|
|
|
|
<div id="region" style="width: 100%">
|
2024-11-05 18:23:58 +08:00
|
|
|
<el-container v-loading="loading">
|
|
|
|
<el-aside width="400px">
|
|
|
|
<RegionTree ref="regionTree" :showHeader=true :edit="true" :clickEvent="treeNodeClickEvent"
|
|
|
|
:onChannelChange="onChannelChange"></RegionTree>
|
2024-07-23 18:00:47 +08:00
|
|
|
</el-aside>
|
|
|
|
<el-main style="padding: 5px;">
|
2024-07-24 17:54:19 +08:00
|
|
|
<div class="page-header">
|
2024-11-05 18:23:58 +08:00
|
|
|
<div class="page-title">
|
|
|
|
<el-breadcrumb separator="/">
|
|
|
|
<el-breadcrumb-item v-for="key in regionParents" >{{key}}</el-breadcrumb-item>
|
|
|
|
</el-breadcrumb>
|
|
|
|
</div>
|
2024-07-24 17:54:19 +08:00
|
|
|
<div class="page-header-btn">
|
2024-11-05 18:23:58 +08:00
|
|
|
<div style="display: inline;">
|
2024-07-24 17:54:19 +08:00
|
|
|
搜索:
|
|
|
|
<el-input @input="search" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字"
|
|
|
|
prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
|
|
|
|
|
|
|
|
在线状态:
|
2024-11-05 18:23:58 +08:00
|
|
|
<el-select size="mini" style="width: 8rem; margin-right: 1rem;" @change="search" v-model="online"
|
|
|
|
placeholder="请选择"
|
2024-07-24 17:54:19 +08:00
|
|
|
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>
|
2024-11-05 18:23:58 +08:00
|
|
|
<el-button size="mini" type="primary" @click="add()">
|
|
|
|
添加通道
|
2024-07-25 18:02:22 +08:00
|
|
|
</el-button>
|
2024-11-05 18:23:58 +08:00
|
|
|
<el-button v-bind:disabled="multipleSelection.length === 0" size="mini" type="danger" @click="remove()">
|
|
|
|
移除通道
|
2024-08-07 17:15:45 +08:00
|
|
|
</el-button>
|
2024-07-31 15:07:54 +08:00
|
|
|
<el-button icon="el-icon-refresh-right" circle size="mini" @click="getChannelList()"></el-button>
|
2024-07-24 17:54:19 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-11-05 18:23:58 +08:00
|
|
|
<el-table size="medium" 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">
|
2024-07-26 17:53:10 +08:00
|
|
|
</el-table-column>
|
2024-07-23 18:00:47 +08:00
|
|
|
<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>
|
2024-07-31 15:07:54 +08:00
|
|
|
<el-table-column label="类型" min-width="100">
|
2024-11-05 18:23:58 +08:00
|
|
|
<template v-slot:default="scope">
|
2024-07-31 15:07:54 +08:00
|
|
|
<div slot="reference" class="name-wrapper">
|
2024-08-23 11:25:45 +08:00
|
|
|
<el-tag size="medium" effect="plain" v-if="scope.row.gbDeviceDbId">国标设备</el-tag>
|
|
|
|
<el-tag size="medium" effect="plain" type="success" v-if="scope.row.streamPushId">推流设备</el-tag>
|
|
|
|
<el-tag size="medium" effect="plain" type="warning" v-if="scope.row.streamProxyId">拉流代理</el-tag>
|
2024-07-31 15:07:54 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
2024-07-23 18:00:47 +08:00
|
|
|
<el-table-column label="状态" min-width="100">
|
2024-11-05 18:23:58 +08:00
|
|
|
<template v-slot:default="scope">
|
2024-07-23 18:00:47 +08:00
|
|
|
<div slot="reference" class="name-wrapper">
|
|
|
|
<el-tag size="medium" v-if="scope.row.gbStatus === 'ON'">在线</el-tag>
|
2024-07-29 17:44:34 +08:00
|
|
|
<el-tag size="medium" type="info" v-if="scope.row.gbStatus !== 'ON'">离线</el-tag>
|
2024-07-23 18:00:47 +08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
<el-pagination
|
2024-08-15 17:45:24 +08:00
|
|
|
style="text-align: right"
|
2024-07-23 18:00:47 +08:00
|
|
|
@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 RegionTree from "./common/RegionTree.vue";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'channelList',
|
|
|
|
components: {
|
|
|
|
uiHeader,
|
|
|
|
RegionTree,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
channelList: [],
|
|
|
|
searchSrt: "",
|
|
|
|
channelType: "",
|
|
|
|
online: "",
|
2024-07-26 17:53:10 +08:00
|
|
|
winHeight: window.innerHeight - 180,
|
2024-07-23 18:00:47 +08:00
|
|
|
currentPage: 1,
|
|
|
|
count: 15,
|
|
|
|
total: 0,
|
|
|
|
loading: false,
|
|
|
|
loadSnap: {},
|
2024-07-28 07:36:20 +08:00
|
|
|
regionId: "",
|
2024-09-27 11:17:45 +08:00
|
|
|
regionDeviceId: "",
|
2024-11-05 18:23:58 +08:00
|
|
|
regionParents: ["请选择行政区划"],
|
2024-07-28 07:36:20 +08:00
|
|
|
multipleSelection: []
|
2024-07-23 18:00:47 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2024-07-26 17:53:10 +08:00
|
|
|
created() {
|
2024-07-23 18:00:47 +08:00
|
|
|
this.initData();
|
|
|
|
},
|
2024-11-05 18:23:58 +08:00
|
|
|
destroyed() {
|
|
|
|
},
|
2024-07-23 18:00:47 +08:00
|
|
|
methods: {
|
|
|
|
initData: function () {
|
2024-07-26 17:53:10 +08:00
|
|
|
this.getChannelList();
|
2024-07-23 18:00:47 +08:00
|
|
|
},
|
|
|
|
currentChange: function (val) {
|
|
|
|
this.currentPage = val;
|
|
|
|
this.initData();
|
|
|
|
},
|
|
|
|
handleSizeChange: function (val) {
|
|
|
|
this.count = val;
|
2024-07-25 18:02:22 +08:00
|
|
|
this.getChannelList();
|
2024-07-23 18:00:47 +08:00
|
|
|
},
|
2024-07-25 18:02:22 +08:00
|
|
|
getChannelList: function () {
|
2024-07-23 18:00:47 +08:00
|
|
|
this.$axios({
|
|
|
|
method: 'get',
|
2024-07-26 17:53:10 +08:00
|
|
|
url: `/api/common/channel/list`,
|
2024-07-23 18:00:47 +08:00
|
|
|
params: {
|
2024-07-29 17:44:34 +08:00
|
|
|
page: this.currentPage,
|
|
|
|
count: this.count,
|
|
|
|
query: this.searchSrt,
|
|
|
|
online: this.online,
|
2024-11-05 18:23:58 +08:00
|
|
|
civilCode: this.regionDeviceId
|
2024-07-23 18:00:47 +08:00
|
|
|
}
|
2024-11-05 18:23:58 +08:00
|
|
|
}).then((res) => {
|
2024-07-23 18:00:47 +08:00
|
|
|
if (res.data.code === 0) {
|
2024-07-29 17:44:34 +08:00
|
|
|
this.total = res.data.data.total;
|
|
|
|
this.channelList = res.data.data.list;
|
2024-07-23 18:00:47 +08:00
|
|
|
// 防止出现表格错位
|
2024-07-29 17:44:34 +08:00
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs.channelListTable.doLayout();
|
2024-07-23 18:00:47 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-11-05 18:23:58 +08:00
|
|
|
}).catch((error) => {
|
2024-07-23 18:00:47 +08:00
|
|
|
console.log(error);
|
|
|
|
});
|
|
|
|
},
|
2024-11-05 18:23:58 +08:00
|
|
|
handleSelectionChange: function (val) {
|
2024-07-28 07:36:20 +08:00
|
|
|
this.multipleSelection = val;
|
|
|
|
},
|
2024-07-31 15:07:54 +08:00
|
|
|
rowDblclick: function (row, rowIndex) {
|
2024-09-27 11:17:45 +08:00
|
|
|
// if (row.gbCivilCode) {
|
|
|
|
// this.$refs.regionTree.refresh(row.gbCivilCode)
|
|
|
|
// }
|
2024-07-31 15:07:54 +08:00
|
|
|
},
|
2024-07-23 18:00:47 +08:00
|
|
|
add: function (row) {
|
2024-09-27 11:17:45 +08:00
|
|
|
if (!this.regionDeviceId) {
|
2024-08-26 17:59:29 +08:00
|
|
|
this.$message.info({
|
|
|
|
showClose: true,
|
|
|
|
message: "请选择左侧行政区划节点"
|
|
|
|
})
|
2024-07-30 17:58:18 +08:00
|
|
|
return;
|
2024-07-26 17:53:10 +08:00
|
|
|
}
|
2024-07-28 07:36:20 +08:00
|
|
|
let channels = []
|
|
|
|
for (let i = 0; i < this.multipleSelection.length; i++) {
|
|
|
|
channels.push(this.multipleSelection[i].gbId)
|
|
|
|
}
|
2024-07-30 17:58:18 +08:00
|
|
|
if (channels.length === 0) {
|
2024-08-26 17:59:29 +08:00
|
|
|
this.$message.info({
|
|
|
|
showClose: true,
|
2024-11-05 18:23:58 +08:00
|
|
|
message: "请选择通道"
|
2024-08-26 17:59:29 +08:00
|
|
|
})
|
2024-07-30 17:58:18 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.loading = true
|
2024-07-26 17:53:10 +08:00
|
|
|
|
2024-07-30 17:58:18 +08:00
|
|
|
this.$axios({
|
|
|
|
method: 'post',
|
|
|
|
url: `/api/common/channel/region/add`,
|
|
|
|
data: {
|
2024-09-27 11:17:45 +08:00
|
|
|
civilCode: this.regionDeviceId,
|
2024-07-30 17:58:18 +08:00
|
|
|
channelIds: channels
|
|
|
|
}
|
2024-11-05 18:23:58 +08:00
|
|
|
}).then((res) => {
|
2024-07-30 17:58:18 +08:00
|
|
|
if (res.data.code === 0) {
|
2024-08-26 17:59:29 +08:00
|
|
|
this.$message.success({
|
|
|
|
showClose: true,
|
|
|
|
message: "保存成功"
|
|
|
|
})
|
2024-07-31 15:07:54 +08:00
|
|
|
this.getChannelList()
|
|
|
|
// 刷新树节点
|
|
|
|
this.$refs.regionTree.refresh(this.regionId)
|
2024-11-05 18:23:58 +08:00
|
|
|
} else {
|
2024-08-26 17:59:29 +08:00
|
|
|
this.$message.error({
|
2024-11-05 18:23:58 +08:00
|
|
|
showClose: true,
|
|
|
|
message: res.data.msg
|
|
|
|
})
|
2024-07-30 17:58:18 +08:00
|
|
|
}
|
|
|
|
this.loading = false
|
2024-11-05 18:23:58 +08:00
|
|
|
}).catch((error) => {
|
2024-08-26 17:59:29 +08:00
|
|
|
this.$message.error({
|
2024-11-05 18:23:58 +08:00
|
|
|
showClose: true,
|
|
|
|
message: error
|
|
|
|
})
|
2024-07-30 17:58:18 +08:00
|
|
|
this.loading = false
|
|
|
|
});
|
2024-07-23 18:00:47 +08:00
|
|
|
},
|
|
|
|
remove: function (row) {
|
2024-08-07 17:15:45 +08:00
|
|
|
let channels = []
|
|
|
|
for (let i = 0; i < this.multipleSelection.length; i++) {
|
|
|
|
channels.push(this.multipleSelection[i].gbId)
|
|
|
|
}
|
|
|
|
if (channels.length === 0) {
|
2024-08-26 17:59:29 +08:00
|
|
|
this.$message.info({
|
|
|
|
showClose: true,
|
2024-11-05 18:23:58 +08:00
|
|
|
message: "请选择通道"
|
2024-08-26 17:59:29 +08:00
|
|
|
})
|
2024-08-07 17:15:45 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.loading = true
|
|
|
|
|
|
|
|
this.$axios({
|
|
|
|
method: 'post',
|
|
|
|
url: `/api/common/channel/region/delete`,
|
|
|
|
data: {
|
|
|
|
channelIds: channels
|
|
|
|
}
|
2024-11-05 18:23:58 +08:00
|
|
|
}).then((res) => {
|
2024-08-07 17:15:45 +08:00
|
|
|
if (res.data.code === 0) {
|
2024-08-26 17:59:29 +08:00
|
|
|
this.$message.success({
|
|
|
|
showClose: true,
|
|
|
|
message: "保存成功"
|
|
|
|
})
|
2024-08-07 17:15:45 +08:00
|
|
|
this.getChannelList()
|
|
|
|
// 刷新树节点
|
|
|
|
this.$refs.regionTree.refresh(this.regionId)
|
2024-11-05 18:23:58 +08:00
|
|
|
} else {
|
2024-08-26 17:59:29 +08:00
|
|
|
this.$message.error({
|
2024-11-05 18:23:58 +08:00
|
|
|
showClose: true,
|
|
|
|
message: res.data.msg
|
|
|
|
})
|
2024-08-07 17:15:45 +08:00
|
|
|
}
|
|
|
|
this.loading = false
|
2024-11-05 18:23:58 +08:00
|
|
|
}).catch((error) => {
|
2024-08-26 17:59:29 +08:00
|
|
|
this.$message.error({
|
2024-11-05 18:23:58 +08:00
|
|
|
showClose: true,
|
|
|
|
message: error
|
|
|
|
})
|
2024-08-07 17:15:45 +08:00
|
|
|
this.loading = false
|
|
|
|
});
|
2024-07-23 18:00:47 +08:00
|
|
|
},
|
|
|
|
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();
|
|
|
|
},
|
2024-11-05 18:23:58 +08:00
|
|
|
treeNodeClickEvent: function (region) {
|
|
|
|
this.regionDeviceId = region.deviceId;
|
|
|
|
this.initData();
|
|
|
|
// 获取regionDeviceId对应的节点信息
|
|
|
|
this.$axios({
|
|
|
|
method: 'get',
|
|
|
|
url: `/api/region/path`,
|
|
|
|
params: {
|
|
|
|
deviceId: this.regionDeviceId,
|
|
|
|
}
|
|
|
|
}).then((res) => {
|
|
|
|
if (res.data.code === 0) {
|
|
|
|
let path = []
|
|
|
|
for (let i = 0; i < res.data.data.length; i++) {
|
|
|
|
path.push(res.data.data[i].name)
|
|
|
|
}
|
|
|
|
this.regionParents = path;
|
|
|
|
}
|
2024-07-26 17:53:10 +08:00
|
|
|
|
2024-11-05 18:23:58 +08:00
|
|
|
}).catch((error) => {
|
|
|
|
console.log(error);
|
|
|
|
});
|
2024-07-26 17:53:10 +08:00
|
|
|
},
|
2024-11-05 18:23:58 +08:00
|
|
|
onChannelChange: function (deviceId) {
|
|
|
|
//
|
2024-07-23 18:00:47 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|