feat: เพิ่ม assignFormDataProductService
This commit is contained in:
parent
87f0973186
commit
2f6f9d7f95
1 changed files with 28 additions and 0 deletions
|
|
@ -28,6 +28,8 @@ import {
|
||||||
ProductCreate,
|
ProductCreate,
|
||||||
ProductList,
|
ProductList,
|
||||||
ServiceCreate,
|
ServiceCreate,
|
||||||
|
Service,
|
||||||
|
ServiceById,
|
||||||
} from 'src/stores/product-service/types';
|
} from 'src/stores/product-service/types';
|
||||||
|
|
||||||
const productServiceStore = useProductServiceStore();
|
const productServiceStore = useProductServiceStore();
|
||||||
|
|
@ -47,6 +49,8 @@ const {
|
||||||
|
|
||||||
fetchListProduct,
|
fetchListProduct,
|
||||||
createProduct,
|
createProduct,
|
||||||
|
|
||||||
|
fetchListServiceById,
|
||||||
} = productServiceStore;
|
} = productServiceStore;
|
||||||
|
|
||||||
import ItemCard from 'src/components/ItemCard.vue';
|
import ItemCard from 'src/components/ItemCard.vue';
|
||||||
|
|
@ -308,6 +312,30 @@ function assignFormDataGroup(data: ProductGroup) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function assignFormDataProductService(id: string) {
|
||||||
|
const res = await fetchListServiceById(id);
|
||||||
|
|
||||||
|
if (res) {
|
||||||
|
formDataProductService.value = {
|
||||||
|
code: res.code,
|
||||||
|
name: res.name,
|
||||||
|
detail: res.detail,
|
||||||
|
attributes: res.attributes,
|
||||||
|
work: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
res.work.forEach((item) => {
|
||||||
|
formDataProductService.value.work.push({
|
||||||
|
name: item.name,
|
||||||
|
attributes: item.attributes,
|
||||||
|
productId: item.productOnWork.map(
|
||||||
|
(productOnWorkItem) => productOnWorkItem.product.id,
|
||||||
|
),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function assignFormDataProduct(data: ProductList) {
|
function assignFormDataProduct(data: ProductList) {
|
||||||
formDataProduct.value = {
|
formDataProduct.value = {
|
||||||
productTypeId: data.productTypeId,
|
productTypeId: data.productTypeId,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue