969f86c612
- DeliveryVideoWorkspace 2690→2176 行,弹窗与结果面板下沉为 4 个子组件,类型抽到共享模块 - TaskCenterBoardPage 1017→834 行,任务表/变体表下沉,失败条与轮询入口留在页面 - 巡店删除/取款/查 ASIN/跟价/商品风险五支 Tab 共用 BrandShopMatchTable,纯逻辑收敛到 brand-shop-match-shared - admin manualChunks 增加 element-plus 分组(915KB 独立 chunk) - 源码钉按新落点更新:分页与表格断言读子组件,页面接线断言保留
224 lines
5.5 KiB
Vue
224 lines
5.5 KiB
Vue
<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>
|