refactor: add installments type to service
This commit is contained in:
parent
5b5e264c27
commit
61bade2013
4 changed files with 13 additions and 12 deletions
|
|
@ -41,7 +41,7 @@ defineExpose({
|
|||
defineEmits<{
|
||||
(e: 'delete', id: string, noDialog?: boolean): void;
|
||||
(e: 'edit', id: string, data: { name: string }): void;
|
||||
(e: 'add', data: { name: string; productId: []; order: number }): void;
|
||||
(e: 'add', data: { name: string; order: number }): void;
|
||||
}>();
|
||||
|
||||
onMounted(async () => {
|
||||
|
|
@ -158,8 +158,7 @@ watch(
|
|||
:disable="isWorkNameEdit()"
|
||||
@click="
|
||||
() => {
|
||||
$emit('add', { name: '', productId: [], order: 1 }),
|
||||
(isAdd = true);
|
||||
$emit('add', { name: '', order: 1 }), (isAdd = true);
|
||||
}
|
||||
"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -929,9 +929,9 @@ async function assignFormDataProductService(id: string) {
|
|||
prevService.value.work.push({
|
||||
name: item.name,
|
||||
attributes: item.attributes,
|
||||
productId: item.productOnWork.map(
|
||||
(productOnWorkItem) => productOnWorkItem.product.id,
|
||||
),
|
||||
product: item.productOnWork.map((productOnWorkItem) => ({
|
||||
id: productOnWorkItem.product.id,
|
||||
})),
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -1063,7 +1063,7 @@ function assignFormDataProductServiceCreate() {
|
|||
formDataProductService.value.work.push({
|
||||
name: item.name,
|
||||
attributes: item.attributes,
|
||||
productId: item.product.map((productItem) => productItem.id),
|
||||
product: item.product.map((productItem) => ({ id: productItem.id })),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -385,9 +385,7 @@ const useProductServiceStore = defineStore('api-product-service', () => {
|
|||
async function createWork(data: Partial<WorkCreate>) {
|
||||
const { ...payload } = data;
|
||||
|
||||
const res = await api.post<WorkCreate>('/work', {
|
||||
...payload,
|
||||
});
|
||||
const res = await api.post<WorkCreate>('/work', payload);
|
||||
|
||||
if (res && res.status < 400) {
|
||||
await fetchListOfWork();
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ export interface Service {
|
|||
createdBy: CreatedBy;
|
||||
status: Status;
|
||||
attributes: Attributes;
|
||||
installments: number;
|
||||
detail: string;
|
||||
name: string;
|
||||
code: string;
|
||||
|
|
@ -29,7 +30,6 @@ export interface Service {
|
|||
|
||||
export interface WorkCreate {
|
||||
attributes: Attributes;
|
||||
productId: string[];
|
||||
name: string;
|
||||
order: number;
|
||||
}
|
||||
|
|
@ -50,9 +50,13 @@ export interface Work {
|
|||
|
||||
export interface ServiceCreate {
|
||||
id?: string;
|
||||
installments?: number;
|
||||
work: {
|
||||
attributes: Attributes;
|
||||
productId: string[];
|
||||
product: {
|
||||
id: string;
|
||||
installmentNo?: number;
|
||||
}[];
|
||||
name: string;
|
||||
}[];
|
||||
attributes: Attributes;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue