fix: โค้คหาย
This commit is contained in:
parent
14eb498133
commit
45d912e20a
1 changed files with 27 additions and 2 deletions
|
|
@ -636,11 +636,14 @@ const prevService = ref<ServiceCreate>({
|
|||
productTypeId: '',
|
||||
});
|
||||
|
||||
const currentService = ref<ServiceById>();
|
||||
|
||||
async function assignFormDataProductService(id: string) {
|
||||
const res = await fetchListServiceById(id);
|
||||
|
||||
if (res) {
|
||||
statusToggle.value = res.status === 'INACTIVE' ? false : true;
|
||||
currentService.value = JSON.parse(JSON.stringify(res));
|
||||
|
||||
prevService.value = {
|
||||
code: res.code,
|
||||
|
|
@ -674,7 +677,7 @@ async function assignFormDataProductService(id: string) {
|
|||
product: item.productOnWork.map((productOnWorkItem) => {
|
||||
return {
|
||||
...productOnWorkItem.product,
|
||||
nameEn: '',
|
||||
nameEn: productOnWorkItem.product.name,
|
||||
};
|
||||
}),
|
||||
};
|
||||
|
|
@ -945,6 +948,28 @@ async function fetchSearch() {
|
|||
}
|
||||
}
|
||||
|
||||
function cloneData() {
|
||||
if (!currentService.value) return;
|
||||
formDataProductService.value = {
|
||||
...prevService.value,
|
||||
attributes: JSON.parse(JSON.stringify(currentService.value.attributes)),
|
||||
};
|
||||
|
||||
workItems.value = currentService.value.work.map((item) => {
|
||||
return {
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
attributes: JSON.parse(JSON.stringify(item.attributes)),
|
||||
product: item.productOnWork.map((productOnWorkItem) => {
|
||||
return {
|
||||
...productOnWorkItem.product,
|
||||
nameEn: productOnWorkItem.product.name,
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
calculateStats();
|
||||
await fetchListGroups();
|
||||
|
|
@ -2160,7 +2185,7 @@ watch(currentPageService, async () => {
|
|||
:undo="
|
||||
() => {
|
||||
infoServiceEdit = false;
|
||||
formDataProductService = { ...prevService };
|
||||
cloneData();
|
||||
statusToggle = prevService.status === 'INACTIVE' ? false : true;
|
||||
flowStore.rotate();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue