feat(appearance-patent): 外观专利数据库卡片按所属主管分组显示+字段精简(2026-11-11 客户拍板「要按主管分组显示」「价格 asin 无侵权 这些都不需要展示的」「到时候能下载表格看就行」)——卡片按主管连续切段,组头=主管名+本页条数(保持服务端 synced_at DESC 行序、不跨页聚合、不按名重排;同名主管被隔开按行序出多个同名组头,只看单人走既有分组下拉);卡片字段精简为 标题(卡头替下 ASIN)/任务/国家/品牌/SKU/同步,价格、ASIN、结论徽章(无侵权)、所属主管行全部下卡(主管由组头表达,全量明细含价格/ASIN/结论/主管列仍走 /export xlsx);退役 cleanItemReasonTooltip(唯一消费者=结论徽章悬停);取数/过滤面/导出/公司tab契约一字未动(company-tab-wiring watch token 与 date-filter 豁免照旧);挂载测试 11→13 例适配(分组切段+组头计数/连续切段不重排/空主管 - 三用例新钉,ASIN/价格/徽章反断言),vue-tsc rc=0、vitest 13 绿、扫本文件三支 node --test 21 绿

This commit is contained in:
2026-11-11 11:27:57 +08:00
parent f218766a55
commit 3cfca462ce
3 changed files with 124 additions and 120 deletions
@@ -3,8 +3,11 @@
*
* 展示形式(2026-11-11 客户改版,推翻 2026-11-10「参照去重库页自绘 table、不做卡片宫格」的
* 旧拍板):参照「店铺数据记录」页(ShopDataTasksPage)——form-box 筛选条件 + panel-box
* 工具条[导出] + 卡片宫格(每卡一条明细:ASIN/任务号/结论徽章/所属主管/国家/品牌/SKU/价格/
* 标题/同步时间)+ `OldPagination.vue` 服务端分页。筛选面同日二次精简(客户「按账号对应的
* 工具条[导出] + 卡片宫格 + `OldPagination.vue` 服务端分页。同日三改(客户「要按主管分组
* 显示」「价格 asin 无侵权 这些都不需要展示的」「到时候能下载表格看就行」):卡片按所属主管
* 连续分组(组头=主管名+本页条数,保持行序、不跨页聚合、不按名重排),每卡一条明细:标题
* (卡头)/任务号/国家/品牌/SKU/同步时间;价格、ASIN、结论徽章(无侵权)、所属主管行不再
* 上卡——全量明细(含价格/ASIN/结论/主管列)仍走 /export xlsx。筛选面同日二次精简(客户「按账号对应的
* 主管吧 不需要店铺」):分组(=主管)/国家/起止时间三样,任务号/ASIN 输入框下架(后端
* §3.2 参数契约与过滤模块逐字对撞护栏保留,UI 不再暴露)。取数/导出/公司 tab 契约不变:
* `companyScoped: true` 公司 Tab;`page`/`page_size` snake 参数,响应
@@ -16,7 +19,7 @@
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { flushPromises, mount, type DOMWrapper, type VueWrapper } from '@vue/test-utils'
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
import { createPinia, setActivePinia, type Pinia } from 'pinia'
import AppearancePatentCleanItemsPage from '@/pages/patent/AppearancePatentCleanItemsPage.vue'
@@ -91,6 +94,7 @@ describe('AC-5 外观专利无侵权数据页(卡片宫格,2026-11-11 改版
expect(src).toContain('OldPagination')
expect(src).toContain('clean-card-grid', '卡片宫格容器必须就位(2026-11-11 客户改版)')
expect(src).toContain('clean-card-head', '卡片本体结构必须就位')
expect(src).toContain('clean-group-head', '主管分组头必须就位(2026-11-11 三改「按主管分组显示」)')
expect(src).not.toContain('<table', '改版后不再有自绘行列表(推翻 2026-11-10 旧拍板)')
expect(src).not.toContain('el-card')
})
@@ -116,26 +120,52 @@ describe('AC-5 外观专利无侵权数据页(卡片宫格,2026-11-11 改版
expect(firstCall.companyId).toBe(1)
expect(wrapper.findAll('.clean-card')).toHaveLength(2, '一卡一条明细')
expect(wrapper.text()).toContain('共 42 条')
expect(wrapper.text()).toContain('B0AB8CDEF1')
expect(wrapper.text()).toContain('无侵权')
// 2026-11-11 三改:ASIN/价格/结论徽章不再上卡(全量明细走导出),卡头换成标题
expect(wrapper.text()).not.toContain('B0AB8CDEF1')
expect(wrapper.text()).not.toContain('29.99')
expect(wrapper.find('.st-pill').exists()).toBe(false, '无侵权结论徽章不再上卡')
const heads = wrapper.findAll('.clean-card-head')
expect(heads).toHaveLength(2)
expect(heads[0].text()).toContain('无侵权商品 1', '卡头=标题(替下原 ASIN 卡头)')
})
it('所属主管行(2026-11-11 客户需求):卡片行就位,行值展示 supervisorName,读不到展示 -', async () => {
it('按所属主管分组显示(2026-11-11 三改):组头=主管名+本页条数,卡片不再重复主管行', async () => {
const wrapper = await mountWith({
items: [row(1, { supervisorName: '主管甲' }), row(2, { supervisorName: '' })],
total: 2,
items: [row(1, { supervisorName: '主管甲' }), row(2, { supervisorName: '主管甲' }), row(3, { supervisorName: '主管乙' })],
total: 3,
page: 1,
pageSize: 10,
})
const cards = wrapper.findAll('.clean-card')
expect(cards).toHaveLength(2)
const supervisorValue = (card: DOMWrapper<Element>): string => {
const rowEl = card.findAll('.clean-card-row').find((r) => r.find('.clean-card-label').text() === '所属主管')
expect(rowEl, '每张卡必须有「所属主管」行').toBeTruthy()
return rowEl!.find('.clean-card-value').text()
}
expect(supervisorValue(cards[0])).toBe('主管甲')
expect(supervisorValue(cards[1])).toBe('-', '读不到主管不猜名字,展示 -')
const heads = wrapper.findAll('.clean-group-head')
expect(heads).toHaveLength(2, '连续同主管的行切段成组')
expect(heads[0].text()).toContain('主管甲')
expect(heads[0].text()).toContain('本页 2 条')
expect(heads[1].text()).toContain('主管乙')
expect(heads[1].text()).toContain('本页 1 条')
expect(wrapper.findAll('.clean-card')).toHaveLength(3, '组头不占卡片位,三张明细卡都在')
// 主管行已由组头表达,卡片不再重复;价格行同批下卡
expect(wrapper.text()).not.toContain('所属主管')
expect(wrapper.text()).not.toContain('价格')
})
it('分组只在当前页窗口内连续切段:保持服务端行序、不跨页聚合、不按名重排', async () => {
const wrapper = await mountWith({
items: [row(1, { supervisorName: '主管甲' }), row(2, { supervisorName: '主管乙' }), row(3, { supervisorName: '主管甲' })],
total: 3,
page: 1,
pageSize: 10,
})
const names = wrapper.findAll('.clean-group-name').map((n) => n.text())
expect(names).toEqual(['主管甲', '主管乙', '主管甲'], '同名主管被隔开时按行序出多个同名组头,忠实反映同步顺序')
expect(wrapper.findAll('.clean-card')).toHaveLength(3)
})
it('读不到主管名的行不猜:组头展示 -(与旧卡片行同口径)', async () => {
const wrapper = await mountWith({ items: [row(9, { supervisorName: '' })], total: 1, page: 1, pageSize: 10 })
const heads = wrapper.findAll('.clean-group-head')
expect(heads).toHaveLength(1)
expect(heads[0].text()).toContain('-', '读不到主管展示 -')
expect(heads[0].text()).toContain('本页 1 条')
})
it('导出按钮带当前过滤面与公司 tab 调导出接口,成功触发 blob 落盘', async () => {