Houjie
2025-04-25 1d18ff904468e4a864312bdcf6d7c6a7c0477721
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
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
<template>
    <view class="container">
        <cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask">
            <block slot="backText">返回</block>
            <block slot="content">{{title}}</block>
        </cu-custom>
        <view class="container">
 
 
            <uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext">
                <uni-group top="1">
                    <view class="text-gray margin-bottom-lg">—————————— 基本信息 ——————————</view>
                    <uni-forms-item :label-width="80" name="num" label="工单号:">
                        <uni-easyinput v-model="formData.orderNum" :disabled="true" />
                    </uni-forms-item>
                    <uni-forms-item :label-width="80" required name="num" label="设备编号:">
                        <uni-data-select v-model="formData.num" :localdata="equipmentList" @change="changeEquipmentList"
                            placeholder="请选择" :disabled="true" />
                    </uni-forms-item>
 
                    <uni-forms-item :label-width="80" name="maintenanceDate" label="保养日期:">
                        <uni-easyinput v-model="formData.maintenanceDate" :disabled="true" />
                    </uni-forms-item>
                    <uni-forms-item :label-width="80" name="operator" label="保养人:">
                        <uni-easyinput v-model="formData.operator" :disabled="true" />
                    </uni-forms-item>
                    <uni-forms-item :label-width="80" name="remark" label="备注:">
                        <uni-easyinput v-model="formData.remark" :disabled="true" />
                    </uni-forms-item>
                    <uni-forms-item :label-width="80" name="outNum" label="保养图片:">
                        <view class="grid col-4 grid-square flex-sub">
                            <view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage"
                                :data-url="imgList[index]">
                                <image :src="imgList[index]" mode="aspectFill"></image>
                                <view class="cu-tag bg-red radius" @tap.stop="DelImg" :data-index="index">
                                    <text class='cuIcon-close'></text>
                                </view>
                            </view>
                            <view class="solids" v-if="imgList.length<1">
                                <text class='cuIcon-cameraadd'></text>
                            </view>
                        </view>
 
                    </uni-forms-item>
                </uni-group>
            </uni-forms>
            <view class="text-gray margin-bottom-lg">—————————— 保养项信息 ——————————</view>
 
            <uni-collapse>
                <uni-collapse-item :show-animation="true" :accordion="true" title="查看保养项" :border="false"
                    title-border="none">
                    <uni-card margin="10px" spacing="1px" v-for="(item,index) in partTakeAdviceDetailList" :key="index">
 
 
                        <view class="flex">
                            <view class="flex-sub text-light bg-white padding-xs margin-xs radius">行号:</view>
                            <view class="flex-sub bg-white padding-xs margin-xs radius text-right">{{index+1}}
                            </view>
                        </view>
                        <view class="flex">
                            <view class="flex-sub text-light bg-white padding-xs margin-xs radius">保养项:</view>
                            <view class="flex-sub bg-white padding-xs margin-xs text-bold radius text-right">
                                {{item.itemName}}
                            </view>
                        </view>
                        <view class="flex">
                            <view class="flex-sub text-light bg-white padding-xs margin-xs radius">子保养项:</view>
                            <view class="flex-sub bg-white padding-xs margin-xs radius text-right"
                                v-if="item.subItemName!=null && item.subItemName.length>10">
                                {{(item.subItemName).toString().substr(0,10)+'...'}}
                            </view>
 
                            <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else>
                                {{item.subItemName}}
                            </view>
                        </view>
                        <view class="flex">
                            <view class="flex-sub text-light bg-white  padding-xs margin-xs radius">保养要求:</view>
                            <view class="flex-sub bg-white padding-xs margin-xs radius text-right"
                                v-if="item.itemDemand!=null && item.itemDemand.length>10">
                                {{(item.itemDemand).toString().substr(0,10)+'...'}}
                            </view>
 
                            <view class="flex-sub bg-white padding-xs margin-xs radius text-right" v-else>
                                {{item.itemDemand}}
                            </view>
                        </view>
                        <view class="flex">
                            <view class="flex-sub text-light bg-white  padding-xs margin-xs radius">是否报修:</view>
                            <view class="flex-sub bg-white padding-xs     text-right margin-xs radius">
                                <uni-data-select :localdata="item.type" v-model="item.reportFlag"
                                    :disabled="item.istrue" />
                            </view>
                        </view>
                        <view class="flex">
                            <view class="flex-sub text-light bg-white  padding-xs margin-xs radius">保养结果:</view>
                            <view class="flex-sub bg-white padding-xs     text-right margin-xs radius">
                                <uni-data-select :localdata="item.restle" v-model="item.maintenanceResult"
                                    @change="handleCode($event, index)" :disabled="item.istrue" />
                            </view>
                        </view>
 
                        <view class="flex">
                            <view class="flex-sub text-light bg-white  padding-xs margin-xs radius">异常描述:</view>
                            <view class="flex-sub bg-white padding-xs     text-right margin-xs radius">
                                <uni-easyinput v-model="item.exceptionDescription" :disabled="item.istrue" />
                            </view>
                        </view>
                    </uni-card>
                </uni-collapse-item>
            </uni-collapse>
 
 
            <uni-forms ref="form" :modelValue="ScanData" validate-trigger="bind" err-show-type="undertext">
                <uni-group top="1">
                    <view class="text-gray margin-bottom-lg">—————————班组长确认信息——————————</view>
                    <uni-forms-item :label-width="80" required name="typeName" label="处理类型:">
                        <uni-data-select v-model="ScanData.typeName" :localdata="ScanData.handlingType"
                            @change="changehandlingType" placeholder="请选择" :disabled="isShowSure" />
                    </uni-forms-item>
                    <uni-forms-item :label-width="80" required name="handlingSuggestion" label="处理意见:">
                        <uni-easyinput type="textarea" v-model="ScanData.handlingSuggestion" :disabled="isShowSure" />
                    </uni-forms-item>
 
                </uni-group>
            </uni-forms>
            <uni-forms v-show="isHideFist" ref="form" :modelValue="ScanData" validate-trigger="bind"
                err-show-type="undertext">
                <uni-group top="1">
                    <view class="text-gray margin-bottom-lg">—————————初验收信息——————————</view>
                    <uni-forms-item :label-width="80" required name="initialAcceptanceComment" label="初审意见:">
                        <uni-easyinput type="textarea" v-model="ScanData.initialAcceptanceComment" placeholder="请输入意见"
                            :disabled="isShowLast" />
                    </uni-forms-item>
 
                    <uni-forms-item :label-width="80" name="outNum" label="初验收附件:">
                        <view class="grid col-4 grid-square flex-sub">
                            <view class="bg-img" v-for="(item,index) in imgListinitialAccept" :key="index"
                                @tap="ViewImageFile" :data-url="imgListinitialAccept[index]">
                                <image :src="imgListinitialAccept[index]" mode="aspectFill"></image>
                                <view class="cu-tag bg-red radius" @tap.stop="DelImgFile" :data-index="index">
                                    <text class='cuIcon-close'></text>
                                </view>
                            </view>
                            <view class="solids" @click="ChooseImageFile()" v-if="imgListinitialAccept.length<1">
                                <text class='cuIcon-cameraadd'></text>
                            </view>
                        </view>
 
                    </uni-forms-item>
                </uni-group>
            </uni-forms>
            <uni-forms v-show="isHideLast" ref="form" :modelValue="ScanData" validate-trigger="bind"
                err-show-type="undertext">
                <uni-group top="1">
                    <view class="text-gray margin-bottom-lg">—————————终验收信息——————————</view>
                    <uni-forms-item :label-width="80" required name="finalAcceptanceComment" label="终验收意见:">
                        <uni-easyinput type="textarea" v-model="ScanData.finalAcceptanceComment" placeholder="请输入意见"
                            :disabled="isfinal" />
                    </uni-forms-item>
                    <uni-forms-item :label-width="80" name="outNum" label="终验收附件:">
                        <view class="grid col-4 grid-square flex-sub">
                            <view class="bg-img" v-for="(item,index) in imgListfinalAcceptanceFilesResult" :key="index"
                                @tap="ViewImageFinal" :data-url="imgListfinalAcceptanceFilesResult[index]">
                                <image :src="imgListfinalAcceptanceFilesResult[index]" mode="aspectFill"></image>
                                <view class="cu-tag bg-red radius" @tap.stop="DelImgFinal" :data-index="index">
                                    <text class='cuIcon-close'></text>
                                </view>
                            </view>
                            <view class="solids" @click="ChooseImageFinal()"
                                v-if="imgListfinalAcceptanceFilesResult.length<1">
                                <text class='cuIcon-cameraadd'></text>
                            </view>
                        </view>
 
                    </uni-forms-item>
                </uni-group>
            </uni-forms>
            <view v-show="isShowBtn" class="padding flex flex-direction">
                <view class="flex-sub bg-blue padding-sm margin-xl radius text-sm text-center text-white"
                    @click.stop="ProductionTask()" hover-class="is-hover">确定</view>
            </view>
 
        </view>
    </view>
