From 98c10c2fa15a83ecb75666e59abcbe47514755e9 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Fri, 11 Oct 2024 11:11:16 +0700 Subject: [PATCH] feat: remember selected worker for product --- src/components/05_quotation/ProductItem.vue | 26 ++++++------------ src/pages/05_quotation/QuotationForm.vue | 30 ++++++++++++++------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/components/05_quotation/ProductItem.vue b/src/components/05_quotation/ProductItem.vue index a4194fb4..09cc18e9 100644 --- a/src/components/05_quotation/ProductItem.vue +++ b/src/components/05_quotation/ProductItem.vue @@ -40,13 +40,6 @@ const rows = defineModel< Required[] >('rows', { required: true }); -const groupList = ref< - { - title: string; - product: QuotationPayload['productServiceList'][number][]; - }[] ->([{ title: '', product: [] }]); - const finalDiscount = defineModel('finalDiscount', { default: 0 }); const summaryPrice = defineModel<{ @@ -181,7 +174,7 @@ function openEmployeeTable(title: string, index: number) { !currentBtnOpen.value[0].opened[index]; } -function groupByServiceId() { +function groupByServiceId(data: typeof rows.value) { const groupedItems: { title: string; product: QuotationPayload['productServiceList'][number][]; @@ -191,7 +184,7 @@ function groupByServiceId() { let currentServiceName: string | null = null; let serviceFlag: boolean = false; - rows.value.forEach((item) => { + data.forEach((item) => { if (item.service) { if (noServiceGroup.length > 0) { // console.log('push p changmode'); @@ -244,7 +237,7 @@ function groupByServiceId() { }); } - groupList.value = groupedItems; + return groupedItems; } function handleCheck( @@ -259,13 +252,6 @@ function handleCheck( } } -watch( - () => rows.value, - () => { - if (rows.value.length > 0) groupByServiceId(); - }, -); - watch( () => summary.value, () => { @@ -289,7 +275,11 @@ watch(