zhangzengfei
2022-08-04 a6119509e09abadc65f020f594ae446883567bd5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
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()
    bases.push(this.tableId)
    const rsp: any = await searchFromBase({
      databases: bases,
      page: this.page,
      size: this.size,
      threshold: this.threshold,
      picUrl: this.picUrl
    })
    this.personList = []
    if (rsp && rsp.success) {
      rsp.data.totalList.forEach((element) => {
        this.personList.push(element as any)
      })
      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() {}
}