fix: product node not updated

This commit is contained in:
Thanaphon Frappet 2025-02-25 11:48:22 +07:00
parent 33a3a929e1
commit bead74e0b7
2 changed files with 25 additions and 11 deletions

View file

@ -673,6 +673,7 @@ async function triggerSelectEmployeeDialog() {
} }
function triggerProductServiceDialog() { function triggerProductServiceDialog() {
covertToNode();
pageState.productServiceModal = true; pageState.productServiceModal = true;
} }
@ -1067,11 +1068,7 @@ const productServiceNodes = ref<ProductTree>([]);
watch( watch(
() => productServiceList.value, () => productServiceList.value,
() => { () => {
productServiceNodes.value = quotationProductTree( covertToNode();
productServiceList.value,
agentPrice.value,
config.value?.vat,
);
}, },
); );
@ -1302,6 +1299,14 @@ async function formDownload() {
a.click(); a.click();
a.remove(); a.remove();
} }
function covertToNode() {
productServiceNodes.value = quotationProductTree(
productServiceList.value,
agentPrice.value,
config.value?.vat,
);
}
</script> </script>
<template> <template>

View file

@ -255,14 +255,18 @@ const QUOTATION_STATUS = [
'ProcessComplete', 'ProcessComplete',
]; ];
function covertToNode() {
productServiceNodes.value = quotationProductTree(
productServiceList.value,
agentPrice.value,
config.value?.vat,
);
}
watch( watch(
() => productServiceList.value, () => productServiceList.value,
() => { () => {
productServiceNodes.value = quotationProductTree( covertToNode();
productServiceList.value,
agentPrice.value,
config.value?.vat,
);
}, },
); );
@ -1102,7 +1106,12 @@ async function submitAccepted() {
:agent-price="agentPrice" :agent-price="agentPrice"
:employee-rows="selectedWorkerItem" :employee-rows="selectedWorkerItem"
:rows="productService" :rows="productService"
@add-product="() => (pageState.productServiceModal = true)" @add-product="
() => {
pageState.productServiceModal = true;
covertToNode();
}
"
@update-rows=" @update-rows="
(v) => { (v) => {
view === null && (productServiceList = v); view === null && (productServiceList = v);