feat(看板): 删净在跑店铺看板,进度文案对齐客户端,加国家列,默认筛「在跑」
- 店铺看板整条移除(面板/`/shops`/`shops()`/`TaskCenterShopVo`),汇总卡「在跑店铺」保留; - 采集数据行进度改成客户端那句「关键词进度:第 N/总 个」(只改文字,数字口径与夹取不变), 其余无进度条的模块仍显示「—」; - 列表加「国家」列:值来自 request_json 的 7 条路径(线上实测顺序与覆盖 315/451=69.8%), 按页内主键点查、不进列表 UNION,以免把大 JSON 列拉回已知慢查询;品牌行不发查询; 只展示不筛选,无迁移; - 状态默认「在跑」= PENDING∪RUNNING∪SCHEDULED,前端下发 ACTIVE 哨兵、只在服务层 statusFilter 一处展开,成员与 ACTIVE_STATUS_SET/ACTIVE_STATUSES 同源钉死; - 护栏:后端 task-center 77 例(新增状态 IN 渲染、7 路径顺序、归一两形态、品牌不查国家等)、 前端 21 例;4 个变异点(路径顺序/哨兵不展开/归一截断/文案分支)全部被抓到并字节级还原。
This commit is contained in:
@@ -4,6 +4,7 @@ import { readSource } from './helpers.ts'
|
||||
import { adminPages, validateAdminPages } from '../src/router/routes.ts'
|
||||
import { operationGuideFor } from '../src/layout/operation-guides.ts'
|
||||
import {
|
||||
ACTIVE_TASK_STATUS,
|
||||
MODULE_OPTIONS,
|
||||
TASK_STATUS_OPTIONS,
|
||||
VARIANT_STATUS_OPTIONS,
|
||||
@@ -44,11 +45,10 @@ test('task_center_guide_present_for_menu_key', () => {
|
||||
assert.equal(guide.steps.length, 3)
|
||||
})
|
||||
|
||||
test('task_center_api_has_six_endpoints', () => {
|
||||
test('task_center_api_has_five_endpoints', () => {
|
||||
const api = readSource(API)
|
||||
for (const path of [
|
||||
'/api/admin/task-center/overview',
|
||||
'/api/admin/task-center/shops',
|
||||
'/api/admin/task-center/shop-options',
|
||||
'/api/admin/task-center/tasks',
|
||||
'/api/admin/task-center/tasks/detail',
|
||||
@@ -58,7 +58,6 @@ test('task_center_api_has_six_endpoints', () => {
|
||||
}
|
||||
for (const fn of [
|
||||
'fetchTaskCenterOverview',
|
||||
'fetchTaskCenterShops',
|
||||
'fetchTaskCenterShopOptions',
|
||||
'fetchTaskCenterTasks',
|
||||
'fetchTaskCenterTaskDetail',
|
||||
@@ -166,6 +165,43 @@ test('task_center_progress_counts_done_rows_like_the_client', () => {
|
||||
assert.equal(progressPercent({ progressSuccess: -5, progressFailed: 0, progressTotal: 10 }), 0, '脏负数不按负进度画')
|
||||
})
|
||||
|
||||
/**
|
||||
* 采集数据的进度文案逐字抄客户端(BrandCollectDataTab.vue taskKeywordProgress):
|
||||
* 客户端从不显示「已完成 0 / 总 1」,看板这么写就会被读成任务卡在第 0 步。
|
||||
* N = 已处理 + 1(下一个要处理的关键词),封顶总个数——跑完时客户端也停在「第 总/总 个」,不会跳到 总+1。
|
||||
*/
|
||||
test('task_center_collect_data_progress_wording_matches_the_client', () => {
|
||||
assert.equal(
|
||||
progressText({ progressSuccess: 0, progressFailed: 0, progressTotal: 1, moduleType: 'COLLECT_DATA' }),
|
||||
'关键词进度:第 1/1 个',
|
||||
)
|
||||
assert.equal(
|
||||
progressText({ progressSuccess: 1, progressFailed: 0, progressTotal: 2, moduleType: 'COLLECT_DATA' }),
|
||||
'关键词进度:第 2/2 个',
|
||||
'已处理 1/2 ⇒ 正在处理第 2 个,不是 50% 那种读法',
|
||||
)
|
||||
assert.equal(
|
||||
progressText({ progressSuccess: 41, progressFailed: 0, progressTotal: 41, moduleType: 'COLLECT_DATA' }),
|
||||
'关键词进度:第 41/41 个',
|
||||
'跑完不溢出成 42/41',
|
||||
)
|
||||
assert.equal(
|
||||
progressText({ progressSuccess: 3, progressFailed: 0, progressTotal: 10, moduleType: 'collect_data' }),
|
||||
'关键词进度:第 4/10 个',
|
||||
'大小写差异不放过(品牌任务状态就是小写)',
|
||||
)
|
||||
assert.equal(
|
||||
progressText({ progressSuccess: 3, progressFailed: 0, progressTotal: 10, moduleType: 'PUBLISH' }),
|
||||
'已完成 3 / 总 10',
|
||||
'只有采集数据换文案,按文件数计进度的模块不动',
|
||||
)
|
||||
assert.equal(
|
||||
progressText({ progressSuccess: 0, progressFailed: 0, progressTotal: 0, moduleType: 'COLLECT_DATA' }),
|
||||
'—',
|
||||
'客户端 total 不可用时也是空串,这边继续画「—」',
|
||||
)
|
||||
})
|
||||
|
||||
/**
|
||||
* 后端把「客户端没有进度条」的模块(跟价/定时匹配)progressTotal 置 0 ⇒ 前端只画「—」:
|
||||
* 留一条 0% 空进度轨会被读成「进度 0%」,和「这里没有进度可看」是两件事。
|
||||
@@ -218,7 +254,6 @@ 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(page, /暂无在跑的变体采集任务/, '变体空态:口径是在跑不是全部')
|
||||
assert.match(page, /ElMessage\.error/, '接口失败提示')
|
||||
assert.match(page, /resetFilter/, '筛选重置接线')
|
||||
@@ -226,16 +261,15 @@ test('task_center_page_handles_empty_and_error_states', () => {
|
||||
assert.match(page, /@size-change="changeVariantSize"/, '变体分页每页条数切换')
|
||||
})
|
||||
|
||||
test('task_center_shop_panel_is_the_board_and_drills_down_by_exact_shop', () => {
|
||||
test('task_center_has_no_shop_panel_anymore', () => {
|
||||
const page = readSource(PAGE)
|
||||
assert.match(page, /在跑店铺看板/, '面板标题')
|
||||
assert.match(page, /最近上报/, '面板与任务表都带最近上报')
|
||||
assert.match(page, /row\.noShop \? null : selectShop\(row\.shop\)/, '点店铺行下钻,「不挂店铺」桶不可点')
|
||||
assert.match(page, /不落店铺/, '桶行说明:这类任务本来就没有店铺维度')
|
||||
assert.match(page, /shopFilterOptions/, '店铺下拉候选 = 店铺库 ∪ 面板出现的店铺')
|
||||
assert.match(page, /fetchTaskCenterShops/, '面板取数')
|
||||
assert.match(page, /fetchTaskCenterShopOptions/, '候选取数')
|
||||
assert.match(page, /moduleSummary/, '业务分布列')
|
||||
for (const gone of ['在跑店铺看板', 'selectShop', 'shopFilterOptions', 'fetchTaskCenterShops', 'moduleSummary']) {
|
||||
assert.equal(page.includes(gone), false, `店铺看板已整条拆除,页面里不该再出现 ${gone}`)
|
||||
}
|
||||
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.equal(page.includes('device-strip'), false, '设备卡条已删除')
|
||||
})
|
||||
|
||||
@@ -260,8 +294,8 @@ test('task_center_task_list_columns_are_trimmed_to_the_data_that_exists', () =>
|
||||
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(/colspan="10"/.test(page), false, '任务表空态不再是 10 列')
|
||||
assert.equal(page.match(/colspan="9"/g)?.length, 2, '加载中/空态两处收到 9 列')
|
||||
assert.equal(page.match(/colspan="10"/g)?.length, 2, '加载中/空态两处 = 任务表 10 列(含国家)')
|
||||
assert.equal(/colspan="9"/.test(page), false, '加国家列后空态不该还写 9 列')
|
||||
|
||||
assert.match(style, /\.shop-filter\s*\{[^}]*position: relative/, '店铺组是提示的定位父元素')
|
||||
assert.match(style, /\.filter-tip\s*\{[^}]*position: absolute/, '提示绝对定位,不再撑高该组把 label 顶上去')
|
||||
@@ -273,6 +307,41 @@ 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)
|
||||
|
||||
assert.match(page, /<th style="width: 90px">国家<\/th>/, '国家列在店铺与业务之间')
|
||||
assert.match(page, /<td class="mono">\{\{ row\.country \|\| '—' \}\}<\/td>/,
|
||||
'取不到国家画「—」:七条 JSON 路径只覆盖约七成行,留白会被读成数据缺失')
|
||||
assert.equal(readSource(API).includes('country: string | null'), true, '接口类型带 country 且可为 null')
|
||||
|
||||
// 只加列,不做筛选(用户 2026-10-04 定案):不许冒出国家筛选或 country 查询参数
|
||||
assert.equal(/filter\.country/.test(page), false, '没有国家筛选')
|
||||
assert.equal('country' in buildTaskQuery({ ...createTaskFilter(), status: 'ACTIVE' }, 1, 20), false,
|
||||
'查询参数不带 country')
|
||||
})
|
||||
|
||||
/**
|
||||
* 默认「在跑」(用户 2026-10-04 要求:其他状态保留,但默认看执行中的):
|
||||
* ACTIVE 是三个进行中状态的合并哨兵,展开发生在后端,所以这里只钉
|
||||
* ① 选项在位且排在「全部状态」之后,② 页面默认值与重置都走它,③ createTaskFilter 仍是全空
|
||||
* (全空 = 不裁剪,是「重置到无筛选」语义的底座,页面默认值再覆盖上去)。
|
||||
*/
|
||||
test('task_center_defaults_to_the_merged_active_status', () => {
|
||||
assert.equal(TASK_STATUS_OPTIONS[0].value, '', '首项仍是全部状态')
|
||||
assert.equal(TASK_STATUS_OPTIONS[1].value, ACTIVE_TASK_STATUS, '第二项就是默认的在跑')
|
||||
assert.deepEqual(TASK_STATUS_OPTIONS.map((o) => o.value),
|
||||
['', 'ACTIVE', 'PENDING', 'RUNNING', 'SCHEDULED', 'SUCCESS', 'FAILED', 'CANCELLED'],
|
||||
'七个状态一个不少(用户要求历史状态保留入口)')
|
||||
assert.equal(buildTaskQuery({ ...createTaskFilter(), status: ACTIVE_TASK_STATUS }, 1, 20).status, 'ACTIVE',
|
||||
'哨兵原样下传,展开在后端做')
|
||||
assert.equal(createTaskFilter().status, '', 'createTaskFilter 保持全空')
|
||||
|
||||
const page = readSource(PAGE)
|
||||
assert.match(page, /status: ACTIVE_TASK_STATUS/, '页面默认筛在跑')
|
||||
assert.match(page, /Object\.assign\(filter, defaultTaskFilter\(\)\)/, '重置回到默认「在跑」而不是全部状态')
|
||||
})
|
||||
|
||||
test('task_center_page_wires_tabs_filters_and_polling', () => {
|
||||
const page = readSource(PAGE)
|
||||
assert.match(page, /客户端任务/, '页签一文案')
|
||||
|
||||
Reference in New Issue
Block a user