Commit 6ea9755b by 张珈源

fix(ckgl): 修复领料数量字段映射和校验逻辑

- 移除InputNumber组件的默认value值设置
- 启用onChange事件处理函数来更新记录的数量值
- 修改打开弹窗时的数据初始化逻辑,将blsl字段替换为sl字段并默认值设为0
- 更新数量校验逻辑,检查sl字段是否为null或0值
- 修复全零数量校验条件以正确处理空值情况
parent 9581fa71
...@@ -51,19 +51,19 @@ ...@@ -51,19 +51,19 @@
// 常驻输入框 // 常驻输入框
customRender: ({ record }) => customRender: ({ record }) =>
h(InputNumber, { h(InputNumber, {
value: 0, //value: 0,
min: 0, min: 0,
max: 999999, max: 999999,
size: 'small', size: 'small',
style: { width: '100%' }, style: { width: '100%' },
// onChange: (val) => (record.sl = val), onChange: (val) => (record.sl = val),
}), }),
}, },
]; ];
/* 打开弹窗 - 父组件调用 */ /* 打开弹窗 - 父组件调用 */
function open(rows: any[]) { function open(rows: any[]) {
tableData.value = rows.map((r) => ({ ...r, blsl: r.blsl || 0 })); tableData.value = rows.map((r) => ({ ...r,sl: 0}));
openModal(true); openModal(true);
} }
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
if (loading.value) return; if (loading.value) return;
// 简单校验:数量不能全 0 // 简单校验:数量不能全 0
const allZero = tableData.value.every((r) => r.blsl === 0); const allZero = tableData.value.every((r) => r.sl === null || r.sl === 0);
if (allZero) { if (allZero) {
createMessage.warning('请至少输入一行领料数量'); // ✅ 用 createMessage createMessage.warning('请至少输入一行领料数量'); // ✅ 用 createMessage
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment