优化分屏监控
This commit is contained in:
@@ -1,32 +1,24 @@
|
||||
<template>
|
||||
<div id="DeviceTree" style="width: 100%;height: 100%; background-color: #FFFFFF; overflow: auto">
|
||||
<el-container>
|
||||
<el-header>设备列表</el-header>
|
||||
<el-main style="background-color: #ffffff;">
|
||||
<div class="device-tree-main-box">
|
||||
<el-tree ref="gdTree" :props="defaultProps" :load="loadNode" lazy @node-click="handleNodeClick"@node-contextmenu="handleContextMenu" node-key="id" style="min-width: 100%; display:inline-block !important;">
|
||||
<span class="custom-tree-node" slot-scope="{ node, data }" style="width: 100%">
|
||||
<span v-if="node.data.type === 0 && node.data.online" title="在线设备" class="device-online iconfont icon-jiedianleizhukongzhongxin2"></span>
|
||||
<span v-if="node.data.type === 0 && !node.data.online " title="离线设备" class="device-offline iconfont icon-jiedianleizhukongzhongxin2"></span>
|
||||
<span v-if="node.data.type === 2 && node.data.online" title="目录" class="device-online iconfont icon-jiedianleilianjipingtai"></span>
|
||||
<span v-if="node.data.type === 2 && !node.data.online" title="目录" class="device-offline iconfont icon-jiedianleilianjipingtai"></span>
|
||||
<span v-if="node.data.type === 3 && node.data.online " title="在线通道" class="device-online iconfont icon-shebeileijiankongdian"></span>
|
||||
<span v-if="node.data.type === 3 && !node.data.online" title="在线通道" class="device-offline iconfont icon-shebeileijiankongdian"></span>
|
||||
<span v-if="node.data.type === 4 && node.data.online " title="在线通道-球机" class="device-online iconfont icon-shebeileiqiuji"></span>
|
||||
<span v-if="node.data.type === 4 && !node.data.online" title="在线通道-球机" class="device-offline iconfont icon-shebeileiqiuji"></span>
|
||||
<span v-if="node.data.type === 5 && node.data.online " title="在线通道-半球" class="device-online iconfont icon-shebeileibanqiu"></span>
|
||||
<span v-if="node.data.type === 5 && !node.data.online" title="在线通道-半球" class="device-offline iconfont icon-shebeileibanqiu"></span>
|
||||
<span v-if="node.data.type === 6 && node.data.online " title="在线通道-枪机" class="device-online iconfont icon-shebeileiqiangjitongdao"></span>
|
||||
<span v-if="node.data.type === 6 && !node.data.online" title="在线通道-枪机" class="device-offline iconfont icon-shebeileiqiangjitongdao"></span>
|
||||
<span v-if="node.data.online" style="padding-left: 1px" class="device-online">{{ node.label }}</span>
|
||||
<span v-if="!node.data.online" style="padding-left: 1px" class="device-offline">{{ node.label }}</span>
|
||||
<span>
|
||||
<i v-if="node.data.hasGPS && node.data.online" style="color: #9d9d9d" class="device-online iconfont icon-dizhi"></i>
|
||||
<i v-if="node.data.hasGPS && !node.data.online" style="color: #9d9d9d" class="device-offline iconfont icon-dizhi"></i>
|
||||
</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
<el-header>
|
||||
<div style="display: grid; grid-template-columns: auto auto">
|
||||
<div >通道列表</div>
|
||||
<div >
|
||||
<el-switch
|
||||
v-model="showRegion"
|
||||
active-color="#13ce66"
|
||||
inactive-color="rgb(64, 158, 255)"
|
||||
active-text="行政区划"
|
||||
inactive-text="业务分组">
|
||||
</el-switch>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</el-header>
|
||||
<el-main style="background-color: #ffffff;">
|
||||
<RegionTree v-if="showRegion" ref="regionTree" :edit="false" :showHeader="false" :clickEvent="treeNodeClickEvent" ></RegionTree>
|
||||
<GroupTree v-if="!showRegion" ref="groupTree" :edit="false" :showHeader="false" :clickEvent="treeNodeClickEvent" ></GroupTree>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</div>
|
||||
@@ -34,11 +26,15 @@
|
||||
|
||||
<script>
|
||||
import DeviceService from "../service/DeviceService.js";
|
||||
import RegionTree from "./RegionTree.vue";
|
||||
import GroupTree from "./GroupTree.vue";
|
||||
|
||||
export default {
|
||||
name: 'DeviceTree',
|
||||
components: {GroupTree, RegionTree},
|
||||
data() {
|
||||
return {
|
||||
showRegion: true,
|
||||
deviceService: new DeviceService(),
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
@@ -49,120 +45,17 @@ export default {
|
||||
},
|
||||
props: ['device', 'onlyCatalog', 'clickEvent', 'contextMenuEvent'],
|
||||
methods: {
|
||||
handleNodeClick(data,node,element) {
|
||||
let deviceNode = this.$refs.gdTree.getNode(data.userData.deviceId)
|
||||
if(typeof (this.clickEvent) == "function") {
|
||||
this.clickEvent(deviceNode.data.userData, data.userData, data.type === 2)
|
||||
}
|
||||
handleClick: function (tab, event){
|
||||
},
|
||||
handleContextMenu(event,data,node,element) {
|
||||
console.log("右键点击事件")
|
||||
let deviceNode = this.$refs.gdTree.getNode(data.userData.deviceId)
|
||||
if(typeof (this.contextMenuEvent) == "function") {
|
||||
this.contextMenuEvent(deviceNode.data.userData, event, data.userData, data.type === 2)
|
||||
}
|
||||
},
|
||||
loadNode: function(node, resolve){
|
||||
console.log(this.device)
|
||||
if (node.level === 0) {
|
||||
if (this.device) {
|
||||
let node = {
|
||||
name: this.device.name || this.device.deviceId,
|
||||
isLeaf: false,
|
||||
id: this.device.deviceId,
|
||||
type: this.device.online,
|
||||
online: this.device.online === 1,
|
||||
userData: this.device
|
||||
}
|
||||
resolve([node])
|
||||
}else {
|
||||
this.deviceService.getAllDeviceList((data)=>{
|
||||
console.log(data)
|
||||
if (data.length > 0) {
|
||||
let nodeList = []
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
console.log(data[i].name)
|
||||
let node = {
|
||||
name: data[i].name || data[i].deviceId,
|
||||
isLeaf: false,
|
||||
id: data[i].deviceId,
|
||||
type: data[i].online,
|
||||
online: data[i].online === 1,
|
||||
userData: data[i]
|
||||
}
|
||||
nodeList.push(node);
|
||||
}
|
||||
resolve(nodeList)
|
||||
}else {
|
||||
resolve([])
|
||||
}
|
||||
}, (list)=>{
|
||||
console.log("设备加载完成")
|
||||
}, (error)=>{
|
||||
treeNodeClickEvent: function (data){
|
||||
|
||||
})
|
||||
if (data.leaf) {
|
||||
console.log(23111)
|
||||
console.log(data)
|
||||
if (this.clickEvent){
|
||||
this.clickEvent(data.id)
|
||||
}
|
||||
}else {
|
||||
let channelArray = []
|
||||
|
||||
this.deviceService.getTree(node.data.userData.deviceId, node.data.id, this.onlyCatalog, catalogData =>{
|
||||
console.log(catalogData)
|
||||
channelArray = channelArray.concat(catalogData)
|
||||
this.channelDataHandler(channelArray, resolve)
|
||||
},(endCatalogData) => {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
channelDataHandler: function (data, resolve) {
|
||||
if (data.length > 0) {
|
||||
let nodeList = []
|
||||
for (let i = 0; i <data.length; i++) {
|
||||
let item = data[i];
|
||||
let type = 3;
|
||||
if (item.id.length <= 10) {
|
||||
type = 2;
|
||||
}else {
|
||||
if (item.id.length > 14) {
|
||||
let channelType = item.id.substring(10, 13)
|
||||
console.log("channelType: " + channelType)
|
||||
if (channelType === '215' || channelType === '216') {
|
||||
type = 2;
|
||||
}
|
||||
console.log(type)
|
||||
if (item.basicData.ptzType === 1 ) { // 1-球机;2-半球;3-固定枪机;4-遥控枪机
|
||||
type = 4;
|
||||
}else if (item.basicData.ptzType === 2) {
|
||||
type = 5;
|
||||
}else if (item.basicData.ptzType === 3 || item.basicData.ptzType === 4) {
|
||||
type = 6;
|
||||
}
|
||||
}else {
|
||||
if (item.basicData.subCount > 0 || item.basicData.parental === 1) {
|
||||
type = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
let node = {
|
||||
name: item.name || item.basicData.channelId,
|
||||
isLeaf: type !== 2,
|
||||
id: item.id,
|
||||
deviceId: item.deviceId,
|
||||
type: type,
|
||||
online: item.basicData.status === 1,
|
||||
hasGPS: item.basicData.longitude*item.basicData.latitude !== 0,
|
||||
userData: item.basicData
|
||||
}
|
||||
nodeList.push(node);
|
||||
}
|
||||
resolve(nodeList)
|
||||
}else {
|
||||
resolve([])
|
||||
}
|
||||
},
|
||||
reset: function (){
|
||||
this.$forceUpdate();
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div id="DeviceTree">
|
||||
<div class="page-header" style="margin-bottom: 1rem;">
|
||||
<div v-if="showHeader" class="page-header" style="margin-bottom: 1rem;">
|
||||
<div class="page-title">业务分组</div>
|
||||
<div class="page-header-btn">
|
||||
<div style="display: inline;">
|
||||
@@ -11,6 +11,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="showHeader" style="height: 2rem; background-color: #FFFFFF" ></div>
|
||||
<div>
|
||||
<vue-easy-tree
|
||||
class="flow-tree"
|
||||
@@ -18,7 +19,7 @@
|
||||
node-key="deviceId"
|
||||
height="78vh"
|
||||
lazy
|
||||
style="padding: 2rem 0 2rem 0.5rem"
|
||||
style="padding: 0 0 2rem 0.5rem"
|
||||
:load="loadNode"
|
||||
:data="treeData"
|
||||
:props="props"
|
||||
@@ -27,8 +28,8 @@
|
||||
@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 > 2 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange(node.data.deviceId, node.data.businessGroup)" :label="node.data.deviceId">{{''}}</el-radio>
|
||||
<span @click.stop v-if="edit">
|
||||
<el-radio v-if="node.data.type === 0 && node.level > 2" style="margin-right: 0" v-model="chooseId" @input="chooseIdChange(node.data.deviceId, node.data.businessGroup)" :label="node.data.deviceId">{{''}}</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>
|
||||
@@ -63,7 +64,7 @@ export default {
|
||||
treeData: [],
|
||||
}
|
||||
},
|
||||
props: ['edit', 'clickEvent', 'chooseIdChange', 'onChannelChange'],
|
||||
props: ['edit', 'clickEvent', 'chooseIdChange', 'onChannelChange', 'showHeader'],
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
@@ -100,7 +101,9 @@ export default {
|
||||
this.$forceUpdate();
|
||||
},
|
||||
contextmenuEventHandler: function (event, data, node, element) {
|
||||
|
||||
if (!this.edit) {
|
||||
return;
|
||||
}
|
||||
console.log(node.level)
|
||||
if (node.data.type === 1) {
|
||||
data.parentId = node.parent.data.id;
|
||||
@@ -356,11 +359,9 @@ export default {
|
||||
}, 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);
|
||||
if (this.clickEvent) {
|
||||
this.clickEvent(data)
|
||||
}
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div id="DeviceTree">
|
||||
<div class="page-header" style="margin-bottom: 1rem;">
|
||||
<div class="page-header" style="margin-bottom: 1rem;" v-if="showHeader">
|
||||
<div class="page-title">行政区划</div>
|
||||
<div class="page-header-btn">
|
||||
<div style="display: inline;">
|
||||
@@ -11,14 +11,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div v-if="showHeader" style="height: 2rem; background-color: #FFFFFF" ></div>
|
||||
<div >
|
||||
<vue-easy-tree
|
||||
class="flow-tree"
|
||||
ref="veTree"
|
||||
node-key="deviceId"
|
||||
height="78vh"
|
||||
lazy
|
||||
style="padding: 2rem 0 2rem 0.5rem"
|
||||
style="padding: 0 0 2rem 0.5rem"
|
||||
:load="loadNode"
|
||||
:data="treeData"
|
||||
:props="props"
|
||||
@@ -27,7 +28,7 @@
|
||||
@node-click="nodeClickHandler"
|
||||
>
|
||||
<span class="custom-tree-node" slot-scope="{ node, data }">
|
||||
<span @click.stop >
|
||||
<span @click.stop v-if="edit">
|
||||
<el-radio v-if="node.data.type === 0 && node.level !== 1 " style="margin-right: 0" v-model="chooseId" @input="chooseIdChange" :label="node.data.deviceId">{{''}}</el-radio>
|
||||
</span>
|
||||
<span v-if="node.data.type === 0" style="color: #409EFF" class="iconfont icon-bianzubeifen3"></span>
|
||||
@@ -63,7 +64,7 @@ export default {
|
||||
treeData: [],
|
||||
}
|
||||
},
|
||||
props: ['edit', 'clickEvent', 'chooseIdChange', 'onChannelChange'],
|
||||
props: ['edit', 'clickEvent', 'chooseIdChange', 'onChannelChange', 'showHeader'],
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
@@ -102,7 +103,9 @@ export default {
|
||||
this.$forceUpdate();
|
||||
},
|
||||
contextmenuEventHandler: function (event, data, node, element) {
|
||||
|
||||
if (!this.edit) {
|
||||
return
|
||||
}
|
||||
console.log(node.level)
|
||||
if (node.data.type === 1) {
|
||||
data.parentId = node.parent.data.id;
|
||||
@@ -356,6 +359,9 @@ export default {
|
||||
nodeClickHandler: function (data, node, tree) {
|
||||
console.log(data)
|
||||
console.log(node)
|
||||
if (this.clickEvent) {
|
||||
this.clickEvent(data)
|
||||
}
|
||||
// this.chooseId = data.id;
|
||||
// this.chooseName = data.name;
|
||||
// if (this.catalogIdChange)this.catalogIdChange(this.chooseId, this.chooseName);
|
||||
|
||||
Reference in New Issue
Block a user