refactor(phase-6): 拆分交付工作区与任务中心,五支队列 Tab 收敛到共享匹配表

- DeliveryVideoWorkspace 2690→2176 行,弹窗与结果面板下沉为 4 个子组件,类型抽到共享模块
- TaskCenterBoardPage 1017→834 行,任务表/变体表下沉,失败条与轮询入口留在页面
- 巡店删除/取款/查 ASIN/跟价/商品风险五支 Tab 共用 BrandShopMatchTable,纯逻辑收敛到 brand-shop-match-shared
- admin manualChunks 增加 element-plus 分组(915KB 独立 chunk)
- 源码钉按新落点更新:分页与表格断言读子组件,页面接线断言保留
This commit is contained in:
2026-10-24 21:53:10 +08:00
parent a7682bffef
commit 969f86c612
18 changed files with 1472 additions and 1272 deletions
@@ -28,6 +28,8 @@ import {
// 客户端任务管理看板(后台):路由注册 / guides 对齐 / 接口层 / 纯逻辑映射。
const PAGE = 'src/pages/task-center/TaskCenterBoardPage.vue'
const TASK_TABLE = 'src/pages/task-center/TaskCenterTaskTable.vue'
const VARIANT_TABLE = 'src/pages/task-center/TaskCenterVariantTable.vue'
const API = 'src/api/task-center.ts'
test('task_center_route_registered_with_menu_key', () => {
@@ -222,8 +224,8 @@ test('task_center_collect_data_progress_wording_matches_the_client', () => {
* 留一条 0% 空进度轨会被读成「进度 0%」,和「这里没有进度可看」是两件事。
*/
test('task_center_progress_bar_is_dropped_when_there_is_no_progress', () => {
const page = readSource(PAGE)
assert.match(page, /<div class="p-track" v-if="row\.progressTotal > 0">/, '无进度时不画进度轨')
const table = readSource(TASK_TABLE)
assert.match(table, /<div class="p-track" v-if="row\.progressTotal > 0">/, '无进度时不画进度轨')
})
/**
@@ -232,11 +234,11 @@ test('task_center_progress_bar_is_dropped_when_there_is_no_progress', () => {
* 失败行(含详情抽屉)只给失败徽标,不给进度条也不说「已完成」。
*/
test('task_center_failed_rows_never_render_a_progress_bar', () => {
const page = readSource(PAGE)
const sources = { row: readSource(TASK_TABLE), detail: readSource(PAGE) }
for (const scope of ['row', 'detail']) {
const branch = new RegExp(
`<template v-if="taskStatusType\\(${scope}\\.status\\) === 'failed'">[\\s\\S]{0,400}?</template>`,
).exec(page)
).exec(sources[scope as keyof typeof sources])
assert.ok(branch, `${scope} 的失败分支存在`)
assert.equal(branch[0].includes('p-track'), false, '失败分支不画进度轨')
assert.equal(branch[0].includes('progressText'), false, '失败分支不说「已完成 X / 总 Y」')
@@ -287,12 +289,12 @@ test('task_center_filter_reset_clears_every_field', () => {
test('task_center_page_handles_empty_and_error_states', () => {
const page = readSource(PAGE)
assert.match(page, /暂无符合条件的任务/, '任务空态')
assert.match(page, /暂无变体采集任务/, '变体空态:四态口径下不再限定「在跑」')
assert.match(readSource(TASK_TABLE), /暂无符合条件的任务/, '任务空态')
assert.match(readSource(VARIANT_TABLE), /暂无变体采集任务/, '变体空态:四态口径下不再限定「在跑」')
assert.match(page, /showAdminFeedback\([^\n]*, 'error'\)/, '接口失败提示走统一出口')
assert.match(page, /resetFilter/, '筛选重置接线')
assert.match(page, /@size-change="changeTaskSize"/, '分页每页条数切换')
assert.match(page, /@size-change="changeVariantSize"/, '变体分页每页条数切换')
assert.match(page, /@size="changeTaskSize"/, '分页每页条数切换')
assert.match(page, /@size="changeVariantSize"/, '变体分页每页条数切换')
})
test('task_center_has_no_shop_panel_anymore', () => {
@@ -303,7 +305,7 @@ test('task_center_has_no_shop_panel_anymore', () => {
assert.equal(readSource(API).includes('/api/admin/task-center/shops'), false, '接口层不留 /shops')
assert.match(page, /fetchTaskCenterShopOptions/, '店铺筛选候选仍要取数')
assert.match(page, /v-for="shop in shopOptions"/, '下拉候选就是店铺库本身,不再并入面板出现的店铺')
assert.match(page, /最近上报/, '任务表仍带最近上报')
assert.match(readSource(TASK_TABLE), /最近上报/, '任务表仍带最近上报')
assert.equal(page.includes('device-strip'), false, '设备卡条已删除')
})
@@ -318,18 +320,20 @@ test('task_center_has_no_shop_panel_anymore', () => {
*/
test('task_center_task_list_columns_are_trimmed_to_the_data_that_exists', () => {
const page = readSource(PAGE)
const table = readSource(TASK_TABLE)
const style = page.slice(page.indexOf('<style scoped>'))
assert.match(page, /<th style="width: 170px">任务ID<\/th>/, '「当前处理」列改名任务ID')
assert.equal(/<th[^>]*>当前处理<\/th>/.test(page), false, '列表不再有全「—」的当前处理列')
assert.match(page, /<td>\s*<button class="cell-link mono" type="button" @click="openDetail\(row\)">\{\{ row\.id \}\}<\/button>/, 'ID 单元格点开详情')
assert.match(page, /:key="row\.taskNo"/, ':key 仍是唯一任务号(biz 与 brand 两张表的自增 id 会撞)')
assert.match(table, /<th style="width: 170px">任务ID<\/th>/, '「当前处理」列改名任务ID')
assert.equal(/<th[^>]*>当前处理<\/th>/.test(table), false, '列表不再有全「—」的当前处理列')
assert.match(table, /<td>\s*<button class="cell-link mono" type="button" @click="emit\('open', row\)">\{\{ row\.id \}\}<\/button>/, 'ID 单元格点开详情')
assert.match(table, /:key="row\.taskNo"/, ':key 仍是唯一任务号(biz 与 brand 两张表的自增 id 会撞)')
assert.match(page, /@open="openDetail"/, '页面把表格行点击接到详情抽屉')
assert.equal(/<span class="sub">\{\{ row\.taskNo \}\}<\/span>/.test(page), false, '账号下方不再重复任务号')
assert.equal(/<th[^>]*>操作<\/th>/.test(page), false, '操作列已删')
assert.equal(page.includes('btn-sm'), false, '没有别的按钮后 btn-sm 样式一并撤掉')
assert.equal(page.match(/colspan="10"/g)?.length, 2, '加载中/空态两处 = 任务表 10 列(含国家)')
assert.equal(/colspan="9"/.test(page), false, '加国家列后空态不该还写 9 列')
assert.equal(/<span class="sub">\{\{ row\.taskNo \}\}<\/span>/.test(table), false, '账号下方不再重复任务号')
assert.equal(/<th[^>]*>操作<\/th>/.test(table), false, '操作列已删')
assert.equal(table.includes('btn-sm'), false, '没有别的按钮后 btn-sm 样式一并撤掉')
assert.equal(table.match(/colspan="10"/g)?.length, 2, '加载中/空态两处 = 任务表 10 列(含国家)')
assert.equal(/colspan="9"/.test(table), false, '加国家列后空态不该还写 9 列')
assert.match(style, /\.shop-filter\s*\{[^}]*position: relative/, '店铺组是提示的定位父元素')
assert.match(style, /\.filter-tip\s*\{[^}]*position: absolute/, '提示绝对定位,不再撑高该组把 label 顶上去')
@@ -343,9 +347,10 @@ test('task_center_task_list_columns_are_trimmed_to_the_data_that_exists', () =>
test('task_center_country_column_is_display_only', () => {
const page = readSource(PAGE)
const table = readSource(TASK_TABLE)
assert.match(page, /<th style="width: 90px">国家<\/th>/, '国家列在店铺与业务之间')
assert.match(page, /<td>\{\{ countryLabel\(row\.country\) \}\}<\/td>/,
assert.match(table, /<th style="width: 90px">国家<\/th>/, '国家列在店铺与业务之间')
assert.match(table, /<td>\{\{ countryLabel\(row\.country\) \}\}<\/td>/,
'国家码转中文展示(UK→英国),空值由 countryLabel 画「—」')
assert.equal(readSource(API).includes('country: string | null'), true, '接口类型带 country 且可为 null')
@@ -413,7 +418,17 @@ test('task_center_page_wires_tabs_filters_and_polling', () => {
assert.match(page, /变体采集/, '页签二文案')
assert.match(page, /panel-box/, '复用全局 panel-box 样式')
assert.match(page, /form-row/, '复用全局筛选行样式')
assert.match(page, /OldPagination/, '旧版分页组件')
// 2026-10-24 拆分:两个表格子组件各自持有分页器,页面负责传 total/page/pageSize 并接事件。
for (const table of [
'src/pages/task-center/TaskCenterTaskTable.vue',
'src/pages/task-center/TaskCenterVariantTable.vue',
]) {
const src = readSource(table)
assert.match(src, /OldPagination/, `${table} 用旧版分页组件`)
assert.match(src, /@size-change="emit\('size', \$event\)"/, `${table} 分页事件上抛`)
}
assert.match(page, /TaskCenterTaskTable/, '页面接入客户端任务表格')
assert.match(page, /TaskCenterVariantTable/, '页面接入变体采集表格')
assert.match(page, /formatDateTime/, '统一时间格式')
assert.match(page, /el-drawer/, '任务详情抽屉')
assert.match(page, /疑似卡住/, 'stuck 徽标文案')
@@ -422,7 +437,7 @@ test('task_center_page_wires_tabs_filters_and_polling', () => {
assert.match(page, /document\.visibilityState/, '隐藏时跳过轮询')
assert.match(page, /POLL_INTERVAL_MS/, '30s 轮询常量')
assert.match(page, /clearInterval/, '卸载清理定时器')
assert.match(page, /resMes/, '变体表展示麦象 res_mes')
assert.match(readSource(VARIANT_TABLE), /resMes/, '变体表展示麦象 res_mes')
assert.equal(/shopName/.test(readSource(PAGE)), true)
})
@@ -433,8 +448,8 @@ test('task_center_page_wires_tabs_filters_and_polling', () => {
* (task-center.ts 的类型保持如实),只是页面不渲染。
*/
test('task_center_variant_result_column_dumps_no_raw_task_data', () => {
const page = readSource(PAGE)
assert.doesNotMatch(page, /taskData/, '变体表不再渲染 task_data 原始 JSON')
assert.doesNotMatch(readSource(VARIANT_TABLE), /taskData/, '变体表不再渲染 task_data 原始 JSON')
assert.doesNotMatch(readSource(PAGE), /taskData/, '页面不把 task_data 透传给表格')
})
/**