From 3d6db7478d79b824f93708f936c598cc622221f2 Mon Sep 17 00:00:00 2001
From: mk1990 <153958232@qq.com>
Date: 星期一, 20 六月 2022 15:10:31 +0800
Subject: [PATCH] fix设备状态查询接口
---
web_src/src/components/common/DeviceTree.vue | 37 +++++++++++++++++++++++++------------
1 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/web_src/src/components/common/DeviceTree.vue b/web_src/src/components/common/DeviceTree.vue
index 43a797b..73618cc 100644
--- a/web_src/src/components/common/DeviceTree.vue
+++ b/web_src/src/components/common/DeviceTree.vue
@@ -1,10 +1,10 @@
<template>
- <div id="DeviceTree" style="width: 100%;height: 100%; background-color: #FFFFFF">
+ <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 :props="defaultProps" :load="loadNode" lazy @node-click="handleNodeClick"@node-contextmenu="handleContextMenu">
+ <el-tree :props="defaultProps" :load="loadNode" lazy @node-click="handleNodeClick"@node-contextmenu="handleContextMenu" 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>
@@ -49,16 +49,17 @@
},
props: ['clickEvent', 'contextMenuEvent'],
methods: {
- handleNodeClick(data) {
+ handleNodeClick(data,node,element) {
console.log("鐐瑰嚮浜嬩欢")
+ console.log(data)
if(typeof (this.clickEvent) == "function") {
this.clickEvent(data.userData)
}
},
- handleContextMenu(data) {
+ handleContextMenu(event,data,node,element) {
console.log("鍙抽敭鐐瑰嚮浜嬩欢")
if(typeof (this.contextMenuEvent) == "function") {
- this.contextMenuEvent(data.userData)
+ this.contextMenuEvent(event, data.userData)
}
},
loadNode: function(node, resolve){
@@ -83,22 +84,34 @@
}else {
resolve([])
}
+ }, (list)=>{
+ console.log("璁惧鍔犺浇瀹屾垚")
}, (error)=>{
})
}
if (node.level === 1) {
- this.deviceService.getAllChannel(true, node.data.id, (catalogData) => {
- this.deviceService.getAllChannel(false, node.data.id, (channelData) => {
- let data = catalogData.concat(channelData)
- this.channelDataHandler(data, resolve)
+ let channelArray = []
+ this.deviceService.getAllChannel(true, true, node.data.id, catalogData =>{
+ channelArray = channelArray.concat(catalogData)
+ this.channelDataHandler(channelArray, resolve)
+ },(endCatalogData) => {
+ this.deviceService.getAllChannel(false, true, node.data.id, channelData => {
+ channelArray = channelArray.concat(channelData)
+ this.channelDataHandler(channelArray, resolve)
+ }, endChannelList => {
+
})
})
}else if (node.level > 1){
+ let channelArray = []
this.deviceService.getAllSubChannel(true, node.data.deviceId, node.data.id, (catalogData)=>{
+ channelArray = channelArray.concat(catalogData)
+ this.channelDataHandler(channelArray, resolve)
+ }, (endCatalogData)=>{
this.deviceService.getAllSubChannel(false, node.data.deviceId, node.data.id, (channelData)=>{
- let data = catalogData.concat(channelData)
- this.channelDataHandler(data, resolve)
+ channelArray = channelArray.concat(channelData)
+ this.channelDataHandler(channelArray, resolve)
})
})
}
@@ -108,7 +121,7 @@
let nodeList = []
for (let i = 0; i < data.length; i++) {
let type = 3;
- if (data[i].subCount > 0) {
+ if (data[i].subCount > 0 || data[i].parental === 1) {
type = 2;
}else if (data[i].ptztype === 1 ) { // 1-鐞冩満;2-鍗婄悆;3-鍥哄畾鏋満;4-閬ユ帶鏋満
type = 4;
--
Gitblit v1.8.0