This commit is contained in:
2025-08-22 19:53:19 +08:00
28 changed files with 1802 additions and 1533 deletions

View File

@ -485,15 +485,13 @@ 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;
// 计算缺件数量(数量 - 验收数量)
if (form.value.itemList[index]) {
form.value.itemList[index].shortageQuantity = qty - acceptedQty;
}
form.value.itemList[index].shortageQuantity = qty - acceptedQty;
},
{ immediate: true }
);