ClassAmongClean.vue
11.3 KB
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
<template>
<el-container class="DataClean">
<el-header height="auto">
<span class="title-text">类间清洗</span>
<div style="display: flex; justify-content:flex-end">
<el-button @click="goBack">返回上一页</el-button>
</div>
<div style="font-size: 20px">任务名:{{ name }}</div>
<div style="font-size: 20px">批次:{{ packName }}</div>
<el-menu mode="horizontal" @select="onMenuSelect" :default-active="''">
<el-menu-item :index="'0'">
未处理
</el-menu-item>
<el-menu-item :index="'1'">
已处理
</el-menu-item>
<el-menu-item :index="''">
全部
</el-menu-item>
</el-menu>
</el-header>
<el-main>
<el-table :data="dataCleanList" v-loading="isLoading">
<el-table-column prop="personId" label="左侧ID" align="center"></el-table-column>
<el-table-column prop="simPersonId" label="右侧ID" align="center"></el-table-column>
<el-table-column prop="same" label="是否是同一个人" align="center">
<template #default="scope">
{{ getSameTitle(scope.row.same) }}
</template>
</el-table-column>
<el-table-column prop="status" label="状态" align="center">
<template #default="scope">
{{ getStatusTitle(scope.row.status) }}
</template>
</el-table-column>
<el-table-column prop="operation" label="操作" align="center">
<template #default="scope">
<el-button @click="gotoHandle(scope.row)" type="text">进入</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination @current-change="onPageNumChange"
@size-change="onPageSizeChange"
:current-page="pageNum"
:page-size="pageSize"
:total="total"
:page-sizes="[10, 20, 40, 80]"
layout="total, sizes, prev, pager, next, jumper"
style="text-align:center"
>
</el-pagination>
</el-main>
</el-container>
</template>
<script>
import {computed, onMounted, reactive, ref, toRaw, toRefs, watch} from "vue"
import {
filterEmptyValueInObject, goBack,
resetForm
} from "@/PublicUtil/PublicUtil"
import dataCleanApi from './ClassAmongClean'
import {ElMessageBox} from 'element-plus'
import {ElMessage} from 'element-plus'
import {getImagePackageMap, getUserNameIdMap} from '@/Request/DictionaryRequest'
import router from '@/router'
import {useRoute, useRouter} from 'vue-router'
export default {
setup() {
// scalar
const packId = useRoute().query.packId
const name = useRoute().query.name
const packName = useRoute().query.packName
const pageNum = ref(1)
const pageSize = ref(10)
const total = ref()
const isLoading = ref(false)
const addDataCleanVisible = ref(false)
const editDataCleanVisible = ref(false)
const dataCleanList = ref([])
const ref_addDataCleanForm = ref()
const ref_editDataCleanForm = ref()
const router = useRouter()
let selectedMenuIndex = ''
// computed
// mapping
const rules = reactive(
{}
)
const userNameIdMap = reactive({})
const imagePackageMap = reactive({})
const addDataCleanForm = reactive(
{
packId: '',
name: '',
}
)
const editDataCleanForm = reactive(
{
packId: '',
name: '',
}
)
// function
const onPageNumChange = function(num) {
pageNum.value = num
getDataCleanList()
}
const onPageSizeChange = function(size) {
pageNum.value = 1
pageSize.value = size
getDataCleanList()
}
const confirmAddDataClean = function() {
ref_addDataCleanForm.value.validate(
(isValid) => {
if (isValid)
{
addDataCleanVisible.value = false
const rawData = toRaw(addDataCleanForm)
const data = filterEmptyValueInObject(rawData)
dataCleanApi.addDataClean(data).then(
(r) => {
const message = r.msg
ElMessage(`${message}`)
getDataCleanList()
}
)
}
}
)
}
const editDataClean = function(row) {
editDataCleanVisible.value = true
editDataCleanForm.id = row.id
editDataCleanForm.name = row.name
editDataCleanForm.managerId = row.managerId
editDataCleanForm.description = row.description
}
const confirmEditDataClean = function() {
ref_editDataCleanForm.value.validate(
(isValid) => {
if (isValid)
{
const rawData = toRaw(editDataCleanForm)
const data = filterEmptyValueInObject(
{
name: rawData.name,
managerId: rawData.managerId,
description: rawData.description,
}
)
dataCleanApi.editDataClean(rawData.id, data).then(
(r) => {
const message = r.msg
getDataCleanList()
ElMessage(`${message}`)
}
)
editDataCleanVisible.value = false
}
}
)
}
const confirmDeleteDataClean = function(id) {
ElMessageBox.confirm(
"删除后此数据清洗相关数据全部都会消失,你确定要删除吗?",
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(
() => {
dataCleanApi.deleteDataClean(id).then(
(r) => {
const message = r.msg
getDataCleanList()
ElMessage(`${message}`)
}
)
}
)
}
const addDataClean = function() {
resetForm(addDataCleanForm)
addDataCleanVisible.value = true
}
const getDataCleanList = function() {
isLoading.value = true
dataCleanApi.getDataCleanList({
packId: packId,
status: selectedMenuIndex,
pageNum: pageNum.value,
pageSize: pageSize.value,
}).then(
({data}) => {
isLoading.value = false
dataCleanList.value = data.list
total.value = data.total
}
)
}
const getStatusTitle = function(status) {
switch (status)
{
case 0:
{
return '未处理'
}
case 1:
{
return '已处理'
}
case 2:
{
return '处理中'
}
default:
{
break
}
}
}
const getTypeTitle = function(status) {
switch (status)
{
case 1:
{
return '类内清洗'
}
case 2:
{
return '类间清洗'
}
{
break
}
}
}
const gotoHandle = function(row) {
const data = {
id: row.id,
packId: row.packId,
}
dataCleanApi.getCleanAmongResult(data).then(
({data}) => {
router.push(
{
path: '/JudgePeople',
query: {
id: row.id,
packId: row.packId,
leftPersonId: data.personId,
rightPersonId: data.simPersonId,
same: getSameTitle(row.same),
name: name,
packName: packName,
personId: row.personId,
}
}
)
}
)
}
const onMenuSelect = function(index) {
selectedMenuIndex = index
getDataCleanList()
}
const getSameTitle = function(same) {
switch (same)
{
case 0:
{
return '不是'
}
case 1:
{
return '是'
}
default:
{
break
}
}
}
// const goBack = function() {
// router.push(
// {
// path: '/DataClean/DataClean',
// }
// )
// }
const initialize = function() {
getDataCleanList()
getUserNameIdMap(userNameIdMap)
getImagePackageMap(imagePackageMap)
}
initialize()
return {
// scalar
name,
packName,
pageNum,
pageSize,
total,
isLoading,
dataCleanList,
ref_addDataCleanForm,
ref_editDataCleanForm,
addDataCleanVisible,
editDataCleanVisible,
// mapping
userNameIdMap,
imagePackageMap,
addDataCleanForm,
editDataCleanForm,
rules,
// function
onPageNumChange,
onPageSizeChange,
addDataClean,
editDataClean,
confirmEditDataClean,
confirmAddDataClean,
confirmDeleteDataClean,
gotoHandle,
getStatusTitle,
getTypeTitle,
getSameTitle,
onMenuSelect,
goBack,
}
},
}
</script>
<style lang="less" scoped>
@import "./ClassAmongClean.less";
</style>