From 68fe1629ea048cf3b806b700f9934f990aa4bfdf Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@iotlink.com>
Date: 星期四, 17 九月 2020 16:52:45 +0800
Subject: [PATCH] 可视化摄像机树排序,取消图标隐藏
---
src/pages/visual/components/LeftNav.vue | 4 --
src/pages/visual/index/home.vue | 18 ++-------
src/pages/visual/components/TopNav.vue | 1
src/pages/visual/Pool/TreeData.ts | 54 +++++++++++++++-----------
4 files changed, 35 insertions(+), 42 deletions(-)
diff --git a/src/pages/visual/Pool/TreeData.ts b/src/pages/visual/Pool/TreeData.ts
index da3b7a7..d6097a0 100644
--- a/src/pages/visual/Pool/TreeData.ts
+++ b/src/pages/visual/Pool/TreeData.ts
@@ -119,6 +119,29 @@
}
}
+ sortTreeData(node) {
+ if (!node) {
+ return
+ }
+ node.sort(function (obj1: any, obj2: any) {
+ var val1 = obj1.name;
+ var val2 = obj2.name;
+ if (val1 < val2) {
+ return -1;
+ } else if (val1 > val2) {
+ return 1;
+ } else {
+ return 0;
+ }
+ });
+
+ node.forEach(n => {
+ if (n.children && n.children.length > 0) {
+ this.sortTreeData(n.children)
+ }
+ })
+ }
+
async fetchLocalTree() {
const rsp: any = await getLocalCameraTree({
searchType: this.searchCamType,
@@ -127,19 +150,12 @@
});
if (rsp && rsp.success) {
- this.treeData = rsp.data
- this.treeData.sort(function (obj1: any, obj2: any) {
- var val1 = obj1.id;
- var val2 = obj2.id;
- if (val1 < val2) {
- return -1;
- } else if (val1 > val2) {
- return 1;
- } else {
- return 0;
- }
- });
+ this.treeData = rsp.data ? rsp.data : []
+ if (this.treeData && this.treeData.length > 0) {
+ this.sortTreeData(this.treeData)
+ }
+ // 璁剧疆绂佹鎷栨嫿鎽勫儚鏈哄埌鎽勫儚鏈鸿妭鐐�
this.treeDataPure = JSON.parse(JSON.stringify(this.treeData));
}
}
@@ -152,17 +168,9 @@
if (rsp && rsp.success) {
this.gb28181Data = rsp.data
- this.gb28181Data.sort(function (obj1: any, obj2: any) {
- var val1 = obj1.id;
- var val2 = obj2.id;
- if (val1 < val2) {
- return -1;
- } else if (val1 > val2) {
- return 1;
- } else {
- return 0;
- }
- });
+ if (this.gb28181Data && this.gb28181Data.length > 0) {
+ this.sortTreeData(this.gb28181Data)
+ }
this.gb28181DataPure = JSON.parse(JSON.stringify(this.gb28181Data));
}
diff --git a/src/pages/visual/components/LeftNav.vue b/src/pages/visual/components/LeftNav.vue
index 02f31a7..2e2df43 100644
--- a/src/pages/visual/components/LeftNav.vue
+++ b/src/pages/visual/components/LeftNav.vue
@@ -213,10 +213,6 @@
},
closeTree() {
this.TreeDataPool.showTreeBox = false;
- this.CategoryData.isShow = false;
- this.$nextTick(() => {
- this.CategoryData.isShow = true;
- });
},
addNode(event) {
this.$refs.tree.addNode(event, { id: 0 });
diff --git a/src/pages/visual/components/TopNav.vue b/src/pages/visual/components/TopNav.vue
index aec32fd..e785605 100644
--- a/src/pages/visual/components/TopNav.vue
+++ b/src/pages/visual/components/TopNav.vue
@@ -22,7 +22,6 @@
},
methods: {
slideLeft() {
- this.CategoryData.isShow = false;
this.TreeDataPool.showTreeBox = !this.TreeDataPool.showTreeBox;
},
}
diff --git a/src/pages/visual/index/home.vue b/src/pages/visual/index/home.vue
index 720d531..d63d80b 100644
--- a/src/pages/visual/index/home.vue
+++ b/src/pages/visual/index/home.vue
@@ -48,18 +48,14 @@
</div>
</div>
<div v-if="radioType === '1'" id="category" class="category-parent">
- <category
- v-if="CategoryData.isShow"
- :xAxisData="CategoryData.xAxisArray"
- :seriesData="CategoryData.seriesArray"
- ></category>
+ <category :xAxisData="CategoryData.xAxisArray" :seriesData="CategoryData.seriesArray"></category>
</div>
<div v-if="radioType === '2'" class="div-realTime">
<realTimeList></realTimeList>
</div>
</div>
<div v-if="radioType === '1'" id="category" class="category-parent">
- <category v-if="CategoryData.isShow"></category>
+ <category></category>
</div>
<div v-if="radioType === '2'" class="div-realTime">
<realTimeList></realTimeList>
@@ -142,7 +138,7 @@
</div>
</div>
<div class="div-pie">
- <mutPie v-if="CategoryData.isShow"></mutPie>
+ <mutPie></mutPie>
</div>
<div class="bottom-title">
<span class="s-1">鎽勫儚鏈�</span>
@@ -159,7 +155,6 @@
<div class="div-pie" v-if="CategoryData.dataStatus==='default'">
<span>棰勮浜嬩欢</span>
<pie
- v-if="CategoryData.isShow"
:seriesName="CategoryData.pieName"
:radiusType="radiusType"
:seriesData="CategoryData.pieData"
@@ -240,12 +235,7 @@
// 鐩戝惉绐楀彛
document.addEventListener("visibilitychange", this.visibilitychange, false);
window.addEventListener('resize', this.windowSizeChange)
- this.CategoryData.isShow = false;
- this.$nextTick(() => {
- // let height = document.getElementById('category').clientHeight
- // console.log(height,'category鐨勯珮搴�')
- this.CategoryData.isShow = true;
- })
+
this.timer = setInterval(() => {
this.VideoPhotoData.capture()
this.CategoryData.realTimeCapture();
--
Gitblit v1.8.0