fix: work name management
This commit is contained in:
parent
48bf222f4e
commit
831df21930
2 changed files with 21 additions and 1 deletions
|
|
@ -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<string>(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];
|
||||
}
|
||||
},
|
||||
);
|
||||
</script>
|
||||
<template>
|
||||
<div class="bordered rounded">
|
||||
|
|
|
|||
|
|
@ -1172,6 +1172,13 @@ function triggerConfirmCloseWork() {
|
|||
dialogWarningClose(t, {
|
||||
action: () => {
|
||||
manageWorkNameDialog.value = false;
|
||||
if(workNameItems.value[workNameItems.value.length - 1].name ===''){
|
||||
|
||||
confirmDeleteWork(
|
||||
workNameItems.value[workNameItems.value.length - 1].id,
|
||||
true,
|
||||
);
|
||||
}
|
||||
},
|
||||
cancel: () => {},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue