import {
|
getSyncTables,
|
getLocalTables,
|
getPersonList,
|
getPersonListByPhoto,
|
searchFromBase,
|
getTagList,
|
copy,
|
move
|
} from "@/api/baseLibrary";
|
export default class BaseManageData {
|
public syncTables: Array<object> = [];
|
public localTables: Array<object> = [];
|
public personList: Array<object>;
|
public personId: string = "";
|
public blackList: Array<object> = [];
|
public selectBlacks: Array<object> = [];
|
public whiteList: Array<object> = [];
|
public selectWhites: Array<object> = [];
|
public page: number;
|
public size: number;
|
public contentValue: string = "";
|
public tableId: number;
|
public orderName: string = "createTime";
|
public orderType: string = "desc";
|
public faceUrl: string = "";
|
public threshold: number = 60;
|
public total: number;
|
public picUrl: string = "";
|
|
|
constructor() {
|
this.personList = [];
|
this.page = 1;
|
this.size = 10;
|
this.total = 0;
|
}
|
|
cleanData() {
|
this.personList = [];
|
this.page = 1;
|
this.size = 10;
|
this.total = 0;
|
}
|
|
async querySyncTables() {
|
const rsp: any = await getSyncTables({
|
|
});
|
if (rsp && rsp.success) {
|
this.syncTables.splice(0, this.syncTables.length)
|
rsp.data.datalist.forEach(element => {
|
this.syncTables.push((element as any))
|
});
|
}
|
}
|
|
async queryLocalTables() {
|
const rsp: any = await getLocalTables({
|
|
});
|
if (rsp && rsp.success) {
|
this.localTables.splice(0, this.localTables.length)
|
rsp.data.datalist.forEach(element => {
|
this.localTables.push((element as any))
|
});
|
}
|
}
|
|
async queryPersonList() {
|
const rsp: any = await getPersonList({
|
tableId: this.tableId,
|
page: this.page,
|
size: this.size,
|
contentValue: this.contentValue,
|
orderType: this.orderType,
|
orderName: this.orderName
|
});
|
if (rsp && rsp.success) {
|
this.personList.splice(0, this.personList.length)
|
rsp.data.datalist.forEach(element => {
|
let carUrls = element.carPicUrls.split(";")
|
element.carUrls = []
|
carUrls.forEach(picUrl => {
|
element.carUrls.push({ url: "/httpImage/" + picUrl })
|
});
|
element.faceUrl = []
|
element.faceUrl.push({ url: "/httpImage/" + element.personPicUrl })
|
this.personList.push((element as any))
|
});
|
this.total = rsp.data.total
|
}
|
}
|
|
async queryPersonListByPhoto() {
|
const rsp: any = await getPersonListByPhoto({
|
|
});
|
if (rsp && rsp.success) {
|
this.personList.splice(0, this.personList.length)
|
rsp.data.datalist.forEach(element => {
|
this.personList.push((element as any))
|
});
|
}
|
}
|
async searchPhotoFromBase() {
|
var bases = new Array()
|
console.log("tableId", this.tableId)
|
bases.push(this.tableId)
|
const rsp: any = await searchFromBase({
|
databases: bases,
|
page: this.page,
|
size: this.size,
|
threshold: this.threshold,
|
picUrl: this.picUrl
|
})
|
console.log("底库以图搜图返回:", rsp)
|
this.personList = [];
|
if (rsp && rsp.success) {
|
rsp.data.totalList.forEach(element => {
|
this.personList.push((element as any))
|
});
|
console.log("列表:", this.personList)
|
this.total = rsp.data.total
|
}
|
}
|
async queryTagList() {
|
const rsp: any = await getTagList({});
|
// console.log("tag返回值: ",rsp)
|
if (rsp && rsp.success) {
|
// 放置黑白名单 0为白名单
|
this.blackList.length = 0
|
this.whiteList.length = 0
|
rsp.data.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)
|
}
|
}
|
});
|
}
|
}
|
async copyTo() {
|
var param = {
|
personId: this.personId,
|
tableIds: this.selectWhites.length > 0 ? this.selectWhites : this.selectBlacks
|
}
|
const rsp: any = await copy(param)
|
return rsp
|
}
|
async moveTo() {
|
var param = {
|
personId: this.personId,
|
tableIds: this.selectWhites.length > 0 ? this.selectWhites : this.selectBlacks
|
}
|
const rsp: any = await move(param)
|
return rsp
|
}
|
mounted() {
|
|
}
|
}
|