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(