feat(appearance-patent): 后管页恢复明细表+管理员列+导出,撤一主管一卡与删除入口(2026-11-11 客户「不是这种格式 你就按照昨天那个格式」)
This commit is contained in:
@@ -7,7 +7,7 @@ export interface AppearancePatentCleanItem {
|
||||
resultId: number | null
|
||||
taskId: number | null
|
||||
userId: number | null
|
||||
/** 所属主管(后端读侧现算列:主管/公司超管=自己,普通账户=创建人;读不到为空 → 界面展示 -)。 */
|
||||
/** 管理员列(表头「管理员」,客户 2026-11-11 口径;后端读侧现算:主管/公司超管=自己,普通账户=创建人,读不到为空 → 界面展示 -)。 */
|
||||
supervisorName: string
|
||||
companyId: number | null
|
||||
rowNo: number | null
|
||||
@@ -37,79 +37,17 @@ export interface AppearancePatentCleanPageResult {
|
||||
/** 前端首屏默认容量:与后端 PageDefaults.CLEAN_ITEMS_PAGE_SIZE(蓝图 §3.2 默认 10)同值。 */
|
||||
export const APPEARANCE_PATENT_CLEAN_DEFAULT_SIZE = 10
|
||||
|
||||
/** 主管卡片(2026-11-11 客户「获取店铺那边是按店铺做成卡片 我们这边就是按主管划分」):
|
||||
* 一主管一卡,卡内是该主管名下的汇总——不再按明细铺卡(几千条明细=几千张卡,客户明确不要)。 */
|
||||
export interface AppearancePatentSupervisorCard {
|
||||
/** 主管用户 id;null=读不到主管的那一组(该卡不提供按主管下载)。 */
|
||||
supervisorId: number | null
|
||||
/** 主管名(读不到为空,界面展示 -)。 */
|
||||
supervisorName: string
|
||||
/** 无侵权明细条数。 */
|
||||
itemCount: number
|
||||
/** 涉及任务数。 */
|
||||
taskCount: number
|
||||
/** 最近涉及的任务号。 */
|
||||
lastTaskId: number | null
|
||||
/** 最近同步时间。 */
|
||||
lastSyncedAt?: string
|
||||
/** 涉及国家码集(前端用自己的国家字典翻中文)。 */
|
||||
countryCodes: string[]
|
||||
}
|
||||
|
||||
export interface AppearancePatentSupervisorPageResult {
|
||||
items: AppearancePatentSupervisorCard[]
|
||||
/** 主管数(不是明细条数)。 */
|
||||
total: number
|
||||
page: number
|
||||
pageSize: number
|
||||
}
|
||||
|
||||
export function emptyAppearancePatentCleanPage(): AppearancePatentCleanPageResult {
|
||||
return { items: [], total: 0, page: 1, pageSize: APPEARANCE_PATENT_CLEAN_DEFAULT_SIZE }
|
||||
}
|
||||
|
||||
/** 解析主管卡片;缺 supervisorId 的(未知主管组)依然保留(那一卡展示 -),不算无效行。 */
|
||||
export function toAppearancePatentSupervisorCard(raw: unknown): AppearancePatentSupervisorCard | null {
|
||||
if (!raw || typeof raw !== 'object') return null
|
||||
const record = raw as Record<string, unknown>
|
||||
const itemCount = numberOrNull(record.itemCount ?? record.item_count)
|
||||
if (itemCount === null) return null
|
||||
const rawCodes = record.countryCodes ?? record.country_codes
|
||||
const countryCodes = Array.isArray(rawCodes)
|
||||
? rawCodes.map((code) => text(code)).filter((code) => code.length > 0)
|
||||
: []
|
||||
return {
|
||||
supervisorId: numberOrNull(record.supervisorId ?? record.supervisor_id),
|
||||
supervisorName: text(record.supervisorName ?? record.supervisor_name),
|
||||
itemCount,
|
||||
taskCount: numberOrNull(record.taskCount ?? record.task_count) ?? 0,
|
||||
lastTaskId: numberOrNull(record.lastTaskId ?? record.last_task_id),
|
||||
lastSyncedAt: text(record.lastSyncedAt ?? record.last_synced_at) || undefined,
|
||||
countryCodes,
|
||||
}
|
||||
}
|
||||
|
||||
/** 解析主管卡片分页信封({items,total,page,pageSize});total 是主管数。 */
|
||||
export function parseAppearancePatentSupervisorPage(payload: unknown): AppearancePatentSupervisorPageResult {
|
||||
const out: AppearancePatentSupervisorPageResult = {
|
||||
items: [],
|
||||
total: 0,
|
||||
page: 1,
|
||||
pageSize: APPEARANCE_PATENT_CLEAN_DEFAULT_SIZE,
|
||||
}
|
||||
const core = unwrap<unknown>(payload)
|
||||
if (!core || typeof core !== 'object') return out
|
||||
const record = core as Record<string, unknown>
|
||||
if (Array.isArray(record.items)) {
|
||||
out.items = record.items
|
||||
.map((raw) => toAppearancePatentSupervisorCard(raw))
|
||||
.filter((item): item is AppearancePatentSupervisorCard => item !== null)
|
||||
}
|
||||
if (typeof record.total === 'number') out.total = Math.floor(record.total)
|
||||
if (typeof record.page === 'number' && record.page >= 1) out.page = Math.floor(record.page)
|
||||
const rawSize = record.pageSize ?? record.page_size
|
||||
if (typeof rawSize === 'number' && rawSize >= 1) out.pageSize = Math.floor(rawSize)
|
||||
return out
|
||||
/** 结论列悬停提示=三因原文拼装(2026-11-11 随明细表恢复回归;3cfca462 曾随结论徽章一起退役)。 */
|
||||
export function cleanItemReasonTooltip(item: AppearancePatentCleanItem): string {
|
||||
const parts: string[] = []
|
||||
if (item.titleReason) parts.push(`标题:${item.titleReason}`)
|
||||
if (item.appearanceReason) parts.push(`外观:${item.appearanceReason}`)
|
||||
if (item.patentReason) parts.push(`专利:${item.patentReason}`)
|
||||
return parts.join('\n')
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user