feat: สร้าง service
This commit is contained in:
parent
6eea4aea2b
commit
37f1289b76
1 changed files with 27 additions and 0 deletions
|
|
@ -489,10 +489,23 @@ function clearFormService() {
|
|||
},
|
||||
work: [],
|
||||
};
|
||||
|
||||
selectProduct.value = [];
|
||||
dialogService.value = false;
|
||||
}
|
||||
|
||||
function assignFormDataProductServiceCreate() {
|
||||
workItems.value.forEach((item) => {
|
||||
formDataProductService.value.work.push({
|
||||
name: item.name,
|
||||
attributes: item.attributes,
|
||||
productId: item.product.map((productItem) => productItem.id),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function submitService() {
|
||||
assignFormDataProductServiceCreate();
|
||||
const res = await createService(formDataProductService.value);
|
||||
if (res) {
|
||||
await fetchListOfService();
|
||||
|
|
@ -1406,6 +1419,16 @@ watch(currentStatus, async () => {
|
|||
v-model:modal="dialogService"
|
||||
v-model:tabs-list="serviceTab"
|
||||
v-model:current-tab="currentServiceTab"
|
||||
:submit="
|
||||
() => {
|
||||
submitService();
|
||||
}
|
||||
"
|
||||
:close="
|
||||
() => {
|
||||
dialogService = false;
|
||||
}
|
||||
"
|
||||
>
|
||||
<template #prepend>
|
||||
<ProfileUpload
|
||||
|
|
@ -1428,6 +1451,10 @@ watch(currentStatus, async () => {
|
|||
openPropertiesDialog('service');
|
||||
}
|
||||
"
|
||||
v-model:service-code="formDataProductService.code"
|
||||
v-model:service-description="formDataProductService.detail"
|
||||
v-model:service-name-th="formDataProductService.name"
|
||||
@input-file="inputFile.click()"
|
||||
/>
|
||||
<FormServiceWork
|
||||
v-model:work-items="workItems"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue