src/views/qualityManagement/processInspection/components/formDia.vue
@@ -262,9 +262,27 @@
// 监听不良数量变化,自动更新数量
// 当 defectiveQuantity 增加时,quantity 减少;当 defectiveQuantity 减少时,quantity 增加
watch(() => form.value.defectiveQuantity, (newVal, oldVal) => {
  if (newVal > form.value.quantity) {
    form.value.defectiveQuantity = form.value.quantity;
  }
  form.value.qualifiedQuantity = Number((form.value.quantity - newVal).toFixed(2));
});
// 监听总数量变化,自动更新合格数量
watch(() => form.value.quantity, (newVal, oldVal) => {
  const totalQty = Number(newVal) || 0;
  const defectiveQty = Number(form.value.defectiveQuantity) || 0;
  // 确保不良数量不超过总数量
  if (defectiveQty > totalQty) {
    form.value.defectiveQuantity = totalQty;
  }
  console.log(totalQty);
  // 计算合格数量
  form.value.qualifiedQuantity = Number((totalQty - defectiveQty).toFixed(2));
});
// 打开弹框
const openDialog = async (type, row) => {
   operationType.value = type;