From d01700754282efce449ab8b8c1191a21419eb82f Mon Sep 17 00:00:00 2001
From: hanbaoshan <hanbaoshan@aiotlink.com>
Date: 星期五, 08 一月 2021 21:10:24 +0800
Subject: [PATCH] 朔黄视频分析项目添加

---
 src/Pool/TreeData.ts |  313 +++++++++++++++++++++++++--------------------------
 1 files changed, 154 insertions(+), 159 deletions(-)

diff --git a/src/Pool/TreeData.ts b/src/Pool/TreeData.ts
index 7ab436f..cbb1fde 100644
--- a/src/Pool/TreeData.ts
+++ b/src/Pool/TreeData.ts
@@ -7,140 +7,136 @@
   updateAreaTreeData,
   refreshGB28181Tree,
   updateCameraArea
-} from "@/api/area";
-import {
-  findAllFile,
-  show,
-  changeEnable
-} from "@/api/localVedio";
+} from '@/api/area'
+import { findAllFile, show, changeEnable } from '@/api/localVedio'
 
 export default class TreeDataPool {
-  public openeds: Array<boolean>;
-  public treeData: Array<object>;
-  public clusterData: Array<object>;
-  public gb28181Data: Array<object>;
-  public treeDataPure: Array<object>;
-  public gb28181DataPure: Array<object>;
-  public clusterDataPure: Array<object>;
-  public videoArr: Array<string | undefined | object>;
-  public searchCamType: number;
-  public searchInput: string;
-  public activeVideoIndex: number | string;
-  public activeVideoId: number | string;
-  public activeForceChoose: boolean;
-  public readonly: boolean;
-  public gbReadonly: boolean;
-  public multiple: boolean;
-  public searchFrom: string = '';
-  public showTreeBox: boolean;
-  public selectedNodes: Array<string>;
-  public selectedNode: any;
+  public openeds: Array<boolean>
+  public treeData: Array<object>
+  public clusterData: Array<object>
+  public gb28181Data: Array<object>
+  public treeDataPure: Array<object>
+  public gb28181DataPure: Array<object>
+  public clusterDataPure: Array<object>
+  public videoArr: Array<string | undefined | object>
+  public searchCamType: number
+  public searchInput: string
+  public activeVideoIndex: number | string
+  public activeVideoId: number | string
+  public activeForceChoose: boolean
+  public readonly: boolean
+  public gbReadonly: boolean
+  public multiple: boolean
+  public searchFrom: string = ''
+  public showTreeBox: boolean
+  public selectedNodes: Array<string>
+  public selectedNode: any
   // 璁板綍褰撳墠鎿嶄綔鐨勬爲
-  public treeType: string;
+  public treeType: string
   // 璁板綍鏀惰捣鐨勮妭鐐�
-  public foldNodeList: object;
+  public foldNodeList: object
   //璁板綍宸︿晶tab锛歛ctiveName
-  public treeActiveName: string;
+  public treeActiveName: string
   //鏈湴瑙嗛锛氳棰戝垎鏋愬鐞�
-  public vedioAnaliyseSwitch: boolean;
+  public vedioAnaliyseSwitch: boolean
   //鏈湴瑙嗛鍒楄〃
-  public localVedioList: Array<any>;
+  public localVedioList: Array<any>
   //鏈湴瑙嗛褰撳墠椤�
-  public localCurrentPage: number;
+  public localCurrentPage: number
   //鏈湴瑙嗛姣忛〉鏌ヨ20鏉�
-  public localPageSize: number;
+  public localPageSize: number
   //鏈湴瑙嗛鎬绘潯鏁�
-  public localTotal: number;
+  public localTotal: number
   //鍕鹃�夌殑鏈湴瑙嗛
-  public checkedLocalVedio: Array<any>;
+  public checkedLocalVedio: Array<any>
   //褰撳墠閫変腑鐨勬湰鍦拌棰�
-  public clickLocalVideo: object;
+  public clickLocalVideo: object
   //鎺у埗寮�濮嬨�佹殏鍋滄寜閽樉绀虹姸鎬�
-  public btnStaus: string;
+  public btnStaus: string
   //鏈湴瑙嗛绫诲瀷
-  public searchLocalType: number;
+  public searchLocalType: number
   //璁板綍澶嶅埗鐨勬憚鍍忔満id
-  public ctrlCameraId: string;
+  public ctrlCameraId: string
   //璁板綍澶嶅埗鐨勬憚鍍忔満name
-  public ctrlCameraName: string;
+  public ctrlCameraName: string
 
   constructor() {
-    this.openeds = [true, true, false];
-    this.treeData = [];
-    this.gb28181Data = [];
-    this.clusterData = [];
-    this.treeDataPure = [];
-    this.gb28181DataPure = [];
-    this.clusterDataPure = [];
-    this.videoArr = [""];
-    this.searchCamType = 0;
-    this.searchInput = "";
-    this.activeVideoIndex = "";
-    this.activeVideoId = "";
-    this.activeForceChoose = false;
-    this.showTreeBox = true;
-    this.readonly = true;
-    this.gbReadonly = true;
-    this.multiple = false;
-    this.selectedNodes = [];
-    this.selectedNode = {};
-    this.treeType = "";
-    this.foldNodeList = {};
-    this.vedioAnaliyseSwitch = false;
-    this.treeActiveName = "camera";
-    this.searchLocalType = 0;
-    this.localVedioList = [];
-    this.checkedLocalVedio = [];
-    this.clickLocalVideo = {};
+    this.openeds = [true, true, false]
+    this.treeData = []
+    this.gb28181Data = []
+    this.clusterData = []
+    this.treeDataPure = []
+    this.gb28181DataPure = []
+    this.clusterDataPure = []
+    this.videoArr = ['']
+    this.searchCamType = 0
+    this.searchInput = ''
+    this.activeVideoIndex = ''
+    this.activeVideoId = ''
+    this.activeForceChoose = false
+    this.showTreeBox = true
+    this.readonly = true
+    this.gbReadonly = true
+    this.multiple = false
+    this.selectedNodes = []
+    this.selectedNode = {}
+    this.treeType = ''
+    this.foldNodeList = {}
+    this.vedioAnaliyseSwitch = false
+    this.treeActiveName = 'camera'
+    this.searchLocalType = 0
+    this.localVedioList = []
+    this.checkedLocalVedio = []
+    this.clickLocalVideo = {}
     //1:鏆傚仠鐘舵�侊紱2锛氱瓑寰呯姸鎬�;3:缃伆
-    this.btnStaus = "3";
-    this.localCurrentPage = 1;
-    this.localPageSize = 20;
-    this.localTotal = 0;
-    this.ctrlCameraId = "";
-    this.ctrlCameraName = "";
+    this.btnStaus = '3'
+    this.localCurrentPage = 1
+    this.localPageSize = 20
+    this.localTotal = 0
+    this.ctrlCameraId = ''
+    this.ctrlCameraName = ''
   }
 
   setVideoArr(index: number, value: object, vue: any): void {
-    vue.$set(this.videoArr, index, value);
-    this.activeForceChoose = false;
+    vue.$set(this.videoArr, index, value)
+    this.activeForceChoose = false
   }
 
   updateSelectedNodes() {
-    this.selectedNodes = [];
+    this.selectedNodes = []
     if (!this.multiple) {
-      this.selectedNodes = [this.selectedNode.id];
-      return;
+      this.selectedNodes = [this.selectedNode.id]
+      return
     }
-    let _selected = this.selectedNodes;
+    let _selected = this.selectedNodes
     console.log(this.selectedNodes)
     function nodeFilter(node: any) {
-      if (node.type === "4" && node.selected) {
-        _selected.push(node.id);
+      if (node.type === '4' && node.selected) {
+        _selected.push(node.id)
       }
       if (node.children) {
         node.children.forEach((n: any) => {
-          nodeFilter(n);
-        });
+          nodeFilter(n)
+        })
       }
     }
     if (this.selectedNode.cameraType === 0) {
       //鎽勫儚鏈烘爲
-      if(this.treeActiveName == "camera"){
+      if (this.treeActiveName == 'camera') {
         this.treeData.forEach((n: any) => {
-          nodeFilter(n);
-        });
-      }else if(this.treeActiveName == "cluster"){
+          nodeFilter(n)
+        })
+      } else if (this.treeActiveName == 'cluster') {
         //闆嗙兢鏍�
         this.clusterData.forEach((n: any) => {
-          nodeFilter(n);
-        });
+          nodeFilter(n)
+        })
       }
     }
     if (this.selectedNode.cameraType === 1) {
       this.gb28181Data.forEach((n: any) => {
-        nodeFilter(n);
-      });
+        nodeFilter(n)
+      })
     }
     // if (this.selectedNode.cameraType === -1) {
     //   this.clusterData.forEach((n: any) => {
