| | |
| | | import { getCameraTask, initTaskData, monitorRealTimeTaskData } from "@/api/task"; |
| | | import { getCameraTask,getCameraTaskTwo, initTaskData,initTaskDataTwo, monitorRealTimeTaskData } from "@/api/task"; |
| | | |
| | | export default class VideoTaskData { |
| | | public tasks: Array<any> = []; |
| | |
| | | |
| | | public async fetchTasks() { |
| | | // 根据选中摄像机,查找任务,去重 |
| | | const rsp: any = await getCameraTask({ |
| | | cameraIds: this.cameras |
| | | // 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) => { |
| | |
| | | // }) |
| | | // } |
| | | // }) |
| | | rsp.data.forEach((d: any) => { |
| | | resq.forEach((d: any) => { |
| | | if (taskNames.indexOf(d.name) < 0) { |
| | | taskNames.push(d.name); |
| | | this.tasks.push(d) |
| | |
| | | return; |
| | | } |
| | | |
| | | const rsp: any = await initTaskData({ |
| | | //tasks: [this.tasks[this.activeIndex].taskId], |
| | | tasks: this.tasks[this.activeIndex].id.split(','), |
| | | // const rsp: any = await initTaskData({ |
| | | // // tasks: [this.tasks[this.activeIndex].taskId], |
| | | // tasks: this.tasks[this.activeIndex].id.split(','), |
| | | // treeNodes: this.cameras |
| | | // }); |
| | | const rsp: any = await initTaskDataTwo({ |
| | | warning:1, |
| | | taskIds: [this.tasks[this.activeIndex].id], |
| | | treeNodes: this.cameras |
| | | }); |
| | | |
| | | if (rsp && rsp.success && rsp.data.datalist) { |
| | | rsp.data.datalist.forEach(element => { |
| | | this.taskCard = []//初始化所有预警数据 |
| | | // console.log(rsp, 'rsp数据') |
| | | if (rsp && rsp.success && rsp.data.list.datalist) { |
| | | rsp.data.list.datalist.forEach(element => { |
| | | // this.taskCard.push({ |
| | | // list: [element], |
| | | // activeObject: element |
| | |
| | | this.taskCard.push(element) |
| | | }); |
| | | } |
| | | // console.log(this.taskCard, 'taskCard') |
| | | } |
| | | |
| | | public async monitorTaskData() { |
| | |
| | | } |
| | | |
| | | const rsp: any = await monitorRealTimeTaskData({ |
| | | //tasks: [this.tasks[this.activeIndex].id], |
| | | tasks: this.tasks[this.activeIndex].id.split(','), |
| | | warning:1, |
| | | taskIds: [this.tasks[this.activeIndex].id], |
| | | // tasks: this.tasks[this.activeIndex].id.split(','), |
| | | treeNodes: this.cameras |
| | | }); |
| | | if (rsp && rsp.success) { |
| | | if (rsp.data.datalist && rsp.data.datalist.length > 0) { |
| | | rsp.data.datalist.reverse().forEach(element => { |
| | | 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 |
| | | }) |