fix(提示语): 失败提示优先展示后端真实原因,修正 10+ 处误导文案

上架/删除品牌/去重/转换/拆分/撤回/查ASIN/产品风险/跟价/巡店/店铺匹配/视频工作台:
- 解析失败不再只报通用文案,逐条展示后端文件级 errorMessage(上架新增「店铺未找到」专属弹窗)
- 匹配失败不再一律「请检查店铺名」,按 matchStatus 区分 CONFLICT/PENDING
- 去重/转换/拆分全失败弹窗优先列各文件真实原因,取不到才回退猜测文案
- dispatch-guard 新增 fileErrors 选项与 collectDistinctErrors 导出
This commit is contained in:
2026-09-17 23:02:15 +08:00
parent f744aa7ec2
commit a4bc190cae
14 changed files with 166 additions and 16 deletions
@@ -216,6 +216,8 @@ import {
checkParseResult,
checkQueuePayload,
checkSelectedFiles,
collectDistinctErrors,
guardBlocked,
} from '@/shared/dispatch-guard'
import { passGuard } from '@/shared/dispatch-guard-ui'
import { useZiniaoVersion, type ZiniaoVersion } from '@/shared/utils/ziniao-version'
@@ -563,10 +565,25 @@ async function submitRun() {
sync_countries: syncCountries.value.filter((country) => country !== publishCountry.value),
})
if (!parsed.taskId) throw new Error('后端未返回有效任务标识')
// publish 的 Vo 用 files 承载明细,没有 acceptedRows;这里先卡住 taskId 与总行数
const fileErrors = collectDistinctErrors(
(parsed.files || []).map((file) => file.errorMessage || file.error),
)
// 店铺未录入后台是最高频的解析失败原因(2026-09-17 客户因此连试 7 次),
// 单独用「店铺未找到」弹窗直给后端原因,避免被通用文案淹没
const missingShopErrors = fileErrors.filter((message) => message.includes('未找到店铺'))
if (!parsed.totalRows && missingShopErrors.length) {
await passGuard(guardBlocked('店铺未找到', missingShopErrors.join('\n'), 'publish.shop-missing'))
return
}
// publish 的 Vo 用 files 承载明细,没有 acceptedRows;这里先卡住 taskId 与总行数。
// 文件级失败(店铺未匹配等)时 Java 不解析 Excel、totalRows 同样为 0,把具体
// 原因一并交给 guard 优先展示,避免只报「没有读到任何数据行」误导排查方向。
const guard = checkParseResult(
{ taskId: parsed.taskId, totalRows: parsed.totalRows, acceptedRows: parsed.totalRows },
{ requiredColumnsHint: '店铺名 / 商品行' },
{
requiredColumnsHint: '店铺名 / 商品行',
fileErrors,
},
)
if (!(await passGuard(guard))) return
@@ -604,7 +621,9 @@ async function submitRun() {
await Promise.all([loadDashboard(), loadHistory()])
if (!batch.pendingFileIds.length) {
queueMessage.value = '解析完成,当前没有匹配成功且可上架的文件。'
queueMessage.value = fileErrors.length
? `解析完成,当前没有匹配成功且可上架的文件:${fileErrors[0]}`
: '解析完成,当前没有匹配成功且可上架的文件。'
ElMessage.warning(queueMessage.value)
return
}