From d498cdcf61fd8e2ec341cad3e7c21829ecef1672 Mon Sep 17 00:00:00 2001
From: sd <shidong@jhsoft.cc>
Date: 星期二, 26 八月 2025 17:44:18 +0800
Subject: [PATCH] 摄像机配置、数据推送和文搜万物 bug和样式修复; 知识库卡片样式调整参照大模型平台知识库样式。

---
 src/Pool/VideoTaskData.ts |  124 ++++++++++++++++++++++++++++++----------
 1 files changed, 92 insertions(+), 32 deletions(-)

diff --git a/src/Pool/VideoTaskData.ts b/src/Pool/VideoTaskData.ts
index 97b230c..b11bbf7 100644
--- a/src/Pool/VideoTaskData.ts
+++ b/src/Pool/VideoTaskData.ts
@@ -1,4 +1,4 @@
-import { getCameraTask,getCameraTaskTwo, initTaskData,initTaskDataTwo, monitorRealTimeTaskData } from "@/api/task";
+import { getCameraTask,getCameraTaskTwo,getCameraTaskThree, initTaskData,initTaskDataTwo, monitorRealTimeTaskData } from "@/api/task";
 
 export default class VideoTaskData {
   public tasks: Array<any> = [];
@@ -6,25 +6,77 @@
   public cameras: Array<string> = [];
   public activeIndex: number;
   public separateRulesTasks: object = [];
+  public taskNameList = [];//棰勮鏁版嵁鏂板鎺ュ彛鐢�
 
   constructor() {
     this.tasks = [];
+    this.taskNameList = [];
     this.taskCard = [];
     this.cameras = [];
     this.activeIndex = 0;
     this.separateRulesTasks = [];
   }
 
+  // public async fetchTasks() {
+  //   // 鏍规嵁閫変腑鎽勫儚鏈猴紝鏌ユ壘浠诲姟锛屽幓閲�
+  //   // const rsp: any = await getCameraTask({
+  //   //   cameraIds: this.cameras
+  //   // });
+  //   const rsp: any = await getCameraTaskTwo({
+  //     videoIds: this.cameras
+  //   });
+  //   if (rsp && rsp.success) {
+  //     //let taskIds = []
+  //     let taskNames = [];
+  //     this.tasks = [];
+
+  //     let resq = rsp.data.map(item => ({
+  //       id: item.taskId,
+  //       name: item.taskName,
+  //       isDelete: false,
+  //     }))
+  //     // rsp.data.forEach((d: any) => {
+  //     //   if (d.tasks) {
+  //     //     d.tasks.forEach((t: any) => {
+  //     //       if (taskIds.indexOf(t.taskid) < 0) {
+  //     //         taskIds.push(t.taskid)
+  //     //         if (t.taskname == "浜鸿劯娴嬫俯") {
+  //     //           this.tasks.unshift({
+  //     //             taskName: t.taskname,
+  //     //             taskId: t.taskid
+  //     //           })
+  //     //         } else {
+  //     //           this.tasks.push({
+  //     //             taskName: t.taskname,
+  //     //             taskId: t.taskid
+  //     //           })
+  //     //         }
+  //     //       }
+  //     //     })
+  //     //   }
+  //     // })
+  //     resq.forEach((d: any) => {
+  //       if (taskNames.indexOf(d.name) < 0) {
+  //         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;
+  //       }
+  //     });
+
+  //     this.tasks = this.tasks.filter((d: any) => !d.isDelete)
+  //     console.log(this.tasks);
+
+  //     // 鍒濆鍖栫涓�浠诲姟鐨勪俊鎭�
+  //     this.initTaskList()
+  //   }
+  // }
   public async fetchTasks() {
     // 鏍规嵁閫変腑鎽勫儚鏈猴紝鏌ユ壘浠诲姟锛屽幓閲�
-    // const rsp: any = await getCameraTask({
-    //   cameraIds: this.cameras
-    // });
-    const rsp: any = await getCameraTaskTwo({
-      videoIds: this.cameras
-    });
-    if (rsp && rsp.success) {
-      //let taskIds = []
+    const rsp: any = await getCameraTaskThree();
+    if (rsp && rsp.status === 200) {
       let taskNames = [];
       this.tasks = [];
 
@@ -33,30 +85,14 @@
         name: item.taskName,
         isDelete: false,
       }))
-      // rsp.data.forEach((d: any) => {
-      //   if (d.tasks) {
-      //     d.tasks.forEach((t: any) => {
-      //       if (taskIds.indexOf(t.taskid) < 0) {
-      //         taskIds.push(t.taskid)
-      //         if (t.taskname == "浜鸿劯娴嬫俯") {
-      //           this.tasks.unshift({
-      //             taskName: t.taskname,
-      //             taskId: t.taskid
-      //           })
-      //         } else {
-      //           this.tasks.push({
-      //             taskName: t.taskname,
-      //             taskId: t.taskid
-      //           })
-      //         }
-      //       }
-      //     })
-      //   }
-      // })
       resq.forEach((d: any) => {
         if (taskNames.indexOf(d.name) < 0) {
           taskNames.push(d.name);
-          this.tasks.push(d)
+          this.taskNameList.push(d.name);
+          this.tasks.push({
+            value:d.name,
+            label:d.name,
+          })
         } else {
           let repeatOne = this.tasks.find((one: any) => one.name == d.name);
           repeatOne.id += `,${d.id}`;
@@ -86,10 +122,11 @@
     // });
     const rsp: any = await initTaskDataTwo({
       warning:1,
-      tasks: [this.tasks[this.activeIndex].id],
+      taskIds: [this.tasks[this.activeIndex].id],
       treeNodes: this.cameras
     });
 
+    this.taskCard = []//鍒濆鍖栨墍鏈夐璀︽暟鎹�
     // console.log(rsp, 'rsp鏁版嵁')
     if (rsp && rsp.success && rsp.data.list.datalist) {
       rsp.data.list.datalist.forEach(element => {
@@ -110,7 +147,7 @@
 
     const rsp: any = await monitorRealTimeTaskData({
       warning:1,
-      tasks: [this.tasks[this.activeIndex].id],
+      taskIds: [this.tasks[this.activeIndex].id],
       // tasks: this.tasks[this.activeIndex].id.split(','),
       treeNodes: this.cameras
     });
@@ -132,4 +169,27 @@
       }
     }
   }
+  public async monitorTaskDataTwo() {//2025.07.30 鍙充晶棰勮鏁版嵁涓嶅啀涓庢挱鏀剧殑瀹炴椂鐩戞帶缁戝畾
+    if (!this.tasks[this.activeIndex]) {
+      return;
+    }
+
+    const rsp: any = await monitorRealTimeTaskData({
+      warning:1,
+      taskName: this.taskNameList
+    });
+    if (rsp && rsp.success) {
+      if (rsp.data.list.datalist && rsp.data.list.datalist.length > 0) {
+        rsp.data.list.datalist.reverse().forEach(element => {
+          let rt = this.taskCard.filter((c: any) => {
+            return c.activeObject.id === element.activeObject.id
+          })
+          if (rt.length < 1) {
+            this.taskCard.unshift(element)
+          }
+        });
+        this.taskCard.splice(20, this.taskCard.length - 20)
+      }
+    }
+  }
 }

--
Gitblit v1.8.0