From cf35daeb98b7dc6e20f8fdab8e8c0202c369c78a Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期二, 31 五月 2022 15:54:39 +0800
Subject: [PATCH] 优化大数据下的设备树加载

---
 web_src/src/components/common/DeviceTree.vue |   24 ++++++++++++++++++------
 web_src/src/components/MediaServerManger.vue |    2 +-
 web_src/src/layout/UiHeader.vue              |    2 +-
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/web_src/src/components/MediaServerManger.vue b/web_src/src/components/MediaServerManger.vue
index 2e3eeef..1d3c057 100644
--- a/web_src/src/components/MediaServerManger.vue
+++ b/web_src/src/components/MediaServerManger.vue
@@ -15,7 +15,7 @@
             <span style="font-size: 16px">{{item.id}}</span>
             <el-button v-if="!item.defaultServer" icon="el-icon-edit" style="padding: 0;float: right;" type="text" @click="edit(item)">缂栬緫</el-button>
             <el-button v-if="item.defaultServer" icon="el-icon-edit" style="padding: 0;float: right;" type="text" @click="edit(item)">鏌ョ湅</el-button>
-            <el-button icon="el-icon-delete" style="margin-right: 10px;padding: 0;float: right;" type="text" @click="del(item)">绉婚櫎</el-button>
+            <el-button v-if="!item.defaultServer" icon="el-icon-delete" style="margin-right: 10px;padding: 0;float: right;" type="text" @click="del(item)">绉婚櫎</el-button>
             <div style="margin-top: 13px; line-height: 12px; ">
               <span style="font-size: 14px; color: #999; margin-top: 5px; ">{{item.ip}}</span>
               <span style="font-size: 14px; color: #999; margin-top: 5px; float: right;">{{item.createTime}}</span>
diff --git a/web_src/src/components/common/DeviceTree.vue b/web_src/src/components/common/DeviceTree.vue
index 066c344..73618cc 100644
--- a/web_src/src/components/common/DeviceTree.vue
+++ b/web_src/src/components/common/DeviceTree.vue
@@ -84,22 +84,34 @@
             }else {
               resolve([])
             }
+          }, (list)=>{
+              console.log("璁惧鍔犺浇瀹屾垚")
           }, (error)=>{
 
           })
         }
         if (node.level === 1) {
-          this.deviceService.getAllChannel(true, true, node.data.id, (catalogData) => {
-            this.deviceService.getAllChannel(false, true, 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)
             })
           })
         }
diff --git a/web_src/src/layout/UiHeader.vue b/web_src/src/layout/UiHeader.vue
index a0a252c..1e05d21 100644
--- a/web_src/src/layout/UiHeader.vue
+++ b/web_src/src/layout/UiHeader.vue
@@ -3,7 +3,7 @@
     <el-menu router :default-active="activeIndex" menu-trigger="click" background-color="#545c64" text-color="#fff"
              active-text-color="#ffd04b" mode="horizontal">
       <el-menu-item index="/control">鎺у埗鍙�</el-menu-item>
-      <el-menu-item index="/live">瀹炴椂鐩戞帶</el-menu-item>
+      <el-menu-item index="/live">鍒嗗睆鐩戞帶</el-menu-item>
       <el-menu-item index="/deviceList">鍥芥爣璁惧</el-menu-item>
       <el-menu-item index="/map">鐢靛瓙鍦板浘</el-menu-item>
       <el-menu-item index="/pushVideoList">鎺ㄦ祦鍒楄〃</el-menu-item>

--
Gitblit v1.8.0