feat(jd): 列表列对齐+主图投影+SKU 矩阵+删除链收口(B101/B102 服务端与后管)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/** 京东数据库查询适配(v1.4 Phase 5):GET /api/admin/jd-products + 分组端点 /api/admin/jd-product-groups。
|
||||
* 只读列表+导出+分组管理:公司 tab 的值由本发送口从原始入参自己下传
|
||||
/** 京东数据库查询适配(v1.4 Phase 5):GET /api/admin/jd-products + 删除(DELETE /{id} +
|
||||
* POST /batch-delete)+ 分组端点 /api/admin/jd-product-groups。
|
||||
* 只读列表+导出+删除+分组管理:公司 tab 的值由本发送口从原始入参自己下传
|
||||
* (白名单构造不认识 company_id),取值口形状由 company-tab-wiring 护栏钉住。 */
|
||||
import { http } from '@/api/http'
|
||||
import { errorTextOf, unwrap } from '../../api/envelope.ts'
|
||||
@@ -108,6 +109,30 @@ export async function exportJdProductList(
|
||||
return { blob: response.data, filename: exportFilenameOf(disposition) }
|
||||
}
|
||||
|
||||
/** 删除回执(后端 JdProductDeleteVo):三个对象计数分开报——真删的、共用的、前缀外不敢动的。 */
|
||||
export interface JdProductDeleteResult {
|
||||
deleted: number
|
||||
imagesDeleted: number
|
||||
objectsDeleted: number
|
||||
objectsKept: number
|
||||
objectsSkipped: number
|
||||
}
|
||||
|
||||
/** 删除是先删桶、全成功才删库行(后端 JdProductDeleteService);失败文案原样抛给页面。 */
|
||||
export async function deleteJdProducts(
|
||||
ids: number[],
|
||||
companyId: number | null,
|
||||
): Promise<JdProductDeleteResult> {
|
||||
const query: Record<string, number> = {}
|
||||
if (companyId != null) query.company_id = companyId
|
||||
if (ids.length === 1) {
|
||||
const { data } = await http.delete<unknown>(`${JD_PRODUCT_ENDPOINT}/${ids[0]}`, { params: query })
|
||||
return unwrap<JdProductDeleteResult>(data)
|
||||
}
|
||||
const { data } = await http.post<unknown>(`${JD_PRODUCT_ENDPOINT}/batch-delete`, { ids }, { params: query })
|
||||
return unwrap<JdProductDeleteResult>(data)
|
||||
}
|
||||
|
||||
/** 分组行(GET 列表返回:[{id,name,sortOrder,productCount}])。 */
|
||||
export interface JdProductGroup {
|
||||
id: number
|
||||
|
||||
Reference in New Issue
Block a user