修改产值
This commit is contained in:
@ -485,13 +485,15 @@ const addItem = () => {
|
||||
// 监听条目数据变化,自动计算缺件数量
|
||||
const watchItemChanges = (index: number) => {
|
||||
watch(
|
||||
() => [form.value.itemList[index].quantity, form.value.itemList[index].acceptedQuantity],
|
||||
() => [form.value.itemList[index]?.quantity, form.value.itemList[index]?.acceptedQuantity],
|
||||
([quantity, acceptedQuantity]) => {
|
||||
// 确保数量和验收数量都是数字
|
||||
const qty = Number(quantity) || 0;
|
||||
const acceptedQty = Number(acceptedQuantity) || 0;
|
||||
// 计算缺件数量(数量 - 验收数量)
|
||||
form.value.itemList[index].shortageQuantity = qty - acceptedQty;
|
||||
if (form.value.itemList[index]) {
|
||||
form.value.itemList[index].shortageQuantity = qty - acceptedQty;
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
Reference in New Issue
Block a user