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:
@@ -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>
|
||||
@@ -28,6 +28,8 @@ import {
|
||||
// 客户端任务管理看板(后台):路由注册 / guides 对齐 / 接口层 / 纯逻辑映射。
|
||||
|
||||
const PAGE = 'src/pages/task-center/TaskCenterBoardPage.vue'
|
||||
const TASK_TABLE = 'src/pages/task-center/TaskCenterTaskTable.vue'
|
||||
const VARIANT_TABLE = 'src/pages/task-center/TaskCenterVariantTable.vue'
|
||||
const API = 'src/api/task-center.ts'
|
||||
|
||||
test('task_center_route_registered_with_menu_key', () => {
|
||||
@@ -222,8 +224,8 @@ test('task_center_collect_data_progress_wording_matches_the_client', () => {
|
||||
* 留一条 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">/, '无进度时不画进度轨')
|
||||
const table = readSource(TASK_TABLE)
|
||||
assert.match(table, /<div class="p-track" v-if="row\.progressTotal > 0">/, '无进度时不画进度轨')
|
||||
})
|
||||
|
||||
/**
|
||||
@@ -232,11 +234,11 @@ test('task_center_progress_bar_is_dropped_when_there_is_no_progress', () => {
|
||||
* 失败行(含详情抽屉)只给失败徽标,不给进度条也不说「已完成」。
|
||||
*/
|
||||
test('task_center_failed_rows_never_render_a_progress_bar', () => {
|
||||
const page = readSource(PAGE)
|
||||
const sources = { row: readSource(TASK_TABLE), detail: readSource(PAGE) }
|
||||
for (const scope of ['row', 'detail']) {
|
||||
const branch = new RegExp(
|
||||
`<template v-if="taskStatusType\\(${scope}\\.status\\) === 'failed'">[\\s\\S]{0,400}?</template>`,
|
||||
).exec(page)
|
||||
).exec(sources[scope as keyof typeof sources])
|
||||
assert.ok(branch, `${scope} 的失败分支存在`)
|
||||
assert.equal(branch[0].includes('p-track'), false, '失败分支不画进度轨')
|
||||
assert.equal(branch[0].includes('progressText'), false, '失败分支不说「已完成 X / 总 Y」')
|
||||
@@ -287,12 +289,12 @@ 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(readSource(TASK_TABLE), /暂无符合条件的任务/, '任务空态')
|
||||
assert.match(readSource(VARIANT_TABLE), /暂无变体采集任务/, '变体空态:四态口径下不再限定「在跑」')
|
||||
assert.match(page, /showAdminFeedback\([^\n]*, 'error'\)/, '接口失败提示走统一出口')
|
||||
assert.match(page, /resetFilter/, '筛选重置接线')
|
||||
assert.match(page, /@size-change="changeTaskSize"/, '分页每页条数切换')
|
||||
assert.match(page, /@size-change="changeVariantSize"/, '变体分页每页条数切换')
|
||||
assert.match(page, /@size="changeTaskSize"/, '分页每页条数切换')
|
||||
assert.match(page, /@size="changeVariantSize"/, '变体分页每页条数切换')
|
||||
})
|
||||
|
||||
test('task_center_has_no_shop_panel_anymore', () => {
|
||||
@@ -303,7 +305,7 @@ test('task_center_has_no_shop_panel_anymore', () => {
|
||||
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.match(readSource(TASK_TABLE), /最近上报/, '任务表仍带最近上报')
|
||||
assert.equal(page.includes('device-strip'), false, '设备卡条已删除')
|
||||
})
|
||||
|
||||
@@ -318,18 +320,20 @@ test('task_center_has_no_shop_panel_anymore', () => {
|
||||
*/
|
||||
test('task_center_task_list_columns_are_trimmed_to_the_data_that_exists', () => {
|
||||
const page = readSource(PAGE)
|
||||
const table = readSource(TASK_TABLE)
|
||||
const style = page.slice(page.indexOf('<style scoped>'))
|
||||
|
||||
assert.match(page, /<th style="width: 170px">任务ID<\/th>/, '「当前处理」列改名任务ID')
|
||||
assert.equal(/<th[^>]*>当前处理<\/th>/.test(page), false, '列表不再有全「—」的当前处理列')
|
||||
assert.match(page, /<td>\s*<button class="cell-link mono" type="button" @click="openDetail\(row\)">\{\{ row\.id \}\}<\/button>/, 'ID 单元格点开详情')
|
||||
assert.match(page, /:key="row\.taskNo"/, ':key 仍是唯一任务号(biz 与 brand 两张表的自增 id 会撞)')
|
||||
assert.match(table, /<th style="width: 170px">任务ID<\/th>/, '「当前处理」列改名任务ID')
|
||||
assert.equal(/<th[^>]*>当前处理<\/th>/.test(table), false, '列表不再有全「—」的当前处理列')
|
||||
assert.match(table, /<td>\s*<button class="cell-link mono" type="button" @click="emit\('open', row\)">\{\{ row\.id \}\}<\/button>/, 'ID 单元格点开详情')
|
||||
assert.match(table, /:key="row\.taskNo"/, ':key 仍是唯一任务号(biz 与 brand 两张表的自增 id 会撞)')
|
||||
assert.match(page, /@open="openDetail"/, '页面把表格行点击接到详情抽屉')
|
||||
|
||||
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(page.match(/colspan="10"/g)?.length, 2, '加载中/空态两处 = 任务表 10 列(含国家)')
|
||||
assert.equal(/colspan="9"/.test(page), false, '加国家列后空态不该还写 9 列')
|
||||
assert.equal(/<span class="sub">\{\{ row\.taskNo \}\}<\/span>/.test(table), false, '账号下方不再重复任务号')
|
||||
assert.equal(/<th[^>]*>操作<\/th>/.test(table), false, '操作列已删')
|
||||
assert.equal(table.includes('btn-sm'), false, '没有别的按钮后 btn-sm 样式一并撤掉')
|
||||
assert.equal(table.match(/colspan="10"/g)?.length, 2, '加载中/空态两处 = 任务表 10 列(含国家)')
|
||||
assert.equal(/colspan="9"/.test(table), false, '加国家列后空态不该还写 9 列')
|
||||
|
||||
assert.match(style, /\.shop-filter\s*\{[^}]*position: relative/, '店铺组是提示的定位父元素')
|
||||
assert.match(style, /\.filter-tip\s*\{[^}]*position: absolute/, '提示绝对定位,不再撑高该组把 label 顶上去')
|
||||
@@ -343,9 +347,10 @@ 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)
|
||||
const table = readSource(TASK_TABLE)
|
||||
|
||||
assert.match(page, /<th style="width: 90px">国家<\/th>/, '国家列在店铺与业务之间')
|
||||
assert.match(page, /<td>\{\{ countryLabel\(row\.country\) \}\}<\/td>/,
|
||||
assert.match(table, /<th style="width: 90px">国家<\/th>/, '国家列在店铺与业务之间')
|
||||
assert.match(table, /<td>\{\{ countryLabel\(row\.country\) \}\}<\/td>/,
|
||||
'国家码转中文展示(UK→英国),空值由 countryLabel 画「—」')
|
||||
assert.equal(readSource(API).includes('country: string | null'), true, '接口类型带 country 且可为 null')
|
||||
|
||||
@@ -413,7 +418,17 @@ test('task_center_page_wires_tabs_filters_and_polling', () => {
|
||||
assert.match(page, /变体采集/, '页签二文案')
|
||||
assert.match(page, /panel-box/, '复用全局 panel-box 样式')
|
||||
assert.match(page, /form-row/, '复用全局筛选行样式')
|
||||
assert.match(page, /OldPagination/, '旧版分页组件')
|
||||
// 2026-10-24 拆分:两个表格子组件各自持有分页器,页面负责传 total/page/pageSize 并接事件。
|
||||
for (const table of [
|
||||
'src/pages/task-center/TaskCenterTaskTable.vue',
|
||||
'src/pages/task-center/TaskCenterVariantTable.vue',
|
||||
]) {
|
||||
const src = readSource(table)
|
||||
assert.match(src, /OldPagination/, `${table} 用旧版分页组件`)
|
||||
assert.match(src, /@size-change="emit\('size', \$event\)"/, `${table} 分页事件上抛`)
|
||||
}
|
||||
assert.match(page, /TaskCenterTaskTable/, '页面接入客户端任务表格')
|
||||
assert.match(page, /TaskCenterVariantTable/, '页面接入变体采集表格')
|
||||
assert.match(page, /formatDateTime/, '统一时间格式')
|
||||
assert.match(page, /el-drawer/, '任务详情抽屉')
|
||||
assert.match(page, /疑似卡住/, 'stuck 徽标文案')
|
||||
@@ -422,7 +437,7 @@ test('task_center_page_wires_tabs_filters_and_polling', () => {
|
||||
assert.match(page, /document\.visibilityState/, '隐藏时跳过轮询')
|
||||
assert.match(page, /POLL_INTERVAL_MS/, '30s 轮询常量')
|
||||
assert.match(page, /clearInterval/, '卸载清理定时器')
|
||||
assert.match(page, /resMes/, '变体表展示麦象 res_mes')
|
||||
assert.match(readSource(VARIANT_TABLE), /resMes/, '变体表展示麦象 res_mes')
|
||||
assert.equal(/shopName/.test(readSource(PAGE)), true)
|
||||
})
|
||||
|
||||
@@ -433,8 +448,8 @@ test('task_center_page_wires_tabs_filters_and_polling', () => {
|
||||
* (task-center.ts 的类型保持如实),只是页面不渲染。
|
||||
*/
|
||||
test('task_center_variant_result_column_dumps_no_raw_task_data', () => {
|
||||
const page = readSource(PAGE)
|
||||
assert.doesNotMatch(page, /taskData/, '变体表不再渲染 task_data 原始 JSON')
|
||||
assert.doesNotMatch(readSource(VARIANT_TABLE), /taskData/, '变体表不再渲染 task_data 原始 JSON')
|
||||
assert.doesNotMatch(readSource(PAGE), /taskData/, '页面不把 task_data 透传给表格')
|
||||
})
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,6 +37,7 @@ export default defineConfig({
|
||||
output: {
|
||||
manualChunks: {
|
||||
vue: ['vue', 'vue-router', 'pinia'],
|
||||
'element-plus': ['element-plus'],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user