spring
2026-05-20 7465eb431e134576b4c9c43103c9fc6f918d1696
src/views/productionManagement/workOrder/components/CopperPrintingForm.vue
@@ -1,5 +1,5 @@
<script setup lang="ts">
import {computed, onMounted, reactive, ref} from "vue";
import {computed, onMounted, reactive, ref, watch} from "vue";
import dayjs from "dayjs";
import {userListNoPageByTenantId} from "@/api/system/user.js";
import {getDeviceLedger} from "@/api/equipmentManagement/ledger.js";
@@ -22,7 +22,12 @@
  row: {
    type: Object,
    default: () => ({}),
  }
  },
  /** 工单 BOM 投入重量,回显到「投入重量」 */
  bomInputQty: {
    type: Number,
    default: null,
  },
});
const emits = defineEmits(["update:isShow", "refreshData"]);
@@ -83,6 +88,7 @@
    copperFiringTime: undefined, // 烧铜进炉时间
    steelFiringTime: undefined, // 烧钢出炉时间
    weight: undefined, // 重量(kg/pos)
    inputWeight: undefined, // 投入重量(KG)
    copperSmeltingTemperatureProfile: undefined, // 烧铜温度曲线
    remark: undefined, // 备注
  }
@@ -183,11 +189,30 @@
  });
};
const resolveBomInputQty = () => {
  const bom = props.bomInputQty ?? props.row?.bomInputQty;
  if (bom === null || bom === undefined || bom === "") {
    return null;
  }
  const n = Number(bom);
  return Number.isFinite(n) ? n : null;
};
const applyBomInputWeight = () => {
  const n = resolveBomInputQty();
  if (n !== null) {
    formData.otherData.inputWeight = n;
  }
};
const initData = () => {
  if (!props.isEdit) {
    formData.otherData = JSON.parse(props.row.otherData || '{}');
    formData.quantity = props.row.quantity;
    formData.scrapQty = props.row.scrapQty;
    if (formData.otherData.inputWeight === undefined || formData.otherData.inputWeight === null || formData.otherData.inputWeight === "") {
      applyBomInputWeight();
    }
  } else {
    const row = props.row;
    formData.planQuantity = row.planQuantity
@@ -195,8 +220,32 @@
    formData.workOrderId = row.id
    formData.reportWork = row.reportWork
    formData.productMainId = row.productMainId
    applyBomInputWeight();
  }
}
watch(
  () => props.isShow,
  (show) => {
    if (show) {
      initData();
    }
  }
);
watch(
  () => [props.bomInputQty, props.row?.bomInputQty],
  () => {
    if (!props.isShow) return;
    if (props.isEdit) {
      applyBomInputWeight();
      return;
    }
    if (formData.otherData.inputWeight === undefined || formData.otherData.inputWeight === null || formData.otherData.inputWeight === "") {
      applyBomInputWeight();
    }
  }
);
const displayValue = (value: any) => {
  return value === undefined || value === null || value === "" ? "-" : value;
@@ -446,6 +495,19 @@
            <span v-else class="view-value">{{ displayValue(formData.otherData.steelFiringTime) }}</span>
          </td>
        </tr>
        <tr class="report-row report-row--double">
          <td class="label" colspan="2">投入重量(KG)</td>
          <td colspan="19" class="cell-field">
            <el-input-number
                v-if="props.isEdit"
                v-model="formData.otherData.inputWeight"
                :controls="false"
                style="width: 100%"
                placeholder="请输入"
            />
            <span v-else class="view-value">{{ displayValue(formData.otherData.inputWeight) }}</span>
          </td>
        </tr>
        <tr class="report-row report-row--triple">
          <td class="label" colspan="2">烧铜产出</td>
          <td colspan="5" class="cell-field">