fcx
2025-12-02 a177ad6532fcdc1e9d2b3910276bd88d04791469
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
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
<template>
  <view class="inspection-sheet">
    <!-- 头部信息 -->
    <view class="sheet-header">
      <h1>巡检单</h1>
      <view class="inspection-number">检验单号:{{ formData.billNo }}</view>
    </view>
 
    <!-- 基本信息区 -->
    <view class="basic-info">
      <view class="info-row">
        <span class="info-label">创建时间:</span>
        <span class="info-value">{{ formData.createTime }}</span>
        <span class="info-label">检验人:</span>
        <span class="info-value">{{ formData.statusUser }}</span>
      </view>
    </view>
 
    <!-- 物料信息区 -->
    <view class="material-info">
      <view class="info-block">
        <view class="info-label">生产线别:</view>
        <view v-if="!isUpdate" class="info-value">{{ formData.daa020 }}</view>
        <superwei-combox v-else v-model="formData.daa020" :candidates="DAA020List"
                         class="picker info-value-input" placeholder="请选择或输入"
                         @select="onDaa020Change"></superwei-combox>
      </view>
      <view class="info-block">
        <view class="info-label">物料编码:</view>
        <view v-if="!isUpdate" class="info-value">{{ formData.itemNo }}</view>
        <superwei-combox v-else v-model="formData.itemNo" :candidates="boardItems" :isJSON="true"
                         class="picker info-value-input" keyName="itemName" placeholder="请选择或输入"
                         @select="onItemChange"></superwei-combox>
      </view>
      <view class="info-block">
        <view class="info-label">产品名称:</view>
        <view class="info-value">{{ formData.itemName }}</view>
      </view>
      <view class="info-block">
        <view class="info-label">规格型号:</view>
        <view class="info-value">{{ formData.itemModel }}</view>
      </view>
      <view class="info-block">
        <view class="info-label">工单编号:</view>
        <view v-if="!isUpdate" class="info-value">{{ formData.billNo }}</view>
        <picker v-else :range="DAA001List" class="picker info-value-input" name="selector"
                @change="onDaa001Change">
          <view>{{ DAA001List[DAA001Index] }}</view>
        </picker>
        <view class="info-label">项目:</view>
        <view class="info-value">{{ formData.projecT_CODE }}</view>
        <view class="info-label">工单数量:</view>
        <view class="info-value highlight">{{ formData.planQty }}</view>
      </view>
      <view v-if="formData.remarks && current" class="info-block">
        <view class="info-label">备注:</view>
        <view class="info-value">{{ formData.remarks }}</view>
      </view>
    </view>
 
    <!-- 操作按钮区 -->
    <view class="action-buttons">
      <button v-if="current" class="secondary-btn" @click="getTable">获取检验项目</button>
      <button v-if="formData.billNo" class="secondary-btn" @click="closeInspection">关闭此次检验</button>
    <!-- <button v-if="isShowTable && isUpdate" class="primary-btn" @click="saveTable">生成检验项目</button> --> 
    </view>
 
    <!-- 检验项目表格 -->
    <view v-if="tableData.length > 0" class="inspection-table">
      <table>
        <thead>
        <tr>
          <th style="text-align: center;" width="15%">检验项目</th>
          <th style="text-align: center;" width="50%">检验描述</th>
          <th style="text-align: center;" width="20%">记录(点击)</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="(item, index) in tableData" :key="index">
          <td>{{ item.projName }}</td>
          <td>
            <view v-if="item.result=='合格'" class="watermark approved">合格</view>
            <view v-if="item.result=='不合格'" class="watermark rejected">不合格</view>
            <view v-if="item.result=='未完成'" class="watermark pending">待确认</view>
            <view class="description-text">{{ item.itemMod }}</view>
          </td>
          <td>
             <button v-if="item.isCheck < item.levelNum" class="record-btn record-btn-fill"
                    @click="toDetail(item)">
              填写 <!--({{ item.isCheck }}/{{ item.levelNum }})-->
            </button>
            
             <button v-else class="record-btn record-btn-view" @click="toDetail(item, index)">
              查看<!--({{ item.isCheck }}/{{ item.levelNum }})--> 
            </button>
          </td>
        </tr>
        </tbody>
      </table>
    </view>
 
    <!-- 操作按钮区 -->
    <view class="action-buttons">
      <button v-if="isUpdate && !isShowTable" class="secondary-btn" @click="getItem">创建检验单并生成部分默认值</button>
      <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="uploadImages">查看所有图片</button>
      <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="addDefectDescription">查看不良描述</button>
      <!--  <button v-if="!isUpdate && !formData.statusUser && !isShowTable" class="secondary-btn" @click="removeXJ">
        删除单据
      </button> -->
      <!-- <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="saveRemarks">添加备注</button> -->
      <button v-if="!isUpdate && !isShowTable && current" class="primary-btn" @click="submit">检验提交</button>
    </view>
 
    <!-- 不合格描述弹窗 -->
    <view v-if="remarksPopup" class="overlay">
      <view class="popup">
        <h3>修改备注</h3>
        <form>
          <view class="form-group">
            <label class="form-label">备注:</label>
            <textarea v-model="remarks" class="form-input form-textarea" placeholder="请输入备注信息..."></textarea>
          </view>
          <button class="updateBut" @click="editRemarks">修改</button>
          <button @click="remarksPopup = !remarksPopup">取消</button>
        </form>
      </view>
    </view>
  </view>
