feat(appearance-patent): 后管页恢复明细表+管理员列+导出,撤一主管一卡与删除入口(2026-11-11 客户「不是这种格式 你就按照昨天那个格式」)
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
/** 外观专利无侵权数据列表查询适配(v1.3 AC-5):GET /api/admin/appearance-patent-clean-items。
|
||||
* 只读页+导出(2026-11-11 客户需求「数据得导出来」):公司 tab 的值由本发送口从原始入参自己下传
|
||||
* (白名单构造不认识 company_id),取值口形状由 company-tab-wiring 护栏钉住。 */
|
||||
* (白名单构造不认识 company_id),取值口形状由 company-tab-wiring 护栏钉住。
|
||||
* 2026-11-11 晚间恢复明细表:主管聚合(/supervisors)与按主管删除的前端发送口随卡片视图一并
|
||||
* 下架(客户「不是这种格式 按照昨天那个格式」+删除入口先撤);后端两接口保留,要恢复时
|
||||
* 从 git 历史(e1767faf)找回。 */
|
||||
import { http } from '@/api/http'
|
||||
import { errorTextOf, unwrap } from '../../api/envelope.ts'
|
||||
import {
|
||||
@@ -12,14 +15,10 @@ import {
|
||||
} from './appearance-patent-clean-filter.ts'
|
||||
import {
|
||||
parseAppearancePatentCleanPage,
|
||||
parseAppearancePatentSupervisorPage,
|
||||
type AppearancePatentCleanPageResult,
|
||||
type AppearancePatentSupervisorPageResult,
|
||||
} from './appearance-patent-clean-model.ts'
|
||||
|
||||
export const APPEARANCE_PATENT_CLEAN_ENDPOINT = '/api/admin/appearance-patent-clean-items'
|
||||
/** 主管聚合卡片端点(2026-11-11 客户「获取店铺那边是按店铺做成卡片 我们这边就是按主管划分」)。 */
|
||||
export const APPEARANCE_PATENT_SUPERVISOR_ENDPOINT = `${APPEARANCE_PATENT_CLEAN_ENDPOINT}/supervisors`
|
||||
|
||||
export async function fetchAppearancePatentCleanList(
|
||||
params: AppearancePatentCleanListParams,
|
||||
@@ -41,37 +40,6 @@ export async function fetchAppearancePatentCleanList(
|
||||
return parseAppearancePatentCleanPage(data)
|
||||
}
|
||||
|
||||
export interface AppearancePatentSupervisorListParams {
|
||||
page: number
|
||||
pageSize: number
|
||||
country?: string
|
||||
groupId?: string
|
||||
startDate?: string
|
||||
endDate?: string
|
||||
companyId?: number | null
|
||||
}
|
||||
|
||||
/** 主管聚合卡片列表(一主管一卡):与明细列表同一过滤面 + 公司 tab,total 是主管数。 */
|
||||
export async function fetchAppearancePatentCleanSupervisors(
|
||||
params: AppearancePatentSupervisorListParams,
|
||||
): Promise<AppearancePatentSupervisorPageResult> {
|
||||
const query = toAppearancePatentCleanListParams(
|
||||
{
|
||||
taskId: '',
|
||||
asin: '',
|
||||
country: params.country ?? '',
|
||||
groupId: params.groupId ?? '',
|
||||
startDate: params.startDate ?? '',
|
||||
endDate: params.endDate ?? '',
|
||||
},
|
||||
params.page,
|
||||
params.pageSize,
|
||||
)
|
||||
if (params.companyId != null) query.company_id = params.companyId
|
||||
const { data } = await http.get<unknown>(APPEARANCE_PATENT_SUPERVISOR_ENDPOINT, { params: query })
|
||||
return parseAppearancePatentSupervisorPage(data)
|
||||
}
|
||||
|
||||
export interface AppearancePatentCleanExportResult {
|
||||
blob: Blob
|
||||
filename: string
|
||||
@@ -92,22 +60,19 @@ function exportFilenameOf(disposition: unknown): string {
|
||||
return plain?.[1] || '外观专利数据库.xlsx'
|
||||
}
|
||||
|
||||
/** 导出当前过滤面全量明细:与列表共用同一过滤面取值口(含公司 tab),blob 下载交给页面触发保存。
|
||||
* {@code supervisorUserId} 传入=只导出该主管名下明细(卡片上的「下载」,2026-11-11 一主管一卡)。 */
|
||||
/** 导出当前过滤面全量明细:与列表共用同一过滤面取值口(含公司 tab),blob 下载交给页面触发保存。 */
|
||||
export async function exportAppearancePatentCleanList(
|
||||
params: AppearancePatentCleanExportParams & { supervisorUserId?: number | null },
|
||||
params: AppearancePatentCleanExportParams,
|
||||
): Promise<AppearancePatentCleanExportResult> {
|
||||
const query: AppearancePatentCleanExportQuery & { supervisor_user_id?: number } =
|
||||
toAppearancePatentCleanExportParams({
|
||||
taskId: params.taskId ?? '',
|
||||
asin: params.asin ?? '',
|
||||
country: params.country ?? '',
|
||||
groupId: params.groupId ?? '',
|
||||
startDate: params.startDate ?? '',
|
||||
endDate: params.endDate ?? '',
|
||||
})
|
||||
const query: AppearancePatentCleanExportQuery = toAppearancePatentCleanExportParams({
|
||||
taskId: params.taskId ?? '',
|
||||
asin: params.asin ?? '',
|
||||
country: params.country ?? '',
|
||||
groupId: params.groupId ?? '',
|
||||
startDate: params.startDate ?? '',
|
||||
endDate: params.endDate ?? '',
|
||||
})
|
||||
if (params.companyId != null) query.company_id = params.companyId
|
||||
if (params.supervisorUserId != null) query.supervisor_user_id = params.supervisorUserId
|
||||
const response = await http.get<Blob>(`${APPEARANCE_PATENT_CLEAN_ENDPOINT}/export`, {
|
||||
params: query,
|
||||
responseType: 'blob',
|
||||
@@ -131,37 +96,6 @@ export async function exportAppearancePatentCleanList(
|
||||
return { blob: response.data, filename: exportFilenameOf(disposition) }
|
||||
}
|
||||
|
||||
export interface AppearancePatentSupervisorDeleteParams {
|
||||
supervisorUserId: number
|
||||
country?: string
|
||||
groupId?: string
|
||||
startDate?: string
|
||||
endDate?: string
|
||||
companyId?: number | null
|
||||
}
|
||||
|
||||
/** 删除某位主管名下明细(卡片上的「删除」,2026-11-11 客户「也要加个删除按钮」):
|
||||
* 谓词与卡片「下载」逐字同源(同一过滤面 + 同一主管归属表达式),返回实际删除行数。
|
||||
* supervisorUserId 必填——后端缺值按业务错误拒绝(不按主管收窄的删除等于删整个过滤面)。 */
|
||||
export async function deleteAppearancePatentCleanSupervisor(
|
||||
params: AppearancePatentSupervisorDeleteParams,
|
||||
): Promise<number> {
|
||||
const query = toAppearancePatentCleanExportParams({
|
||||
taskId: '',
|
||||
asin: '',
|
||||
country: params.country ?? '',
|
||||
groupId: params.groupId ?? '',
|
||||
startDate: params.startDate ?? '',
|
||||
endDate: params.endDate ?? '',
|
||||
})
|
||||
if (params.companyId != null) query.company_id = params.companyId
|
||||
const { data } = await http.delete<unknown>(APPEARANCE_PATENT_SUPERVISOR_ENDPOINT, {
|
||||
params: { ...query, supervisor_user_id: params.supervisorUserId },
|
||||
})
|
||||
const deleted = unwrap<number>(data)
|
||||
return typeof deleted === 'number' ? deleted : Number(deleted) || 0
|
||||
}
|
||||
|
||||
/** 分组(主管)下拉选项:复用既有 GET /shop-manages/groups(与去重页/店铺管理共用同一分组集,
|
||||
* 不下新端点)。2026-11-11 客户口径「主管就是组长,可以筛选组长来导出,就是分组」——
|
||||
* 选项是分组管理里那一行(DedupeGroupOption {id, name, leaderUserId}),选中后以 group_id
|
||||
|
||||
Reference in New Issue
Block a user