@@ -150,105 +146,105 @@
   }
 
   getCameraInfoByIp(ipaddr) {
-    let camera = null;
- 
+    let camera = null
+
     function nodeFilter(node: any) {
       if (node.rtsp && node.rtsp.indexOf(ipaddr) != -1) {
-        camera = node;
-        return;
+        camera = node
+        return
       }
       if (node.children) {
         node.children.forEach((n: any) => {
-          nodeFilter(n);
-        });
+          nodeFilter(n)
+        })
       }
     }
 
     this.treeData.forEach((n: any) => {
-      nodeFilter(n);
-    });
+      nodeFilter(n)
+    })
 
     if (!camera) {
       this.gb28181Data.forEach((n: any) => {
-        nodeFilter(n);
-      });
+        nodeFilter(n)
+      })
     }
 
-    return camera;
+    return camera
   }
 
   getCameraInfoById(id) {
-    let camera = null;
+    let camera = null
 
     function nodeFilter(node: any) {
       if (node.id === id) {
-        camera = node;
-        return;
+        camera = node
+        return
       }
       if (node.children) {
         node.children.forEach((n: any) => {
-          nodeFilter(n);
-        });
+          nodeFilter(n)
+        })
       }
     }
 
     this.treeData.forEach((n: any) => {
-      nodeFilter(n);
-    });
+      nodeFilter(n)
+    })
 
     if (!camera) {
       this.gb28181Data.forEach((n: any) => {
-        nodeFilter(n);
-      });
+        nodeFilter(n)
+      })
     }
 
-    return camera;
+    return camera
   }
 
   getParent(id: string, isGB: boolean): string {
-    let parent = "0";
+    let parent = '0'
 
     function nodeFilter(node: Array<any>): any {
       for (let i = 0; i < node.length; i++) {
         if (node[i].id == id) {
-          return true;
+          return true
         }
         if (node[i].children && node[i].children.length > 0) {
           if (nodeFilter(node[i].children)) {
-            parent = node[i].id;
+            parent = node[i].id
           }
         }
       }
-      return false;
+      return false
     }
 
     if (isGB) {
-      nodeFilter(this.gb28181Data);
+      nodeFilter(this.gb28181Data)
     } else {
-      nodeFilter(this.treeData);
+      nodeFilter(this.treeData)
     }
 
-    return parent;
+    return parent
   }
 
   clean() {
-    this.treeData = JSON.parse(JSON.stringify(this.treeDataPure));
-    this.gb28181Data = JSON.parse(JSON.stringify(this.gb28181DataPure));
+    this.treeData = JSON.parse(JSON.stringify(this.treeDataPure))
+    this.gb28181Data = JSON.parse(JSON.stringify(this.gb28181DataPure))
 
     this.isFold(this.treeData)
     this.isFold(this.gb28181Data)
-    this.selectedNodes = [];
-    this.selectedNode = {};
+    this.selectedNodes = []
+    this.selectedNode = {}
 
-    this.cleanLocalVedio();
+    this.cleanLocalVedio()
   }
 
   cleanTree(tree) {
-    if (tree === "localTree") {
-      this.treeData = JSON.parse(JSON.stringify(this.treeDataPure));
+    if (tree === 'localTree') {
+      this.treeData = JSON.parse(JSON.stringify(this.treeDataPure))
     }
-    if (tree === "gb28182Tree") {
-      this.gb28181Data = JSON.parse(JSON.stringify(this.gb28181DataPure));
+    if (tree === 'gb28182Tree') {
+      this.gb28181Data = JSON.parse(JSON.stringify(this.gb28181DataPure))
     }
   }
 
@@ -258,7 +254,7 @@
     }
     node.forEach(n => {
       if (this.foldNodeList[n.id]) {
-        n.opened = false;
+        n.opened = false
       }
       if (n.children && n.children.length > 0) {
         this.isFold(n.children)
@@ -274,8 +270,8 @@
       if (n.children && n.children.length > 0) {
         this.setDropDisable(n.children)
       } else {
-        if (n.type === "4") {
-          n.dropDisabled = true;
+        if (n.type === '4') {
+          n.dropDisabled = true
         }
       }
     })
@@ -285,17 +281,17 @@
     if (!node) {
       return
     }
-    node.sort(function (obj1: any, obj2: any) {
-      var val1 = obj1.name;
-      var val2 = obj2.name;
+    node.sort(function(obj1: any, obj2: any) {
+      var val1 = obj1.name
+      var val2 = obj2.name
       if (val1 < val2) {
-        return -1;
+        return -1
       } else if (val1 > val2) {
-        return 1;
+        return 1
       } else {
-        return 0;
+        return 0
       }
-    });
+    })
 
     node.forEach(n => {
       if (n.children && n.children.length > 0) {
@@ -307,13 +303,13 @@
   async fetchLocalTree() {
     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);
+    const rsp: any = await getLocalCameraTree(params)
 
     if (rsp && rsp.success) {
       this.treeData = rsp.data ? rsp.data : []
@@ -323,23 +319,23 @@
 
       // 璁剧疆绂佹鎷栨嫿鎽勫儚鏈哄埌鎽勫儚鏈鸿妭鐐�
       this.setDropDisable(this.treeData)
-      this.treeDataPure = JSON.parse(JSON.stringify(this.treeData));
+      this.treeDataPure = JSON.parse(JSON.stringify(this.treeData))
       this.isFold(this.treeData)
     }
   }
-
+  
   async fetchClusterTree() {
     const rsp: any = await getClusterTree({
       searchType: this.searchCamType,
       cameraName: this.searchInput
-    });
+    })
     if (rsp && rsp.success) {
-      console.log(rsp.data);
+      console.log(rsp.data)
       this.clusterData = rsp.data ? rsp.data : []
       if (this.clusterData && this.clusterData.length > 0) {
         this.sortTreeData(this.clusterData)
       }
-      this.clusterDataPure = JSON.parse(JSON.stringify(this.clusterData));
+      this.clusterDataPure = JSON.parse(JSON.stringify(this.clusterData))
       this.isFold(this.clusterData)
     }
   }
@@ -348,7 +344,7 @@
     const rsp: any = await getGB28181CameraTree({
       searchType: this.searchCamType,
       cameraName: this.searchInput
-    });
+    })
 
     if (rsp && rsp.success) {
       this.gb28181Data = rsp.data ? rsp.data : []
@@ -356,7 +352,7 @@
         this.sortTreeData(this.gb28181Data)
       }
 
-      this.gb28181DataPure = JSON.parse(JSON.stringify(this.gb28181Data));
+      this.gb28181DataPure = JSON.parse(JSON.stringify(this.gb28181Data))
       this.isFold(this.gb28181Data)
     }
   }
@@ -376,17 +372,17 @@
     await addAreaTreeData({
       name: name,
       parentId: parent
-    });
+    })
 
-    this.fetchTreeData();
+    this.fetchTreeData()
   }
 
   async del(id: string) {
     await delAreaTreeData({
       id: id
-    });
+    })
 
-    this.fetchTreeData();
+    this.fetchTreeData()
   }
 
   async update(name: string, id: string, alias: string, isGb: boolean) {
@@ -395,9 +391,9 @@
       name: name,
       parentId: this.getParent(id, isGb),
       alias: alias
-    });
+    })
 
-    this.fetchTreeData();
+    this.fetchTreeData()
   }
 
   async refreshGB28181() {
@@ -406,8 +402,7 @@
   }
 
   async findAllFile(params: any) {
-    params.fileName = this.searchInput,
-      params.type = this.searchLocalType
+    ;(params.fileName = this.searchInput), (params.type = this.searchLocalType)
     params.page = this.localCurrentPage
     params.size = this.localPageSize
     let res: any = await findAllFile(params)
@@ -422,7 +417,7 @@
         }
         if (!i.snapshot_url) {
           // obj.snapshot_url = require('@/assets/nobody.png')
-          obj.snapshot_url = ""
+          obj.snapshot_url = ''
         } else {
           obj.snapshot_url = '/httpImage/' + obj.snapshot_url
         }
@@ -469,7 +464,7 @@
 
     if (this.checkedLocalVedio.length === 0) {
       this.btnStaus = '3'
-      return false;
+      return false
     }
     this.checkedLocalVedio.every((i, index) => {
       let t = ''
@@ -505,7 +500,7 @@
       i.clickStatus = false
     })
     this.checkedLocalVedio = []
-    this.btnStaus = "3"
+    this.btnStaus = '3'
   }
 
   async dropNode(cameraId, areaId) {

--
Gitblit v1.8.0