import {
|
getSearchList,
|
getTagList,
|
getTaskList,
|
getAlarmLevel,
|
findPersonByPic,
|
findPerson,
|
addToBase
|
} from "@/api/search";
|
export default class VideoPhotoData {
|
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;
|
|
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 = [];
|
}
|
|
clearStatus() {
|
//this.cards = [];
|
this.page = 1;
|
this.size = 60;
|
this.pageSizeOption = [30, 60, 120]
|
this.alarmlevel = [];
|
this.inputValue = "";
|
this.showType = "search";
|
}
|
|
async querySearchList() {
|
this.cards = []
|
this.preCards = []
|
var param: any = {
|
page: this.page,
|
size: this.size,
|
searchTime: this.searchTime,
|
alarmlevel: this.queryAlarmlevel,
|
inputValue: this.inputValue,
|
tabs: this.queryTabs,
|
tasks: this.queryTasks,
|
treeNodes: this.treeNodes,
|
dataSource: "camera"
|
}
|
if (this.searchFrom == 'cluster') {
|
param.isAll = true
|
}
|
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 => {
|
|
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);
|
// 只允许每个card渲染一张图片
|
// 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;
|
}
|
}
|
|
async findPerson() {
|
this.cards = []
|
var param = {
|
page: this.page,
|
size: this.size,
|
searchTime: this.searchTime,
|
alarmlevel: this.queryAlarmlevel,
|
inputValue: this.inputValue,
|
tabs: this.queryTabs,
|
treeNodes: this.treeNodes,
|
picUrl: this.picUrl,
|
databases: this.compareTabs,
|
threshold: this.threshold,
|
isAll: this.searchFrom == "cluster" ? true : false
|
}
|
const rsp: any = await findPersonByPic(param);
|
if (rsp && rsp.success) {
|
rsp.data.totalList.forEach(element => {
|
var obj = {
|
activeObject: (element as any),
|
list: []
|
}
|
element.ownerPage = this.page
|
obj.list.push((element as any))
|
this.cards.push(obj)
|
});
|
// console.log("以图搜图查回来的人",this.persons)
|
this.total = rsp.data.total
|
this.compareNum = rsp.data.compareNum
|
}
|
}
|
async findPerson2() {
|
// 111
|
this.cards = []
|
var compType = this.compTargetType == "1" ? 1 : 0
|
let param
|
if (this.searchFrom == "cluster") {
|
param = {
|
page: this.page,
|
size: this.size,
|
searchTime: this.searchTime,
|
picUrl: this.picUrl,
|
alarmlevel: this.queryAlarmlevel,
|
inputValue: this.inputValue,
|
tasks: this.queryTasks,
|
treeNodes: this.treeNodes,
|
compTargetId: this.compTargetId,
|
compTargetType: compType,
|
databases: this.compareTabs,
|
threshold: this.threshold,
|
isAll: true
|
}
|
} else {
|
param = {
|
page: this.page,
|
size: this.size,
|
searchTime: this.searchTime,
|
picUrl: this.picUrl,
|
alarmlevel: this.queryAlarmlevel,
|
inputValue: this.inputValue,
|
tasks: this.queryTasks,
|
treeNodes: this.treeNodes,
|
compTargetId: this.compTargetId,
|
compTargetType: compType,
|
databases: this.compareTabs,
|
threshold: this.threshold,
|
}
|
}
|
const rsp: any = await findPersonByPic(param);
|
if (rsp && rsp.success) {
|
rsp.data.totalList.forEach(element => {
|
var obj = {
|
activeObject: (element as any),
|
list: []
|
}
|
element.ownerPage = this.page
|
obj.list.push((element as any))
|
this.cards.push(obj)
|
});
|
this.total = rsp.data.total
|
this.compareNum = rsp.data.compareNum
|
}
|
}
|
async findPersonByPage() {
|
this.cards = []
|
var param = {
|
page: this.page,
|
size: this.size,
|
searchTime: this.searchTime,
|
alarmlevel: this.queryAlarmlevel,
|
inputValue: this.inputValue,
|
tasks: this.queryTasks,
|
treeNodes: this.treeNodes,
|
picUrl: this.picUrl,
|
databases: this.compareTabs,
|
compareNum: this.compareNum,
|
threshold: this.threshold,
|
isAll: this.searchFrom == "cluster" ? true : false
|
}
|
const rsp: any = await findPerson(param);
|
if (rsp && rsp.success) {
|
rsp.data.totalList.forEach(element => {
|
var obj = {
|
activeObject: (element as any),
|
list: []
|
}
|
element.ownerPage = this.page
|
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({});
|
this.tabsForUploadImg.splice(0, this.tabsForUploadImg.length)
|
if (rsp && rsp.success) {
|
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.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.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 + '(同步库)'
|
this.blackList.push(i)
|
} else {
|
this.blackList.push(i)
|
}
|
}
|
});
|
} else {
|
// this.$notify({
|
// title: "失败",
|
// message: "检索数据查询失败!",
|
// type: "warning"
|
// });
|
}
|
}
|
|
async queryTaskList() {
|
let params: any = {};
|
if (this.searchFrom == 'cluster') {
|
params.isPlatform = 1
|
}
|
console.log(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.aggs.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
|
}
|
});
|
}
|
}
|
|
async queryDictionary() {
|
const rsp: any = await getAlarmLevel({});
|
if (rsp && rsp.success) {
|
this.dictionary = rsp.data;
|
// console.log("字典是:", this.dictionary)
|
|
//this.dictionary['ALARMLEVEL'].unshift({ name: '撤防', value: "-1" })
|
}
|
}
|
async addBase(item) {
|
var param = {
|
captureId: item.id,
|
tableIds: this.selectWhites.length > 0 ? this.selectWhites : this.selectBlacks
|
}
|
const rsp: any = await addToBase(param)
|
return rsp
|
}
|
|
// async getMonitorLevel() {
|
// const rsp: any = await getAlarmLevel({});
|
// if (rsp && rsp.success) {
|
// this.monitorLevel = rsp.data.MONITORLEVEL;
|
// }
|
// }
|
}
|