feat(edit): 编辑页类目树逻辑开发

This commit is contained in:
2026-09-10 22:26:52 +08:00
parent 946af649dd
commit 05a00d46b9
13 changed files with 628 additions and 323 deletions
+7 -16
View File
@@ -39,30 +39,19 @@ export const productEditorApi = {
'If-Match': `"${revisions.product}:${revisions.profile}"`,
},
}),
categoryOptions: (profileId: string, platformId: string, search?: string) =>
categoryOptions: (profileId: string, platformId: string, search?: string, storeId?: string | null) =>
api.get<ProductEditorCategoryOption[]>(
`/product-platform-profiles/${profileId}/category-options`,
{
params: search ? { q: search } : undefined,
params: { ...(search ? { q: search } : {}), ...(storeId ? { store_id: storeId } : {}) },
headers: { 'X-Atlas-Platform-Id': platformId },
}
),
syncCategoryTree: (profileId: string, platformId: string) =>
api.post<{ operation: Operation }>(
`/product-platform-profiles/${profileId}/category-syncs`,
undefined,
{
headers: {
'X-Atlas-Platform-Id': platformId,
'Idempotency-Key': crypto.randomUUID(),
},
}
),
attributeSchema: (profileId: string, platformId: string, categoryId?: string | null) =>
attributeSchema: (profileId: string, platformId: string, categoryId?: string | null, storeId?: string | null) =>
api.get<ProductAttributeSchema[]>(
`/product-platform-profiles/${profileId}/attribute-schema`,
{
params: categoryId ? { category_id: categoryId } : undefined,
params: { ...(categoryId ? { category_id: categoryId } : {}), ...(storeId ? { store_id: storeId } : {}) },
headers: { 'X-Atlas-Platform-Id': platformId },
}
),
@@ -83,13 +72,15 @@ export const productEditorApi = {
platformId: string,
dictionaryId: string,
search?: string,
categoryId?: string | null
categoryId?: string | null,
storeId?: string | null,
) =>
api.get<{ items: ProductAttributeDictionaryValue[]; next_cursor: string | null }>(
`/product-platform-profiles/${profileId}/attribute-dictionaries/${encodeURIComponent(dictionaryId)}`,
{
params: {
...(categoryId ? { category_id: categoryId } : {}),
...(storeId ? { store_id: storeId } : {}),
...(search ? { q: search } : {}),
},
headers: { 'X-Atlas-Platform-Id': platformId },