fastReview.vue
16.1 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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
<template>
<GLDialog class="gl-form-page gl-form-min" title="快速审核" mode="mid" @onOk="closeDialog" @onCancel="closeDialog" v-if="visibility" :visible.sync="visibility">
<div class="review-container">
<div class="filter-wrap">
<!-- 筛选树 -->
<div class="filter-btn">
<span>筛选</span>
<i class="gl-icon-filter filter-icon" @click.stop="showFilter = !showFilter"></i>
<div v-show="showFilter" ref="closetree" class="tree-wrap">
<div class="filter-tree">
<el-tree ref="tree" :data="treeBasic" show-checkbox node-key="id" :props="defaultProps"></el-tree>
</div>
<div class="filter-all">
<el-checkbox v-model="treeChecked">全选</el-checkbox>
<span class="reset">
<el-button type="primary" @click="getCheckedKeys" size="small">确定</el-button>
<el-button size="small" @click="resetChecked">重置</el-button>
</span>
</div>
</div>
</div>
<!-- 左边小图片列表 -->
<div id="pic-list" class="pic-list">
<div class="pic-item" v-for="(item, index) in filterImgList" :key="index">
<span class="title">
<div class="name">{{ item.secondClassifyName }}</div>
<i v-if="item.auditStatus == 1" class="el-icon-success success"></i>
<i v-if="item.auditStatus == 0" class="el-icon-error error"></i>
</span>
<div @click="changeCurImg(item, index)" :class="['pic', { cur: curImg.idx == index }]">
<img :src="item.attachmentFile" alt="" />
</div>
<div v-if="item.auditStatus == 0" class="error_desc flex_cc">
<el-popover placement="top-start" width="200" trigger="hover" :content="item.reasonForFailure">
<div class="intext" slot="reference">{{ item.reasonForFailure }}</div>
</el-popover>
</div>
</div>
</div>
</div>
<!-- 右边大图区 -->
<div class="preview-wrap" :class="[{ flex_cc: !filterImgList.length }]">
<template v-if="filterImgList.length">
<span>{{ curImg.secondClassifyName }}</span>
<div class="preview-oper">
<div class="preview-pic">
<el-image :preview-src-list="[curImg.attachmentFile]" style="width: 100%; height: 100%" :src="curImg.attachmentFile" :fit="fit"></el-image>
<!-- <img :src="curImg.attachmentFile" alt="" /> -->
<!-- <div class="mask">
<i class="gl-icon-eye"></i>
<i class="gl-icon-a-testcaselibrary1"></i>
</div> -->
</div>
<!-- 按钮区 -->
<div class="pass-btn">
<!-- <el-button type="text" @click="changeLeaf('pre')">上一张</el-button> -->
<el-button type="text" @click="handleApproval(1)">通过</el-button>
<el-popover ref="descPopover" class="popover" popper-class="imgPopper" placement="top" width="314" trigger="click">
<div>
<glsx-combi-form ref="imgPassRef" :isInline="false" :formRules="imgPassRule" labelWidth="90px" defaultWidth="184px" :formObj="imgPassObj" :formData="imgPassForm"></glsx-combi-form>
</div>
<el-button slot="reference" type="text">不通过</el-button>
</el-popover>
<!-- <el-button type="text" @click="changeLeaf('next')">下一张</el-button> -->
</div>
</div>
</template>
<template v-else>
<span>筛选结果为空</span>
</template>
</div>
</div>
</GLDialog>
</template>
<script type="text/ecmascript-6">
import glsxCombiForm from '@/components/glsx-combi-form'
export default {
name: 'fastReview',
components: {
glsxCombiForm
},
props: {
images: Array,
lossTypeList: Array
},
data() {
return {
treeChecked: false,
showFilter: false,
visibility: false,
imgPassObj: {
desc: ''
},
imgPassForm: [
{
label: '具体描述',
name: 'desc',
type: 'input',
inputType: 'textarea',
rows: 3,
isClear: true,
maxlength: 200,
inputChange: e => {
this.handleApproval(0, e)
}
}
],
curImg: {},
filterImgList: [],
imgList: [],
treeBasic: [
{
id: 10,
label: '资料名称',
children: []
},
{
id: 11,
label: '处理状态',
children: [
{
id: 12,
label: '已审核'
},
{
id: 13,
label: '未审核'
}
]
},
{
id: 14,
label: '审核状态',
children: [
{
id: 15,
label: '通过'
},
{
id: 16,
label: '未通过'
}
]
}
],
defaultProps: {
children: 'children',
label: 'label',
id: 'id'
}
}
},
watch: {
treeChecked(newVal) {
this.toChangeTreeAll(newVal)
}
},
mounted() {
this.filterImgList = []
document.addEventListener('click', e => {
if (!this.$refs['closetree']?.contains(e.target)) {
this.showFilter = false
}
})
},
methods: {
// changeLeaf(type){
// let idx = this.curImg.idx
// if((type == 'pre' && this.curImg.idx==0) || (type == 'next' && idx==this.imgList.length-1)){
// return this.$message({
// message: `${type == 'next' ? '当前是最后一张图片':'当前是第一张图片'}`,
// type: 'warning',
// customClass: 'msgHierarchy'
// });
// }
// this.curImg =type == 'next' ? this.imgList[idx+1] : this.imgList[idx-1]
// this.curImg.idx =type == 'next' ? idx + 1 : idx - 1
// },
handlerData(val) {
this.treeBasic[0].children = []
let arr = []
val.forEach((el, index) => {
let obj = {
label: el.firstClassifyName,
id: index
}
this.treeBasic[0].children.push(obj)
if (el.firstClassifyName.indexOf('其他') != -1) {
el.secondClassifyList.forEach(ele => {
el.allImages.forEach(ke => {
if (ke.attachmentFile) {
ke.secondClassifyName = ele.secondClassifyName
arr.push(ke)
}
})
})
} else {
el.secondClassifyList.forEach(ele => {
ele.attachmentList.forEach(ke => {
if ((ele.serviceItemType != 4 || (ele.lossType && this.lossTypeList.includes(ele.lossType))) && ke.attachmentFile) {
ke.secondClassifyName = ele.secondClassifyName
arr.push(ke)
}
})
})
}
})
this.filterImgList = arr
this.curImg = arr[0]
this.curImg.idx = 0
},
closeDialog() {
this.visibility = false
},
initDialog() {
this.visibility = true
this.handlerData(this.images)
},
changeCurImg(item, index) {
if (index > this.filterImgList.length - 1 || index < 0) return
this.curImg = this.filterImgList[index]
this.curImg.idx = index
},
handleApproval(type, desc) {
if (type == 0) {
this.curImg.reasonForFailure = desc
this.imgPassObj.desc = ''
this.$refs.descPopover.doClose()
}
this.curImg.auditStatus = type
this.images.forEach(item => {
item.secondClassifyList.forEach(child => {
child.attachmentList.forEach(last => {
if (last.id == this.curImg.id) {
last = this.curImg
}
})
})
})
const idx = this.curImg.idx
this.changeCurImg({}, idx + 1)
try {
let scrollH = document.getElementById('pic-list')
scrollH.scrollTop = 135 * (idx + 1)
} catch (err) {
console.log(err)
}
},
getCheckedKeys() {
let treeList = this.$refs.tree.getCheckedNodes()
let filtterList = []
if (treeList.length) {
treeList.forEach(el => {
if (el.children && el.children.length) {
// 代表这一级全选择
el.children.forEach(ele => {
filtterList.push(ele.label)
})
} else {
filtterList.push(el.label)
}
})
}
if (!filtterList.length) return
filtterList = [...new Set(filtterList)]
this.showFilter = false
this.filterImages(filtterList)
},
resetChecked() {
this.$refs.tree.setCheckedKeys([])
},
toChangeTreeAll(flag) {
if (flag) {
this.$refs.tree.setCheckedKeys([10, 11, 14])
} else {
this.$nextTick(() => {
this.$refs.tree.setCheckedKeys([])
})
}
},
// 过滤照片
filterImages(condition) {
let result = []
const approved = condition.includes('已审核')
const unChecked = condition.includes('未审核')
const pass = condition.includes('通过')
const noPass = condition.includes('未通过')
let tempArr = []
// 第一步:先筛选资料类型的
this.images.forEach(el => {
condition.forEach(con => {
if (con == el.firstClassifyName) {
el.secondClassifyList.forEach(ele => {
ele.attachmentList.forEach(ke => {
ke.secondClassifyName = ele.secondClassifyName
tempArr.push(ke)
})
})
}
})
})
// 第二步:如果此时tempArr不为空,则再次根据其他状态筛选一遍
if (tempArr.length && (approved || unChecked || pass || noPass)) {
tempArr.forEach(ke => {
if (approved && ke.attachmentFile && ke.auditStatus != null) {
result.push(ke)
} else if (unChecked && ke.attachmentFile && ke.auditStatus == null) {
result.push(ke)
} else if (pass && ke.attachmentFile && ke.auditStatus == 1) {
result.push(ke)
} else if (noPass && ke.attachmentFile && ke.auditStatus == 0) {
result.push(ke)
}
})
tempArr = result
}
// 第三步:如果tempArr为空,说明没有勾选任何资料类型,则只需要筛选状态类型
if (!tempArr.length) {
this.images.forEach(el => {
el.secondClassifyList.forEach(ele => {
ele.attachmentList.forEach(ke => {
ke.secondClassifyName = ele.secondClassifyName
if (approved && ke.attachmentFile && ke.auditStatus != null) {
tempArr.push(ke)
} else if (unChecked && ke.attachmentFile && ke.auditStatus == null) {
tempArr.push(ke)
} else if (pass && ke.attachmentFile && ke.auditStatus == 1) {
tempArr.push(ke)
} else if (noPass && ke.attachmentFile && ke.auditStatus == 0) {
tempArr.push(ke)
}
})
})
})
}
// 第四步:如果此时tempArr还是为空,则取所有数据
// if (!tempArr.length) {
// this.images.forEach(el => {
// el.secondClassifyList.forEach(ele => {
// ele.attachmentList.forEach(ke => {
// ke.secondClassifyName = ele.secondClassifyName
// tempArr.push(ke)
// })
// })
// })
// }
this.filterImgList = tempArr
if (tempArr.length) {
this.curImg = tempArr[0]
this.curImg.idx = 0
}
}
}
}
</script>
<style lang="scss" scoped>
.review-container {
display: flex;
flex-wrap: nowrap;
height: 374px;
color: #1d2129;
.filter-wrap {
width: 184px;
height: 100%;
display: flex;
flex-direction: column;
.filter-btn {
display: flex;
justify-content: space-between;
height: 40px;
background: #ececec;
margin-bottom: 1px;
line-height: 40px;
padding: 0 16px;
font-size: 14px;
position: relative;
.filter-icon {
color: #2a58ad;
cursor: pointer;
}
.tree-wrap {
background-color: #fff;
z-index: 20;
position: absolute;
top: 100%;
left: 155px;
width: 260px;
box-shadow: 0px 6px 20px 0px rgba(122, 122, 122, 0.2);
border-radius: 4px;
.filter-tree {
height: 208px;
overflow-y: scroll;
&::-webkit-scrollbar {
width: 4px;
}
/deep/ .el-tree-node__content > label.el-checkbox {
margin-right: 3px;
}
// 修改三角形的颜色
/deep/ .el-tree-node__expand-icon {
color: #333;
font-size: 13px;
&.is-leaf {
color: transparent;
}
}
}
.filter-all {
height: 48px;
display: flex;
align-items: center;
padding: 0 10px;
justify-content: space-between;
border-top: 1px solid #e5e5e5;
.reset {
.el-button:last-child {
margin-left: 2px;
border: none;
}
}
/deep/ .el-checkbox__label {
padding-left: 8px;
}
}
}
}
.pic-list {
flex: 1;
background: #ececec;
padding: 10px 16px;
overflow-y: auto;
&::-webkit-scrollbar {
width: 2px;
}
.pic-item {
font-size: 14px;
margin-bottom: 12px;
position: relative;
.title {
height: 28px;
line-height: 28px;
display: flex;
align-items: center;
justify-content: space-between;
.name {
width: 130px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.success {
color: #2cca74;
}
.error {
color: #eb4e4e;
}
}
.pic {
width: 100%;
position: relative;
width: 150px;
height: 95px;
cursor: pointer;
border: 1px solid transparent;
img {
width: 100%;
height: 100%;
}
}
.cur {
border: 1px solid #2a58ad;
}
.error_desc {
background: rgba(255, 82, 87, 0.5);
position: absolute;
left: 0;
right: 0;
bottom: 0;
z-index: 10;
.intext {
box-sizing: border-box;
padding: 0 2px;
font-size: 12px;
font-weight: 400;
color: #ffffff;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
}
}
.preview-wrap {
flex: 1;
background: #f9f9f9;
padding: 20px;
box-sizing: border-box;
height: 374px;
.preview-oper {
width: 100%;
height: 100%;
margin-top: 8px;
.preview-pic {
height: 270px;
position: relative;
&:hover {
.mask {
display: block;
}
}
img {
width: 100%;
height: 100%;
}
.mask {
display: none;
background: rgba(0, 0, 0, 0.5);
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
text-align: center;
line-height: 270px;
i {
color: #c6c6c6;
font-size: 18px;
cursor: pointer;
&:last-child {
margin-left: 12px;
}
}
}
}
.pass-btn {
margin-top: 16px;
display: flex;
height: 20px;
justify-content: center;
.popover {
line-height: 20px;
margin-left: 20px;
}
}
}
}
}
</style>