廖井涛
2025-03-24 ae9de858b0a514b6a129fa9fd985ce75079a68a0
north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue
@@ -314,6 +314,7 @@
      path: '/main/processCard/AddProcessCard',
      query: {orderId: orderId,
        productionId: productionId,
        quantity: orderQuantity,
        random:Math.random()
      }
    })
@@ -897,10 +898,9 @@
            }
            // 计算 $table 里 quantity 字段的总和
            let totalQuantity = selectRecords.reduce((sum, record) => sum + (record.quantity || 0), 0);
            let totalQuantity = selectRecords.reduce((sum, record) => sum + (Number(record.quantity) || 0), 0);
            // 对比全局变量 orderQuantity
            if (totalQuantity !== orderQuantity) {
            if (totalQuantity !== orderQuantity*1) {
              ElMessage.warning(`所选数据的数量总和 (${totalQuantity}) 与订单数量 (${orderQuantity}) 不匹配,请检查后重试!`);
              gridLeftOptions.toolbarConfig.buttons[0].disabled = false;
              return;
@@ -948,19 +948,22 @@
let quantit = ref('')
let weight = ref('')
const handleCheckboxChange = ({row}) => {
  const $grid = xGrid.value
  //获取右边表格checkbox选中的数据
  const checkedList = $grid.getCheckboxRecords()
const handleCheckboxChange = ({ row }) => {
  const $grid = xGrid.value;
  // 获取右边表格 checkbox 选中的数据
  const checkedList = $grid.getCheckboxRecords();
  let quantitySum = 0;
  let weightsum = 0;
  checkedList.forEach(item => {
    quantitySum += item.baiscQuantity;
    quantitySum += Number(item.baiscQuantity) || 0; // 确保转换为数字
    weightsum += weightSum(item);
  });
  quantit.value = quantitySum;
  quantit.value = Number(quantitySum) || 0; // 确保最终值是数字
  weight.value = parseFloat(weightsum.toFixed(2));
}
};
</script>
<template>
@@ -1018,8 +1021,8 @@
        <div height="100%" style="margin: 5px" width="11%">
          <el-main style="">
            <div>
              <span><el-input v-model="quantit" style="width: 80px;"/></span>
              <span><el-input v-model="weight" style="width: 80px;"/></span>
              <span><el-input :readonly="true" v-model="quantit" style="width: 80px;"/></span>
              <span><el-input :readonly="true" v-model="weight" style="width: 80px;"/></span>
            </div>
            <span>{{ $t('processCard.selectedQuantity') }}:<el-input id="checkedNum" v-model="checkedNum" clearable
                                                                     type="number"></el-input></span><br>
@@ -1051,6 +1054,7 @@
                v-bind="gridOptions"
                v-on="gridEventsRight"
                @checkbox-change="handleCheckboxChange"
                @checkbox-all="handleCheckboxChange"
            >
              <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
              <!--      下拉显示所有信息插槽-->