From de281ea79fcf2bec7fa151a2b3e7095b82a19df3 Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 22 May 2025 16:35:58 +0700 Subject: [PATCH] fix: improve work name management and validation logic --- .../WorkManagementComponent.vue | 11 +++---- .../04_product-service/WorkNameManagement.vue | 8 ++--- src/pages/04_product-service/MainPage.vue | 29 ++++++++++++------- src/stores/product-service/index.ts | 2 +- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/components/04_product-service/WorkManagementComponent.vue b/src/components/04_product-service/WorkManagementComponent.vue index e79872d9..86e79951 100644 --- a/src/components/04_product-service/WorkManagementComponent.vue +++ b/src/components/04_product-service/WorkManagementComponent.vue @@ -98,7 +98,8 @@ watch( (c, o) => { const list = c.map((v: { name: string }) => v.name); const oldList = o.map((v: { name: string }) => v.name); - const index = oldList.indexOf(workName.value || ''); + const index = workName.value ? oldList.indexOf(workName.value) : -1; + if (index === -1) return; if ( list[index] !== oldList[index] && @@ -704,8 +705,8 @@ watch( } :deep( - .q-item__section.column.q-item__section--side.justify-center.q-item__section--avatar.q-focusable.relative-position.cursor-pointer - ) { + .q-item__section.column.q-item__section--side.justify-center.q-item__section--avatar.q-focusable.relative-position.cursor-pointer +) { justify-content: start !important; padding-right: 8px !important; padding-top: 16px; @@ -735,8 +736,8 @@ watch( } :deep( - i.q-icon.mdi.mdi-chevron-down-circle.q-expansion-item__toggle-icon.q-expansion-item__toggle-icon--rotated - ) { + i.q-icon.mdi.mdi-chevron-down-circle.q-expansion-item__toggle-icon.q-expansion-item__toggle-icon--rotated +) { color: var(--brand-1); } diff --git a/src/components/04_product-service/WorkNameManagement.vue b/src/components/04_product-service/WorkNameManagement.vue index 2bde41ce..81854b9e 100644 --- a/src/components/04_product-service/WorkNameManagement.vue +++ b/src/components/04_product-service/WorkNameManagement.vue @@ -1,7 +1,6 @@