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:
@@ -116,71 +116,16 @@
|
||||
>
|
||||
<template #cards-extra>
|
||||
<div class="subsection-title">匹配结果</div>
|
||||
<div v-if="!matchedItems.length" class="match-empty">
|
||||
完成“匹配店铺”后,这里会展示匹配结果。
|
||||
</div>
|
||||
<el-table
|
||||
v-else
|
||||
:data="pagedMatchedItems"
|
||||
:row-key="rowKeyForMatch"
|
||||
:highlight-current-row="false"
|
||||
class="result-table match-table"
|
||||
>
|
||||
<el-table-column prop="shopName" label="店铺名" min-width="120" />
|
||||
<el-table-column label="匹配" width="72" align="center">
|
||||
<template #default="{ row }">
|
||||
<span :class="row.matched ? 'ok' : 'fail'">
|
||||
{{ row.matched ? "是" : "否" }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="shopId"
|
||||
label="店铺 ID"
|
||||
min-width="120"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
prop="platform"
|
||||
label="平台"
|
||||
width="88"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
prop="companyName"
|
||||
label="公司"
|
||||
min-width="120"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="状态" width="110" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatMatchStatus(row.matchStatus) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="说明" min-width="180" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ formatMatchRemark(row) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="72" align="center">
|
||||
<template #default="{ row }">
|
||||
<button
|
||||
type="button"
|
||||
class="link-danger"
|
||||
@click="removeMatchedRow(row)"
|
||||
>
|
||||
删除
|
||||
</button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
v-if="matchedTotal > matchedPageSize"
|
||||
class="matched-pagination"
|
||||
layout="total, prev, pager, next"
|
||||
<BrandShopMatchTable
|
||||
v-model:page="matchedPage"
|
||||
:items="pagedMatchedItems"
|
||||
:total="matchedTotal"
|
||||
:page-size="matchedPageSize"
|
||||
v-model:current-page="matchedPage"
|
||||
:row-key="rowKeyForMatch"
|
||||
:status-text="formatMatchStatus"
|
||||
:remark-text="formatMatchRemark"
|
||||
empty-text="完成“匹配店铺”后,这里会展示匹配结果。"
|
||||
@remove="removeMatchedRow"
|
||||
/>
|
||||
</template>
|
||||
<template #item-actions="{ item }">
|
||||
@@ -205,6 +150,15 @@ import { ElMessage } from "element-plus";
|
||||
import type { TableInstance } from "element-plus";
|
||||
import AmazonToolPageShell from '@/pages/amazon/components/AmazonToolPageShell.vue';
|
||||
import TaskCenterPanel from "@/shared/components/tasks/TaskCenterPanel.vue";
|
||||
import BrandShopMatchTable from './BrandShopMatchTable.vue'
|
||||
import {
|
||||
formatMatchRemark,
|
||||
formatMatchStatus,
|
||||
historyItemKey,
|
||||
isTransientBackendError,
|
||||
rowKeyForMatch,
|
||||
uidForStorage,
|
||||
} from './brand-shop-match-shared'
|
||||
import type { TaskItemView, TaskStatCard } from "@/shared/components/tasks/types";
|
||||
import {
|
||||
addQueryAsinCandidate,
|
||||
@@ -356,11 +310,6 @@ const hasQueuedTaskWork = computed(
|
||||
const hasQueueWork = computed(() => queueWorkerRunning.value || hasQueuedTaskWork.value);
|
||||
const isQueueBusy = computed(() => queueWorkerRunning.value && hasQueuedTaskWork.value);
|
||||
|
||||
function uidForStorage() {
|
||||
return typeof window !== "undefined"
|
||||
? window.localStorage.getItem("uid") || "0"
|
||||
: "0";
|
||||
}
|
||||
|
||||
function matchedStorageKey() {
|
||||
return `query-asin:matched:${uidForStorage()}`;
|
||||
@@ -374,13 +323,7 @@ function taskStartTimeStorageKey() {
|
||||
return `query-asin:start-times:${uidForStorage()}`;
|
||||
}
|
||||
|
||||
function rowKeyForMatch(row: QueryAsinShopQueueItem) {
|
||||
return `${(row.shopName || "").trim()}::${row.shopId || ""}`;
|
||||
}
|
||||
|
||||
function historyItemKey(item: QueryAsinHistoryItem) {
|
||||
return `${item.taskId ?? 0}:${item.resultId ?? 0}`;
|
||||
}
|
||||
|
||||
let disposed = false;
|
||||
|
||||
@@ -400,20 +343,6 @@ function clearSleepTimers() {
|
||||
timers.clearCategory("queue-wait");
|
||||
}
|
||||
|
||||
function isTransientBackendError(error: unknown) {
|
||||
const message =
|
||||
error instanceof Error ? error.message.toLowerCase() : String(error || "").toLowerCase();
|
||||
return (
|
||||
message.includes("network error") ||
|
||||
message.includes("failed to fetch") ||
|
||||
message.includes("timeout") ||
|
||||
message.includes("503") ||
|
||||
message.includes("502") ||
|
||||
message.includes("504") ||
|
||||
message.includes("500") ||
|
||||
message.includes("load failed")
|
||||
);
|
||||
}
|
||||
|
||||
async function withTransientRetry<T>(
|
||||
action: () => Promise<T>,
|
||||
@@ -440,34 +369,7 @@ function createSubmissionId(taskId: number, shopName?: string) {
|
||||
return `query-asin:${taskId}:${shopName || "shop"}:${Date.now()}`;
|
||||
}
|
||||
|
||||
function formatMatchStatus(status?: string) {
|
||||
const value = (status || "").trim();
|
||||
const map: Record<string, string> = {
|
||||
MATCHED: "已匹配",
|
||||
PENDING: "待匹配",
|
||||
CONFLICT: "需人工确认",
|
||||
INDEX_STALE: "匹配已过期",
|
||||
};
|
||||
return map[value] || value || "-";
|
||||
}
|
||||
|
||||
function formatMatchRemark(row: QueryAsinShopQueueItem) {
|
||||
const message = (row.matchMessage || "").trim();
|
||||
if (message) return message;
|
||||
if (row.matched && row.matchStatus === "MATCHED") {
|
||||
return "已匹配成功,可启动任务";
|
||||
}
|
||||
if (row.matched) {
|
||||
return "已匹配成功,请查看状态确认";
|
||||
}
|
||||
if (row.matchStatus === "CONFLICT") {
|
||||
return "存在多个同名店铺,请人工确认";
|
||||
}
|
||||
if (row.matchStatus === "PENDING") {
|
||||
return "店铺尚未匹配完成,请稍后查看";
|
||||
}
|
||||
return "未匹配成功,请检查店铺名";
|
||||
}
|
||||
|
||||
function flattenQueryAsinRows(record: Pick<QueryAsinHistoryItem, "shopName" | "queryAsins">) {
|
||||
const sections = readQueryAsins(record);
|
||||
|
||||
Reference in New Issue
Block a user