feat(phase-3): 后管无侵权只读页——私有鉴权闸+readCompanyIdOrOwn 公司隔离+分页钳制;前端自绘表格页与路由/操作提示/五护栏同轮记账
后端:AdminAppearancePatentCleanItemsController(GET /api/admin/appearance-patent-clean-items,requireCleanItemsAccess 照去重页形状)+ AppearancePatentCleanItemQueryService(page≤10000/size≤100 钳制防 (page-1)*page_size 溢出)+两 VO;PageDefaults 第五种 page_size=10 显式登记。前端:AppearancePatentCleanItemsPage(自绘 table+OldPagination,companyScoped)+api/filter/model 拆件;routes/company-scope/operation-guides 收口。护栏:company-tab-wiring 24 处发送口、date-range-order 分母 21 实例/9 对、date-guard EXEMPT、ChunkRow 无侵权白名单四件(LlmClient 仍是唯一结论值来源)、SourceScan 52 支、G2 WIRED_PAGE_KEYS 第七支。判据修正:columnKey→getColumnKey 对齐代码库命名。
This commit is contained in:
@@ -60,4 +60,7 @@ export const COMPANY_SCOPED_PAGES: readonly CompanyScopedPage[] = [
|
||||
// 「无效的菜单权限项」。写侧(编辑/删除/重排)不带参数——归属由那一行的 id 与操作者公司共同判定,
|
||||
// 跨公司写后端 403(见 docs/ops/menu-company-tree-design-2026-10-06.md §5)。
|
||||
{ menuKey: 'admin_columns', apiFiles: ['src/pages/account/menu-manage-api.ts'], pageFiles: ['src/pages/account/MenusPage.vue'] },
|
||||
// 外观专利无侵权数据(2026-11-10 v1.3):出表成功自动同步的只读明细,归属物化在行 company_id 列
|
||||
// (V189,同店铺密钥形状)⇒ 后端正门 readCompanyIdOrOwn(超管显式传才收窄,非超管强制本公司)。
|
||||
{ menuKey: 'admin_appearance_patent_clean_items', apiFiles: ['src/pages/patent/appearance-patent-clean-api.ts'], pageFiles: ['src/pages/patent/AppearancePatentCleanItemsPage.vue'] },
|
||||
]
|
||||
|
||||
@@ -121,6 +121,10 @@ export const OPERATION_GUIDES: Record<string, OperationGuideData> = {
|
||||
text: '按账号、业务、状态、店铺和创建时间筛出客户端任务,点任务查看明细与分组结果;顶部汇总卡给当前在跑与疑似卡住的总量。',
|
||||
steps: ['按条件筛任务', '查看任务明细', '核对汇总卡'],
|
||||
},
|
||||
admin_appearance_patent_clean_items: {
|
||||
text: '本页只读:出表成功后「结论=无侵权」的明细自动同步到这里,按分公司隔离分页展示;支持任务号/ASIN/国家/同步日期筛选,下载原表请到任务中心取结果文件。',
|
||||
steps: ['筛选记录', '核对结论明细', '到任务中心下载原表'],
|
||||
},
|
||||
}
|
||||
|
||||
/** 全部有独立/兜底提示的后台业务菜单 key。 */
|
||||
|
||||
@@ -0,0 +1,334 @@
|
||||
<script setup lang="ts">
|
||||
import { formatDateTime, orderedPair } from '@/utils/datetime'
|
||||
/** 外观专利无侵权数据 · 只读分页列表(v1.3,展示形式参照「去重数据库」页:自绘 table +
|
||||
* OldPagination,不做卡片宫格)。数据由出表成功点自动同步(后端 SyncService),本页零写操作:
|
||||
* 无编辑/导入/导出,下载走既有结果直链/任务中心。 */
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { fetchAppearancePatentCleanList } from './appearance-patent-clean-api.ts'
|
||||
import type { AppearancePatentCleanItem } from './appearance-patent-clean-model.ts'
|
||||
import { cleanItemReasonTooltip } from './appearance-patent-clean-model.ts'
|
||||
import { createAppearancePatentCleanFilterState } from './appearance-patent-clean-filter.ts'
|
||||
import { ASIN_COUNTRY_CODES, asinCountryLabel } from '../asin/asin-country.ts'
|
||||
import OldPagination from '@/components/OldPagination.vue'
|
||||
import { useCompanyTabStore } from '@/stores/company-tab'
|
||||
import { showAdminFeedback } from '@/components/admin-feedback-ui'
|
||||
import { loadFailureMessage } from '@/components/load-failure-model'
|
||||
import LoadFailureBar from '@/components/LoadFailureBar.vue'
|
||||
|
||||
const companyTab = useCompanyTabStore()
|
||||
|
||||
const loading = ref(false)
|
||||
const loadFailure = ref('')
|
||||
const rows = ref<AppearancePatentCleanItem[]>([])
|
||||
const total = ref(0)
|
||||
const page = ref(1)
|
||||
const pageSize = ref(10)
|
||||
/** 同步台账是累计数据,日期初值故意留空(默认当天会让首屏只剩今天同步的行);见 date-filter-default-today 护栏的 EXEMPT。 */
|
||||
const filter = reactive(createAppearancePatentCleanFilterState())
|
||||
/** min/max 挡不住手输,落值后把倒挂的起止交换回来。 */
|
||||
function clampDatePair(): void {
|
||||
const [s, e] = orderedPair(filter.startDate, filter.endDate)
|
||||
filter.startDate = s
|
||||
filter.endDate = e
|
||||
}
|
||||
|
||||
const totalPages = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
|
||||
|
||||
async function load(): Promise<void> {
|
||||
loading.value = true
|
||||
loadFailure.value = ''
|
||||
try {
|
||||
const result = await fetchAppearancePatentCleanList({
|
||||
page: page.value,
|
||||
pageSize: pageSize.value,
|
||||
taskId: filter.taskId,
|
||||
asin: filter.asin,
|
||||
country: filter.country,
|
||||
startDate: filter.startDate,
|
||||
endDate: filter.endDate,
|
||||
companyId: companyTab.requestCompanyId,
|
||||
})
|
||||
rows.value = result.items
|
||||
total.value = result.total
|
||||
if (result.page >= 1) page.value = result.page
|
||||
} catch (error) {
|
||||
loadFailure.value = loadFailureMessage(error, '无侵权数据加载失败')
|
||||
showAdminFeedback(loadFailure.value, 'error')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function apply(): void {
|
||||
page.value = 1
|
||||
void load()
|
||||
}
|
||||
|
||||
function changePage(next: number): void {
|
||||
if (next < 1 || next > totalPages.value) return
|
||||
page.value = next
|
||||
void load()
|
||||
}
|
||||
|
||||
function changeSize(size: number) {
|
||||
pageSize.value = size
|
||||
page.value = 1
|
||||
void load()
|
||||
}
|
||||
|
||||
// 切公司 = 重新取数:任务号/ASIN 是上一家选中的值,在新一家的行集里筛不出东西,必须一起清。
|
||||
watch(() => companyTab.activeId, () => { filter.taskId = ''; filter.asin = ''; page.value = 1; void load() })
|
||||
|
||||
onMounted(() => {
|
||||
void load()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="clean-items-view">
|
||||
<section class="panel-box">
|
||||
<div class="clean-panel-head">
|
||||
<h3>外观专利无侵权数据</h3>
|
||||
</div>
|
||||
|
||||
<div class="clean-filter-row">
|
||||
<div class="form-group">
|
||||
<label>任务号</label>
|
||||
<input v-model="filter.taskId" type="text" placeholder="输入任务号" @keyup.enter="apply" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>ASIN</label>
|
||||
<input v-model="filter.asin" type="text" placeholder="输入 ASIN" @keyup.enter="apply" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>国家</label>
|
||||
<select v-model="filter.country">
|
||||
<option value="">全部国家</option>
|
||||
<option v-for="code in ASIN_COUNTRY_CODES" :key="code" :value="code">{{ asinCountryLabel(code) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>同步开始日期</label>
|
||||
<input v-model="filter.startDate" type="date" :max="filter.endDate" @change="clampDatePair" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>同步结束日期</label>
|
||||
<input v-model="filter.endDate" type="date" :min="filter.startDate" @change="clampDatePair" />
|
||||
</div>
|
||||
<div class="clean-filter-actions">
|
||||
<button class="btn" type="button" @click="apply">查询</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="load" />
|
||||
<div class="table-scroll clean-table-scroll">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 90px">任务号</th>
|
||||
<th>ASIN</th>
|
||||
<th style="width: 64px">国家</th>
|
||||
<th>SKU</th>
|
||||
<th>品牌</th>
|
||||
<th style="width: 90px">价格</th>
|
||||
<th>标题</th>
|
||||
<th style="width: 130px">结论</th>
|
||||
<th style="width: 150px">同步时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<template v-if="rows.length">
|
||||
<tr v-for="row in rows" :key="row.id">
|
||||
<td>{{ row.taskId ?? '-' }}</td>
|
||||
<td class="mono-cell">{{ row.asin || '-' }}</td>
|
||||
<td>{{ asinCountryLabel(row.country || '') }}</td>
|
||||
<td class="mono-cell">{{ row.sku || '-' }}</td>
|
||||
<td>{{ row.brand || '-' }}</td>
|
||||
<td>{{ row.price || '-' }}</td>
|
||||
<td class="title-cell" :title="row.title">{{ row.title || '-' }}</td>
|
||||
<td class="conclusion-cell" :title="cleanItemReasonTooltip(row)">{{ row.conclusion || '-' }}</td>
|
||||
<td>{{ formatDateTime(row.syncedAt || '') }}</td>
|
||||
</tr>
|
||||
</template>
|
||||
<tr v-else-if="loading">
|
||||
<td colspan="9" class="empty-tip">加载中...</td>
|
||||
</tr>
|
||||
<tr v-else>
|
||||
<td colspan="9" class="empty-tip">暂无无侵权数据</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<OldPagination :total="total" :page="page" :page-size="pageSize" @change="changePage" @size-change="changeSize" />
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 像素复刻参照「去重数据库」页(panel-box + 自绘表格 + 旧式分页),只读无操作列。 */
|
||||
.clean-items-view {
|
||||
font-family: inherit;
|
||||
color: var(--c-text, #24384d);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
}
|
||||
.panel-box {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 20px 22px 24px;
|
||||
border: 1px solid #d8e3ee;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||||
}
|
||||
h3 {
|
||||
margin: 0 0 16px;
|
||||
font-size: 15px;
|
||||
font-weight: 650;
|
||||
color: #24384d;
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.clean-panel-head h3 {
|
||||
margin: 0 0 16px;
|
||||
}
|
||||
.clean-filter-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(150px, 1fr)) auto;
|
||||
gap: 12px;
|
||||
align-items: end;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.clean-filter-row .form-group {
|
||||
min-width: 0;
|
||||
}
|
||||
.clean-filter-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.form-group label {
|
||||
color: #5b6f83;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.form-group input,
|
||||
.form-group select {
|
||||
min-width: 0;
|
||||
min-height: 42px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #cbd9e6;
|
||||
border-radius: 9px;
|
||||
background: #f8fbfd;
|
||||
color: #24384d;
|
||||
font-size: 13.5px;
|
||||
font-family: inherit;
|
||||
color-scheme: light;
|
||||
outline: none;
|
||||
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
|
||||
}
|
||||
.form-group input:hover,
|
||||
.form-group select:hover {
|
||||
border-color: #9fb7cd;
|
||||
}
|
||||
.form-group input:focus,
|
||||
.form-group select:focus {
|
||||
background: #ffffff;
|
||||
border-color: #5f85ad;
|
||||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||||
}
|
||||
.form-group input[type="date"] {
|
||||
color-scheme: light;
|
||||
}
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
min-height: 42px;
|
||||
padding: 9px 18px;
|
||||
border: 1px solid #4f78a5;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||||
color: #ffffff;
|
||||
font-family: inherit;
|
||||
font-size: 13.5px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||||
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
|
||||
}
|
||||
.btn:hover:not(:disabled) {
|
||||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||||
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
|
||||
}
|
||||
.btn:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
}
|
||||
.table-scroll {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
overflow-x: auto;
|
||||
border: 1px solid #dbe5ee;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
}
|
||||
.table-scroll table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
}
|
||||
.clean-table-scroll > table {
|
||||
min-width: 1040px;
|
||||
}
|
||||
.table-scroll th,
|
||||
.table-scroll td {
|
||||
padding: 10px 12px;
|
||||
text-align: left;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.5;
|
||||
border-bottom: 1px solid #e0e8ef;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.table-scroll th {
|
||||
background: #edf4fa;
|
||||
color: #4e6479;
|
||||
border-bottom-color: #d5e1eb;
|
||||
font-size: 12.5px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.4px;
|
||||
}
|
||||
.table-scroll tbody tr:hover td {
|
||||
background: #f1f7fb;
|
||||
}
|
||||
.table-scroll tbody tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.mono-cell {
|
||||
font-family: "Cascadia Mono", "SF Mono", Consolas, "Courier New", monospace;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
.title-cell {
|
||||
max-width: 260px;
|
||||
}
|
||||
.conclusion-cell {
|
||||
max-width: 130px;
|
||||
}
|
||||
.empty-tip {
|
||||
padding: 44px 24px;
|
||||
text-align: center;
|
||||
color: #8293a5;
|
||||
font-size: 13.5px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,33 @@
|
||||
/** 外观专利无侵权数据列表查询适配(v1.3 AC-5):GET /api/admin/appearance-patent-clean-items。
|
||||
* 只读页,无写/删/导出入口。公司 tab 的值由本发送口从原始入参自己下传(白名单构造不认识
|
||||
* company_id),取值口形状由 company-tab-wiring 护栏钉住。 */
|
||||
import { http } from '@/api/http'
|
||||
import {
|
||||
toAppearancePatentCleanListParams,
|
||||
type AppearancePatentCleanListParams,
|
||||
} from './appearance-patent-clean-filter.ts'
|
||||
import {
|
||||
parseAppearancePatentCleanPage,
|
||||
type AppearancePatentCleanPageResult,
|
||||
} from './appearance-patent-clean-model.ts'
|
||||
|
||||
export const APPEARANCE_PATENT_CLEAN_ENDPOINT = '/api/admin/appearance-patent-clean-items'
|
||||
|
||||
export async function fetchAppearancePatentCleanList(
|
||||
params: AppearancePatentCleanListParams,
|
||||
): Promise<AppearancePatentCleanPageResult> {
|
||||
const query = toAppearancePatentCleanListParams(
|
||||
{
|
||||
taskId: params.taskId ?? '',
|
||||
asin: params.asin ?? '',
|
||||
country: params.country ?? '',
|
||||
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_CLEAN_ENDPOINT, { params: query })
|
||||
return parseAppearancePatentCleanPage(data)
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/** 外观专利无侵权数据页筛选纯函数(v1.3 AC-5):任务号/ASIN/国家/起止时间 + snake 分页参数。
|
||||
* 产出与后端 §3.2 参数归一逐字对撞:`page`/`page_size`(默认 10、上限 100)、`task_id`、
|
||||
* `asin`、`country`、`start_date`/`end_date`(ISO yyyy-MM-dd;空白不下发)。
|
||||
* 分页钳制(铁律 15):page < 1 归 1、上限 10_000(后端 CR-18 同值),(page-1)*page_size
|
||||
* 最大 999_900,Number.MAX_SAFE_INTEGER 也不会把乘积顶出安全整数。纯逻辑,node --test 直测。
|
||||
* 公司维不在这里:归一化构造器不认识 company_id(同 asin-filter 惯例),由 api 发送口从
|
||||
* 原始入参自己下传——取值口由 company-tab-wiring 护栏的发送行钉看守。 */
|
||||
import { validIsoDateOrUndefined } from '../asin/asin-filter.ts'
|
||||
|
||||
/** 每页条数默认 10(蓝图 §3.2),上限 100。 */
|
||||
export const APPEARANCE_PATENT_CLEAN_PAGE_SIZE = 10
|
||||
export const APPEARANCE_PATENT_CLEAN_MAX_PAGE_SIZE = 100
|
||||
/** 页码上限:与后端 AppearancePatentCleanItemQueryService.MAX_PAGE(CR-18 先例)同值,两侧不漂。 */
|
||||
export const APPEARANCE_PATENT_CLEAN_MAX_PAGE = 10_000
|
||||
|
||||
export interface AppearancePatentCleanFilterState {
|
||||
/** 任务号(纯数字文本,空串不限)。 */
|
||||
taskId: string
|
||||
/** ASIN 前缀。 */
|
||||
asin: string
|
||||
/** 国家代码,空串=全部。 */
|
||||
country: string
|
||||
/** 同步开始日期(ISO yyyy-MM-dd;空串不限)。 */
|
||||
startDate: string
|
||||
/** 同步结束日期(ISO yyyy-MM-dd;空串不限)。 */
|
||||
endDate: string
|
||||
}
|
||||
|
||||
export function createAppearancePatentCleanFilterState(): AppearancePatentCleanFilterState {
|
||||
return { taskId: '', asin: '', country: '', startDate: '', endDate: '' }
|
||||
}
|
||||
|
||||
/** 是否有任一激活筛选条件。 */
|
||||
export function appearancePatentCleanFilterActive(state: AppearancePatentCleanFilterState): boolean {
|
||||
if ((state.taskId || '').trim()) return true
|
||||
if ((state.asin || '').trim()) return true
|
||||
if ((state.country || '').trim()) return true
|
||||
if (validIsoDateOrUndefined(state.startDate) || validIsoDateOrUndefined(state.endDate)) return true
|
||||
return false
|
||||
}
|
||||
|
||||
/** 序列化到后端的查询参数(snake_case,仅下发非空字段)。 */
|
||||
export interface AppearancePatentCleanQuery {
|
||||
page: number
|
||||
page_size: number
|
||||
task_id?: number
|
||||
asin?: string
|
||||
country?: string
|
||||
start_date?: string
|
||||
end_date?: string
|
||||
/** 公司 tab:白名单构造不点名它,字段只为 api 发送口的 `query.company_id = params.companyId` 存在。 */
|
||||
company_id?: number
|
||||
}
|
||||
|
||||
/** api 模块的入参:筛选态 + 分页 + 公司值(camel)。 */
|
||||
export interface AppearancePatentCleanListParams {
|
||||
page: number
|
||||
pageSize: number
|
||||
taskId?: string
|
||||
asin?: string
|
||||
country?: string
|
||||
startDate?: string
|
||||
endDate?: string
|
||||
companyId?: number | null
|
||||
}
|
||||
|
||||
/** 过滤态 + 分页 → 列表查询参数;空白/非法日期不下发,分页钳制在此单出口(不含公司维)。 */
|
||||
export function toAppearancePatentCleanListParams(
|
||||
state: AppearancePatentCleanFilterState,
|
||||
page: number,
|
||||
pageSize: number,
|
||||
): AppearancePatentCleanQuery {
|
||||
const safePage = Math.min(Math.max(Math.floor(page) || 1, 1), APPEARANCE_PATENT_CLEAN_MAX_PAGE)
|
||||
const rawSize = Math.floor(pageSize) || APPEARANCE_PATENT_CLEAN_PAGE_SIZE
|
||||
const safeSize = Math.min(Math.max(rawSize, 1), APPEARANCE_PATENT_CLEAN_MAX_PAGE_SIZE)
|
||||
const query: AppearancePatentCleanQuery = { page: safePage, page_size: safeSize }
|
||||
const taskId = Number.parseInt((state.taskId || '').trim(), 10)
|
||||
if (Number.isFinite(taskId) && taskId > 0) query.task_id = taskId
|
||||
const asin = (state.asin || '').trim()
|
||||
if (asin) query.asin = asin
|
||||
const country = (state.country || '').trim()
|
||||
if (country) query.country = country
|
||||
const startDate = validIsoDateOrUndefined(state.startDate)
|
||||
if (startDate) query.start_date = startDate
|
||||
const endDate = validIsoDateOrUndefined(state.endDate)
|
||||
if (endDate) query.end_date = endDate
|
||||
return query
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/** 外观专利无侵权数据列表查询模型(v1.3 AC-5):解析 AppearancePatentCleanItemPageVo(camel),纯逻辑。
|
||||
* 行值是同步服务从 chunk payload 原样落的,读侧只搬运不加工(与后端 toVo 同一口径)。 */
|
||||
import { unwrap } from '../../api/envelope.ts'
|
||||
|
||||
export interface AppearancePatentCleanItem {
|
||||
id: number
|
||||
resultId: number | null
|
||||
taskId: number | null
|
||||
userId: number | null
|
||||
companyId: number | null
|
||||
rowNo: number | null
|
||||
asin: string
|
||||
country: string
|
||||
sku: string
|
||||
brand: string
|
||||
price: string
|
||||
title: string
|
||||
imageUrl: string
|
||||
itemUrl: string
|
||||
conclusion: string
|
||||
titleReason: string
|
||||
appearanceReason: string
|
||||
patentReason: string
|
||||
sourceFilename: string
|
||||
syncedAt?: string
|
||||
}
|
||||
|
||||
export interface AppearancePatentCleanPageResult {
|
||||
items: AppearancePatentCleanItem[]
|
||||
total: number
|
||||
page: number
|
||||
pageSize: number
|
||||
}
|
||||
|
||||
/** 前端首屏默认容量:与后端 PageDefaults.CLEAN_ITEMS_PAGE_SIZE(蓝图 §3.2 默认 10)同值。 */
|
||||
export const APPEARANCE_PATENT_CLEAN_DEFAULT_SIZE = 10
|
||||
|
||||
export function emptyAppearancePatentCleanPage(): AppearancePatentCleanPageResult {
|
||||
return { items: [], total: 0, page: 1, pageSize: APPEARANCE_PATENT_CLEAN_DEFAULT_SIZE }
|
||||
}
|
||||
|
||||
function text(value: unknown): string {
|
||||
return typeof value === 'string' ? value.trim() : ''
|
||||
}
|
||||
|
||||
function numberOrNull(value: unknown): number | null {
|
||||
return typeof value === 'number' && Number.isFinite(value) ? Math.floor(value) : null
|
||||
}
|
||||
|
||||
/** 解析单行明细;缺 id 视为无效。camel 为正、snake 容错(与去重页模型同形)。 */
|
||||
export function toAppearancePatentCleanItem(raw: unknown): AppearancePatentCleanItem | null {
|
||||
if (!raw || typeof raw !== 'object') return null
|
||||
const record = raw as Record<string, unknown>
|
||||
const id = numberOrNull(record.id)
|
||||
if (id === null) return null
|
||||
return {
|
||||
id,
|
||||
resultId: numberOrNull(record.resultId ?? record.result_id),
|
||||
taskId: numberOrNull(record.taskId ?? record.task_id),
|
||||
userId: numberOrNull(record.userId ?? record.user_id),
|
||||
companyId: numberOrNull(record.companyId ?? record.company_id),
|
||||
rowNo: numberOrNull(record.rowNo ?? record.row_no),
|
||||
asin: text(record.asin),
|
||||
country: text(record.country),
|
||||
sku: text(record.sku),
|
||||
brand: text(record.brand),
|
||||
price: text(record.price),
|
||||
title: text(record.title),
|
||||
imageUrl: text(record.imageUrl ?? record.image_url),
|
||||
itemUrl: text(record.itemUrl ?? record.item_url),
|
||||
conclusion: text(record.conclusion),
|
||||
titleReason: text(record.titleReason ?? record.title_reason),
|
||||
appearanceReason: text(record.appearanceReason ?? record.appearance_reason),
|
||||
patentReason: text(record.patentReason ?? record.patent_reason),
|
||||
sourceFilename: text(record.sourceFilename ?? record.source_filename),
|
||||
syncedAt: text(record.syncedAt ?? record.synced_at) || undefined,
|
||||
}
|
||||
}
|
||||
|
||||
/** 归一化分页负载(信封或已解包 VO)为前端结果;缺省字段回默认。无 keyset 游标(蓝图 Out of Scope)。 */
|
||||
export function parseAppearancePatentCleanPage(payload: unknown): AppearancePatentCleanPageResult {
|
||||
const out = emptyAppearancePatentCleanPage()
|
||||
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) => toAppearancePatentCleanItem(raw))
|
||||
.filter((item): item is AppearancePatentCleanItem => 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
|
||||
}
|
||||
|
||||
/** 结论单元格的悬停全文:三因齐给,空因不下发(读侧不加工的展示面出口)。 */
|
||||
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')
|
||||
}
|
||||
@@ -44,6 +44,7 @@ export const adminPages: AdminPageDef[] = [
|
||||
{ path: 'asin-center/query', menuKey: 'admin_query_asin', title: '查询ASIN', companyScoped: true, load: () => import('@/pages/asin/QueryAsinPage.vue') },
|
||||
{ path: 'asin-center/categories', menuKey: 'admin_product_categories', title: '商品类目', companyScoped: false, load: () => import('@/pages/asin/ProductCategoryPage.vue') },
|
||||
{ path: 'asin-center/skip-price', menuKey: 'admin_skip_price_asin', title: '最低价ASIN', companyScoped: true, load: () => import('@/pages/asin/SkipPricePage.vue') },
|
||||
{ path: 'patent-center/clean-items', menuKey: 'admin_appearance_patent_clean_items', title: '外观专利无侵权数据', companyScoped: true, load: () => import('@/pages/patent/AppearancePatentCleanItemsPage.vue') },
|
||||
]
|
||||
|
||||
export function routeOf(page: AdminPageDef): RouteRecordRaw {
|
||||
|
||||
Reference in New Issue
Block a user