修改产值

This commit is contained in:
Teo
2025-08-22 15:11:31 +08:00
parent 65f4191211
commit d93b0d71a9
8 changed files with 422 additions and 357 deletions

View File

@ -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 }
);