优化大数据下的设备树加载

This commit is contained in:
648540858 2022-05-31 15:54:39 +08:00
parent 94793cc19d
commit f725fac744
3 changed files with 20 additions and 8 deletions

View File

@ -15,7 +15,7 @@
<span style="font-size: 16px">{{item.id}}</span> <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 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; "> <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; ">{{item.ip}}</span>
<span style="font-size: 14px; color: #999; margin-top: 5px; float: right;">{{item.createTime}}</span> <span style="font-size: 14px; color: #999; margin-top: 5px; float: right;">{{item.createTime}}</span>

View File

@ -84,22 +84,34 @@ export default {
}else { }else {
resolve([]) resolve([])
} }
}, (list)=>{
console.log("设备加载完成")
}, (error)=>{ }, (error)=>{
}) })
} }
if (node.level === 1) { if (node.level === 1) {
this.deviceService.getAllChannel(true, true, node.data.id, (catalogData) => { let channelArray = []
this.deviceService.getAllChannel(false, true, node.data.id, (channelData) => { this.deviceService.getAllChannel(true, true, node.data.id, catalogData =>{
let data = catalogData.concat(channelData) channelArray = channelArray.concat(catalogData)
this.channelDataHandler(data, resolve) 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){ }else if (node.level > 1){
let channelArray = []
this.deviceService.getAllSubChannel(true, node.data.deviceId, node.data.id, (catalogData)=>{ 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)=>{ this.deviceService.getAllSubChannel(false, node.data.deviceId, node.data.id, (channelData)=>{
let data = catalogData.concat(channelData) channelArray = channelArray.concat(channelData)
this.channelDataHandler(data, resolve) this.channelDataHandler(channelArray, resolve)
}) })
}) })
} }

View File

@ -3,7 +3,7 @@
<el-menu router :default-active="activeIndex" menu-trigger="click" background-color="#545c64" text-color="#fff" <el-menu router :default-active="activeIndex" menu-trigger="click" background-color="#545c64" text-color="#fff"
active-text-color="#ffd04b" mode="horizontal"> active-text-color="#ffd04b" mode="horizontal">
<el-menu-item index="/control">控制台</el-menu-item> <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="/deviceList">国标设备</el-menu-item>
<el-menu-item index="/map">电子地图</el-menu-item> <el-menu-item index="/map">电子地图</el-menu-item>
<el-menu-item index="/pushVideoList">推流列表</el-menu-item> <el-menu-item index="/pushVideoList">推流列表</el-menu-item>