feat(看板): 变体采集只看在跑,进度列改客户端同源口径
两件事,都是用户当场指出的读数误导: 1. 变体采集页签徽章 106 是麦象历史全量。console 代理一次只接受一个 status, 故 status 缺省时服务端合并 0(等待)∪1(处理中),按 createTime 倒序后内存切片; 单状态各拉 200 条,触顶打 warn。前端状态下拉去掉「已完成/处理失败」两个入口。 2. 进度列的「已完成 0 / 总 1」来自 source_file_count(采集/跟价都是单文件任务), 与客户端进度条不同源。改为按模块分档:COLLECT_DATA 取 result_json 的 $.totalRows/$.processedRows(与客户端「关键词进度:第 X/N 个」同一对数), PRICE_TRACK/SHOP_MATCH 这类客户端本来没有进度条的返回 0,前端 progressTotal<=0 显示「—」且不再画 0% 进度轨;PUBLISH/DELETE_BRAND/品牌行保持文件数/品牌行数。 护栏:Mapper SQL 渲染 26 例、QueryService 34 例、VariantService 8 例、 ScopeService 7 例;前端 node:test 1653 例。docs/specs/16-client-task-console.md 的「进度口径」一节按新规则重写。
This commit is contained in:
@@ -110,7 +110,27 @@ test('task_center_variant_status_map_follows_maixiang_semantics', () => {
|
||||
assert.equal(variantStatusLabel(9), '未知')
|
||||
assert.equal(variantStatusLabel(null), '未知')
|
||||
assert.equal(variantStatusLabel('2'), '已完成', '字符串数字同样识别')
|
||||
assert.equal(VARIANT_STATUS_OPTIONS.length, 5)
|
||||
})
|
||||
|
||||
/**
|
||||
* 变体采集页签只讲「在跑」(2026-10-04 用户口径:历史彻底不看):
|
||||
* 状态下拉必须收掉 2 已完成 / 3 处理失败 两个入口,空值改成「在跑」而不是「全部状态」——
|
||||
* 文案留着「全部状态」会让用户以为后端还在给他合并历史。
|
||||
*/
|
||||
test('task_center_variant_status_options_drop_history_states', () => {
|
||||
assert.deepEqual(VARIANT_STATUS_OPTIONS, [
|
||||
{ value: '', label: '在跑' },
|
||||
{ value: '0', label: '等待执行' },
|
||||
{ value: '1', label: '处理中' },
|
||||
])
|
||||
const values = VARIANT_STATUS_OPTIONS.map((o) => o.value)
|
||||
assert.equal(values.includes('2'), false, '已完成不再是可选项')
|
||||
assert.equal(values.includes('3'), false, '处理失败不再是可选项')
|
||||
|
||||
const page = readSource(PAGE)
|
||||
assert.match(page, /只看在跑/, '面板说明写明只看在跑')
|
||||
assert.match(page, /title="麦象在跑批量任务条数/, '徽章 tooltip 是在跑口径不是全部状态')
|
||||
assert.equal(/麦象批量任务条数(全部状态)/.test(page), false)
|
||||
})
|
||||
|
||||
test('task_center_device_display_falls_back_to_truncated_id', () => {
|
||||
@@ -146,6 +166,15 @@ test('task_center_progress_counts_done_rows_like_the_client', () => {
|
||||
assert.equal(progressPercent({ progressSuccess: -5, progressFailed: 0, progressTotal: 10 }), 0, '脏负数不按负进度画')
|
||||
})
|
||||
|
||||
/**
|
||||
* 后端把「客户端没有进度条」的模块(跟价/定时匹配)progressTotal 置 0 ⇒ 前端只画「—」:
|
||||
* 留一条 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">/, '无进度时不画进度轨')
|
||||
})
|
||||
|
||||
test('task_center_query_builder_omits_blanks_and_normalizes_time', () => {
|
||||
const query = buildTaskQuery(
|
||||
{ username: ' 张三 ', moduleType: 'COLLECT_DATA', status: 'RUNNING', shop: '林芳旗舰店', startTime: '2026-09-28T10:00', endTime: '' },
|
||||
@@ -167,10 +196,11 @@ test('task_center_query_builder_omits_blanks_and_normalizes_time', () => {
|
||||
|
||||
test('task_center_variant_query_builder_keeps_paging', () => {
|
||||
const empty = buildVariantQuery({ status: '' }, 1, 20)
|
||||
assert.equal(empty.status, undefined)
|
||||
assert.equal(empty.status, undefined, '空状态不下传 status ⇒ 后端按在跑(0∪1)合并')
|
||||
assert.equal(empty.page, 1)
|
||||
const filtered = buildVariantQuery({ status: '3' }, 3, 50)
|
||||
assert.equal(filtered.status, 3)
|
||||
const filtered = buildVariantQuery({ status: '1' }, 3, 50)
|
||||
assert.equal(filtered.status, 1)
|
||||
assert.equal(buildVariantQuery({ status: '0' }, 1, 20).status, 0, '状态 0 是 falsy,不能被当成「没选」')
|
||||
assert.equal(filtered.page, 3)
|
||||
assert.equal(filtered.pageSize, 50)
|
||||
})
|
||||
@@ -189,7 +219,7 @@ 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, /暂无在跑的变体采集任务/, '变体空态:口径是在跑不是全部')
|
||||
assert.match(page, /ElMessage\.error/, '接口失败提示')
|
||||
assert.match(page, /resetFilter/, '筛选重置接线')
|
||||
assert.match(page, /@size-change="changeTaskSize"/, '分页每页条数切换')
|
||||
|
||||
Reference in New Issue
Block a user