From 45faaf27722588e92050e2e3eace9b3704377048 Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期六, 02 四月 2022 18:44:30 +0800
Subject: [PATCH] 首页接口

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

diff --git a/src/Pool/TreeData.ts b/src/Pool/TreeData.ts
index 27be295..49b9c0e 100644
--- a/src/Pool/TreeData.ts
+++ b/src/Pool/TreeData.ts
@@ -11,6 +11,8 @@
   getCameraBaseImage
 } from '@/api/area'
 
+import {getClusterDevList} from '@/api/clusterManage'
+
 export default class TreeDataPool {
   public openeds: Array<boolean>
   public activeTreeData: Array<object>
@@ -63,6 +65,8 @@
   public cameraNameForBaseImage: string
   public gb28181CameraBaseImage: string
   public baseImageLoading: boolean
+  public clusterId: string
+  public devId: string
 
   constructor() {
     this.openeds = [true, true, false]
@@ -102,6 +106,23 @@
     this.cameraNameForBaseImage = ""
     this.gb28181CameraBaseImage = ""
     this.baseImageLoading = false
+
+    this.clusterId = ""
+    this.devId = ""
+
+    this.getId()
+  }
+
+ async getId(){
+
+      //鍏堟嬁闆嗙兢id鎴栬澶噄d
+    const res:any = await getClusterDevList()
+    if(res.data.clusterList.length > 0) {
+      this.clusterId = res.data.clusterList[0].cluster_id
+    }
+    else {
+      this.devId = res.data.devList[0].devId
+    }
   }
 
   setVideoArr(index: number, value: object, vue: any): void {
@@ -338,17 +359,22 @@
 
   async fetchLocalTree() {
     let params: any = {
+      parentId:"",
       searchType: this.searchCamType,
-      cameraName: this.searchInput
+      cameraName: this.searchInput,
+      clusterId:this.clusterId,
+      devId:this.devId
       //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 : []
+      this.treeData = rsp.data.treeMenu ? rsp.data.treeMenu : []
       if (this.treeData && this.treeData.length > 0) {
         this.sortTreeData(this.treeData)
       }

--
Gitblit v1.8.0