feat(P16C-4,P16C-6): 完成供应商主数据前端与矩阵收口
这个提交包含在:
@@ -94,6 +94,27 @@ export type HolidayCalendarDayItem = {
|
||||
updatedAt: string | null;
|
||||
};
|
||||
|
||||
export type SupplierItem = {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
shortName: string | null;
|
||||
taxNo: string | null;
|
||||
contactName: string | null;
|
||||
contactPhone: string | null;
|
||||
paymentTerms: string | null;
|
||||
legalEntityId: string | null;
|
||||
enabled: boolean;
|
||||
archivedAt: string | null;
|
||||
createdAt: string | null;
|
||||
updatedAt: string | null;
|
||||
legalEntity: {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type MasterDataListResponse<T> = {
|
||||
includeArchived: boolean;
|
||||
items: T[];
|
||||
@@ -345,3 +366,61 @@ export async function replaceHolidayCalendarDays(
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export async function fetchSuppliers(params: {
|
||||
includeArchived?: boolean;
|
||||
enabled?: boolean;
|
||||
legalEntityId?: string;
|
||||
q?: string;
|
||||
} = {}) {
|
||||
return apiRequestData<MasterDataListResponse<SupplierItem>>(
|
||||
`/api/master-data/suppliers${toQueryString(params as Record<string, string | boolean | undefined>)}`,
|
||||
);
|
||||
}
|
||||
|
||||
export async function createSupplier(payload: {
|
||||
code: string;
|
||||
name: string;
|
||||
shortName?: string | null;
|
||||
taxNo?: string | null;
|
||||
contactName?: string | null;
|
||||
contactPhone?: string | null;
|
||||
paymentTerms?: string | null;
|
||||
legalEntityId?: string | null;
|
||||
enabled?: boolean;
|
||||
}) {
|
||||
return apiRequestData<{ supplier: SupplierItem }>("/api/master-data/suppliers", {
|
||||
method: "POST",
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export async function patchSupplier(
|
||||
supplierId: string,
|
||||
payload: Partial<{
|
||||
code: string;
|
||||
name: string;
|
||||
shortName: string | null;
|
||||
taxNo: string | null;
|
||||
contactName: string | null;
|
||||
contactPhone: string | null;
|
||||
paymentTerms: string | null;
|
||||
legalEntityId: string | null;
|
||||
enabled: boolean;
|
||||
}>,
|
||||
) {
|
||||
return apiRequestData<{ supplier: SupplierItem }>(`/api/master-data/suppliers/${supplierId}`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
export async function archiveSupplier(supplierId: string) {
|
||||
return apiRequestData<{ supplier: SupplierItem; outcome: string }>(
|
||||
`/api/master-data/suppliers/${supplierId}/archive`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户