pages/product/report/index.vue
@@ -23,40 +23,48 @@
         <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-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-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-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> -->
         <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-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> -->
         <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>
@@ -210,8 +218,10 @@
               moOn: "",
               partNo: "",
               partName: "",
               qtyRequired: "",
               Jianqtyfinished: "",
               // qtyRequired: "",
               // Jianqtyfinished: "",
               FeedInputProductionVolume: null, //投料产量
               reportProductionVolume: null, //汇报产量
               proposedLocation: "",
               productType: "dep",
               receive: "mo",
@@ -222,7 +232,10 @@
               Persons: '',
               productStaffIds: [],
               productStaffs: []
            },
            reportProductionVolumelist: {},
            FeedInputProductionVolumeList: {}, //投料产量
            personList: [],
            canSelectPerson: false,
            rules: {
@@ -266,6 +279,17 @@
                  message: "请选择人员",
                  trigger: ["change"],
               }, ],
               reportProductionVolume: [{
                  required: true,
                  message: "请输入汇报产量",
                  trigger: ["change"],
               }, ],
               // FeedInputProductionVolume: [{
               //    required: true,
               //    message: "请输入投料产量",
               //    trigger: ["change"],
               // }, ],
            },
            showSave: false,
            operationTaskId: "",
@@ -286,15 +310,30 @@
                  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
                  .operationTask({
                     id: this.form.id,
                  })
                  .submitPDA(this.form)
                  .then((res) => {
                     res.data.name = this.form.name;
                     this.$refs.saveForm.open(res);
                     uni.hideLoading();
                     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 {
               // 可以获取具体的错误信息
@@ -322,10 +361,10 @@
                  // 扫描报工单二维码
                  that.CopperReportingWork(codeInfo);
               }
               if (codeInfo.BN) {
                  // 扫描报工单二维码
                  that.$refs.saveForm.saveForm(codeInfo);
               }
               // if (codeInfo.BN) {
               //    // 扫描报工单二维码
               //    that.$refs.saveForm.saveForm(codeInfo);
               // }
            }
         });
      },
@@ -341,6 +380,47 @@
         }
      },
      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,
            });
         },
         // 汇报产量
         reportProductionVolumeCLick() {
            if (this.form.taskNo === "") {
               uni.showToast({
                  title: "请先扫码",
                  icon: "none",
               });
               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() {
            // 切换报工方式时清空人员名称
@@ -460,7 +540,7 @@
         },
         confirmModle() {
            console.log("点击确认后获取取消报工记录");
            console.log("点击确认后获取取消报工记录",this.detailedList);
            // 处理确认逻辑
            this.$u.api.cancelReporting
               .cancelDTAOfWorkApplication({
@@ -469,7 +549,7 @@
               })
               .then((res) => {
                  console.log("res", res);
                  this.detailedList.splice(this.index, 1)
                  this.InventoryReceiptList.splice(this.index, 1)
                  this.showModal = false;
                  // this.getHandelList();
                  this.$u.toast("取消报工成功");
@@ -516,9 +596,11 @@
         // }
         // },
         handleUpdate(val) {
            this.subdisabled = true;
            this.reportProductionVolumelist = val
            this.form.reportProductionVolume = val.outBatchNo;
            // this.subdisabled = true;
            // this.getHandelList();
            this.InventoryReceiptList.unshift(val);
            // this.InventoryReceiptList.unshift(val);
         },
         // 打开弹框--后面还需要监听扫码枪扫码结果,赋值给报工单号字段,然后打开弹框选择订单号等操作
         open() {
@@ -543,6 +625,14 @@
         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 = {
@@ -554,8 +644,8 @@
               moOn: val.moOn,
               partNo: val.partNo,
               partName: val.partName,
               qtyRequired: val.qtyRequired,
               Jianqtyfinished: val.qtyRequired - val.qtyFinished,
               // qtyRequired: val.qtyRequired,
               // Jianqtyfinished: val.qtyRequired - val.qtyFinished,
               proposedLocation: val.proposedLocation,
               productType: "dep",
               receive: "mo",