diff --git a/src/components/04_product-service/WorkManagementComponent.vue b/src/components/04_product-service/WorkManagementComponent.vue index c76cd1cb..6a4544c7 100644 --- a/src/components/04_product-service/WorkManagementComponent.vue +++ b/src/components/04_product-service/WorkManagementComponent.vue @@ -6,7 +6,7 @@ import useProductServiceStore from 'stores/product-service'; import useOptionStore from 'stores/options'; import { Attributes, ProductList } from 'stores/product-service/types'; import { storeToRefs } from 'pinia'; -import { ref } from 'vue'; +import { ref, watch } from 'vue'; const baseUrl = ref(import.meta.env.VITE_API_BASE_URL); const productServiceStore = useProductServiceStore(); @@ -58,6 +58,19 @@ defineEmits<{ (e: 'manageWorkName'): void; (e: 'workProperties'): void; }>(); + +watch( + () => workNameItems.value, + (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); + + if (list[index] !== oldList[index]) { + workName.value = list[index]; + } + }, +);