</template>
 
<script>
export default {
  data() {
    return {
      formData: {
        createTime: "",
        id: "",
        billNo: "",
        itemNo: "",
        itemName: "",
        workshopCode: "",
        workshopName: "",
        line: "",
        lineName: "",
        comments: "",
        statusUser: "",
        itemId: "",
        fSubmit: 0,
      },
 
      DAA020List: [],
 
      DAA001List: [],
      schemeResult: [],
      DAA001Index: -1,
 
      ItemList: [],
 
      boardItems: [],
 
      womdaaList: [],
 
      tableData: [],
 
      isSubmit: true,
 
      isUpdate: true,
 
      isShowTable: false,
 
      remarks: "",
      remarksPopup: false,
 
      comments: "",
      commentsPopup: false,
      current: true,
    };
  },
  onLoad(options) {
    //options中包含了url附带的参数
 
    let params = options;
 
    // tab 状态识别
    if(params["current"] === 'A') {
        this.current = true;
    } else if(params["current"] === 'B') {
        this.current = false;
    }
 
    if (params["id"]) {
 
        this.isUpdate = false;
 
        // ⭐⭐⭐ 新增:必须保存到 this.id,后续接口才能使用
        this.id = params["id"];         // ←←← 必须加这一句!!!
 
        // 原来你的逻辑保持不动
        this.formData.id = params["id"];
        this.formData.billNo = params["billNo"];
 
        // 初始化明细
        this.init();
 
    } else {
 
        // 初始化检验单号
        this.$post({
            url: "/XJ/getMaxReleaseNo"
        }).then(res => {
            this.formData.billNo = res.data.tbBillList;
            this.formData.createTime = this.$getDate("yyyy-mm-dd");
        });
 
        // 产品编码下拉框初始化
        this.$post({
            url: "/XJ/getLineAll"
        }).then(res => {
            this.lineList = res.data.tbBillList;
            this.DAA020List = res.data.tbBillList.map(item => item.lineName);
            this.formData.itemNo = "";
            this.formData.itemName = "";
            this.formData.workshopCode = "";
            this.formData.workshopName = "";
            this.formData.line = "";
            this.formData.lineName = "";
            this.formData.pbaid = null;
        })
    }
}
,
  methods: {
    // 获取合格项目数量
    getPassedCount() {
      return this.tableData.filter(item => item.result === '合格').length;
    },
    // 获取不合格项目数量
    getFailedCount() {
      return this.tableData.filter(item => item.result === '不合格').length;
    },
    // 获取待检验项目数量
    getPendingCount() {
      return this.tableData.filter(item => item.result === '未完成').length;
    },
    // 关闭此次检验并传巡检单号给后端
    closeInspection() {
      if (this.formData.billNo) {
        this.$post({
          url: "/XJ/closeInspection",
          data: {
            billNo: this.formData.billNo,
            id: this.formData.id
          }
        }).then(res => {
          this.$showMessage("检验已关闭");
          // 关闭当前页面,返回上一页面
          uni.navigateBack();
        }).catch(err => {
          this.$showMessage("关闭检验失败,请重试");
        });
      } else {
        this.$showMessage("巡检单号不存在");
      }
    },
    removeXJ() {
      if (this.formData.id) {
        this.$post({
          url: "/XJ/removeXJ",
          data: {
            id: this.formData.id
          }
        }).then(res => {
          if (res.data.tbBillList > 0) {
            this.$showMessage("删除成功");
            //关闭当前页面,返回上一页面或多级页面
            uni.navigateBack();
          } else {
            this.$showMessage("删除失败");
          }
        });
      } else {
        this.$showMessage("请先选择检验单号");
      }
    },
 
    submit() {
      this.$post({
        url: "/XJ/XJQaSubmit",
        data: {
          userNo: this.$loginInfo.account,
          gid: this.formData.id
        }
      }).then(res => {
 
        //2024-11-28 kyy 校验合格提交增加提示
        console.log("完整响应数据:", res);
        console.log("Status Code的值:", res.statusCode);
        console.log("返回的数据:", res.data);
        
        // 检查多种成功条件
        if (res.statusCode === 200 || res.status === 0 || res.data === true || res.data.tbBillList === true) {
 
          this.$showMessage("成功提交检验");
          // 提交成功后跳转到列表页面
          setTimeout(() => {
            uni.navigateTo({
              url: '/pages/QC/XJ/List'
            });
          }, 1500); // 1.5秒后跳转,让用户看到成功提示
        } else {
          this.$showMessage(res.data.message || res.message || "提交失败");
        }
      }).catch(err => {
        console.log("提交出错:", err);
        this.$showMessage("提交失败,请重试");
      })
    },
 
    init() {
      if (this.formData.id) {
        this.$post({
          url: "/XJ/getPage",
          data: {
            pageIndex: 1,
            limit: 1,
            id: this.formData.id
          }
        }).then(res => {
          let tbBillListElement = res.data.tbBillList[0];
          if (tbBillListElement) {
            // 保存原有的ID值
            const originalId = this.formData.id;
            
            // 保存原有的billNo值
            const originalBillNo = this.formData.billNo;
            
            // 将服务器返回的数据合并到现有数据中,而不是直接替换
            Object.assign(this.formData, tbBillListElement);
            
            // 确保关键字段值不被覆盖
            if ((!this.formData.id || this.formData.id === null || this.formData.id === undefined || this.formData.id === "") && originalId) {
              this.formData.id = originalId;
            }
            
            if ((!this.formData.billNo || this.formData.billNo === null || this.formData.billNo === undefined || this.formData.billNo === "") && originalBillNo) {
              this.formData.billNo = originalBillNo;
            }
            
            this.$post({
              url: "/XJ/getJYItem",
              data: {
                pid: this.formData.id
              }
            }).then(res => {
              this.tableData.splice(0, this.tableData.length, ...res.data.tbBillList);
 
              this.tableData.sort((a, b) => {
                if (a.result === '未完成' && b.result === '合格') {
                  return -1;
                } else if (a.result === '合格' && b.result === '未完成') {
                  return 1;
                } else {
                  return 0;
                }
              });
 
              if (this.tableData.length === 0) {
                this.isShowTable = true;
              }
              
              console.log('init完成后tableData长度:', this.tableData.length, 'isShowTable:', this.isShowTable);
            })
          }
        })
      }
    },
    onDaa020Change(event) {
      //获取生产线别的下标地址
      //this.formData.line = event;
 
      this.lineNo = this.lineList[this.DAA020List.indexOf(event)].lineNo;
 
      this.formData.line = this.lineNo;
 
      this.$post({
        url: "/XJ/getBoardItem",
        data: {
          lineNo: this.lineNo
        }
      }).then(res => {
        //填充工单号的数据源
        this.boardItems = res.data.tbBillList;
 
        this.ItemList = this.boardItems.map(item => item.itemName);
      })
 
    },
    onItemChange(event) {
 
      this.formData.itemNo = event.itemNo;
 
      this.$post({
        url: "/XJ/getDaa001",
        data: {
          daa020: this.lineNo,
          item: this.formData.itemNo
        }
      }).then(res => {
        //填充工单号的数据源
        this.schemeResult = res.data.tbBillList;
        this.DAA001List = this.schemeResult.map(s => s.daa001);
        //变为默认空值的状态
        this.DAA001Index = -1;
        this.formData.daa001 = "";
      })
    },
    //选取工单填充物料号和其他信息
    onDaa001Change(event) {
      this.DAA001Index = event.mp.detail.value;
 
      this.formData.daa001 = this.schemeResult[this.DAA001Index].daa001;
 
      //表单中的部分字段赋值
      this.$post({
        url: "/XJ/getItem",
        data: {
          daa001: this.formData.daa001
        }
      }).then(res => {
        let data = res.data.tbBillList[0];
        //当返回的结果集为空时置空原有的值
        if (!data) {
          this.formData.billNo = "";
          this.formData.taskNo = "";
          this.formData.itemNo = "";
          this.tableData.splice(0, this.tableData.length);
          return;
        }
        //不为空时赋值
        this.formData.daa001 = data.daa001;
        this.formData.daa003 = data.daa003;
        this.formData.daa004 = data.daa004;
        this.formData.daa008 = data.daa008;
        this.formData.projecT_CODE = data.projecT_CODE;
        this.formData.itemId = data.itemId;
        this.formData.pbaid = data.pbaid;
        this.formData.remarks = data.remarks;
      })
    },
    toDetail(item, index) {
  // 检查检验单是否存在
  if (!this.formData.id) {
    this.$showMessage("检验单数据不完整,请先获取检验项目或重新加载页面");
    return;
  }
 
  if (this.isUpdate) {
    uni.showToast({
      icon: "none",
      title: "请先生成检验项目",
      duration: 2000,
    });
    return;
  }
 
  // 如果 item.id 不存在,就传空字符串或者特殊标识
  const itemId = item.id != null ? item.id : '';
  const billNo = this.formData.billNo || '';
  const gid = this.formData.id || '';
  const itemIndex = index != null ? index : 0;
 
  uni.navigateTo({
    url: 'detail?id=' + encodeURIComponent(itemId) + 
         '&billNo=' + encodeURIComponent(billNo) + 
         '&gid=' + encodeURIComponent(gid) + 
         '&index=' + encodeURIComponent(itemIndex)
  });
},
    getTable() {
      // 在开始时清空现有数据,避免累加
      this.tableData.splice(0, this.tableData.length);
      
      // 确保itemNo存在
      if (!this.formData || !this.formData.itemNo) {
        this.$showMessage("请先选择物料编码");
        return;
      }
 
      // 显示加载提示,防止用户在保存过程中点击填写按钮
      uni.showLoading({
        title: '正在获取检验项目...'
      });
 
      this.$post({
        url: "/XJ/setJYItem",
        data: {
          itemNo: this.formData.itemNo
        }
      }).then(res => {
        if (res.data && res.data.tbBillList && res.data.tbBillList.length > 0) {
          // 直接赋值,避免累加
          this.tableData.splice(0, this.tableData.length, ...res.data.tbBillList);
          
          // 设置状态以显示生成检验项目按钮
          this.isShowTable = true;
          this.isUpdate = true;  // 注意这里是true,表示可以生成检验项目
          
          console.log('getTable完成后的状态:', {
            isShowTable: this.isShowTable,
            isUpdate: this.isUpdate,
            tableDataLength: this.tableData.length
          });
          
          // 显示成功消息
          this.$showMessage("检验项目获取成功");
 
//生成检验项目的逻辑(根据规范已注释)
       this.saveTable();
 
      // 自动刷新逻辑(根据规范已注释)
      // 获取当前页面路径和参数
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const route = '/' + currentPage.route;
const options = currentPage.options; // 页面参数对象
 
// 拼接参数
let query = '';
for (let key in options) {
  query += `${key}=${options[key]}&`;
}
query = query.slice(0, -1);
 
// 刷新当前页面
uni.redirectTo({
  url: query ? `${route}?${query}` : route
});
 
location.reload()
        } else {
          this.$showMessage("此物料没有启用的检验项目,请维护!");
          this.tableData.splice(0, this.tableData.length);
        }
        
        // 隐藏加载提示,允许用户操作
        uni.hideLoading();
      }).catch(err => {
        console.error("获取检验项目失败:", err);
        this.$showMessage("获取检验项目失败,请检查网络连接");
        uni.hideLoading();
      });
    },
    saveTable() {
      if (this.tableData.length === 0) {
        return;
      }
      
      // 显示加载提示
      uni.showLoading({
        title: '正在保存...'
      });
 
      this.$post({
        url: "/XJ/saveItem",
        data: {
          gid: this.formData.id,
          items: this.tableData,
          statusUser: this.$loginInfo.account,
          ItemNo:this.formData.itemNo
        }
      }).then(res => {
        // 只在需要时更新tableData,避免重复累加
        if (res.data && res.data.tbBillList && res.data.tbBillList.items) {
          // 确保完全替换而不是累加
          this.tableData.splice(0, this.tableData.length, ...res.data.tbBillList.items);
        }
            
        // 重要:确保formData.id不被覆盖
        if (!this.formData.id) {
          this.$showMessage("警告:检验单ID丢失,请重新加载页面");
        }
            
        // 设置状态以显示检验提交按钮
        this.isShowTable = false;
        this.isUpdate = false;
            
        console.log('saveTable完成后的状态:', {
          isShowTable: this.isShowTable,
          isUpdate: this.isUpdate,
          tableDataLength: this.tableData.length
        });
            
        // 显示成功消息
        this.$showMessage("生成检验项目成功");
            
        // 隐藏加载提示,允许用户操作
        uni.hideLoading();
      }).catch(err => {
        console.error("保存检验项目失败:", err);
        this.$showMessage("保存检验项目失败,请重试");
        uni.hideLoading();
      })
    },
    toYzxSubmitFrom(releaseNo){
      uni.navigateTo({
        url: 'yzxFrom?id=' +this.formData.id+'&current='+(this.current ? 'true' : 'false')
      });
    },
    toSNScanCode(releaseNo){
      uni.navigateTo({
        url: 'ScanCode?id=' +this.formData.id+'&current='+(this.current ? 'true' : 'false')
      });
    },
    save() {
 
      // if (this.tableData.length === 0) {
      //     this.$showMessage(this.formData.itemNo + "物料没有检验项目");
      //     return;
      // }
 
      if (!this.formData.daa001) {
        this.$showMessage("请选择计划编号");
        return;
      }
 
      this.formData.statusUser = this.$loginInfo.account;
 
      this.$post({
        url: "/XJ/save",
        data: {
          from: this.formData,
          userNo: this.$loginInfo.account,
          items: this.tableData
        }
      }).then(res => {
        // 保存原有的ID值
        const originalId = this.formData.id;
        
        // 设置新的ID值(如果返回的是ID)
        if (res.data.tbBillList && typeof res.data.tbBillList === 'string' && res.data.tbBillList !== null && res.data.tbBillList !== undefined && res.data.tbBillList !== "") {
          this.formData.id = res.data.tbBillList;
        }
        
        // 如果没有返回新的ID,则保持原有的ID
        if (!this.formData.id && originalId) {
          this.formData.id = originalId;
        }
        
        this.$showMessage("生成检验项目成功");
        this.init();
        this.isUpdate = false;
      });
    },
    saveRemarks() {
      this.remarksPopup = !this.remarksPopup;
      this.remarks = this.formData.remarks;
    },
    saveComments() {
      this.commentsPopup = !this.commentsPopup;
      this.comments = this.formData.comments;
    },
    editRemarks() {
      if (this.remarks) {
        //saveRemarksGid
        this.$post({
          url: "/XJ/saveRemarksGid",
          data: {
            gid: this.formData.id,
            remarks: this.remarks
          }
        }).then(res => {
          if (res.data.tbBillList > 0) {
            this.formData.remarks = this.remarks;
            this.remarksPopup = !this.remarksPopup;
            this.$showMessage("保存成功");
          }
        })
      }
    },
    editComments() {
      if (this.comments) {
        //saveRemarksGid
        this.$post({
          url: "/XJ/saveCommentGid",
          data: {
            gid: this.formData.id,
            comments: this.comments
          }
        }).then(res => {
          if (res.data.tbBillList > 0) {
            this.formData.comments = this.comments;
            this.commentsPopup = !this.commentsPopup;
            this.$showMessage("保存成功");
          }
        })
      }
    },
    uploadImages() {
      // 查看所有图片的逻辑
      console.log('点击了查看所有图片按钮,billNo:', this.formData.billNo);
      uni.navigateTo({
        url: 'ImageItemALL?id=' + this.formData.id
      });
    },
    addDefectDescription() {
      // 查看所有不良描述的逻辑
      console.log('点击了查看不良描述按钮,billNo:', this.formData.billNo);
      uni.navigateTo({
        url: 'Blms?id=' + this.formData.id
      });
    },
  },
  onShow() {
    //每次进入页面都会执行的方法
    this.init();
  }
};
</script>
 
<style>
/* 基础样式 */
.inspection-sheet {
  font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  background-color: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
 
/* 头部样式 */
.sheet-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e0e0e0;
}
 
.sheet-header h1 {
  color: #2c3e50;
  font-size: 24px;
  margin-bottom: 5px;
}
 
.inspection-number {
  font-size: 16px;
  font-weight: bold;
  color: #3498db;
}
 
/* 基本信息区样式 */
.basic-info,
.material-info {
  margin-bottom: 20px;
}
 
.info-row {
  display: flex;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
 
.info-label {
  font-weight: bold;
  color: #34495e;
  min-width: 80px;
  margin-right: 5px;
}
 
.info-value {
  color: #2c3e50;
  margin-right: 20px;
}
 
.highlight {
  font-weight: bold;
  color: #e74c3c;
}
 
/* 物料信息区样式 */
.material-info {
  border: 1px solid #eee;
  padding: 15px;
  border-radius: 5px;
}
 
.info-block {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
 
.info-value-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  background: #ffffff;
  font-size: 14px;
  margin-top: 6px;
}
 
.picker {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  background: #ffffff;
  font-size: 14px;
  margin-top: 6px;
}
 
/* 表格样式 */
.inspection-table {
  margin: 25px 0;
}
 
.inspection-table table {
  width: 100%;
  border-collapse: collapse;
}
 
.inspection-table th, .inspection-table td {
  padding: 12px 15px;
  border: 1px solid #ddd;
  text-align: left;
}
 
.inspection-table th {
  background-color: #f8f9fa;
  font-weight: bold;
  color: #34495e;
}
 
.inspection-table tr:nth-child(even) {
  background-color: #f9f9f9;
}
 
.inspection-table tr:hover {
  background-color: #f1f5f9;
}
 
/* 检验描述列特殊样式 */
.inspection-table td:nth-child(2) {
  position: relative;
  overflow: hidden;
  padding: 0;
}
 
/* 按钮样式 */
.action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
 
.primary-btn,
.secondary-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}
 
.primary-btn {
  background-color: #3498db;
  color: white;
}
 
.primary-btn:hover {
  background-color: #2980b9;
}
 
.secondary-btn {
  background-color: #ecf0f1;
  color: #7f8c8d;
}
 
.secondary-btn:hover {
  background-color: #d5dbdb;
}
 
.record-btn {
  padding: 6px 12px;
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: all 0.2s;
}
 
.record-btn:hover {
  background-color: #e9ecef;
}
 
/* 填写状态按钮 */
.record-btn-fill {
  background-color: #f8f9fa;
  border: 1px solid #ddd;
}
 
.record-btn-fill:hover {
  background-color: #e9ecef;
}
 
/* 查看状态按钮 */
.record-btn-view {
  background-color: #f8f9fa;
  border: 1px solid #ddd;
}
 
.record-btn-view:hover {
  background-color: #e9ecef;
}
 
/* 水印样式 */
.watermark {
  position: absolute;
  font-size: 40px;
  font-weight: bold;
  opacity: 1;
  z-index: 1;
  pointer-events: none;
  transform: rotate(-15deg);
  width: 100%;
  text-align: center;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
}
 
.watermark.approved {
  color: #2ecc71; /* 绿色 */
}
 
.watermark.rejected {
  color: #e74c3c; /* 红色 */
}
 
.watermark.pending {
  color: #f39c12; /* 橙色 */
}
 
/* 描述文本容器 */
.description-text {
  position: relative;
  z-index: 2;
  padding: 25px;
  background-color: rgba(255, 255, 255, 0.7);
}
 
/* 弹窗样式 */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
 
.popup {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-width: 500px;
  width: 90%;
}
 
.popup h3 {
  margin-top: 0;
  color: #333;
}
 
.form-group {
  margin-bottom: 15px;
}
 
.form-label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #555;
}
 
.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}
 
.form-textarea {
  height: 100px;
  resize: vertical;
}
 
.updateBut {
  background-color: #3498db;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 10px;
}
 
.updateBut:hover {
  background-color: #2980b9;
}
 
/* 响应式设计 */
@media (max-width: 768px) {
  .inspection-sheet {
    padding: 10px;
  }
  
  .info-row {
    flex-direction: column;
  }
  
  .info-label, .info-value {
    margin-bottom: 5px;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .primary-btn, .secondary-btn {
    width: 100%;
    margin-bottom: 10px;
  }
}
</style>