yyb
2025-10-16 c7d2ef6c5306da7e8af002cbfc61fcadbf89c9c2
铜杆报工时对汇报产量字段不做校验,改变铜杆提交逻辑
已修改1个文件
488 ■■■■ 文件已修改
pages/product/report/index.vue 488 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/product/report/index.vue
@@ -1,26 +1,80 @@
<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-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 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
        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
        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
        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-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-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">
@@ -29,15 +83,38 @@
            <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
        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
        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-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">
@@ -52,10 +129,19 @@
                    <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-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 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">
@@ -65,25 +151,63 @@
                    <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-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
        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-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)">
        <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 class="content-header-title" style="font-size: small">{{
                index + 1
              }}</view>
                        </view>
                        <view class="content-body">
                            <view class="row-list">
@@ -117,13 +241,30 @@
        </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">
@@ -163,14 +304,31 @@
                </view>
            </view>
        </u-modal>
        <u-modal v-model="personShowModal" title="" :show-cancel-button="true" :show-confirm-button="true"
            @confirm="confirmSelection" @cancel="cancelSelection">
    <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">
              <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>
@@ -227,69 +385,85 @@
                    receive: "mo",
                    materialCost: "",
                    // autoReport: false,
                    simplifyMaterials: 'false',
                    status: 'false',
                    Persons: '',
        simplifyMaterials: "false",
        status: "false",
        Persons: "",
                    productStaffIds: [],
                    productStaffs: []
        productStaffs: [],
                },
                reportProductionVolumelist: {},
                FeedInputProductionVolumeList: [], //投料产量
                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"],
                    }, ],
                    reportProductionVolume: [{
          },
        ],
        reportProductionVolume: [
          {
                        required: true,
                        message: "请输入汇报产量",
                        trigger: ["change"],
                    }, ],
          },
        ],
                    // FeedInputProductionVolume: [{
                    //     required: true,
                    //     message: "请输入投料产量",
                    //     trigger: ["change"],
                    // }, ],
                },
                showSave: false,
                operationTaskId: "",
@@ -314,9 +488,13 @@
                    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.productStaffIds =
          this.form.productStaffIds;
                    this.reportProductionVolumelist.productStaffs = this.form.productStaffs;
                    this.reportProductionVolumelist.productInputList = Object.keys(this.FeedInputProductionVolumeList).length === 0 ? null : this.FeedInputProductionVolumeList;
        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); // 向数组中添加元素
@@ -327,14 +505,16 @@
                            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);
            (this.reportProductionVolumelist = {}),
              (this.FeedInputProductionVolumeList = []), //投料产量
              (this.form.FeedInputProductionVolume = null), //投料产量
              (this.form.reportProductionVolume = null), //汇报产量
              console.log(
                "this.InventoryReceiptList",
                this.InventoryReceiptList
              );
                        })
                        .finally(() => {
                        });
          .finally(() => {});
                } else {
                    // 可以获取具体的错误信息
                    const errors = this.$refs.uForm.getError();
@@ -357,7 +537,7 @@
                        that.saveForm(codeInfo);
                        // that.getHandelList();
                    }
                    if (codeInfo.ES) {
        if (codeInfo.WC) {
                        // 扫描报工单二维码
                        that.CopperReportingWork(codeInfo);
                    }
@@ -372,12 +552,12 @@
            "form.taskNo": function(newVal, oldVal) {
                this.subdisabled = false;
            },
            'form.status'(newVal) {
                this.selectedPersons = this.selectedPersons.map(item => ({
    "form.status"(newVal) {
      this.selectedPersons = this.selectedPersons.map((item) => ({
                    ...item,
                    checked: newVal === 'false'
        checked: newVal === "false",
                }));
            }
    },
        },
        methods: {
            // 投料产量
@@ -397,9 +577,11 @@
                    return;
                }
                uni.navigateTo({
                    url: "/pages/product/report/seachPersonnelNo?moOn=" + this.form.moOn + "&workstationId=" + this.form.workstationId,
        url:
          "/pages/product/report/seachPersonnelNo?moOn=" +
          this.form.moOn +
          "&workstationId=" +
          this.form.workstationId,
                });
            },
            // 汇报产量
@@ -410,6 +592,14 @@
                        icon: "none",
                    });
                    return;
      }
      if (this.form.work === "tg") {
        uni.showToast({
          title: "铜杆报工无需填写汇报产量,请扫码",
          icon: "none",
          duration: 2000,
        });
        return
                }
                // 处理提交逻辑
                this.$u.api.workReporting
@@ -425,7 +615,7 @@
            // 处理报工方式变更
            handleReportTypeChange() {
                // 切换报工方式时清空人员名称
                this.form.Persons = '';
      this.form.Persons = "";
                this.form.productStaffs = [];
                this.form.productStaffIds = [];
            },
@@ -435,63 +625,86 @@
            },
            // 复选框变化事件
            checkboxChange(e) {
                console.log('e', e)
      console.log("e", e);
                const values = e.target.value || [];
                if (this.form.status === 'true') {
      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) {
        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.$u.toast("按人员报工时只能选择一位人员");
                        // 保持原选择
                        this.selectedPersons = this.selectedPersons.map(item => ({
          this.selectedPersons = this.selectedPersons.map((item) => ({
                            ...item,
                            checked: item.staffId === previouslySelected.staffId
            checked: item.staffId === previouslySelected.staffId,
                        }));
                    } else {
                        // 首次选择或取消选择
                        this.selectedPersons = this.selectedPersons.map(item => ({
          this.selectedPersons = this.selectedPersons.map((item) => ({
                            ...item,
                            checked: newlySelected ? item.staffId === newlySelected : false
            checked: newlySelected ? item.staffId === newlySelected : false,
                        }));
                    }
                } else {
                    // 多选模式
                    this.selectedPersons = this.selectedPersons.map(item => ({
        this.selectedPersons = this.selectedPersons.map((item) => ({
                        ...item,
                        checked: values.includes(item.staffId)
          checked: values.includes(item.staffId),
                    }));
                }
            },
            // 确认选择
            confirmSelection() {
                const selected = this.selectedPersons.filter(item => item.checked);
      const selected = this.selectedPersons.filter((item) => item.checked);
                // 根据报工方式设置人员名称
                if (this.form.status === 'true' && selected.length > 0) {
      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.Persons = selected.map((item) => item.staffName).join(",");
                }
                this.form.productStaffs = selected.map(item => item.staffNo);
                this.form.productStaffIds = selected.map(item => item.staffId);
      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.grossWeight = val.TR
                        copperList.operationTaskId = this.form.id
          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.grossWeight = val.TR;
          copperList.operationTaskId = this.form.id;
                        copperList.status = this.form.status;
                        copperList.Persons = this.form.Persons;
                        copperList.productStaffIds = this.form.productStaffIds;
@@ -500,7 +713,7 @@
                        this.form.operationTaskId = this.form.id;
                        this.form.dutyRecordId = this.dutyId;
                        this.form.productOutputList.push(copperList);
                        console.log('this.form', this.form)
          console.log("this.form", this.form);
                        this.$u.api.workReporting.submitPDA(this.form).then((res) => {
                            this.subdisabled = true;
                            this.InventoryReceiptList.unshift(this.form);
@@ -519,25 +732,24 @@
            },
            // 获取人员列表
            getPersonList(dutyId) {
                console.log('111111', dutyId)
      console.log("111111", dutyId);
                try {
                    this.$u.api.workReporting.getPersonByDutyRecordId({
                            id: dutyId
                        }).then((res) => {
                            this.selectedPersons = res.data.map(item => ({
        this.$u.api.workReporting
          .getPersonByDutyRecordId({
            id: dutyId,
          })
          .then((res) => {
            this.selectedPersons = res.data.map((item) => ({
                                ...item,
                                checked: this.form.status === 'false'
              checked: this.form.status === "false",
                            }));
                        })
                        .catch(err => {
                            console.log(err)
                        })
          .catch((err) => {
            console.log(err);
          });
                } catch (err) {
                    console.log(err)
        console.log(err);
                }
            },
            confirmModle() {
@@ -546,11 +758,11 @@
                this.$u.api.cancelReporting
                    .cancelDTAOfWorkApplication({
                        outBatchNo: this.detailedList.outBatchNo,
                        outputId: this.detailedList.id
          outputId: this.detailedList.id,
                    })
                    .then((res) => {
                        console.log("res", res);
                        this.InventoryReceiptList.splice(this.index, 1)
          this.InventoryReceiptList.splice(this.index, 1);
                        this.showModal = false;
                        // this.getHandelList();
                        this.$u.toast("取消报工成功");
@@ -597,7 +809,7 @@
            // }
            // },
            handleUpdate(val) {
                this.reportProductionVolumelist = val
      this.reportProductionVolumelist = val;
                this.form.reportProductionVolume = val.outBatchNo;
                // this.subdisabled = true;
                // this.getHandelList();
@@ -627,12 +839,14 @@
                this.form.moOn = val.moNo;
            },
            setFeedInputProductionVolume(val) {
                console.log('val', val)
      console.log("val", val);
                this.FeedInputProductionVolumeList = val;
                const values = this.FeedInputProductionVolumeList.map((item) => item.ifsBatchNo)
                console.log('values', values)
      const values = this.FeedInputProductionVolumeList.map(
        (item) => item.ifsBatchNo
      );
      console.log("values", values);
                  this.form.FeedInputProductionVolume = values.join(';')
      this.form.FeedInputProductionVolume = values.join(";");
            },
            // 回显扫码的信息-报工单
            saveForm(val) {
@@ -652,9 +866,9 @@
                    receive: "mo",
                    materialCost: val.materialCost,
                    // autoReport: false,
                    simplifyMaterials: 'false',
                    status: 'false',
                    Persons: '',
        simplifyMaterials: "false",
        status: "false",
        Persons: "",
                };
                if (this.form.materialCost == "倒冲") {
                    this.simplifyDisabled = true;