yuan
5 天以前 cbaf7cc08c1472e3afc1c168b023290ce8194d5a
fix: 移除生产报工小数取整,可以输入小数
已修改1个文件
30 ■■■■ 文件已修改
src/views/productionManagement/workOrderManagement/index.vue 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/workOrderManagement/index.vue
@@ -133,7 +133,7 @@
          <el-input v-model.number="reportForm.quantity"
                    type="number"
                    min="0"
                    step="1"
                    step="0.1"
                    style="width: 300px"
                    placeholder="请输入生产合格数量"
                    @input="handleQuantityInput" />
@@ -143,7 +143,7 @@
          <el-input v-model.number="reportForm.scrapQty"
                    type="number"
                    min="0"
                    step="1"
                    step="0.1"
                    style="width: 300px"
                    placeholder="请输入报废数量"
                    @input="handleScrapQtyInput" />
@@ -445,8 +445,7 @@
      return;
    }
    const num = Number(value);
    // 整数且大于等于1
    if (isNaN(num) || !Number.isInteger(num) || num < 0) {
    if (isNaN(num) || num < 0) {
      callback(new Error("生产合格数量必须大于等于0"));
      return;
    }
@@ -460,8 +459,7 @@
      return;
    }
    const num = Number(value);
    // 整数且大于等于0
    if (isNaN(num) || !Number.isInteger(num) || num < 0) {
    if (isNaN(num) || num < 0) {
      callback(new Error("报废数量必须大于等于0"));
      return;
    }
@@ -484,22 +482,10 @@
    if (isNaN(num)) {
      return;
    }
    // 如果小于1,清除
    if (num < 0) {
      reportForm.quantity = null;
      return;
    }
    // 如果是小数取整数部分
    /*if (!Number.isInteger(num)) {
      const intValue = Math.floor(num);
      // 如果取整后小于1,清除
      if (intValue < 0) {
        reportForm.quantity = null;
        return;
      }
      reportForm.quantity = intValue;
      return;
    }*/
    reportForm.quantity = num;
  };
@@ -510,21 +496,13 @@
      return;
    }
    const num = Number(value);
    // 如果是NaN,保持原值
    if (isNaN(num)) {
      return;
    }
    // 如果是负数,清除输入
    if (num < 0) {
      reportForm.scrapQty = null;
      return;
    }
    // 如果是小数,取整数部分
    if (!Number.isInteger(num)) {
      reportForm.scrapQty = Math.floor(num);
      return;
    }
    // 有效的非负整数(包括0)
    reportForm.scrapQty = num;
  };