liding
10 小时以前 9c6cea8bae9779a3289161a56b40641f3ef2074d
fix:报工报废数量不再关联生产数量
已修改1个文件
13 ■■■■■ 文件已修改
src/views/productionManagement/workOrder/index.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/workOrder/index.vue
@@ -545,7 +545,6 @@
  const handleQuantityInput = value => {
    if (value === "" || value === null || value === undefined) {
      reportForm.quantity = null;
      reportForm.scrapQty = null;
      return;
    }
    const num = Number(value);
@@ -554,29 +553,17 @@
    }
    if (num < 1) {
      reportForm.quantity = null;
      reportForm.scrapQty = null;
      return;
    }
    if (!Number.isInteger(num)) {
      const intValue = Math.floor(num);
      if (intValue < 1) {
        reportForm.quantity = null;
        reportForm.scrapQty = null;
        return;
      }
      reportForm.quantity = intValue;
    } else {
      reportForm.quantity = num;
    }
    // 如果 totalInvestment 有值,自动计算 scrapQty = totalInvestment - quantity
    if (reportForm.totalInvestment !== null && reportForm.totalInvestment !== undefined && reportForm.totalInvestment !== "") {
      const total = Number(reportForm.totalInvestment);
      const qty = Number(reportForm.quantity);
      if (total > qty) {
        reportForm.scrapQty = total - qty;
      } else {
        reportForm.scrapQty = null;
      }
    }
  };