gaoluyang
5 天以前 c899675f6cd2303dc802ee7d04d4bf5dc903ac02
src/pages/productionManagement/productionReport/index.vue
@@ -24,11 +24,12 @@
          <u-input v-model="form.quantity"
                   placeholder="请输入"
                   type="number" />
          <!-- <u-number-box v-model="form.quantity"
                        step="0.1"
                        bgColor="#fff"
                        decimal-length="1"
                        :min="0"></u-number-box> -->
        </u-form-item>
        <u-form-item label="报废数量"
                     prop="scrapQty">
          <u-input v-model="form.scrapQty"
                   placeholder="请输入"
                   type="number" />
        </u-form-item>
        <u-form-item label="班组信息"
                     prop="schedulingUserId"
@@ -78,6 +79,7 @@
  let form = ref({
    planQuantity: "",
    quantity: "",
    scrapQty: "",
    userName: "",
    workOrderId: "",
    productProcessRouteItemId: "",
@@ -140,8 +142,15 @@
      return;
    }
    // 转换为数字进行比较
    const quantity = Number(form.value.quantity);
    const quantity = Number(form.value.quantity) || 0;
    const scrapQty = Number(form.value.scrapQty) || 0;
    const planQuantity = Number(form.value.planQuantity);
    // 验证生产数量和报废数量的和不能超过待生产数量
    if (quantity + scrapQty > planQuantity) {
      submitting.value = false;
      showToast("生产数量和报废数量的和不能超过待生产数量");
      return;
    }
    if (quantity > planQuantity) {
      submitting.value = false;
      showToast("本次生产数量不能大于待生产数量");
@@ -151,6 +160,7 @@
    const submitData = {
      ...form.value,
      quantity: Number(form.value.quantity),
      scrapQty: Number(form.value.scrapQty) || 0,
      planQuantity: Number(form.value.planQuantity) || 0,
    };
    console.log(submitData, "submitData");
@@ -172,6 +182,17 @@
  // 页面加载时初始化数据
  onLoad(options => {
    console.log(options, "options");
    // 如果没有 orderRow 参数,说明是从首页直接跳转,需要用户手动选择订单
    if (!options.orderRow) {
      console.log("从首页跳转,无订单数据");
      getInfo().then(res => {
        // 默认使用当前登录用户
        form.value.userId = res.user.userId;
        form.value.userName = res.user.userName;
        form.value.schedulingUserId = res.user.userId;
      });
      return;
    }
    try {
      const orderRow = JSON.parse(options.orderRow);
      console.log("构造的orderRow:", orderRow);