From 1e84774c0c0752c61e60592e7f7fc1c0d25a1dab Mon Sep 17 00:00:00 2001 From: hanbaoshan <hanbaoshan@aiotlink.com> Date: 星期二, 27 十月 2020 16:38:48 +0800 Subject: [PATCH] 首页加入算法 --- src/Pool/TreeData.ts | 25 +++++++++++++++++-------- 1 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/Pool/TreeData.ts b/src/Pool/TreeData.ts index ee52310..98708da 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,7 +112,6 @@ this.selectedNodes = [this.selectedNode.id]; return; } - let _selected = this.selectedNodes; function nodeFilter(node: any) { if (node.type === "4" && node.selected) { @@ -130,6 +130,11 @@ } if (this.selectedNode.cameraType === 1) { this.gb28181Data.forEach((n: any) => { + nodeFilter(n); + }); + } + if (this.selectedNode.cameraType === -1) { + this.clusterData.forEach((n: any) => { nodeFilter(n); }); } @@ -291,10 +296,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 +319,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