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
@@ -7,11 +7,12 @@ import { computed, onMounted, onUnmounted, reactive, ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import { userNotice } from '@/api/user-notice'
import { ElMessage } from 'element-plus'
import OldPagination from '@/components/OldPagination.vue'
import { useCompanyTabStore } from '@/stores/company-tab'
import { formatDateTime, orderedPair } from '@/utils/datetime'
import { showAdminFeedback } from '@/components/admin-feedback-ui'
import LoadFailureBar from '@/components/LoadFailureBar.vue'
import TaskCenterTaskTable from './TaskCenterTaskTable.vue'
import TaskCenterVariantTable from './TaskCenterVariantTable.vue'
import {
fetchTaskCenterOverview,
fetchTaskCenterShopOptions,
@@ -30,19 +31,14 @@ import {
VARIANT_STATUS_OPTIONS,
buildTaskQuery,
buildVariantQuery,
countryLabel,
createTaskFilter,
createVariantFilter,
deviceDisplayName,
progressPercent,
progressText,
shopDisplayName,
tabCount,
taskStatusLabel,
taskStatusType,
variantAccountText,
variantStatusLabel,
variantStatusType,
type TaskCenterTaskFilter,
type TaskCenterVariantFilter,
} from './task-center-model'
@@ -216,6 +212,10 @@ function resetFilter() {
void loadTasks()
}
function retryTasks() {
void loadTasks()
}
function changeTaskPage(next: number) {
if (next < 1 || next > taskTotalPages.value) return
taskPage.value = next
@@ -423,78 +423,16 @@ onUnmounted(() => {
</div>
</div>
<LoadFailureBar v-if="tasksFailure" :message="tasksFailure" @retry="loadTasks" />
<div class="table-scroll">
<table>
<thead>
<tr>
<th style="width: 120px">账号</th>
<th style="width: 160px">店铺</th>
<th style="width: 90px">国家</th>
<th style="width: 120px">业务</th>
<th style="width: 120px">状态</th>
<th style="width: 170px">任务ID</th>
<th style="width: 165px">开始时间</th>
<th style="width: 165px">最近上报</th>
<th style="width: 165px">结束时间</th>
<th style="width: 190px">进度</th>
</tr>
</thead>
<tbody>
<template v-if="tasks.length">
<tr v-for="row in tasks" :key="row.taskNo">
<td>
<span class="strong">{{ accountOf(row) }}</span>
</td>
<td>{{ shopDisplayName(row.shopName, row.shopCount) }}</td>
<td>{{ countryLabel(row.country) }}</td>
<td>{{ row.moduleLabel || row.moduleType }}</td>
<td>
<span class="st-pill" :class="`is-${taskStatusType(row.status)}`">{{ taskStatusLabel(row.status) }}</span>
<span v-if="row.stuck" class="badge warn">疑似卡住</span>
</td>
<td>
<button class="cell-link mono" type="button" @click="openDetail(row)">{{ row.id }}</button>
</td>
<td>{{ formatDateTime(row.createdAt) }}</td>
<td>
<span :class="{ 'is-warn-text': row.stuck }">
{{ row.lastReportAt ? formatDateTime(row.lastReportAt) : '—' }}
</span>
</td>
<td>{{ row.finishedAt ? formatDateTime(row.finishedAt) : '—' }}</td>
<td>
<template v-if="taskStatusType(row.status) === 'failed'">
<span v-if="row.progressFailed > 0" class="badge danger">失败 {{ row.progressFailed }}</span>
<span v-else>—</span>
</template>
<template v-else>
<div class="progress-line">
<span>{{ progressText(row) }}</span>
<span v-if="row.progressFailed > 0" class="badge danger">失败 {{ row.progressFailed }}</span>
</div>
<div class="p-track" v-if="row.progressTotal > 0">
<div class="p-fill" :style="{ width: progressPercent(row) + '%' }"></div>
</div>
</template>
</td>
</tr>
</template>
<tr v-else-if="tasksLoading">
<td colspan="10" class="empty-tip">加载中...</td>
</tr>
<tr v-else>
<td colspan="10" class="empty-tip">暂无符合条件的任务</td>
</tr>
</tbody>
</table>
</div>
<OldPagination
<LoadFailureBar v-if="tasksFailure" :message="tasksFailure" @retry="retryTasks" />
<TaskCenterTaskTable
:rows="tasks"
:loading="tasksLoading"
:total="taskTotal"
:page="taskPage"
:page-size="taskPageSize"
@change="changeTaskPage"
@size-change="changeTaskSize"
@page="changeTaskPage"
@size="changeTaskSize"
@open="openDetail"
/>
</section>
</template>
@@ -522,55 +460,14 @@ onUnmounted(() => {
</div>
</div>
<div class="table-scroll">
<table>
<thead>
<tr>
<th style="width: 150px">账号</th>
<th style="width: 200px">任务号</th>
<th style="width: 110px">状态</th>
<th style="width: 165px">开始时间</th>
<th style="width: 165px">更新时间</th>
<th>结果信息</th>
</tr>
</thead>
<tbody>
<template v-if="variantRows.length">
<tr v-for="row in variantRows" :key="row.taskId">
<td>
<span class="strong">{{ variantAccountText(row) }}</span>
<span v-if="!row.username && row.uid" class="sub" :title="row.uid">{{ row.uid }}</span>
</td>
<td>
<span class="mono">{{ row.taskId }}</span>
</td>
<td>
<span class="st-pill" :class="`is-${variantStatusType(row.status)}`">
{{ row.statusLabel || variantStatusLabel(row.status) }}
</span>
</td>
<td>{{ formatDateTime(row.createTime) }}</td>
<td>{{ formatDateTime(row.updateTime) }}</td>
<td>
<span class="res-mes" :title="row.resMes || ''">{{ row.resMes || '—' }}</span>
</td>
</tr>
</template>
<tr v-else-if="variantLoading">
<td colspan="6" class="empty-tip">加载中...</td>
</tr>
<tr v-else>
<td colspan="6" class="empty-tip">暂无变体采集任务</td>
</tr>
</tbody>
</table>
</div>
<OldPagination
<TaskCenterVariantTable
:rows="variantRows"
:loading="variantLoading"
:total="variantTotal ?? 0"
:page="variantPage"
:page-size="variantPageSize"
@change="changeVariantPage"
@size-change="changeVariantSize"
@page="changeVariantPage"
@size="changeVariantSize"
/>
</section>
</template>
@@ -763,10 +660,6 @@ h3 {
color: #8598ab;
font-size: 12.5px;
}
.is-warn-text {
color: #b3803a;
font-weight: 650;
}
.shop-filter {
position: relative;
}
@@ -854,60 +747,6 @@ h3 {
border-color: #95b1cb;
color: #2f5d8b;
}
.table-scroll {
width: 100%;
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
th {
padding: 10px 12px;
text-align: left;
color: #5b6f83;
font-weight: 650;
font-size: 12.5px;
border-bottom: 1px solid #dbe6f0;
white-space: nowrap;
}
td {
padding: 10px 12px;
border-bottom: 1px solid #eaf1f7;
vertical-align: top;
}
.strong {
display: block;
font-weight: 600;
word-break: break-all;
}
.sub {
display: block;
color: #8598ab;
font-size: 11.5px;
word-break: break-all;
}
.mono {
font-family: Consolas, 'Courier New', monospace;
font-size: 12px;
word-break: break-all;
}
/* 任务 ID 单元格:「操作」列删除后,它是详情抽屉唯一的入口。 */
.cell-link {
padding: 0;
border: none;
background: none;
color: #2f5d8b;
cursor: pointer;
}
.cell-link:hover {
text-decoration: underline;
}
.res-mes {
display: block;
word-break: break-all;
}
.st-pill {
display: inline-flex;
align-items: center;
@@ -959,24 +798,6 @@ td {
background: #f8ebeb;
color: #91474f;
}
.progress-line {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
margin-bottom: 5px;
}
.p-track {
height: 6px;
border-radius: 999px;
background: #eaf1f7;
overflow: hidden;
}
.p-fill {
height: 100%;
border-radius: 999px;
background: linear-gradient(90deg, #6f97bd, #4f78a5);
}
.empty-tip {
padding: 30px 24px;
text-align: center;
@@ -0,0 +1,223 @@
<script setup lang="ts">
import OldPagination from '@/components/OldPagination.vue'
import { formatDateTime } from '@/utils/datetime'
import type { TaskCenterTaskRow } from '@/api/task-center'
import {
countryLabel,
progressPercent,
progressText,
shopDisplayName,
taskStatusLabel,
taskStatusType,
} from './task-center-model'
defineProps<{
rows: TaskCenterTaskRow[]
loading: boolean
total: number
page: number
pageSize: number
}>()
const emit = defineEmits<{
page: [number]
size: [number]
open: [TaskCenterTaskRow]
}>()
</script>
<template>
<div class="table-scroll">
<table>
<thead>
<tr>
<th style="width: 120px">账号</th>
<th style="width: 160px">店铺</th>
<th style="width: 90px">国家</th>
<th style="width: 120px">业务</th>
<th style="width: 120px">状态</th>
<th style="width: 170px">任务ID</th>
<th style="width: 165px">开始时间</th>
<th style="width: 165px">最近上报</th>
<th style="width: 165px">结束时间</th>
<th style="width: 190px">进度</th>
</tr>
</thead>
<tbody>
<template v-if="rows.length">
<tr v-for="row in rows" :key="row.taskNo">
<td>
<span class="strong">{{ row.username || (row.userId != null ? `UID ${row.userId}` : '—') }}</span>
</td>
<td>{{ shopDisplayName(row.shopName, row.shopCount) }}</td>
<td>{{ countryLabel(row.country) }}</td>
<td>{{ row.moduleLabel || row.moduleType }}</td>
<td>
<span class="st-pill" :class="`is-${taskStatusType(row.status)}`">{{ taskStatusLabel(row.status) }}</span>
<span v-if="row.stuck" class="badge warn">疑似卡住</span>
</td>
<td>
<button class="cell-link mono" type="button" @click="emit('open', row)">{{ row.id }}</button>
</td>
<td>{{ formatDateTime(row.createdAt) }}</td>
<td>
<span :class="{ 'is-warn-text': row.stuck }">
{{ row.lastReportAt ? formatDateTime(row.lastReportAt) : '—' }}
</span>
</td>
<td>{{ row.finishedAt ? formatDateTime(row.finishedAt) : '—' }}</td>
<td>
<template v-if="taskStatusType(row.status) === 'failed'">
<span v-if="row.progressFailed > 0" class="badge danger">失败 {{ row.progressFailed }}</span>
<span v-else>—</span>
</template>
<template v-else>
<div class="progress-line">
<span>{{ progressText(row) }}</span>
<span v-if="row.progressFailed > 0" class="badge danger">失败 {{ row.progressFailed }}</span>
</div>
<div class="p-track" v-if="row.progressTotal > 0">
<div class="p-fill" :style="{ width: progressPercent(row) + '%' }"></div>
</div>
</template>
</td>
</tr>
</template>
<tr v-else-if="loading">
<td colspan="10" class="empty-tip">加载中...</td>
</tr>
<tr v-else>
<td colspan="10" class="empty-tip">暂无符合条件的任务</td>
</tr>
</tbody>
</table>
</div>
<OldPagination
:total="total"
:page="page"
:page-size="pageSize"
@change="emit('page', $event)"
@size-change="emit('size', $event)"
/>
</template>
<style scoped>
.table-scroll {
width: 100%;
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
th {
padding: 10px 12px;
text-align: left;
color: #5b6f83;
font-weight: 650;
font-size: 12.5px;
border-bottom: 1px solid #dbe6f0;
white-space: nowrap;
}
td {
padding: 10px 12px;
border-bottom: 1px solid #eaf1f7;
vertical-align: top;
}
.strong {
display: block;
font-weight: 600;
word-break: break-all;
}
.mono {
font-family: Consolas, 'Courier New', monospace;
font-size: 12px;
word-break: break-all;
}
.cell-link {
padding: 0;
border: none;
background: none;
color: #2f5d8b;
cursor: pointer;
}
.cell-link:hover {
text-decoration: underline;
}
.is-warn-text {
color: #b3803a;
font-weight: 650;
}
.st-pill {
display: inline-flex;
align-items: center;
padding: 2px 10px;
border-radius: 999px;
font-size: 12px;
line-height: 1.7;
border: 1px solid transparent;
white-space: nowrap;
}
.st-pill.is-success {
color: #3d7158;
background: #e8f2eb;
border-color: #bdd7c5;
}
.st-pill.is-failed {
color: #91474f;
background: #f8ebeb;
border-color: #e4c2c5;
}
.st-pill.is-pending {
color: #8a6d3b;
background: #fbf4ea;
border-color: #e7d3ae;
}
.st-pill.is-running {
color: #37618f;
background: #e8f1fb;
border-color: #c3d8ef;
}
.badge {
display: inline-block;
margin-left: 6px;
padding: 1px 7px;
border-radius: 999px;
font-size: 11px;
font-weight: 600;
white-space: nowrap;
}
.badge.danger {
background: #f8ebeb;
color: #91474f;
}
.badge.warn {
background: #fbf4ea;
color: #8a6d3b;
}
.progress-line {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
margin-bottom: 5px;
}
.p-track {
height: 6px;
border-radius: 999px;
background: #eaf1f7;
overflow: hidden;
}
.p-fill {
height: 100%;
border-radius: 999px;
background: linear-gradient(90deg, #6f97bd, #4f78a5);
}
.empty-tip {
padding: 30px 24px;
text-align: center;
color: #8293a5;
font-size: 13.5px;
}
</style>
@@ -0,0 +1,158 @@
<script setup lang="ts">
import OldPagination from '@/components/OldPagination.vue'
import { formatDateTime } from '@/utils/datetime'
import type { TaskCenterVariantTaskRow } from '@/api/task-center'
import {
variantAccountText,
variantStatusLabel,
variantStatusType,
} from './task-center-model'
defineProps<{
rows: TaskCenterVariantTaskRow[]
loading: boolean
total: number
page: number
pageSize: number
}>()
const emit = defineEmits<{
page: [number]
size: [number]
}>()
</script>
<template>
<div class="table-scroll">
<table>
<thead>
<tr>
<th style="width: 150px">账号</th>
<th style="width: 200px">任务号</th>
<th style="width: 110px">状态</th>
<th style="width: 165px">开始时间</th>
<th style="width: 165px">更新时间</th>
<th>结果信息</th>
</tr>
</thead>
<tbody>
<template v-if="rows.length">
<tr v-for="row in rows" :key="row.taskId">
<td>
<span class="strong">{{ variantAccountText(row) }}</span>
<span v-if="!row.username && row.uid" class="sub" :title="row.uid">{{ row.uid }}</span>
</td>
<td>
<span class="mono">{{ row.taskId }}</span>
</td>
<td>
<span class="st-pill" :class="`is-${variantStatusType(row.status)}`">
{{ row.statusLabel || variantStatusLabel(row.status) }}
</span>
</td>
<td>{{ formatDateTime(row.createTime) }}</td>
<td>{{ formatDateTime(row.updateTime) }}</td>
<td>
<span class="res-mes" :title="row.resMes || ''">{{ row.resMes || '—' }}</span>
</td>
</tr>
</template>
<tr v-else-if="loading">
<td colspan="6" class="empty-tip">加载中...</td>
</tr>
<tr v-else>
<td colspan="6" class="empty-tip">暂无变体采集任务</td>
</tr>
</tbody>
</table>
</div>
<OldPagination
:total="total"
:page="page"
:page-size="pageSize"
@change="emit('page', $event)"
@size-change="emit('size', $event)"
/>
</template>
<style scoped>
.table-scroll {
width: 100%;
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
th {
padding: 10px 12px;
text-align: left;
color: #5b6f83;
font-weight: 650;
font-size: 12.5px;
border-bottom: 1px solid #dbe6f0;
white-space: nowrap;
}
td {
padding: 10px 12px;
border-bottom: 1px solid #eaf1f7;
vertical-align: top;
}
.strong {
display: block;
font-weight: 600;
word-break: break-all;
}
.sub {
display: block;
color: #8598ab;
font-size: 11.5px;
word-break: break-all;
}
.mono {
font-family: Consolas, 'Courier New', monospace;
font-size: 12px;
word-break: break-all;
}
.res-mes {
display: block;
word-break: break-all;
}
.st-pill {
display: inline-flex;
align-items: center;
padding: 2px 10px;
border-radius: 999px;
font-size: 12px;
line-height: 1.7;
border: 1px solid transparent;
white-space: nowrap;
}
.st-pill.is-success {
color: #3d7158;
background: #e8f2eb;
border-color: #bdd7c5;
}
.st-pill.is-failed {
color: #91474f;
background: #f8ebeb;
border-color: #e4c2c5;
}
.st-pill.is-pending {
color: #8a6d3b;
background: #fbf4ea;
border-color: #e7d3ae;
}
.st-pill.is-running {
color: #37618f;
background: #e8f1fb;
border-color: #c3d8ef;
}
.empty-tip {
padding: 30px 24px;
text-align: center;
color: #8293a5;
font-size: 13.5px;
}
</style>