From f20a554bdb24e9dfde9dc6a69d78595944f61d15 Mon Sep 17 00:00:00 2001
From: mark <mark18340872469@163.com>
Date: 星期二, 25 十月 2022 14:53:57 +0800
Subject: [PATCH] 设备管理 样式调整

---
 src/Pool/TreeData.ts |   53 +++++++++++++++++++++++++++--------------------------
 1 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/src/Pool/TreeData.ts b/src/Pool/TreeData.ts
index 49b9c0e..1ff4151 100644
--- a/src/Pool/TreeData.ts
+++ b/src/Pool/TreeData.ts
@@ -65,8 +65,11 @@
   public cameraNameForBaseImage: string
   public gb28181CameraBaseImage: string
   public baseImageLoading: boolean
+
+  public activeNode: string
   public clusterId: string
   public devId: string
+
 
   constructor() {
     this.openeds = [true, true, false]
@@ -106,24 +109,13 @@
     this.cameraNameForBaseImage = ""
     this.gb28181CameraBaseImage = ""
     this.baseImageLoading = false
+    this.activeNode = ''
+    this.clusterId = ''
+    this.devId = ''
 
-    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 {
     vue.$set(this.videoArr, index, value)
@@ -140,6 +132,7 @@
     function nodeFilter(node: any) {
       if (node.type === '4' && node.selected) {
         _selected.push(node.id)
+        sessionStorage.setItem('cameraDevId',node.devId)
       }
       if (node.children) {
         node.children.forEach((n: any) => {
@@ -182,6 +175,7 @@
 
     function nodeFilter(node: any) {
       if (node.type === '4' && (node.selected || node.checked)) {
+      sessionStorage.setItem("cameraDevId", node.devId);
         _this.selectedNodes.push(node.id)
       }
       if (node.children) {
@@ -362,8 +356,7 @@
       parentId:"",
       searchType: this.searchCamType,
       cameraName: this.searchInput,
-      clusterId:this.clusterId,
-      devId:this.devId
+    
       //isPlatform: 1
     }
     if (this.searchFrom == 'cluster') {
@@ -374,6 +367,7 @@
     const rsp: any = await getLocalCameraTree(params)
 
     if (rsp && rsp.success) {
+    
       this.treeData = rsp.data.treeMenu ? rsp.data.treeMenu : []
       if (this.treeData && this.treeData.length > 0) {
         this.sortTreeData(this.treeData)
@@ -403,12 +397,13 @@
 
   async fetchGbTree() {
     const rsp: any = await getGB28181CameraTree({
+      parentId: "",
       searchType: this.searchCamType,
       cameraName: this.searchInput
     })
 
     if (rsp && rsp.success) {
-      this.gb28181Data = rsp.data ? rsp.data : []
+      this.gb28181Data = rsp.data.treeMenu ? rsp.data.treeMenu : []
       if (this.gb28181Data && this.gb28181Data.length > 0) {
         this.sortTreeData(this.gb28181Data)
       }
@@ -430,7 +425,7 @@
   async add(name: string, parent: string) {
     await addAreaTreeData({
       name: name,
-      parentId: parent
+      parentId: parent,
     })
 
     this.fetchTreeData()
@@ -438,7 +433,7 @@
 
   async del(id: string) {
     await delAreaTreeData({
-      id: id
+      id: id,
     })
 
     this.fetchTreeData()
@@ -449,14 +444,14 @@
       id: id,
       name: name,
       parentId: this.getParent(id, isGb),
-      alias: alias
+      alias: alias,
     })
 
     this.fetchTreeData()
   }
 
   async refreshGB28181() {
-    await refreshGB28181Tree()
+    await refreshGB28181Tree({})
     // this.fetchGbTree()
   }
 
@@ -494,7 +489,10 @@
     if (update) {
       fn = refreshGB28181Tree
     }
-    const rsp: any = await fn()
+    const rsp: any = await fn({
+      clusterId:this.clusterId,
+      devId:this.devId,
+    })
 
     if (rsp && rsp.success) {
       this.selectedNode = {}
@@ -507,10 +505,9 @@
       this.setDropDisable(this.treeData)
       this.isFold(this.treeData)
 
-      this.activeTreeData = this.treeData
-
-      this.gb28181CheckedCount = 0;
+      this.gb28181CheckedCount = 0
       this.gb28181ChildNodeCount = this.countChildrenNodes(this.treeData)
+      this.activeTreeData = this.treeData
     }
   }
 
@@ -551,7 +548,11 @@
     this.cameraNameForBaseImage = node.name
 
     try {
-      const rsp: any = await getCameraBaseImage({ id: node.id })
+      const rsp: any = await getCameraBaseImage({ 
+        id: node.id,
+        clusterId: this.clusterId,
+        devId: this.devId,
+      })
 
       if (rsp && rsp.data) {
         this.gb28181CameraBaseImage = rsp.data

--
Gitblit v1.8.0