小小儁爺
2025-11-19 89513a76e1ea16d602f5d12949f61e880fafb9f6
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
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
<template>
    <view>
        <page-nav title="维修验证"></page-nav>
 
 
        <view v-show="topContent.length===0">
            <div class="sacnBody">
                <div class="boxImg"></div>
                <div class="scanText">暂无维修可验证</div>
            </div>
        </view>
 
 
        <view v-show="topContent.length!==0">
            <view class="mainContent">
                <view>
                    <u-gap height="10" bgColor="#eff0f1"></u-gap>
                    <view class="head">
                        <view class="head_block">
                            <view class="head_left">
                                <view class="head_bar"></view>
                                <view class="head_title">
                                    扫描维修工位
                                </view>
                            </view>
 
                            <view class="marginRight20">
                                <u-icon name="scan" @click="topScanClick" color="red" size="28"></u-icon>
                            </view>
 
                        </view>
 
 
 
                        <view :style="{maxHeight:'1360rpx',overflow: 'scroll'}">
                            <view class="marginTop20 marginLeft20 marginRight20 flex_column">
 
                                <u-radio-group v-model="radioValue" class="flex_column">
                                    <view class="marginBottom20 flex_column" style="width: 100%;"
                                        @click="groupChange(item.repair_code)" v-for="item in topContent"
                                        :key="item.repair_code">
                                        <view class="flex_between marginBottom20">
                                            <view style="display: flex;">
                                                <view class="flex_column titleFont">
                                                    <view>维修维修单:</view>
                                                    <view>工位编码:</view>
                                                    <view>工位名称:</view>
                                                    <view>生产车间:</view>
                                                    <view>维修人员:</view>
                                                    <view>维修时间:</view>
                                                    <view>停机维修:</view>
                                                    <view>故障描述:</view>
                                                </view>
                                                <view class="flex_column contentFont">
                                                    <view>{{item.repair_code}}</view>
                                                    <view>{{item.eqpcode}}</view>
                                                    <view>{{item.eqpname}}</view>
                                                    <view>{{item.wksp_name}}</view>
                                                    <view>{{item.repair_person}}</view>
                                                    <view>{{item.repair_date}}</view>
                                                    <view>{{item.is_shutdown==='Y'?'是':'否'}}</view>
                                                    <view style="width:400rpx;word-wrap:break-word">
                                                        {{item.failure_descript}}
                                                    </view>
                                                </view>
                                            </view>
                                            <u-radio size='20' :key="item.repair_code" :name="item.repair_code"
                                                @change="groupChange(item.repair_code)" activeColor="red"></u-radio>
                                        </view>
 
 
                                        <view v-show="!item.arrowType" class="repairDetail">
                                            维修详情
                                        </view>
                                        <view class="head" v-show="!item.arrowType" style="padding-bottom: 10rpx;">
                                            <view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
                                                <view class="head_left">
                                                    <view class="head_bar"></view>
                                                    <view class="head_title">
                                                        故障描述
                                                    </view>
                                                </view>
                                            </view>
                                            <view style="margin: 0 20rpx; width: 95%;" class="contentFont">
                                                {{descMessage}}
                                            </view>
                                            <view style="display: flex;" v-show="fileList.length!==0">
                                                <view v-for="(pic,index) in fileList" :key="index">
                                                    <view style="margin: 20rpx 0rpx 20rpx 20rpx;position: relative;"
                                                        v-if='pic.img1url'>
                                                        <!--                                         <u-icon name="close" color="#fff" size="26"
                                                        style="position: absolute;z-index: 10;right: 0;background-color: black;border-radius:50%;"
                                                        @click="deletePic(pic)"></u-icon>
 -->
                                                        <image :src="baseUrl+ pic.img1url" @click="imgPreview(pic)"
                                                            class="upLoadImg">
                                                        </image>
                                                    </view>
                                                </view>
 
                                            </view>
                                        </view>
 
 
                                        <u-gap height="5" v-show="!item.arrowType" bgColor="#eff0f1"
                                            style='width: 106%;margin-left: -3%;'></u-gap>
                                        <view class="head" v-show="!item.arrowType" style="padding-bottom: 10rpx;">
                                            <view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
                                                <view class="head_left">
                                                    <view class="head_bar"></view>
                                                    <view class="head_title">
                                                        停机维修
                                                    </view>
                                                </view>
 
                                                <view class="" style="width: 90rpx;display: flex;">
                                                    <u-button type="primary" disabled style="height: 60rpx;"
                                                        :text="descMessage2.toString().length>0?'否':'是'">
                                                    </u-button>
                                                </view>
                                            </view>
                                        </view>
 
                                        <u-gap height="5" v-show="!item.arrowType&&descMessage2" bgColor="#eff0f1"
                                            style='width: 106%;margin-left: -3%;'></u-gap>
 
                                        <view class="head" v-show="!item.arrowType&&descMessage2"
                                            style="padding-bottom: 10rpx;">
                                            <view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
                                                <view class="head_left">
                                                    <view class="head_bar"></view>
                                                    <view class="head_title">
                                                        维修内容
                                                    </view>
                                                </view>
                                            </view>
                                            <view style="margin: 0 20rpx; width: 95%;" class="contentFont">
                                                {{descMessage2}}
                                            </view>
                                        </view>
 
                                        <u-gap height="5" v-show="!item.arrowType&&descMessage3" bgColor="#eff0f1"
                                            style='width: 106%;margin-left: -3%;'></u-gap>
 
                                        <view class="head" v-show="!item.arrowType&&descMessage3"
                                            style="padding-bottom: 10rpx;">
                                            <view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
                                                <view class="head_left">
                                                    <view class="head_bar"></view>
                                                    <view class="head_title">
                                                        更换备件
                                                    </view>
                                                </view>
                                            </view>
 
 
                                            <view style="margin: 0 20rpx; width: 95%;" class="contentFont">
                                                {{descMessage3}}
                                            </view>
                                            <view style="display: flex;" v-show="fileList2.length!==0">
                                                <view v-for="(pic,index) in fileList2" :key="index">
                                                    <view style="margin: 20rpx 0rpx 20rpx 20rpx;position: relative;"
                                                        v-if='pic.img2url'>
                                                        <!--                                 <u-icon name="close" color="#fff" size="26"
                                                        style="position: absolute;z-index: 10;right: 0;background-color: black;border-radius:50%;"
                                                        @click="deletePic(pic)"></u-icon>
 -->
                                                        <image :src="baseUrl+ pic.img2url" @click="imgPreview2(pic)"
                                                            class="upLoadImg">
                                                        </image>
                                                    </view>
                                                </view>
 
                                            </view>
                                        </view>
 
 
                                        <u-gap height="5" v-show="!item.arrowType" bgColor="#eff0f1"
                                            style='width: 106%;margin-left: -3%;'></u-gap>
                                        <view class="head" v-show="!item.arrowType" style="padding-bottom: 10rpx;">
                                            <view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
                                                <view class="head_left">
                                                    <view class="head_bar"></view>
                                                    <view class="head_title">
                                                        验证结果
                                                    </view>
                                                </view>
 
 
                                                <view class=" " style="width: 190rpx;display: flex;"
                                                    :key="Math.random()+item.repair_code">
                                                    <u-button :plain="item.resultValue!=='OK'" text="正常"
                                                        @click="resultValueClick(item.repair_code,'OK')"
                                                        style="height: 60rpx;"
                                                        :key="Math.random()+item.repair_code+'OK'" type="primary">
 
                                                    </u-button>
                                                    <u-button type="warning" :plain="item.resultValue!=='NG'"
                                                        :key="Math.random()+item.repair_code+'NG'" text="异常"
                                                        style="height: 60rpx;margin: 0 5rpx;"
                                                        @click="resultValueClick(item.repair_code,'NG')">
                                                    </u-button>
                                                </view>
                                            </view>
                                        </view>
 
                                        <!-- <u-gap height="16" v-show="!item.arrowType" bgColor="#eff0f1"
                                            style='width: 106%;margin-left: -3%;'></u-gap> -->
 
                                        <view style="display: flex;justify-content: center;margin : 10rpx; 0">
                                            <view class="arrowClass"
                                                @click="item.arrowType?arrowDownClick(item):arrowUpClick(item)">
                                                <u-icon :name="item.arrowType?'arrow-down':'arrow-up'" color="#c8c8c8"
                                                    size="25"></u-icon>
                                            </view>
                                        </view>
 
 
                                        <u-gap height="16" bgColor="#eff0f1" style="width: 106%;margin-left: -3%;">
                                        </u-gap>
                                    </view>
                                </u-radio-group>
                            </view>
                        </view>
                    </view>
 
                </view>
            </view>
 
            <view class="footer" style="min-height:62rpx;">
                <u-button size="large" :loading="isDisabledSubmitButton" loadingText="正在提交,请稍等..." type="primary"
                    @click="submit"
                    :disabled="topContent.length>0? topContent.find(i=>i.repair_code===radioValue).resultValue==='':true"
                    text="确认提交">
                </u-button>
            </view>
 
 
 
        </view>
 
 
        <scan-code></scan-code>
    </view>
</template>
 
<script>
    import {
        RepairVerificationScanDeviceData,
        RepairVerificationScanDeviceDataSub,
        RepairVerificationScanDeviceSave
    } from '../../config/api.js'
    import {
        data
    } from '../../uni_modules/uview-ui/libs/mixin/mixin.js';
    import scanCode from '@/components/scan-code/scan-code.vue'
 
    export default {
        components: {
            scanCode
        },
        onLoad(option) {
            const _this = this
            uni.$off('scancodedate') // 每次进来先 移除全局自定义事件监听器
            uni.$on('scancodedate', function(content) {
                console.log("扫描到的内容为:", content)
 
 
                let r = _this.topContent.find(i => i.repair_code === content)
 
                if (r === undefined) {
                    uni.$u.toast('所扫的二维码不在列表中!')
                    // return
                } else {
                    _this.topContent.forEach((item, index) => {
                        if (item.repair_code === content) {
                            _this.topContent.splice(index, 1)
                        }
                    })
                    _this.topContent.unshift(r)
                    _this.radioValue = content
                }
            })
        },
        onPullDownRefresh() {
            setTimeout(() => {
                this.init(() => {
                    uni.stopPullDownRefresh();
                })
            }, 1000);
        },
        data() {
            return {
                isDisabledSubmitButton: false,
                baseUrl: this.$baseUrl.split('api')[0],
                topContent: [], //扫描保养工位所带出来的内容
                radioValue: '', //单选框的值
                scanContent: '', //扫描扫出来的值
 
                detailContent: [], //显示详情内容
 
                descMessage: '', // 
                descMessage2: '', // 
                descMessage3: '', // 
                imgPreviewSrcs: [], //图片预览src   故障描述
                fileList: [], //图片数组         故障描述
                fileList2: [], //更换备件图片
                imgPreviewSrcs2: [],
 
 
 
            }
        },
        created() {
 
 
        },
        mounted() {
            this.init()
            this.getRepairVerificationScanDeviceData()
        },
        methods: {
            // 预览图片
            imgPreview(img) {
                console.log(img)
                uni.previewImage({
                    current: this.fileList.findIndex(i => i.img1url === img.img1url),
                    indicator: "number",
                    loop: true,
                    urls: this.imgPreviewSrcs
                })
            },
            imgPreview2(img) {
                uni.previewImage({
                    current: this.fileList2.findIndex(i => i.img2url === img.img2url),
                    indicator: "number",
                    loop: true,
                    urls: this.imgPreviewSrcs2
                })
            },
            init() {
                uni.stopPullDownRefresh();
            },
            // 单选按钮选中值改变
            groupChange(repair_code) {
                this.radioValue = repair_code
                this.topContent.forEach(item => {
                    if (item.repair_code !== repair_code) {
                        item.resultValue = ''
                    }
                })
                this.$forceUpdate()
 
            },
 
            // 扫码框点击
            topScanClick() {
                let that = this;
                uni.scanCode({
                    onlyFromCamera: true,
                    // scanType: ['barCode', 'qrCode'],
                    scanType: ['qrCode'],
                    success: function(res) {
                        console.log('条码类型:' + res.scanType);
                        console.log('条码内容:' + res.result);
                        that.scanContent = res.result;
 
 
 
                        let r = that.topContent.find(i => i.repair_code === that.scanContent)
 
                        if (r === undefined) {
                            uni.$u.toast('所扫的二维码不在列表中!')
                        } else {
                            that.topContent.forEach((item, index) => {
                                if (item.repair_code === that.scanContent) {
                                    that.topContent.splice(index, 1)
                                }
                            })
                            that.topContent.unshift(r)
                            that.radioValue = that.scanContent
                        }
 
                    },
                    complete: function(res) {
 
                    },
                    fail: function(res) {
                        console.log('条码类型:' + res.scanType);
                        console.log('条码内容:' + res.result);
                    }
 
                });
            },
 
            // 获取维修列表    
            async getRepairVerificationScanDeviceData(val) {
                const res = await RepairVerificationScanDeviceData()
                if (res.code === '200') {
                    this.topContent = res.data
                    this.topContent.forEach(i => {
                        i.arrowType = true
                        i.resultValue = ''
                    })
                    if (this.topContent.length > 0) {
                        this.getRepairVerificationScanDeviceDataSub(this.topContent[0].repair_code, this.topContent[0]
                            .eqpcode, this.topContent[0].wksp_code)
                    }
                    this.radioValue = this.topContent.length > 0 ? this.topContent[0].repair_code : ''
                    // console.log(this.topContent, 1)
                    this.$forceUpdate()
 
                }
            },
            // 获取维修列表详情
            async getRepairVerificationScanDeviceDataSub(repair_code, eqpcode, wkshpcode) {
                const res = await RepairVerificationScanDeviceDataSub(repair_code, eqpcode, wkshpcode)
                this.detailContent = res.data
 
                this.descMessage = this.detailContent.failure_descript
                this.fileList = this.detailContent.failure_descriptimg ? this.detailContent.failure_descriptimg.filter(
                    i => i.img1url !== '') : []
 
                this.imgPreviewSrcs = []
                this.fileList.forEach(i => {
                    this.imgPreviewSrcs.push(this.baseUrl + i.img1url)
                })
 
                this.descMessage2 = this.detailContent.repair_content ? this.detailContent.repair_content : ''
                this.descMessage3 = this.detailContent.repair_part ? this.detailContent.repair_part : ''
                this.fileList2 = this.detailContent.repair_partimage ? this.detailContent.repair_partimage.filter(i =>
                    i.img2url !== '') : []
                this.imgPreviewSrcs2 = []
                this.fileList2.forEach(i => {
                    this.imgPreviewSrcs2.push(this.baseUrl + i.img2url)
                })
 
                this.$forceUpdate()
            },
            // 向下的箭头点击
            arrowDownClick(val) {
                this.topContent.forEach(item => {
                    item.arrowType = true
                    if (item.repair_code === val.repair_code) {
                        item.arrowType = false
                        item.resultValue = item.resultValue ? item.resultValue : ''
                        this.descMessage = ''
                        this.descMessage2 = ''
                        this.descMessage3 = ''
                        this.fileList = []
                        this.fileList2 = []
                        this.imgPreviewSrcs = []
                        this.imgPreviewSrcs2 = []
                        this.getRepairVerificationScanDeviceDataSub(item.repair_code, item.eqpcode, item.wksp_code)
                    }
                })
                this.$forceUpdate()
            },
            //向上从箭头点击
            arrowUpClick(val) {
                this.topContent.forEach(item => {
                    item.arrowType = true
                })
                this.$forceUpdate()
            },
            // 验证结果点击
            resultValueClick(repair_code, val) {
                console.log(repair_code, val)
                this.topContent.forEach(item => {
                    if (item.repair_code === repair_code) {
                        item.resultValue = val
                    }
                })
                console.log(this.topContent, 8)
                this.$forceUpdate()
            },
            // 确认提交按钮
            async submit() {
                const result = this.topContent.find(item => item.repair_code === this.radioValue)
                let formData = {
                    repairwo: result.repair_code,
                    eqpcode: result.eqpcode,
                    wkshpcode: result.wksp_code,
                    result: result.resultValue,
                }
 
                this.isDisabledSubmitButton = true
 
                const res = await RepairVerificationScanDeviceSave(formData)
                if (res.code == '200') {
                    uni.$u.toast('提交成功!')
                    this.topContent = this.topContent.filter(i => i.repair_code !== this
                        .radioValue)
                    this.radioValue = this.topContent.length === 0 ? '' : this.topContent[0]
                        .repair_code
                    this.isDisabledSubmitButton = false
                } else {
                    this.isDisabledSubmitButton = false
                    uni.$u.toast(result.Message)
                }
                // this.isDisabledSubmitButton = false
                this.$forceUpdate()
 
                // uni.uploadFile({
                //     url: this.$baseUrl + '/AppDeviceManage/RepairVerificationScanDeviceSave',
                //     files: [{
                //         "uri": "/"
                //     }],
                //     header: header,
                //     formData: formData,
                //     success: (res) => {
                //         let result = JSON.parse(res.data)
                //         if (res.statusCode == 200 && result.code == '200') {
                //             uni.$u.toast('提交成功!')
                //             this.topContent = this.topContent.filter(i => i.repair_code !== this
                //                 .radioValue)
                //             this.radioValue = this.topContent.length === 0 ? '' : this.topContent[0]
                //                 .repair_code
                //         } else {
                //             uni.$u.toast(result.Message)
                //         }
                //         this.isDisabledSubmitButton = false
                //         this.$forceUpdate()
                //     },
                //     fail(res) {
                //         uni.$u.toast('提交失败!')
                //         this.isDisabledSubmitButton = false
                //     },
                // })
 
 
            },
        }
    }
</script>
 
<style lang="scss" scoped>
    @import url('@/style/global.css');
 
    ::v-deep .uicon-arrow-left>span {
        display: block;
    }
 
    ::v-deep .uicon-camera-fill {
        font-size: 60rpx !important;
    }
 
 
    ::v-deep .uni-progress-bar {
        background-color: transparent !important;
    }
 
    .upLoadImg {
        width: 160rpx;
        height: 160rpx;
        border-radius: 20rpx;
    }
 
    .repairDetail {
        margin-top: 20rpx;
        background-color: #eff0f1;
        height: 80rpx;
        font-size: 36rpx;
        width: 106%;
        margin-left: -3%;
        display: flex;
        justify-content: center;
        align-items: center;
        border-radius: 10rpx;
    }
 
    .arrowClass {
        display: flex;
        justify-content: center;
        // background-color: #efefef;
        width: 100rpx;
        // border-radius: 10rpx;
        height: 56rpx;
    }
</style>