</template>
 
<script>
    import configService from "@/common/service/config.service.js";
    import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
    export default {
        mixins: [MescrollMixin], // 使用mixin
        data() {
            return {
                title: '',
                isShowBtn: true,
                isHideLast: false,
                isHideFist: false,
                isShowSure: false,
                scrollLeft: 0,
                isfinal: false,
                searchValue: '',
                imgList: [],
                imgListinitialAccept: [],
                imgListfinalAcceptanceFilesResult: [],
                equipmentList: [],
                uploadUrl: "/sys/common/upload",
                ScanData: {
                    typeName: '',
                    initialAcceptanceComment: '',
                    handlingType: [{
                            text: "通过",
                            value: "1"
                        },
                        {
                            text: "驳回",
                            value: "2"
                        }
                    ],
                    handlingSuggestion: ''
                },
                formData: {
                    avatar: [],
                    avatarFile: [],
                    avatarFinal: [],
                    id: '',
                    maintenanceStatus: ''
                },
                istrue: true,
                ipAndPort: configService.staticURL,
                partTakeAdviceDetailList: [],
                NavBarColor: this.NavBarColor,
                url: {
                    upload: "/eam/sysFiles/batch_upload",
                    stallList: "/eam/weekMaintenanceOrder/queryById",
                    // getEquipmentList: "eam/equipment/asyncLoadEquipment",
                    getEquipmentList:'eam/equipment/list',
                    BaoList: '/eam/weekMaintenanceOrderDetail/queryList',
                    approval: 'eam/weekMaintenanceOrder/approval'
                },
                id: '',
                taskId: '',
                inspectionResult: '',
                upOption: {
                    page: {
                        num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
                        size: 10 // 每页数据的数量
                    },
                    noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
                    empty: {
                        tip: '~ 暂无数据 ~', // 提示
                    },
                    loading: '',
                    text: '全部',
                    isShowNoMore: false,
                    textNoMore: '我是有底线的 >_<'
                },
                styles: {
                    color: '#2979FF',
                    borderColor: '#2979FF'
                },
                isShowLast: false,
                msg1Count: 0,
                msg2Count: 0,
                msg1Title: "",
                procInstId: '',
                values: '',
                imageFiles: '',
                imageFilesList: [],
                imageFilesnitialAcceptList: []
            }
        },
        computed: {
            top() {
                return this.CustomBar * 2 + 160
            },
            style() {
                var StatusBar = this.StatusBar;
                var CustomBar = this.CustomBar;
                var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
                return style
            },
        },
        onLoad(options) {
            const annItem = JSON.parse(decodeURIComponent(options.item));
            this.variables = annItem.variables
            this.id = annItem.dataId
            this.taskId = annItem.id
            this.procInstId = annItem.procInstId
            this.assignee = annItem.assignee
        },
        created() {
            this.getEquipment();
            this.getList();
            this.upCallback();
        },
 
        methods: {
            changehandlingType(e) {
                this.ScanData.typeName = e;
            },
            ProductionTask() {
                if (this.formData.maintenanceStatus == 'WAIT_FINAL_ACCEPTANCE') {
 
                    if (this.ScanData.finalAcceptanceComment == undefined || this.ScanData.finalAcceptanceComment ==
                        null || this.ScanData.finalAcceptanceComment ==
                        '') {
 
                        uni.showToast({
                            icon: 'none',
                            title: '请输入终验收意见!'
                        });
                        return false;
                    }
                }
                if (this.formData.maintenanceStatus == 'WAIT_INITIAL_ACCEPTANCE') {
 
                    if (this.ScanData.initialAcceptanceComment == undefined || this.ScanData.initialAcceptanceComment ==
                        null || this.ScanData.acceptanceComment ==
                        '') {
 
                        uni.showToast({
                            icon: 'none',
                            title: '请输入初验收意见!'
                        });
                        return false;
                    }
                }
 
 
                if (this.ScanData.typeName == undefined || this.ScanData.typeName == null || this.ScanData.typeName ==
                    '') {
 
                    uni.showToast({
                        icon: 'none',
                        title: '处理类型不能为空'
                    });
                    return false;
                }
                if (this.ScanData.handlingSuggestion == undefined || this.ScanData.handlingSuggestion == null || this
                    .ScanData.handlingSuggestion ==
                    '') {
 
                    uni.showToast({
                        icon: 'none',
                        title: '处理意见不能为空'
                    });
                    return false;
                }
                this.$http.put(this.url.approval, {
                    finalAcceptanceFilesResult: this.formData.avatarFinal,
                    finalAcceptanceComment: this.ScanData.finalAcceptanceComment,
                    initialAcceptanceFilesResult: this.formData.avatarFile,
                    initialAcceptanceComment: this.ScanData.initialAcceptanceComment,
                    confirmComment: this.ScanData.handlingSuggestion,
                    confirmDealType: this.ScanData.typeName,
                    id: this.formData.id,
                    dataId: this.id,
                    instanceId: this.procInstId,
                    tableDetailList: this.partTakeAdviceDetailList,
                    taskId: this.taskId,
                    userId: this.assignee,
                    maintenanceDate: this.formData.maintenanceDate,
                    equipmentId: this.formData.num,
                    imageFilesResult: this.imageFilesList,
                    remark: this.formData.remark,
                    standardId: this.formData.standardId,
                    standardName: this.formData.standardName
                }).then(res => {
                    console.log(res)
                    this.$tip.loaded();
                    if (res.data.success) {
                        uni.showToast({
                            icon: "success",
                            title: '提交成功',
                            duration: 2000
                        });
                        // this.$Router.replace({
                        //     name: 'ToDoList'
                        // })
                        this.$Router.replaceAll({
                            name: 'ToDoList'
                        })
                    }
                }).catch(() => {
                    this.$tip.loaded();
                    uni.showToast({
                        icon: "error",
                        title: '提交失败',
                        duration: 2000
                    });
                });
            },
 
            changeEquipmentList(e) {
                this.formData.num = e;
            },
            handleCode(e, index) {
                console.log(index);
                // 根据 e 的值来判断是否需要更新 isTrue 的状态
                if (e == '2') {
                    this.partTakeAdviceDetailList[index].istrue = false;
                } else if (e == '1') {
                    this.partTakeAdviceDetailList[index].istrue = true;
                }
            },
            // getEquipment() {
            //     this.$http.get(this.url.getEquipmentList).then(res => {
            //         //设置列表数据
            //         if (res.data.success) {
            //             this.equipmentList = res.data.result
            //         } else {
            //             uni.showToast({
            //                 icon: "error",
            //                 title: res.data.message,
            //                 duration: 2000
            //             });
 
            //         }
            //     }).catch(() => {
            //         this.$tip.error("联网失败")
            //     })
            // },
                getEquipment() {
                            this.$http.get(this.url.getEquipmentList, {
                                params: {
                                    pageNo: 1,
                                    pageSize: 9999,
                                    order: 'desc',
                                    column: 'createTime'
                                },
                            
                            }).then(res => {
                                //设置列表数据
                                if (res.data.success) {
                                    this.equipmentList = res.data.result.records
                                } else {
                                    uni.showToast({
                                        icon: "error",
                                        title: res.data.message,
                                        duration: 2000
                                    });
            
                                }
                            }).catch(() => {
                                this.$tip.error("联网失败")
                            })
                        },
            getList() {
                this.$http.get(this.url.BaoList, {
                    params: {
                        orderId: this.id
                    },
 
                }).then(res => {
                    this.partTakeAdviceDetailList = res.data.result;
                    const restle = [];
                    this.partTakeAdviceDetailList.forEach(item => {
                        item.restle = [{
                                text: "正常",
                                value: '1'
                            },
                            {
                                text: "异常",
                                value: '2'
                            }
                        ]; // 新字段,值为一个空数组
                        item.type = [{
                                text: "否",
                                value: 0
                            },
                            {
                                text: "是",
                                value: 1
                            }
                        ]; // 新字段,值为一个空数组
                        item.istrue = true;
                    });
                    console.log("url", res)
                    //设置列表数据
                    if (res.data.success) {
                        console.log("res", res.data.result)
 
                    }
                }).catch(() => {
                    //联网失败, 结束加载
                })
            },
 
            ChooseImageFinal() {
                var that = this;
                uni.chooseImage({
                    count: 4,
                    sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
                    sourceType: ['album'], // 从相册选择
                    success: (res) => {
                        // 存储选择的图片路径
                        that.imgListfinalAcceptanceFilesResult = res.tempFilePaths;
 
                        // 初始化 formData.avatar 为空字符串
                        that.formData.avatarFinal = [];
 
                        // 创建上传任务的 Promise 数组
                        const uploadPromises = res.tempFilePaths.map((filePath, index) => {
                            return new Promise((resolve, reject) => {
                                that.$http.upload(that.url.upload, {
                                        filePath: filePath,
                                        name: 'file'
                                    })
                                    .then(uploadRes => {
                                        // 假设服务器返回的结果中包含文件路径
                                        const filePath = uploadRes.data.result[0];
                                        this.formData.avatarFinal.push(filePath);
                                        resolve(filePath);
                                    })
                                    .catch(err => {
                                        console.error('图片' + index + '上传失败:', err);
                                        reject(err);
                                    });
                            });
                        });
 
                        // 并发执行所有上传任务
                        Promise.all(uploadPromises)
                            .then((uploadedFilePaths) => {
                                console.log('所有图片上传成功:', that.formData.avatarFinal);
                            })
                            .catch((err) => {
                                console.error('图片上传失败:', err);
                                that.$tip.error('图片上传失败');
                            });
                    }
                });
            },
 
            ChooseImageFile() {
                var that = this;
                uni.chooseImage({
                    count: 4,
                    sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
                    sourceType: ['album'], // 从相册选择
                    success: (res) => {
                        // 存储选择的图片路径
                        that.imgListinitialAccept = res.tempFilePaths;
 
                        // 初始化 formData.avatar 为空字符串
                        that.formData.avatarFile = [];
 
                        // 创建上传任务的 Promise 数组
                        const uploadPromises = res.tempFilePaths.map((filePath, index) => {
                            return new Promise((resolve, reject) => {
                                that.$http.upload(that.url.upload, {
                                        filePath: filePath,
                                        name: 'file'
                                    })
                                    .then(uploadRes => {
                                        // 假设服务器返回的结果中包含文件路径
                                        const filePath = uploadRes.data.result[0];
                                        this.formData.avatarFile.push(filePath);
                                        resolve(filePath);
                                    })
                                    .catch(err => {
                                        console.error('图片' + index + '上传失败:', err);
                                        reject(err);
                                    });
                            });
                        });
 
                        // 并发执行所有上传任务
                        Promise.all(uploadPromises)
                            .then((uploadedFilePaths) => {
                                console.log('所有图片上传成功:', that.formData.avatarFile);
                            })
                            .catch((err) => {
                                console.error('图片上传失败:', err);
                                that.$tip.error('图片上传失败');
                            });
                    }
                });
            },
 
            ChooseImage() {
                var that = this;
                uni.chooseImage({
                    count: 4,
                    sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
                    sourceType: ['album'], // 从相册选择
                    success: (res) => {
                        // 存储选择的图片路径
                        that.imgList = res.tempFilePaths;
 
                        // 初始化 formData.avatar 为空字符串
                        that.formData.avatar = [];
 
                        // 创建上传任务的 Promise 数组
                        const uploadPromises = res.tempFilePaths.map((filePath, index) => {
                            return new Promise((resolve, reject) => {
                                that.$http.upload(that.url.upload, {
                                        filePath: filePath,
                                        name: 'file'
                                    })
                                    .then(uploadRes => {
                                        // 假设服务器返回的结果中包含文件路径
                                        const filePath = uploadRes.data.result[0];
                                        this.formData.avatar.push(filePath);
                                        resolve(filePath);
                                    })
                                    .catch(err => {
                                        console.error('图片' + index + '上传失败:', err);
                                        reject(err);
                                    });
                            });
                        });
 
                        // 并发执行所有上传任务
                        Promise.all(uploadPromises)
                            .then((uploadedFilePaths) => {
                                console.log('所有图片上传成功:', that.formData.avatar);
                            })
                            .catch((err) => {
                                console.error('图片上传失败:', err);
                                that.$tip.error('图片上传失败');
                            });
                    }
                });
            },
            ViewImageFinal(e) {
                uni.previewImage({
                    urls: this.imgListfinalAcceptanceFilesResult,
                    current: e.currentTarget.dataset.url
                });
            },
            ViewImage(e) {
                uni.previewImage({
                    urls: this.imgList,
                    current: e.currentTarget.dataset.url
                });
            },
            ViewImageFile(e) {
                uni.previewImage({
                    urls: this.imgListinitialAccept,
                    current: e.currentTarget.dataset.url
                });
            },
            DelImgFinal(e) {
                uni.showModal({
                    title: '提示',
                    content: '确定要删除这段回忆吗?',
                    cancelText: '再看看',
                    confirmText: '再见',
                    success: res => {
                        if (res.confirm) {
                            this.imgListfinalAcceptanceFilesResult.splice(e.currentTarget.dataset.index, 1)
                        }
                    }
                })
            },
            DelImgFile(e) {
                uni.showModal({
                    title: '提示',
                    content: '确定要删除这段回忆吗?',
                    cancelText: '再看看',
                    confirmText: '再见',
                    success: res => {
                        if (res.confirm) {
                            this.imgListinitialAccept.splice(e.currentTarget.dataset.index, 1)
                        }
                    }
                })
            },
            DelImg(e) {
                uni.showModal({
                    title: '提示',
                    content: '确定要删除这段回忆吗?',
                    cancelText: '再看看',
                    confirmText: '再见',
                    success: res => {
                        if (res.confirm) {
                            this.imgList.splice(e.currentTarget.dataset.index, 1)
                        }
                    }
                })
            },
 
            upCallback() {
                console.log(configService.staticURL)
                this.$http.get(this.url.stallList, {
                    params: {
                        id: this.id
                    },
 
                }).then(res => {
                    this.announcement1 = res.data.result
                    console.log("url", res)
                    //设置列表数据
                    if (res.data.success) {
                        console.log("res", res.data.result.equipmentCode)
                        this.formData.num = this.announcement1.equipmentId
                        this.formData.orderNum = this.announcement1.orderNum
                        this.formData.operator = this.announcement1.operator_dictText
                        this.formData.maintenanceDate = this.announcement1.maintenanceDate
                        this.formData.remark = this.announcement1.remark
                        this.ScanData.finalAcceptanceComment = this.announcement1.finalAcceptanceComment
                        this.formData.maintenanceStatus = this.announcement1.maintenanceStatus
                        switch (this.formData.maintenanceStatus) {
                            /**
                             * 初检
                             */
                            case 'WAIT_INITIAL_ACCEPTANCE':
                                this.title = '初检'
                                this.isShowSure = true;
                                this.isHideFist = true;
                                break
                                /**
                                 * 终验
                                 */
                            case 'WAIT_FINAL_ACCEPTANCE':
                                this.title = '终验'
                                this.isHideFist = true;
                                this.isShowLast = true;
                                this.isShowSure = true;
                                this.isHideLast = true;
                                break
                                /**
                                 * 执行
                                 */
                            case 'WAIT_CONFIRM':
                                this.title = '执行'
                                this.isHideLast = false
                                this.isHideFist = false
                                this.isShowBtn=false
                                this.isShowSure=true
                                break
                            case 'COMPLETE':
                                this.isShowSure = true;
                                this.isHideLast = true
                                this.isHideFist = true
                                this.isShowLast = true
                                this.isfinal = true
                                this.isShowBtn = false
                                this.title = '详情'
                                break
                        }
                        this.ScanData.initialAcceptanceComment = this.announcement1.initialAcceptanceComment
                        this.ScanData.typeName = this.announcement1.confirmDealType
                        this.formData.id = this.announcement1.id
                        this.ScanData.handlingSuggestion = this.announcement1.confirmComment
                        this.formData.avatar = this.announcement1.imageFiles
                        this.imageFilesList = JSON.parse(this.formData.avatar)
                        const imageObjects = JSON.parse(this.formData.avatar);
                        // 提取 filePath 并拼接 IP 和端口
                        this.imgList = imageObjects.map(imageObj => {
                            return `${this.ipAndPort}${imageObj.filePath}`;
                        });
                        this.formData.avatarFile = this.announcement1.initialAcceptanceFiles,
                            this.imageFilesnitialAcceptList = JSON.parse(this.formData.avatarFile)
                        const imageObjectInIt = JSON.parse(this.formData.avatarFile);
                        // 提取 filePath 并拼接 IP 和端口
                        this.imgListinitialAccept = imageObjectInIt.map(imageObj => {
                            return `${this.ipAndPort}${imageObj.filePath}`;
                        });
 
                        this.formData.avatarFinal = this.announcement1.finalAcceptanceFiles,
                            this.imageObjectFinal = JSON.parse(this.formData.avatarFinal)
                        const imageObjectFinal = JSON.parse(this.formData.avatarFinal);
                        // 提取 filePath 并拼接 IP 和端口
                        this.imgListfinalAcceptanceFilesResult = imageObjectFinal.map(imageObj => {
                            return `${this.ipAndPort}${imageObj.filePath}`;
                        });
 
 
 
 
                    }
                }).catch(() => {
                    //联网失败, 结束加载
                })
            },
 
 
 
            /* 检索 */
            getSera(res) {
                this.msgList = [];
                if (keyword == 0) {
                    this.$http.get(this.url.stallList, {
                        params: {
                            pageNo: 1,
                            pageSize: 999,
                            order: "desc",
                            column: "createTime",
                            equipmentCode: res
                        }
                    }).then(res => {
                        //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
 
                        this.announcement1 = res.data.result.records
                        this.mescroll.endSuccess(this.announcement1.length);
                        console.log("url", res)
                        //设置列表数据
                        if (res.data.success) {
                            console.log("res", res.data)
                            this.msg1Count = res.data.result.total
                            this.msg1Title = "通知(" + res.data.result.total + ")";
                            for (let annItem of this.announcement1) {
                                this.msgList.push(annItem)
                            }
                        }
                        if (page.num == 1) {
                            this.msgList = []; //如果是第一页需手动制空列表
                            this.msgList = this.msgList.concat(this.announcement1); //追加新数据
                        }
 
                    }).catch(() => {
                        //联网失败, 结束加载
                        this.mescroll.endErr();
                    })
                }
            },
 
            mescrollInit(mescroll) {
                console.log('mescrollInit')
                this.mescroll = mescroll;
            },
        },
 
    }
</script>
 
<style>
    .is-hover {
        color: rgba(255, 255, 255, 0.6);
        background-color: #55aaff;
        border-color: #55aaff;
    }
 
 
 
    .content {
        margin-top: 5px;
    }
 
    .content scroll-view {
        scrollIndicator: "none"
    }
 
    .popupView {
        margin-top: 85px;
        height: auto;
    }
</style>