pages/product/report/index.vue
@@ -1,13 +1,7 @@
<template>
  <!-- 报工 -->
  <div class="page">
    <u-form
      :model="form"
      ref="uForm"
      :label-width="200"
      :rules="rules"
      :error-type="['toast']"
    >
      <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>
@@ -15,27 +9,13 @@
        </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-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-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-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 />
@@ -46,12 +26,7 @@
      <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-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="proposedLocation" style="font-size:small">
@@ -76,7 +51,8 @@
        </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-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>
@@ -88,24 +64,16 @@
        </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-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)"
          >
            <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>
@@ -141,30 +109,13 @@
    </view>
    <!-- 填写报工单 -->
    <modalBg ref="modalBg" :confirm="confirm">
      <u-field
        v-model="form.taskNo"
        label="报工单号"
        placeholder="请输入"
        :border-bottom="false"
        style="font-size:small"
      >
         <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"
    >
      <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">
@@ -207,7 +158,8 @@
    <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;">
            <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">
@@ -274,62 +226,46 @@
      personList: [],
      canSelectPerson: false,
      rules: {
        work: [
          {
               work: [{
            required: true,
            message: "请选择车间",
            trigger: ["change"],
          },
        ],
        taskNo: [
          {
               }, ],
               taskNo: [{
            required: true,
            message: "请选择报工单号",
            trigger: ["change", "blur"],
          },
        ],
        name: [
          {
               }, ],
               name: [{
            required: true,
            message: "请选择工序",
            trigger: ["change", "blur"],
          },
        ],
        moOn: [
          {
               }, ],
               moOn: [{
            required: true,
            message: "请选择订单号",
            trigger: ["change", "blur"],
          },
        ],
        productType: [
          {
               }, ],
               productType: [{
            required: true,
            message: "请选择报工类型",
            trigger: ["change"],
          },
        ],
        receive: [
          {
               }, ],
               receive: [{
            required: true,
            message: "请选择接收零件类型",
            trigger: ["change"],
          },
        ],
        status: [
          {
               }, ],
               status: [{
            required: true,
            message: "请选择报工方式",
            trigger: ["change"],
          },
        ],
        Persons: [
          {
               }, ],
               Persons: [{
            required: true,
            message: "请选择人员",
            trigger: ["change"],
          },
        ],
               }, ],
      },
      showSave: false,
      operationTaskId: "",
@@ -339,6 +275,7 @@
      showModal: false,
      personShowModal: false,
         checkboxList: [],
            index: 0,
    };
  },
  // 点击提交按钮的事件处理函数
@@ -379,11 +316,15 @@
           that.codeInfoId = codeInfo.id;
          // 扫描报工单二维码
          that.saveForm(codeInfo);
          that.getHandelList();
                  // that.getHandelList();
               }
               if (codeInfo.ES) {
                  // 扫描报工单二维码
                  that.CopperReportingWork(codeInfo);
        }
        if (codeInfo.BN) {
          // 扫描报工单二维码
          that.CopperReportingWork(codeInfo);
                  that.$refs.saveForm.saveForm(codeInfo);
        }
      }
    });
@@ -459,6 +400,8 @@
      cancelSelection(){},
    // 铜杆报工
    CopperReportingWork(val) {
            this.$refs.uForm.validate((valid) => {
               if (valid) {
      const copperList = {};
      copperList.outBatchNo = val.BN
      copperList.partNo = val.PN
@@ -474,12 +417,19 @@
      copperList.productStaffs = this.form.productStaffs;
      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;
        this.getHandelList();
                     this.InventoryReceiptList.unshift(this.form);
                     // this.getHandelList();
        this.$u.toast("报工成功");
                  });
               } else {
                  // 可以获取具体的错误信息
                  const errors = this.$refs.uForm.getError();
               }
      });
    },
    // 点击确认后获取取消报工记录
@@ -488,9 +438,12 @@
    },
    // 获取人员列表
    getPersonList(dutyId) {
      console.log('111111')
            console.log('111111', dutyId)
      try {
        this.$u.api.workReporting.getPersonByDutyRecordId({ id: dutyId }).then((res) => {
               this.$u.api.workReporting.getPersonByDutyRecordId({
                     id: dutyId
                  }).then((res) => {
        this.selectedPersons = res.data.map(item => ({
          ...item,
          checked: this.form.status === 'false'
@@ -516,8 +469,9 @@
        })
        .then((res) => {
          console.log("res", res);
                  this.detailedList.splice(this.index, 1)
          this.showModal = false;
          this.getHandelList();
                  // this.getHandelList();
          this.$u.toast("取消报工成功");
        });
    },
@@ -525,8 +479,9 @@
      this.showModal = false; // 关闭弹窗
    },
    // 取消报工
    cancelReport(item) {
         cancelReport(item,index) {
      let that = this;
            that.index = index;
      uni.showModal({
        title: "提示",
        content: "是否确认取消批次" + item.outBatchNo + "的报工",
@@ -540,17 +495,17 @@
        },
      });
    },
    getHandelList() {
      this.$u.api.workReporting
        .getProductMainV1({
          current: 1,
          size: -1,
          id: this.codeInfoId,
        })
        .then((res) => {
          this.InventoryReceiptList = res.data.productOutputList;
        });
    },
         // 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 === "工序的自动报告") {
@@ -560,9 +515,10 @@
      //   this.form.simplifyMaterials = val.value;
      // }
    // },
    handleUpdate() {
         handleUpdate(val) {
      this.subdisabled = true;
      this.getHandelList();
            // this.getHandelList();
            this.InventoryReceiptList.unshift(val);
    },
    // 打开弹框--后面还需要监听扫码枪扫码结果,赋值给报工单号字段,然后打开弹框选择订单号等操作
    open() {