From c99cad106ef5be9f818e45d385dfdcec29ce19e5 Mon Sep 17 00:00:00 2001
From: hanbaoshan <hanbaoshan@aiotlink.com>
Date: 星期四, 03 十二月 2020 16:52:24 +0800
Subject: [PATCH] 修复绘制多边形撤销错误的bug

---
 src/Pool/TreeData.ts |   42 ++++++++++++++++++++++++++++++------------
 1 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/src/Pool/TreeData.ts b/src/Pool/TreeData.ts
index ee52310..7ab436f 100644
--- a/src/Pool/TreeData.ts
+++ b/src/Pool/TreeData.ts
@@ -31,6 +31,7 @@
   public readonly: boolean;
   public gbReadonly: boolean;
   public multiple: boolean;
+  public searchFrom: string = '';
   public showTreeBox: boolean;
   public selectedNodes: Array<string>;
   public selectedNode: any;
@@ -111,8 +112,8 @@
       this.selectedNodes = [this.selectedNode.id];
       return;
     }
-
     let _selected = this.selectedNodes;
+    console.log(this.selectedNodes)
     function nodeFilter(node: any) {
       if (node.type === "4" && node.selected) {
         _selected.push(node.id);
@@ -124,20 +125,33 @@
       }
     }
     if (this.selectedNode.cameraType === 0) {
-      this.treeData.forEach((n: any) => {
-        nodeFilter(n);
-      });
+      //鎽勫儚鏈烘爲
+      if(this.treeActiveName == "camera"){
+        this.treeData.forEach((n: any) => {
+          nodeFilter(n);
+        });
+      }else if(this.treeActiveName == "cluster"){
+        //闆嗙兢鏍�
+        this.clusterData.forEach((n: any) => {
+          nodeFilter(n);
+        });
+      }
     }
     if (this.selectedNode.cameraType === 1) {
       this.gb28181Data.forEach((n: any) => {
         nodeFilter(n);
       });
     }
+    // if (this.selectedNode.cameraType === -1) {
+    //   this.clusterData.forEach((n: any) => {
+    //     nodeFilter(n);
+    //   });
+    // }
   }
 
   getCameraInfoByIp(ipaddr) {
     let camera = null;
-
+ 
     function nodeFilter(node: any) {
       if (node.rtsp && node.rtsp.indexOf(ipaddr) != -1) {
         camera = node;
@@ -291,10 +305,15 @@
   }
 
   async fetchLocalTree() {
-    const rsp: any = await getLocalCameraTree({
+    let params: any = {
       searchType: this.searchCamType,
-      cameraName: this.searchInput
-    });
+      cameraName: this.searchInput,
+      //isPlatform: 1
+    };
+    if (this.searchFrom == 'cluster') {
+      params.isPlatform = 1
+    }
+    const rsp: any = await getLocalCameraTree(params);
 
     if (rsp && rsp.success) {
       this.treeData = rsp.data ? rsp.data : []
@@ -309,16 +328,15 @@
     }
   }
 
-  async fetchClusterTree (){
-    debugger
+  async fetchClusterTree() {
     const rsp: any = await getClusterTree({
       searchType: this.searchCamType,
       cameraName: this.searchInput
     });
-    if(rsp && rsp.success){
+    if (rsp && rsp.success) {
       console.log(rsp.data);
       this.clusterData = rsp.data ? rsp.data : []
-      if(this.clusterData && this.clusterData.length > 0){
+      if (this.clusterData && this.clusterData.length > 0) {
         this.sortTreeData(this.clusterData)
       }
       this.clusterDataPure = JSON.parse(JSON.stringify(this.clusterData));

--
Gitblit v1.8.0