From e37e45cfe1123928dba5d9c5a427b0ee497b7ad6 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期二, 23 八月 2022 03:21:32 +0800
Subject: [PATCH] 修复算法配置的字段内容

---
 src/Pool/VideoPhotoData.ts |  259 ++++++++++++++++++++++++++++-----------------------
 1 files changed, 144 insertions(+), 115 deletions(-)

diff --git a/src/Pool/VideoPhotoData.ts b/src/Pool/VideoPhotoData.ts
index e86de54..82d42f5 100644
--- a/src/Pool/VideoPhotoData.ts
+++ b/src/Pool/VideoPhotoData.ts
@@ -6,69 +6,70 @@
   findPersonByPic,
   findPerson,
   addToBase
-} from "@/api/search";
+} from "@/api/search"
 export default class VideoPhotoData {
-  public searchFrom: string = 'search';
-  public preCards: Array<object> = [];
-  public cards: Array<object> = [];
-  public persons: Array<object> = [];
+  public searchFrom: string = "search"
+  public preCards: Array<object> = []
+  public cards: Array<object> = []
+  public persons: Array<object> = []
   public activeName: string = "pic"
-  public page: number = 1;
-  public size: number;
-  public pageSizeOption: Array<number>;
-  public alarmlevel: Array<object>;
-  public dictionary: object = {};
-  public monitorLevel: Array<object> = [];
-  public queryAlarmlevel: Array<string> = [];
-  public inputValue: string;
-  public searchTime: Array<string>;
-  public showType: string;
-  public tabs: Array<object>;
-  public blackList: Array<object> = [];
-  public selectBlacks: Array<object> = [];
-  public whiteList: Array<object> = [];
-  public selectWhites: Array<object> = [];
-  public queryTabs: Array<string> = [];
-  public compareTabs: Array<string> = [];
-  public tasks: Array<object>;
-  public queryTasks: Array<string> = [];
-  public treeNodes: Array<string>;
-  public total: number = 0;
-  public tabsForUploadImg: Array<object> = [];
-  public picUrl: string = "";
-  public threshold: number = 60;
-  public activeCard: number | string = "";
-  public uploadImg: any = "";
-  public captureId: string = "";
-  public compareNum: string = "";
-  public compTargetId: string = "";
-  public compTargetType: string = "1";
-  public rightSectionDisplay: boolean = false;
-  public scrollContainDom: any = '';
-  public uploadDiaplay: boolean = false;
-  public uploadType: boolean = false;
+  public page: number = 1
+  public size: number
+  public pageSizeOption: Array<number>
+  public alarmlevel: Array<object>
+  public dictionary: object = {}
+  public monitorLevel: Array<object> = []
+  public queryAlarmlevel: Array<string> = []
+  public inputValue: string
+  public searchTime: Array<string>
+  public showType: string
+  public tabs: Array<object>
+  public blackList: Array<object> = []
+  public selectBlacks: Array<object> = []
+  public whiteList: Array<object> = []
+  public selectWhites: Array<object> = []
+  public queryTabs: Array<string> = []
+  public compareTabs: Array<string> = []
+  public tasks: Array<object>
+  public queryTasks: Array<string> = []
+  public treeNodes: Array<string>
+  public total: number = 0
+  public tabsForUploadImg: Array<object> = []
+  public picUrl: string = ""
+  public threshold: number = 60
+  public activeCard: number | string = ""
+  public uploadImg: any = ""
+  public captureId: string = ""
+  public compareNum: string = ""
+  public compTargetId: string = ""
+  public compTargetType: string = "1"
+  public rightSectionDisplay: boolean = false
+  public scrollContainDom: any = ""
+  public uploadDiaplay: boolean = false
+  public uploadType: boolean = false
+  public warningFlag: number = 0
 
   constructor() {
-    this.cards = [];
-    this.size = 60;
-    this.pageSizeOption = [30, 60, 120]
-    this.alarmlevel = [];
-    this.inputValue = "";
-    this.searchTime = [];
-    this.showType = "search";
-    this.tabs = [];
-    this.tasks = [];
-    this.treeNodes = [];
+    this.cards = []
+    this.size = 60
+    this.pageSizeOption = [30, 60, 120, 1200]
+    this.alarmlevel = []
+    this.inputValue = ""
+    this.searchTime = []
+    this.showType = "search"
+    this.tabs = []
+    this.tasks = []
+    this.treeNodes = []
   }
 
   clearStatus() {
     //this.cards = [];
-    this.page = 1;
-    this.size = 60;
+    this.page = 1
+    this.size = 60
     this.pageSizeOption = [30, 60, 120]
-    this.alarmlevel = [];
-    this.inputValue = "";
-    this.showType = "search";
+    this.alarmlevel = []
+    this.inputValue = ""
+    this.showType = "search"
   }
 
   async querySearchList() {
@@ -80,29 +81,49 @@
       searchTime: this.searchTime,
       alarmlevel: this.queryAlarmlevel,
       inputValue: this.inputValue,
+      warningFlag: this.warningFlag,
       tabs: this.queryTabs,
       tasks: this.queryTasks,
-      treeNodes: this.treeNodes
+      dataSource: "camera"
     }
-    if (this.searchFrom == 'cluster') {
+
+    // 鏍规嵁鏉冮檺鎺у埗鎽勫儚鏈�
+    let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
+    // 鏈�夋嫨鎽勫儚鏈哄苟涓斾笉鏄鐞嗗憳
+    if (!this.treeNodes.length && userInfo.username != "Administrator") {
+      let checkedCameras = userInfo.email
+
+      this.treeNodes = checkedCameras.split(",")
+    }
+    param.treeNodes = this.treeNodes
+
+    if (this.searchFrom == "cluster") {
       param.isAll = true
     }
-    const rsp: any = await getSearchList(param);
+    const rsp: any = await getSearchList(param)
     if (rsp && rsp.success) {
       this.cards.length = 0 // 娓呬袱娆★紝绗竴娆℃槸涓轰簡鐐瑰畬涔嬪悗涓嶄細鍑虹幇涔嬪墠鏁版嵁鐨勬畫褰憋紝杩欐鏄负浜嗛槻姝㈠洜涓哄紓姝ラ棶棰樹袱娆¤姹備細鍑虹幇鍙屽�嶆暟鎹殑闂
       this.preCards.length = 0
       if (rsp.data.datalist) {
-        rsp.data.datalist.forEach(element => {
+        rsp.data.datalist.forEach((element) => {
+          if (element.activeObject.targetInfo && element.activeObject.targetInfo.length === 0) {
+            element.activeObject.targetInfo = null
+          }
+
+          if (element.list[0].targetInfo && element.list[0].targetInfo.length === 0) {
+            element.list[0].targetInfo = null
+          }
+
           element.ownerPage = this.page
-          this.cards.push(element as any);
+          this.cards.push(element as any)
           // 鍙厑璁告瘡涓猚ard娓叉煋涓�寮犲浘鐗�
           // var obj = {activeObject: element.activeObject,ownerPage: element.ownerPage,list: [],length: element.list.length}
           // obj.list.push(element.activeObject)
           // this.preCards.push(obj)
-        });
+        })
       }
       //console.log("cards鐨勬暟閲�",this.cards)
-      this.total = rsp.data.total;
+      this.total = rsp.data.total
     }
   }
 
@@ -121,17 +142,17 @@
       threshold: this.threshold,
       isAll: this.searchFrom == "cluster" ? true : false
     }
