yyb
15 小时以前 74ead6f7bb66fe8d3f8db11b1cbadd92b57e28d1
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
<template>
  <!-- 报工 -->
  <div class="page">
    <u-form
      :model="form"
      ref="uForm"
      :label-width="200"
      :rules="rules"
      :error-type="['toast']"
    >
      <u-form-item
        label="车间"
        :border-bottom="false"
        prop="work"
        style="font-size: small"
      >
        <u-radio-group v-model="form.work" :disabled="subdisabled">
          <u-radio name="dt"
            ><span style="font-size: small">导体</span></u-radio
          >
          <u-radio name="tg"
            ><span style="fongt-size: small">铜杆</span></u-radio
          >
        </u-radio-group>
      </u-form-item>
      <u-form-item
        label="报工单号"
        :border-bottom="false"
        prop="taskNo"
        style="font-size: small"
      >
        <u-input
          v-model="form.taskNo"
          type="select"
          placeholder="请扫描报工单号"
          @click="open"
        />
      </u-form-item>
      <u-form-item
        label="工序"
        :border-bottom="false"
        prop="name"
        style="font-size: small"
      >
        <u-input
          v-model="form.name"
          type="select"
          placeholder="请扫描报工单号"
        />
      </u-form-item>
      <u-form-item
        label="订单号"
        :border-bottom="false"
        prop="moOn"
        style="font-size: small"
      >
        <u-input
          v-model="form.moOn"
          type="select"
          placeholder="点击选择"
          @click="openList"
        />
      </u-form-item>
      <u-form-item
        label="零件号"
        :border-bottom="false"
        prop="partNo"
        style="font-size: small"
      >
        <u-input v-model="form.partNo" placeholder="" disabled />
      </u-form-item>
      <u-form-item
        label="零件描述"
        :border-bottom="false"
        prop="partName"
        style="font-size: small"
      >
        <u-input v-model="form.partName" placeholder="" disabled />
      </u-form-item>
      <!-- <u-form-item label="批量大小" :border-bottom="false" prop="qtyRequired" style="font-size:small">
                <u-input v-model="form.qtyRequired" placeholder="" disabled />
            </u-form-item>
            <u-form-item label="剩余数量" :border-bottom="false" prop="Jianqtyfinished" style="font-size:small">
                <u-input v-model="form.Jianqtyfinished" placeholder="" disabled />
            </u-form-item> -->
      <u-form-item
        label="投料产量"
        :border-bottom="false"
        prop="FeedInputProductionVolume"
        style="font-size: small"
      >
        <u-input
          v-model="form.FeedInputProductionVolume"
          type="select"
          placeholder="请填写投料产量"
          @click="FeedInputProductionVolumeCLick"
        />
      </u-form-item>
      <u-form-item
        label="汇报产量"
        :border-bottom="false"
        prop="reportProductionVolume"
        style="font-size: small"
      >
        <u-input
          v-model="form.reportProductionVolume"
          type="select"
          placeholder="请填写汇报产量"
          @click="reportProductionVolumeCLick"
        />
      </u-form-item>
      <u-form-item
        label="库位"
        :border-bottom="false"
        prop="proposedLocation"
        style="font-size: small"
      >
        <u-input v-model="form.proposedLocation" placeholder="" disabled />
      </u-form-item>
      <!-- <u-form-item label="报工类型" label-width="90px" prop="productType" style="font-size:small">
                <u-radio-group v-model="form.productType" :disabled="subdisabled">
                    <u-radio name="dep"><span style="font-size:small">下机报工</span></u-radio>
                    <u-radio name="ndep"><span style="font-size:small">未下机报工</span></u-radio>
                </u-radio-group>
            </u-form-item> -->
      <!-- <u-form-item label="接收零件" label-width="90px" prop="receive" style="font-size:small">
                <u-radio-group v-model="form.receive" :disabled="subdisabled">
                    <u-radio name="mo"><span style="font-size:small">车间订单</span></u-radio>
                    <u-radio name="part"><span style="font-size:small">替代零件</span></u-radio>
                </u-radio-group>
            </u-form-item> -->
      <u-form-item
        label="物料"
        label-width="90px"
        prop="materialCost"
        style="font-size: small"
      >
        <u-radio-group v-model="form.materialCost" :disabled="true">
          <u-radio name="倒冲"
            ><span style="font-size: small">倒冲</span></u-radio
          >
          <u-radio name="投料"
            ><span style="font-size: small">投料</span></u-radio
          >
        </u-radio-group>
      </u-form-item>
      <!-- <u-form-item label="简化物料检查" label-width="90px" prop="simplifyMaterials" style="font-size:small">
                <u-radio-group v-model="form.simplifyMaterials" :disabled="subdisabled || simplifyDisabled"
                    @change="radioChange">
                    <u-radio name="true"><span style="font-size:small">是</span></u-radio>
                    <u-radio name="false"><span style="font-size:small">否</span></u-radio>
                </u-radio-group>
            </u-form-item> -->
      <u-form-item
        label="报工方式"
        label-width="90px"
        prop="status"
        style="font-size: small"
      >
        <u-radio-group
          v-model="form.status"
          :disabled="subdisabled"
          @change="handleReportTypeChange"
        >
          <u-radio name="false"
            ><span style="font-size: small">按班组报工</span></u-radio
          >
          <u-radio name="true"
            ><span style="font-size: small">按人员报工</span></u-radio
          >
        </u-radio-group>
      </u-form-item>
      <u-form-item
        label="人员名称"
        label-width="90px"
        :border-bottom="false"
        prop="Persons"
        style="font-size: small"
      >
        <u-input
          v-model="form.Persons"
          type="select"
          placeholder="请选择"
          @click="openselectedPersons"
          :disabled="!canSelectPerson || subdisabled"
        />
      </u-form-item>
      <u-form-item
        label="产出列表"
        :border-bottom="false"
        style="font-size: small"
      ></u-form-item>
    </u-form>
    <view class="wrap">
      <scroll-view class="packing-registration-scroll-list" scroll-y="true">
        <u-cell-group
          class="packing-registration-scroll-list-group"
          :border="false"
        >
          <view
            class="content"
            v-for="(item, index) in InventoryReceiptList"
            :key="index"
            :index="index"
            @click="cancelReport(item, index)"
          >
            <view class="content-header">
              <view class="content-header-title" style="font-size: small">{{
                index + 1
              }}</view>
            </view>
            <view class="content-body">
              <view class="row-list">
                <view class="_label">
                  <view class="_label-name">批号:</view>
                </view>
                <view class="_content">
                  {{ item.outBatchNo }}
                </view>
              </view>
              <view class="row-list">
                <view class="_label">
                  <view class="_label-name">数量:</view>
                </view>
                <view class="_content">
                  {{ item.netWeight }}
                </view>
              </view>
              <view class="row-list">
                <view class="_label">
                  <view class="_label-name">库位:</view>
                </view>
                <view class="_content">
                  {{ item.proposedLocation }}
                </view>
              </view>
            </view>
          </view>
        </u-cell-group>
      </scroll-view>
    </view>
    <!-- 填写报工单 -->
    <modalBg ref="modalBg" :confirm="confirm">
      <u-field
        v-model="form.taskNo"
        label="报工单号"
        placeholder="请输入"
        :border-bottom="false"
        style="font-size: small"
      >
      </u-field>
    </modalBg>
    <saveForm
      ref="saveForm"
      :operationTaskList="this.form"
      :dutyId="dutyId"
      @update="handleUpdate"
    />
    <u-modal
      width="720rpx"
      v-model="showModal"
      title=""
      :show-cancel-button="true"
      :show-confirm-button="true"
      @confirm="confirmModle"
      @cancel="cancelModle"
    >
      <view class="popup-content">
        <view class="packing-registration-param">
          <view class="packing-registration-param-view">
            <view class="packing-registration-param-item param-extra">
              <view class="packing-registration-param-item-left">
                <text class="item-one">批号</text>
              </view>
              <view class="packing-registration-param-item-right">
                <text class="item-one">{{ detailedList.outBatchNo }}</text>
              </view>
            </view>
            <view class="packing-registration-param-item param-extra">
              <view class="packing-registration-param-item-left">
                <text class="item-one">零件号</text>
              </view>
              <view class="packing-registration-param-item-right">
                <text class="item-one">{{ detailedList.partNo }}</text>
              </view>
            </view>
            <view class="packing-registration-param-item param-extra">
              <view class="packing-registration-param-item-left">
                <text class="item-one">零件描述</text>
              </view>
              <view class="packing-registration-param-item-right">
                <span class="item-one">{{ detailedList.partName }}</span>
              </view>
            </view>
            <view class="packing-registration-param-item param-extra">
              <view class="packing-registration-param-item-left">
                <text class="item-one">取消接收数量</text>
              </view>
              <view class="packing-registration-param-item-right">
                <span class="item-one">{{ detailedList.netWeight }}</span>
              </view>
            </view>
          </view>
        </view>
      </view>
    </u-modal>
    <u-modal
      v-model="personShowModal"
      title=""
      :show-cancel-button="true"
      :show-confirm-button="true"
      @confirm="confirmSelection"
      @cancel="cancelSelection"
    >
      <view class="popup-content">
        <scroll-view
          scroll-y="true"
          style="
            height: 100%;
            transform: translateZ(0);
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
          "
        >
          <view class="popup-header">
            <checkbox-group @change="checkboxChange">
              <label
                class="checkbox-item"
                v-for="(item, index) in selectedPersons"
                :key="index"
              >
                <checkbox :value="item.staffId" :checked="item.checked" />
                <text class="label">{{ item.staffName }}</text>
              </label>
            </checkbox-group>
          </view>
        </scroll-view>
      </view>
    </u-modal>
    <scan></scan>
  </div>
</template>
 
<script>
import modalBg from "@/components/modal/modal-bg.vue";
import saveForm from "./components/saveForm.vue";
import scan from "@/components/scan/scan.vue";
export default {
  components: {
    modalBg,
    saveForm,
    scan,
  },
  data() {
    return {
      simplifyDisabled: false,
      // checkboxList: [
      //   {
      //     name: "工序的自动报告",
      //     value: false,
      //     disabled: false,
      //   },
      //   {
      //     name: "简化物料检查",
      //     value: false,
      //     disabled: false,
      //   },
      // ],
      InventoryReceiptList: [],
      selectedPersons: [],
      form: {
        workstationId: "",
        work: "",
        taskNo: "",
        name: "",
        moOn: "",
        partNo: "",
        partName: "",
        // qtyRequired: "",
        // Jianqtyfinished: "",
        FeedInputProductionVolume: null, //投料产量
        reportProductionVolume: null, //汇报产量
        proposedLocation: "",
        productType: "dep",
        receive: "mo",
        materialCost: "",
        // autoReport: false,
        simplifyMaterials: "false",
        status: "false",
        Persons: "",
        productStaffIds: [],
        productStaffs: [],
      },
      reportProductionVolumelist: {},
      FeedInputProductionVolumeList: [], //投料产量
      personList: [],
      canSelectPerson: false,
      rules: {
        work: [
          {
            required: true,
            message: "请选择车间",
            trigger: ["change"],
          },
        ],
        taskNo: [
          {
            required: true,
            message: "请选择报工单号",
            trigger: ["change", "blur"],
          },
        ],
        name: [
          {
            required: true,
            message: "请选择工序",
            trigger: ["change", "blur"],
          },
        ],
        moOn: [
          {
            required: true,
            message: "请选择订单号",
            trigger: ["change", "blur"],
          },
        ],
        productType: [
          {
            required: true,
            message: "请选择报工类型",
            trigger: ["change"],
          },
        ],
        receive: [
          {
            required: true,
            message: "请选择接收零件类型",
            trigger: ["change"],
          },
        ],
        status: [
          {
            required: true,
            message: "请选择报工方式",
            trigger: ["change"],
          },
        ],
        Persons: [
          {
            required: true,
            message: "请选择人员",
            trigger: ["change"],
          },
        ],
        reportProductionVolume: [
          {
            required: true,
            message: "请输入汇报产量",
            trigger: ["change"],
          },
        ],
        // FeedInputProductionVolume: [{
        //     required: true,
        //     message: "请输入投料产量",
        //     trigger: ["change"],
        // }, ],
      },
      showSave: false,
      operationTaskId: "",
      subdisabled: false,
      codeInfoId: "",
      detailedList: {},
      showModal: false,
      personShowModal: false,
      checkboxList: [],
      index: 0,
    };
  },
  // 点击提交按钮的事件处理函数
  onNavigationBarButtonTap() {
    this.$refs.uForm.validate((valid) => {
      if (valid) {
        uni.showLoading({
          mask: true,
          title: "加载中",
        });
        this.form.operationTaskId = this.form.id;
        this.reportProductionVolumelist.operationTaskId = this.form.id;
        this.reportProductionVolumelist.status = this.form.status;
        this.reportProductionVolumelist.Persons = this.form.Persons;
        this.reportProductionVolumelist.productStaffIds =
          this.form.productStaffIds;
        this.reportProductionVolumelist.productStaffs = this.form.productStaffs;
        this.reportProductionVolumelist.productInputList =
          Object.keys(this.FeedInputProductionVolumeList).length === 0
            ? null
            : this.FeedInputProductionVolumeList;
        this.reportProductionVolumelist.dutyRecordId = this.dutyId;
        this.form.productOutputList = []; // 创建一个空数组
        this.form.productOutputList.push(this.reportProductionVolumelist); // 向数组中添加元素
        console.log("this.form", this.form);
        this.$u.api.workReporting
          .submitPDA(this.form)
          .then((res) => {
            this.subdisabled = true;
            this.$u.toast("提交成功");
            this.InventoryReceiptList.unshift(this.form.productOutputList[0]);
            (this.reportProductionVolumelist = {}),
              (this.FeedInputProductionVolumeList = []), //投料产量
              (this.form.FeedInputProductionVolume = null), //投料产量
              (this.form.reportProductionVolume = null), //汇报产量
              console.log(
                "this.InventoryReceiptList",
                this.InventoryReceiptList
              );
          })
          .finally(() => {});
      } else {
        // 可以获取具体的错误信息
        const errors = this.$refs.uForm.getError();
      }
    });
  },
  onReady() {
    this.$refs.uForm.setRules(this.rules);
  },
  onShow() {
    let that = this;
    uni.$off("scan"); // 每次进来先 移除全局自定义事件监听器
    uni.$on("scan", function (data) {
      //扫码成功后的回调,你可以写自己的逻辑代码在这里
      if (data.code) {
        let codeInfo = JSON.parse(data.code);
        if (codeInfo.moOn) {
          that.codeInfoId = codeInfo.id;
          // 扫描报工单二维码
          that.saveForm(codeInfo);
          // that.getHandelList();
        }
        if (codeInfo.WC) {
          // 扫描报工单二维码
          that.CopperReportingWork(codeInfo);
        }
        // if (codeInfo.BN) {
        //     // 扫描报工单二维码
        //     that.$refs.saveForm.saveForm(codeInfo);
        // }
      }
    });
  },
  watch: {
    "form.taskNo": function (newVal, oldVal) {
      this.subdisabled = false;
    },
    "form.status"(newVal) {
      this.selectedPersons = this.selectedPersons.map((item) => ({
        ...item,
        checked: newVal === "false",
      }));
    },
  },
  methods: {
    // 投料产量
    FeedInputProductionVolumeCLick() {
      if (this.form.taskNo === "") {
        uni.showToast({
          title: "请先扫码",
          icon: "none",
        });
        return;
      }
      if (this.simplifyDisabled) {
        uni.showToast({
          title: "倒冲无需投料",
          icon: "none",
        });
        return;
      }
      uni.navigateTo({
        url:
          "/pages/product/report/seachPersonnelNo?moOn=" +
          this.form.moOn +
          "&workstationId=" +
          this.form.workstationId,
      });
    },
    // 汇报产量
    reportProductionVolumeCLick() {
      if (this.form.taskNo === "") {
        uni.showToast({
          title: "请先扫码",
          icon: "none",
        });
        return;
      }
      if (this.form.work === "tg") {
        uni.showToast({
          title: "铜杆报工无需填写汇报产量,请扫码",
          icon: "none",
          duration: 2000,
        });
        return
      }
      // 处理提交逻辑
      this.$u.api.workReporting
        .operationTask({
          id: this.form.id,
        })
        .then((res) => {
          res.data.name = this.form.name;
          this.$refs.saveForm.open(res);
          uni.hideLoading();
        });
    },
    // 处理报工方式变更
    handleReportTypeChange() {
      // 切换报工方式时清空人员名称
      this.form.Persons = "";
      this.form.productStaffs = [];
      this.form.productStaffIds = [];
    },
    // 人员名称
    openselectedPersons() {
      this.personShowModal = true;
    },
    // 复选框变化事件
    checkboxChange(e) {
      console.log("e", e);
      const values = e.target.value || [];
      if (this.form.status === "true") {
        // 单选模式,只允许选择一个人
        const previouslySelected = this.selectedPersons.find(
          (item) => item.checked
        );
        const newlySelected =
          values.length > 0 ? values[values.length - 1] : null;
        if (
          previouslySelected &&
          newlySelected &&
          previouslySelected.staffId !== newlySelected
        ) {
          // 已有选中项且选择了新的项,提示只能选择一个人
          this.$u.toast("按人员报工时只能选择一位人员");
          // 保持原选择
          this.selectedPersons = this.selectedPersons.map((item) => ({
            ...item,
            checked: item.staffId === previouslySelected.staffId,
          }));
        } else {
          // 首次选择或取消选择
          this.selectedPersons = this.selectedPersons.map((item) => ({
            ...item,
            checked: newlySelected ? item.staffId === newlySelected : false,
          }));
        }
      } else {
        // 多选模式
        this.selectedPersons = this.selectedPersons.map((item) => ({
          ...item,
          checked: values.includes(item.staffId),
        }));
      }
    },
    // 确认选择
    confirmSelection() {
      const selected = this.selectedPersons.filter((item) => item.checked);
      // 根据报工方式设置人员名称
      if (this.form.status === "true" && selected.length > 0) {
        this.form.Persons = selected[0].staffName;
      } else {
        this.form.Persons = selected.map((item) => item.staffName).join(",");
      }
      this.form.productStaffs = selected.map((item) => item.staffNo);
      this.form.productStaffIds = selected.map((item) => item.staffId);
    },
    cancelSelection() {},
    // 铜杆报工
    CopperReportingWork(val) {
      if (this.form.work === "dt") {
        uni.showToast({
          title: "铜杆二维码报工车间需选择铜杆",
          icon: "none",
        });
        return;
      }
      // 保存原始的reportProductionVolume验证规则
      const originalReportProductionVolumeRule =
        this.rules.reportProductionVolume;
 
      // 临时移除reportProductionVolume的验证规则
      delete this.rules.reportProductionVolume;
 
      // 进行表单验证
      this.$refs.uForm.validate((valid) => {
        // 无论验证成功与否,都恢复原始规则
        this.rules.reportProductionVolume = originalReportProductionVolumeRule;
 
        if (valid) {
          const copperList = {};
          copperList.outBatchNo = val.BN;
          copperList.partNo = val.PN;
          copperList.weighingClerk = val.WC;
          copperList.executiveStandard = val.ES;
          copperList.netWeight = val.NW;
          copperList.specificationType = val.ST;
          copperList.reelWeight= val.TR;
          copperList.grossWeight = val.TW;
          copperList.operationTaskId = this.form.id;
          copperList.status = this.form.status;
          copperList.Persons = this.form.Persons;
          copperList.productStaffIds = this.form.productStaffIds;
          copperList.productStaffs = this.form.productStaffs;
          copperList.dutyRecordId = this.dutyId;
          copperList.proposedLocation = this.form.proposedLocation;
          this.form.productOutputList = [];
          this.form.operationTaskId = this.form.id;
          this.form.dutyRecordId = this.dutyId;
          this.form.productOutputList.push(copperList);
          console.log("this.form", this.form);
          this.$u.api.workReporting.submitPDA(this.form).then((res) => {
            this.subdisabled = true;
            console.log("val", val);
            // this.form.outBatchNo = val.BN;
            // this.form.netWeight = val.NW;
            console.log("this.form", this.form);
             
            this.InventoryReceiptList.unshift(this.form.productOutputList[0]);
            console.log("this.InventoryReceiptList", this.InventoryReceiptList);
 
            // this.getHandelList();
            this.$u.toast("报工成功");
          });
        } else {
          // 可以获取具体的错误信息
          const errors = this.$refs.uForm.getError();
        }
      });
    },
    // 点击确认后获取取消报工记录
    radioChange() {
      // 处理单选框变化事件
    },
    // 获取人员列表
    getPersonList(dutyId) {
      console.log("111111", dutyId);
      try {
        this.$u.api.workReporting
          .getPersonByDutyRecordId({
            id: dutyId,
          })
          .then((res) => {
            this.selectedPersons = res.data.map((item) => ({
              ...item,
              checked: this.form.status === "false",
            }));
          })
          .catch((err) => {
            console.log(err);
          });
      } catch (err) {
        console.log(err);
      }
    },
 
    confirmModle() {
      console.log("点击确认后获取取消报工记录", this.detailedList);
      // 处理确认逻辑
      this.$u.api.cancelReporting
        .cancelDTAOfWorkApplication({
          outBatchNo: this.detailedList.outBatchNo,
          outputId: this.detailedList.id,
        })
        .then((res) => {
          console.log("res", res);
          this.InventoryReceiptList.splice(this.index, 1);
          this.showModal = false;
          // this.getHandelList();
          this.$u.toast("取消报工成功");
        });
    },
    cancelModle() {
      this.showModal = false; // 关闭弹窗
    },
    // 取消报工
    cancelReport(item, index) {
      let that = this;
      that.index = index;
      uni.showModal({
        title: "提示",
        content: "是否确认取消批次" + item.outBatchNo + "的报工",
        success: function (res) {
          if (res.confirm) {
            that.detailedList = item;
            that.showModal = true;
          } else if (res.cancel) {
            return;
          }
        },
      });
    },
    // getHandelList() {
    //     this.$u.api.workReporting
    //         .getProductMainV1({
    //             current: 1,
    //             size: -1,
    //             id: this.codeInfoId,
    //         })
    //         .then((res) => {
    //             this.InventoryReceiptList = res.data.productOutputList;
    //         });
    // },
    // 多选处理
    // changeCheckbox(val) {
    // if (val.name === "工序的自动报告") {
    //   this.form.autoReport = val.value;
    // }
    // if (val.name === "简化物料检查") {
    //   this.form.simplifyMaterials = val.value;
    // }
    // },
    handleUpdate(val) {
      this.reportProductionVolumelist = val;
      this.form.reportProductionVolume = val.outBatchNo;
      // this.subdisabled = true;
      // this.getHandelList();
      // this.InventoryReceiptList.unshift(val);
    },
    // 打开弹框--后面还需要监听扫码枪扫码结果,赋值给报工单号字段,然后打开弹框选择订单号等操作
    open() {
      this.$refs.modalBg.open();
    },
    // 弹框保存
    confirm() {},
    // 选择订单号
    openList() {
      if (this.form.taskNo === "") {
        uni.showToast({
          title: "请先扫描或输入报工单号",
          icon: "none",
        });
        return;
      }
      uni.navigateTo({
        url: "/pages/product/report/orderList",
      });
    },
    // 存订单号
    setNo(val) {
      this.form.moOn = val.moNo;
    },
    setFeedInputProductionVolume(val) {
      console.log("val", val);
      this.FeedInputProductionVolumeList = val;
      const values = this.FeedInputProductionVolumeList.map(
        (item) => item.ifsBatchNo
      );
      console.log("values", values);
 
      this.form.FeedInputProductionVolume = values.join(";");
    },
    // 回显扫码的信息-报工单
    saveForm(val) {
      this.form = {
        id: val.id,
        workstationId: val.workstationId,
        work: val.work,
        taskNo: val.taskNo,
        name: val.name,
        moOn: val.moOn,
        partNo: val.partNo,
        partName: val.partName,
        // qtyRequired: val.qtyRequired,
        // Jianqtyfinished: val.qtyRequired - val.qtyFinished,
        proposedLocation: val.proposedLocation,
        productType: "dep",
        receive: "mo",
        materialCost: val.materialCost,
        // autoReport: false,
        simplifyMaterials: "false",
        status: "false",
        Persons: "",
      };
      if (this.form.materialCost == "倒冲") {
        this.simplifyDisabled = true;
      }
      // 如果有dutyNo,获取人员列表
      if (val.dutyId) {
        this.dutyId = val.dutyId;
        this.getPersonList(val.dutyId);
      }
    },
  },
};
</script>
 
<style lang="scss">
@import "index.scss";
</style>