feat(P16C-4,P16C-6): 完成供应商主数据前端与矩阵收口

这个提交包含在:
2026-03-07 17:44:55 +08:00
父节点 aafa911ee7
当前提交 09b6f4fbb0
共修改 6 个文件,包含 465 行新增和 8 行删除
+79
查看文件
@@ -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({}),
},
);
}