-    const rsp: any = await findPersonByPic(param);
+    const rsp: any = await findPersonByPic(param)
     if (rsp && rsp.success) {
-      rsp.data.totalList.forEach(element => {
+      rsp.data.totalList.forEach((element) => {
         var obj = {
-          activeObject: (element as any),
+          activeObject: element as any,
           list: []
         }
         element.ownerPage = this.page
-        obj.list.push((element as any))
+        obj.list.push(element as any)
         this.cards.push(obj)
-      });
+      })
       // console.log("浠ュ浘鎼滃浘鏌ュ洖鏉ョ殑浜�",this.persons)
       this.total = rsp.data.total
       this.compareNum = rsp.data.compareNum
@@ -171,20 +192,20 @@
         compTargetId: this.compTargetId,
         compTargetType: compType,
         databases: this.compareTabs,
-        threshold: this.threshold,
+        threshold: this.threshold
       }
     }
-    const rsp: any = await findPersonByPic(param);
+    const rsp: any = await findPersonByPic(param)
     if (rsp && rsp.success) {
-      rsp.data.totalList.forEach(element => {
+      rsp.data.totalList.forEach((element) => {
         var obj = {
-          activeObject: (element as any),
+          activeObject: element as any,
           list: []
         }
         element.ownerPage = this.page
-        obj.list.push((element as any))
+        obj.list.push(element as any)
         this.cards.push(obj)
-      });
+      })
       this.total = rsp.data.total
       this.compareNum = rsp.data.compareNum
     }
@@ -205,65 +226,73 @@
       threshold: this.threshold,
       isAll: this.searchFrom == "cluster" ? true : false
     }
-    const rsp: any = await findPerson(param);
+    const rsp: any = await findPerson(param)
     if (rsp && rsp.success) {
-      rsp.data.totalList.forEach(element => {
+      rsp.data.totalList.forEach((element) => {
         var obj = {
-          activeObject: (element as any),
+          activeObject: element as any,
           list: []
         }
         element.ownerPage = this.page
-        obj.list.push((element as any))
+        obj.list.push(element as any)
         this.cards.push(obj)
-      });
+      })
       this.total = rsp.data.total
       // console.log("findPersonByPage---", this.total, this.persons)
     }
   }
   async queryTagList() {
-    const rsp: any = await getTagList({});
+    const rsp: any = await getTagList({})
     this.tabsForUploadImg.splice(0, this.tabsForUploadImg.length)
     if (rsp && rsp.success) {
-      var arr1 = new Array
-      arr1 = rsp.data.filter(i => {
-        if (i.status === 1) {
-          i.title = i.title + '(宸插垹闄�)'
-          return i
-        }
-      });
-      this.tabs = rsp.data.filter(function (i) {
-        if (i.status !== 1) {
-          return i
-        }
-      })
+      var arr1 = new Array()
+      arr1 =
+        rsp.data &&
+        rsp.data.tags.filter((i) => {
+          if (i.status === 1) {
+            i.title = i.title + "(宸插垹闄�)"
+            return i
+          }
+        })
+      this.tabs =
+        rsp.data &&
+        rsp.data.tags.filter(function(i) {
+          if (i.status !== 1) {
+            return i
+          }
+        })
       this.tabs.push(...arr1)
-      this.tabsForUploadImg.push({ key: "esData", title: "鎶撴媿搴�" });
-      rsp.data.forEach(element => {
-        this.tabsForUploadImg.push(element as any);
-      });
+      this.tabsForUploadImg.push({ key: "esData", title: "鎶撴媿搴�" })
+      rsp.data.tags.forEach((element) => {
+        this.tabsForUploadImg.push(element as any)
+      })
       // 鏀剧疆榛戠櫧鍚嶅崟 0涓虹櫧鍚嶅崟
       this.blackList.length = 0
       this.whiteList.length = 0
       var josn = JSON.stringify(rsp)
       var resp = JSON.parse(josn)
-      resp.data.forEach(i => {
-        if (i.status === 0 && i.bwType === "0") { //鐧藉悕鍗�
-          if (i.analyServerId === "") { //鍚屾搴�
-            i.title = i.title + '(鍚屾搴�)'
+      resp.data.tags.forEach((i) => {
+        if (i.status === 0 && i.bwType === "0") {
+          //鐧藉悕鍗�
+          if (i.analyServerId === "") {
+            //鍚屾搴�
+            i.title = i.title + "(鍚屾搴�)"
             this.whiteList.push(i)
           } else {
             this.whiteList.push(i)
           }
         }
-        if (i.status === 0 && i.bwType === "1") { //榛戝悕鍗�
-          if (i.analyServerId === "") { //鍚屾搴�
-            i.title = i.title + '(鍚屾搴�)'
+        if (i.status === 0 && i.bwType === "1") {
+          //榛戝悕鍗�
+          if (i.analyServerId === "") {
+            //鍚屾搴�
+            i.title = i.title + "(鍚屾搴�)"
             this.blackList.push(i)
           } else {
             this.blackList.push(i)
           }
         }
-      });
+      })
     } else {
       // this.$notify({
       //   title: "澶辫触",
@@ -274,36 +303,36 @@
   }
 
   async queryTaskList() {
-    let params: any = {};
-    if (this.searchFrom == 'cluster') {
+    let params: any = {}
+    if (this.searchFrom == "cluster") {
       params.isPlatform = 1
     }
     console.log(params)
-    const rsp: any = await getTaskList(params);
+    const rsp: any = await getTaskList(params)
     if (rsp && rsp.success) {
       // this.tasks.splice(0, this.tasks.length)
       // rsp.data.forEach(element => {
       //   this.tasks.push((element as any).task);
       // });
-      let taskNames = [];
-      this.tasks = [];
-      rsp.data.forEach((d: any) => {
+      let taskNames = []
+      this.tasks = []
+      rsp.data.aggs.forEach((d: any) => {
         if (taskNames.indexOf(d.name) < 0) {
-          taskNames.push(d.name);
+          taskNames.push(d.name)
           this.tasks.push(d)
         } else {
-          let repeatOne = this.tasks.find((one: any) => one.name == d.name);
-          repeatOne['id'] += `,${d.id}`;
-          repeatOne['isDelete'] = repeatOne['isDelete'] && d.isDelete
+          let repeatOne = this.tasks.find((one: any) => one.name == d.name)
+          repeatOne["id"] += `,${d.id}`
+          repeatOne["isDelete"] = repeatOne["isDelete"] && d.isDelete
         }
-      });
+      })
     }
   }
 
   async queryDictionary() {
-    const rsp: any = await getAlarmLevel({});
+    const rsp: any = await getAlarmLevel({})
     if (rsp && rsp.success) {
-      this.dictionary = rsp.data;
+      this.dictionary = rsp.data
       // console.log("瀛楀吀鏄細", this.dictionary)
 
       //this.dictionary['ALARMLEVEL'].unshift({ name: '鎾ら槻', value: "-1" })

--
Gitblit v1.8.0