191e5f9102
撞款控制台整页复刻 reference 观感:引入页面独立 reference 令牌(#2E5BE6 主蓝/#D63A4A 红/#F2F4F8 底)落到 KPI 色点/矩阵单元格/撞款卡/台账 chips;撞款覆盖矩阵与全部ASIN台账改原生表格(台账20条/页+共N条/上一页/下一页/跳至N页分页条,列头服务端排序▲/▼);筛选改原生 input/select/date;明细抽屉+底部 toast 复刻 reference(原生 mask/drawer/d-table 汇总徽章);分组说明只读(归属来自店铺管理)。 数据源保持自家 /api/admin/shop-data-crawl/duplicate-check-console|-ledger|-export 不变。 验收:mock-admin-server 补 console/ledger 夹具;新增 e2e dup-console.spec(渲染/台账切换/令牌色值/矩阵台账结构断言+截图);align-dup-console/align-column-width 断言随原生表格调整;前端 1552 测试全绿 + vue-tsc/build 通过。
59 lines
3.5 KiB
TypeScript
59 lines
3.5 KiB
TypeScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { readSource } from './helpers.ts'
|
|
import { aggregateDrawerRows, drawerSummaryOf } from '../src/pages/tasks/duplicate-console-logic.ts'
|
|
|
|
// 验收反馈:店铺重复检测对齐 reference —— 本轮补齐 P0 缺口:
|
|
// 分组筛选生效、抽屉聚合+汇总徽章、台账计数打开即显示、撞款计数走后端 total_dup、矩阵表头吸顶。
|
|
|
|
test('align_dup_console_group_filter_wired', () => {
|
|
const api = readSource('src/pages/tasks/duplicate-console-api.ts')
|
|
assert.match(api, /query\.group = group/, 'console 查询携带 group 参数')
|
|
const page = readSource('src/pages/tasks/DuplicateCheckPage.vue')
|
|
assert.match(page, /group: filter\.group\.trim\(\)/, '页面筛选把 group 传给查询')
|
|
})
|
|
|
|
test('align_dup_console_group_filter_backend', () => {
|
|
const ctrl = readSource('../backend-java/src/main/java/com/nanri/aiimage/modules/shopduplicatecheck/controller/AdminShopDataDuplicateCheckController.java')
|
|
assert.match(ctrl, /@RequestParam\(name = "group"/, '后端 console/ledger 接收 group 参数')
|
|
assert.match(ctrl, /withGroupFilter\(visibleKeys, scan, group\)/, '端点按分组裁剪可见店铺')
|
|
const service = readSource('../backend-java/src/main/java/com/nanri/aiimage/modules/shopduplicatecheck/service/ShopDataDuplicateCheckQueryService.java')
|
|
assert.match(service, /withGroupFilter/, 'service 提供分组裁剪方法')
|
|
assert.match(service, /分组筛选/, '分组筛选留中文排查日志')
|
|
})
|
|
|
|
test('align_dup_console_drawer_aggregation', () => {
|
|
const rows = aggregateDrawerRows([
|
|
{ asin: 'A', date: '2026-09-02 10:00', price: '1', brand: 'B', shopName: '店1', groupName: '组1', countryCodes: [], country: 'DE' },
|
|
{ asin: 'A', date: '2026-09-01 10:00', price: '1', brand: 'B', shopName: '店1', groupName: '组1', countryCodes: [], country: 'DE' },
|
|
{ asin: 'A', date: '2026-09-03 10:00', price: '1', brand: 'B', shopName: '店2', groupName: '组1', countryCodes: [], country: 'UK' },
|
|
])
|
|
assert.equal(rows.length, 2, '按店铺×站点聚合')
|
|
assert.equal(rows[0].count, 2, '同店同站次数累加')
|
|
assert.deepEqual(rows[0].times, ['2026-09-01 10:00', '2026-09-02 10:00'], '时间升序')
|
|
const summary = drawerSummaryOf(rows.flatMap((row) => row.times.map((time) => ({ asin: 'A', date: time, price: '1', brand: 'B', shopName: row.shopName, groupName: '组1', countryCodes: [], country: row.country }))))
|
|
assert.equal(summary.shopCount, 2)
|
|
assert.equal(summary.totalRecords, 3)
|
|
assert.equal(summary.earliest, '2026-09-01 10:00')
|
|
})
|
|
|
|
test('align_dup_console_drawer_template', () => {
|
|
const page = readSource('src/pages/tasks/DuplicateCheckPage.vue')
|
|
assert.match(page, /drawerAggRows/, '抽屉渲染聚合行')
|
|
assert.match(page, /drawerSummary/, '抽屉渲染汇总徽章')
|
|
assert.match(page, /次上架/, '汇总含 N 次上架')
|
|
assert.match(page, /<th[^>]*>次数<\/th>/, '聚合表含次数列')
|
|
})
|
|
|
|
test('align_dup_console_ledger_total_preload', () => {
|
|
const page = readSource('src/pages/tasks/DuplicateCheckPage.vue')
|
|
assert.match(page, /onMounted\(\(\) => \{\s*loadConsole\(\).*loadLedger\(1\)/s, '挂载即预取台账计数')
|
|
assert.match(page, /totalDup/, '撞款计数走后端 total_dup 字段')
|
|
})
|
|
|
|
test('align_dup_console_matrix_sticky', () => {
|
|
const page = readSource('src/pages/tasks/DuplicateCheckPage.vue')
|
|
assert.match(page, /table\.matrix th\s*\{[^}]*position:\s*sticky/, '矩阵表头吸顶')
|
|
assert.match(page, /\.matrix-wrap\s*\{[^}]*max-height/, '矩阵容器限高滚动')
|
|
})
|