969f86c612
- DeliveryVideoWorkspace 2690→2176 行,弹窗与结果面板下沉为 4 个子组件,类型抽到共享模块 - TaskCenterBoardPage 1017→834 行,任务表/变体表下沉,失败条与轮询入口留在页面 - 巡店删除/取款/查 ASIN/跟价/商品风险五支 Tab 共用 BrandShopMatchTable,纯逻辑收敛到 brand-shop-match-shared - admin manualChunks 增加 element-plus 分组(915KB 独立 chunk) - 源码钉按新落点更新:分页与表格断言读子组件,页面接线断言保留
839 lines
27 KiB
Vue
839 lines
27 KiB
Vue
<script setup lang="ts">
|
||
/** 客户端任务管理看板:全局看有哪些客户端任务在跑,再下钻到任务明细(只读,仅超管或被授权管理员)。
|
||
* 页签一「客户端任务」= biz_file_task(12 个客户端模块)∪ brand_crawl_tasks;
|
||
* 页签二「变体采集」= 麦象批量任务(variant-collection),数据口径与列不同故独立页签。
|
||
* 30s 轮询:页面隐藏暂停、回前台立即刷新、卸载清理;另有手动刷新。 */
|
||
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 { 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,
|
||
fetchTaskCenterTaskDetail,
|
||
fetchTaskCenterTasks,
|
||
fetchTaskCenterVariantTasks,
|
||
type TaskCenterOverview,
|
||
type TaskCenterTaskDetail,
|
||
type TaskCenterTaskRow,
|
||
type TaskCenterVariantTaskRow,
|
||
} from '@/api/task-center'
|
||
import {
|
||
ACTIVE_TASK_STATUS,
|
||
MODULE_OPTIONS,
|
||
TASK_STATUS_OPTIONS,
|
||
VARIANT_STATUS_OPTIONS,
|
||
buildTaskQuery,
|
||
buildVariantQuery,
|
||
createTaskFilter,
|
||
createVariantFilter,
|
||
deviceDisplayName,
|
||
progressText,
|
||
shopDisplayName,
|
||
tabCount,
|
||
taskStatusLabel,
|
||
taskStatusType,
|
||
type TaskCenterTaskFilter,
|
||
type TaskCenterVariantFilter,
|
||
} from './task-center-model'
|
||
|
||
const POLL_INTERVAL_MS = 30_000
|
||
|
||
/** 公司 tab 的唯一取值出口:非超管恒 null(store 里 companyIdForRequest 已经把它算成 null),
|
||
* 所以这里不需要再判一次角色——第二把尺子就是第二个口径。 */
|
||
const companyTab = useCompanyTabStore()
|
||
const route = useRoute()
|
||
|
||
type BoardTab = 'tasks' | 'variant'
|
||
const activeTab = ref<BoardTab>('tasks')
|
||
|
||
// ---------------------------------------------------------------- 客户端任务
|
||
|
||
const overview = ref<TaskCenterOverview | null>(null)
|
||
const shopOptions = ref<string[]>([])
|
||
/** 默认视图 = 只看执行中(合并哨兵,后端展开成三个进行中状态),**不锁创建时间**:
|
||
* 卡片「进行中任务」的 SQL 不带时间窗,锁当天必然比卡片少一截(10-04 实测 21 vs 39,
|
||
* 差的 18 个是跨天仍在上报的长任务)。历史状态与时间窗仍在筛选里,用户自己选。 */
|
||
function defaultTaskFilter(): TaskCenterTaskFilter {
|
||
return { ...createTaskFilter(), status: ACTIVE_TASK_STATUS }
|
||
}
|
||
|
||
const filter = reactive<TaskCenterTaskFilter>(defaultTaskFilter())
|
||
/** min/max 挡不住手输,落值后把倒挂的起止交换回来。 */
|
||
function clampDatePair(): void {
|
||
const [s, e] = orderedPair(filter.startTime, filter.endTime)
|
||
filter.startTime = s
|
||
filter.endTime = e
|
||
}
|
||
|
||
const tasks = ref<TaskCenterTaskRow[]>([])
|
||
const taskTotal = ref(0)
|
||
const taskPage = ref(1)
|
||
const taskPageSize = ref(20)
|
||
const tasksLoading = ref(false)
|
||
const tasksFailure = ref('')
|
||
|
||
// ---------------------------------------------------------------- 变体采集
|
||
|
||
const variantFilter = reactive<TaskCenterVariantFilter>(createVariantFilter())
|
||
const variantRows = ref<TaskCenterVariantTaskRow[]>([])
|
||
/** 没查过就是 null(徽章画「—」):变体列表是外部依赖,停在页签一时不能替它说 0。 */
|
||
const variantTotal = ref<number | null>(null)
|
||
const variantPage = ref(1)
|
||
const variantPageSize = ref(20)
|
||
const variantLoading = ref(false)
|
||
|
||
// ---------------------------------------------------------------- 详情抽屉
|
||
|
||
const detailVisible = ref(false)
|
||
const detailLoading = ref(false)
|
||
const detail = ref<TaskCenterTaskDetail | null>(null)
|
||
|
||
const updatedAt = ref('')
|
||
|
||
const taskTotalPages = computed(() => Math.max(1, Math.ceil(taskTotal.value / taskPageSize.value)))
|
||
const variantTotalPages = computed(() => Math.max(1, Math.ceil((variantTotal.value ?? 0) / variantPageSize.value)))
|
||
|
||
/** 页签一徽章 = 当前在跑任务数,与汇总卡「进行中任务」同源,不允许两处各算各的。
|
||
* 列表 total(历史全量,且每天 00:00 的 7 天保留清理会往下掉)只用于分页,不上徽章。 */
|
||
const runningBadge = computed(() => tabCount(overview.value?.runningTasks))
|
||
|
||
function errorText(error: unknown, fallback: string): string {
|
||
return error instanceof Error && error.message ? error.message : fallback
|
||
}
|
||
|
||
async function loadOverview() {
|
||
try {
|
||
overview.value = await fetchTaskCenterOverview(companyTab.requestCompanyId)
|
||
} catch (error) {
|
||
showAdminFeedback(errorText(error, '汇总数据加载失败'), 'error')
|
||
}
|
||
}
|
||
|
||
/** 店铺库下拉候选。 */
|
||
async function loadShopOptions() {
|
||
try {
|
||
shopOptions.value = (await fetchTaskCenterShopOptions(companyTab.requestCompanyId)) || []
|
||
} catch (error) {
|
||
showAdminFeedback(errorText(error, '店铺候选加载失败'), 'error')
|
||
}
|
||
}
|
||
|
||
async function loadTasks(silent = false) {
|
||
if (!silent) tasksLoading.value = true
|
||
tasksFailure.value = ''
|
||
try {
|
||
const result = await fetchTaskCenterTasks(
|
||
buildTaskQuery(filter, taskPage.value, taskPageSize.value, companyTab.requestCompanyId),
|
||
)
|
||
tasks.value = result?.items || []
|
||
taskTotal.value = Number(result?.total || 0)
|
||
} catch (error) {
|
||
tasksFailure.value = errorText(error, '任务列表加载失败')
|
||
showAdminFeedback(tasksFailure.value, 'error')
|
||
} finally {
|
||
if (!silent) tasksLoading.value = false
|
||
}
|
||
}
|
||
|
||
async function loadVariants(silent = false) {
|
||
if (!silent) variantLoading.value = true
|
||
try {
|
||
const result = await fetchTaskCenterVariantTasks(
|
||
buildVariantQuery(variantFilter, variantPage.value, variantPageSize.value, companyTab.requestCompanyId),
|
||
)
|
||
variantRows.value = result?.items || []
|
||
variantTotal.value = tabCount(result?.total)
|
||
} catch (error) {
|
||
variantTotal.value = null
|
||
showAdminFeedback(errorText(error, '变体采集加载失败'), 'error')
|
||
} finally {
|
||
if (!silent) variantLoading.value = false
|
||
}
|
||
}
|
||
|
||
/** 汇总卡与店铺候选只描述客户端任务,两个页签都刷新它们(切页签时看到的就是最新)。
|
||
* 店铺候选是字典数据(后端 SELECT DISTINCT、无缓存),所以它不进 30s 心跳:
|
||
* 心跳每轮都重拉等于把一次全库去重乘以 2880/天。代价是新入库店铺要等
|
||
* 下一次进页/切页签/点「刷新」才会出现在下拉里。 */
|
||
async function refreshAll(silent = false) {
|
||
await Promise.all([
|
||
loadOverview(),
|
||
silent ? Promise.resolve() : loadShopOptions(),
|
||
activeTab.value === 'tasks' ? loadTasks(silent) : loadVariants(silent),
|
||
])
|
||
updatedAt.value = formatDateTime(Date.now())
|
||
}
|
||
|
||
/** 首屏把「另一个页签」也查一遍,徽章才有真数可画。
|
||
* 只补这一次:变体列表代理麦象 console(外部依赖、8s 超时),不进 30s 轮询热路径。 */
|
||
async function loadInactiveTabTotal() {
|
||
if (activeTab.value === 'tasks') await loadVariants(true)
|
||
else await loadTasks(true)
|
||
}
|
||
|
||
/** 切公司 = 五个取数点全部重取(汇总卡 / 店铺候选 / 当前页签列表 / 另一页签的徽章数)。
|
||
* filter.shop 必须一起清掉:上一家选中的店铺名在新一家的候选里根本不存在,留着会把切 tab 后的首屏
|
||
* 筛成「暂无符合条件的任务」——口径同 ShopManagePage 的 filter.groupId(G1 钉着那条)。
|
||
* 两个页签的页码也回 1:第 7 页对另一家没有意义。详情不在这条链上重取,它按 taskNo 现点现取,
|
||
* 带的是切换后的 company_id,越权那一侧由后端 scope.visible() 把关。 */
|
||
watch(() => companyTab.activeId, () => {
|
||
filter.shop = ''
|
||
taskPage.value = 1
|
||
variantPage.value = 1
|
||
void refreshAll()
|
||
void loadInactiveTabTotal()
|
||
})
|
||
|
||
function switchTab(tab: BoardTab) {
|
||
if (activeTab.value === tab) return
|
||
activeTab.value = tab
|
||
if (tab === 'tasks' ? tasks.value.length === 0 : variantRows.value.length === 0) {
|
||
void refreshAll()
|
||
}
|
||
}
|
||
|
||
// ---------------------------------------------------------------- 筛选/分页
|
||
|
||
function search() {
|
||
taskPage.value = 1
|
||
void loadTasks()
|
||
}
|
||
|
||
function resetFilter() {
|
||
Object.assign(filter, defaultTaskFilter())
|
||
taskPage.value = 1
|
||
void loadTasks()
|
||
}
|
||
|
||
function retryTasks() {
|
||
void loadTasks()
|
||
}
|
||
|
||
function changeTaskPage(next: number) {
|
||
if (next < 1 || next > taskTotalPages.value) return
|
||
taskPage.value = next
|
||
void loadTasks()
|
||
}
|
||
|
||
function changeTaskSize(size: number) {
|
||
taskPageSize.value = size
|
||
taskPage.value = 1
|
||
void loadTasks()
|
||
}
|
||
|
||
function searchVariant() {
|
||
variantPage.value = 1
|
||
void loadVariants()
|
||
}
|
||
|
||
function resetVariant() {
|
||
Object.assign(variantFilter, createVariantFilter())
|
||
variantPage.value = 1
|
||
void loadVariants()
|
||
}
|
||
|
||
function changeVariantPage(next: number) {
|
||
if (next < 1 || next > variantTotalPages.value) return
|
||
variantPage.value = next
|
||
void loadVariants()
|
||
}
|
||
|
||
function changeVariantSize(size: number) {
|
||
variantPageSize.value = size
|
||
variantPage.value = 1
|
||
void loadVariants()
|
||
}
|
||
|
||
// ---------------------------------------------------------------- 详情
|
||
|
||
async function openDetailByTaskNo(taskNo: string, companyId: number | null = companyTab.requestCompanyId) {
|
||
detailVisible.value = true
|
||
detailLoading.value = true
|
||
detail.value = null
|
||
try {
|
||
detail.value = await fetchTaskCenterTaskDetail(taskNo, companyId)
|
||
if (!detail.value) ElMessage.warning('任务不存在或无权查看')
|
||
} catch (error) {
|
||
showAdminFeedback(errorText(error, '任务详情加载失败'), 'error')
|
||
detailVisible.value = false
|
||
} finally {
|
||
detailLoading.value = false
|
||
}
|
||
}
|
||
|
||
async function openDetail(row: TaskCenterTaskRow) {
|
||
await openDetailByTaskNo(row.taskNo)
|
||
}
|
||
|
||
function accountOf(row: TaskCenterTaskRow): string {
|
||
return row.username || (row.userId != null ? `UID ${row.userId}` : '—')
|
||
}
|
||
|
||
function deviceOf(row: TaskCenterTaskRow): string {
|
||
return deviceDisplayName(row.deviceName, row.deviceId)
|
||
}
|
||
|
||
function currentScopeOf(row: TaskCenterTaskRow): string {
|
||
return (row.currentScope || '').trim() || '—'
|
||
}
|
||
|
||
// ---------------------------------------------------------------- 轮询
|
||
|
||
let pollTimer: ReturnType<typeof setInterval> | null = null
|
||
|
||
function onVisibilityChange() {
|
||
if (typeof document !== 'undefined' && document.visibilityState === 'visible') {
|
||
void refreshAll(true)
|
||
}
|
||
}
|
||
|
||
onMounted(() => {
|
||
void refreshAll()
|
||
void loadInactiveTabTotal()
|
||
// 通知明细里的 taskNo 深链:进页直接开抽屉;不锁当前公司 tab(通知可能来自另一家,后端仍按数据权限收口)。
|
||
const linkedTaskNo = typeof route.query.taskNo === 'string' ? route.query.taskNo.trim() : ''
|
||
if (linkedTaskNo) {
|
||
void openDetailByTaskNo(linkedTaskNo, null)
|
||
}
|
||
document.addEventListener('visibilitychange', onVisibilityChange)
|
||
pollTimer = setInterval(() => {
|
||
if (typeof document !== 'undefined' && document.visibilityState !== 'visible') return
|
||
void refreshAll(true)
|
||
}, POLL_INTERVAL_MS)
|
||
})
|
||
|
||
onUnmounted(() => {
|
||
document.removeEventListener('visibilitychange', onVisibilityChange)
|
||
if (pollTimer != null) {
|
||
clearInterval(pollTimer)
|
||
pollTimer = null
|
||
}
|
||
})
|
||
</script>
|
||
|
||
<template>
|
||
<div class="tc-view">
|
||
<section class="panel-box">
|
||
<div class="tc-head">
|
||
<div class="tabs">
|
||
<button class="tab" :class="{ active: activeTab === 'tasks' }" type="button" @click="switchTab('tasks')">
|
||
客户端任务 <span class="t-count" title="当前在跑任务数,与上方「进行中任务」同源">{{ runningBadge ?? '—' }}</span>
|
||
</button>
|
||
<button class="tab" :class="{ active: activeTab === 'variant' }" type="button" @click="switchTab('variant')">
|
||
变体采集 <span class="t-count" title="麦象变体采集任务条数(全部状态),「—」= 还没查到">{{ variantTotal ?? '—' }}</span>
|
||
</button>
|
||
</div>
|
||
<div class="tc-head-tools">
|
||
<span class="updated-tip">数据更新时间 {{ updatedAt || '—' }}</span>
|
||
<button class="btn btn-ghost" type="button" @click="refreshAll()">刷新</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div v-if="activeTab === 'tasks'" class="tc-cards">
|
||
<div class="tc-card">
|
||
<span class="tc-card-label">总店铺</span>
|
||
<span class="tc-card-value">{{ overview?.shopTotal ?? '—' }}</span>
|
||
<span class="tc-card-note">店铺库内可见店铺</span>
|
||
</div>
|
||
<div class="tc-card">
|
||
<span class="tc-card-label">在跑店铺</span>
|
||
<span class="tc-card-value is-ok">{{ overview?.shopRunning ?? '—' }}</span>
|
||
<span class="tc-card-note">有进行中任务的店铺</span>
|
||
</div>
|
||
<div class="tc-card">
|
||
<span class="tc-card-label">进行中任务</span>
|
||
<span class="tc-card-value">{{ overview?.runningTasks ?? '—' }}</span>
|
||
<span class="tc-card-note">含品牌检测</span>
|
||
</div>
|
||
<div class="tc-card">
|
||
<span class="tc-card-label">今日完成</span>
|
||
<span class="tc-card-value">{{ overview?.todayFinishedTasks ?? '—' }}</span>
|
||
<span class="tc-card-note">终态且完成于今日</span>
|
||
</div>
|
||
<div class="tc-card">
|
||
<span class="tc-card-label">疑似卡住</span>
|
||
<span class="tc-card-value" :class="{ 'is-warn': (overview?.stuckTasks || 0) > 0 }">
|
||
{{ overview?.stuckTasks ?? '—' }}
|
||
</span>
|
||
<span class="tc-card-note">超过 10 分钟无上报</span>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- ============ 页签一:客户端任务 ============ -->
|
||
<template v-if="activeTab === 'tasks'">
|
||
<section class="panel-box">
|
||
<div class="box-head">
|
||
<h3>任务筛选</h3>
|
||
<span class="box-note">默认列出执行中的任务(待执行/已排期并入执行中口径),条数与上方「进行中任务」同源;看历史请换状态或选创建时间</span>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group" style="min-width: 160px">
|
||
<label>账号</label>
|
||
<input v-model="filter.username" type="text" placeholder="模糊搜索账号名" @keyup.enter="search" />
|
||
</div>
|
||
<div class="form-group" style="min-width: 150px">
|
||
<label>业务</label>
|
||
<select v-model="filter.moduleType">
|
||
<option v-for="option in MODULE_OPTIONS" :key="option.value" :value="option.value">{{ option.label }}</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group" style="min-width: 130px">
|
||
<label>状态</label>
|
||
<select v-model="filter.status">
|
||
<option v-for="option in TASK_STATUS_OPTIONS" :key="option.value" :value="option.value">{{ option.label }}</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group shop-filter">
|
||
<label>店铺</label>
|
||
<el-select
|
||
v-model="filter.shop"
|
||
class="admin-filter"
|
||
filterable
|
||
clearable
|
||
placeholder="全部店铺"
|
||
style="width: 220px"
|
||
@change="search"
|
||
>
|
||
<el-option v-for="shop in shopOptions" :key="shop" :label="shop" :value="shop" />
|
||
</el-select>
|
||
<span class="filter-tip">精确匹配店铺名</span>
|
||
</div>
|
||
<div class="form-group" style="min-width: 190px">
|
||
<label>创建时间(起)</label>
|
||
<input v-model="filter.startTime" type="datetime-local" :max="filter.endTime" @change="clampDatePair" />
|
||
</div>
|
||
<div class="form-group" style="min-width: 190px">
|
||
<label>创建时间(止)</label>
|
||
<input v-model="filter.endTime" type="datetime-local" :min="filter.startTime" @change="clampDatePair" />
|
||
</div>
|
||
<div class="form-group">
|
||
<label> </label>
|
||
<div class="filter-actions">
|
||
<button class="btn" type="button" @click="search">查询</button>
|
||
<button class="btn btn-ghost" type="button" @click="resetFilter">重置</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<LoadFailureBar v-if="tasksFailure" :message="tasksFailure" @retry="retryTasks" />
|
||
<TaskCenterTaskTable
|
||
:rows="tasks"
|
||
:loading="tasksLoading"
|
||
:total="taskTotal"
|
||
:page="taskPage"
|
||
:page-size="taskPageSize"
|
||
@page="changeTaskPage"
|
||
@size="changeTaskSize"
|
||
@open="openDetail"
|
||
/>
|
||
</section>
|
||
</template>
|
||
|
||
<!-- ============ 页签二:变体采集 ============ -->
|
||
<template v-else>
|
||
<section class="panel-box">
|
||
<div class="box-head">
|
||
<h3>变体采集(麦象批量任务)</h3>
|
||
<span class="box-note">数据来自麦象平台,范围限本组账号,默认全部状态(待执行/处理中/成功/失败)</span>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group" style="min-width: 150px">
|
||
<label>状态</label>
|
||
<select v-model="variantFilter.status">
|
||
<option v-for="option in VARIANT_STATUS_OPTIONS" :key="option.value" :value="option.value">{{ option.label }}</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group">
|
||
<label> </label>
|
||
<div class="filter-actions">
|
||
<button class="btn" type="button" @click="searchVariant">查询</button>
|
||
<button class="btn btn-ghost" type="button" @click="resetVariant">重置</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<TaskCenterVariantTable
|
||
:rows="variantRows"
|
||
:loading="variantLoading"
|
||
:total="variantTotal ?? 0"
|
||
:page="variantPage"
|
||
:page-size="variantPageSize"
|
||
@page="changeVariantPage"
|
||
@size="changeVariantSize"
|
||
/>
|
||
</section>
|
||
</template>
|
||
|
||
<el-drawer v-model="detailVisible" title="任务详情" size="760px">
|
||
<div v-loading="detailLoading">
|
||
<template v-if="detail">
|
||
<el-descriptions :column="2" border size="small">
|
||
<el-descriptions-item label="任务号">{{ detail.taskNo }}</el-descriptions-item>
|
||
<el-descriptions-item label="业务">{{ detail.moduleLabel || detail.moduleType }}</el-descriptions-item>
|
||
<el-descriptions-item label="账号">{{ accountOf(detail) }}</el-descriptions-item>
|
||
<el-descriptions-item label="设备">
|
||
{{ deviceOf(detail) }}<span v-if="detail.webDevice" class="badge web">网页</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="店铺">{{ shopDisplayName(detail.shopName, detail.shopCount) }}</el-descriptions-item>
|
||
<el-descriptions-item label="状态">
|
||
<span class="st-pill" :class="`is-${taskStatusType(detail.status)}`">{{ taskStatusLabel(detail.status) }}</span>
|
||
<span v-if="detail.stuck" class="badge warn">疑似卡住</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="开始时间">{{ formatDateTime(detail.createdAt) }}</el-descriptions-item>
|
||
<el-descriptions-item label="最近上报">{{ detail.lastReportAt ? formatDateTime(detail.lastReportAt) : '—' }}</el-descriptions-item>
|
||
<el-descriptions-item label="结束时间">{{ detail.finishedAt ? formatDateTime(detail.finishedAt) : '—' }}</el-descriptions-item>
|
||
<el-descriptions-item label="进度">
|
||
<template v-if="taskStatusType(detail.status) === 'failed'">
|
||
<span v-if="detail.progressFailed > 0" class="badge danger">失败 {{ detail.progressFailed }}</span>
|
||
<span v-else>—</span>
|
||
</template>
|
||
<template v-else>
|
||
{{ progressText(detail) }}
|
||
<span v-if="detail.progressFailed > 0" class="badge danger">失败 {{ detail.progressFailed }}</span>
|
||
</template>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="当前处理">{{ currentScopeOf(detail) }}</el-descriptions-item>
|
||
<el-descriptions-item label="错误信息" :span="2">{{ userNotice(detail.errorMessage || detail.message, '—') }}</el-descriptions-item>
|
||
</el-descriptions>
|
||
|
||
<h4 class="detail-title">分组明细({{ (detail.shops || []).length }} 组)</h4>
|
||
<table v-if="(detail.shops || []).length" class="detail-table">
|
||
<thead>
|
||
<tr>
|
||
<th>分组</th>
|
||
<th style="width: 90px">总数</th>
|
||
<th style="width: 90px">成功</th>
|
||
<th style="width: 90px">失败</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr v-for="(item, index) in detail.shops" :key="`${item.scopeKey}-${index}`">
|
||
<td>{{ item.scopeKey || '—' }}</td>
|
||
<td>{{ item.total }}</td>
|
||
<td>{{ item.success }}</td>
|
||
<td>
|
||
<span :class="{ 'is-failed': item.failed > 0 }">{{ item.failed }}</span>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<div v-else class="empty-tip">暂无分组明细</div>
|
||
</template>
|
||
<div v-else-if="!detailLoading" class="empty-tip">任务不存在或无权查看</div>
|
||
</div>
|
||
</el-drawer>
|
||
</div>
|
||
</template>
|
||
|
||
<style scoped>
|
||
/* 沿用「记录与版本」系列的旧后台面板视觉语言。 */
|
||
.tc-view {
|
||
font-family: inherit;
|
||
color: #24384d;
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 18px;
|
||
}
|
||
.panel-box {
|
||
width: 100%;
|
||
min-width: 0;
|
||
padding: 20px 22px 24px;
|
||
border: 1px solid #d8e3ee;
|
||
border-radius: 14px;
|
||
background: linear-gradient(145deg, #ffffff, #f9fbfd);
|
||
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
|
||
}
|
||
h3 {
|
||
margin: 0;
|
||
font-size: 15px;
|
||
font-weight: 650;
|
||
color: #24384d;
|
||
letter-spacing: 0.2px;
|
||
}
|
||
.tc-head {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
flex-wrap: wrap;
|
||
}
|
||
.tc-head-tools {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
}
|
||
.updated-tip {
|
||
color: #8598ab;
|
||
font-size: 12.5px;
|
||
}
|
||
.tabs {
|
||
display: inline-flex;
|
||
gap: 4px;
|
||
padding: 4px;
|
||
border: 1px solid #dbe6f0;
|
||
border-radius: 9px;
|
||
background: #f4f8fb;
|
||
}
|
||
.tab {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 7px;
|
||
min-height: 34px;
|
||
padding: 5px 14px;
|
||
border: none;
|
||
border-radius: 7px;
|
||
background: transparent;
|
||
color: #5b6f83;
|
||
font-family: inherit;
|
||
font-size: 13.5px;
|
||
cursor: pointer;
|
||
}
|
||
.tab:hover {
|
||
color: #2f5d8b;
|
||
}
|
||
.tab.active {
|
||
background: #4f78a5;
|
||
color: #ffffff;
|
||
}
|
||
.t-count {
|
||
padding: 0 7px;
|
||
border-radius: 10px;
|
||
background: rgba(0, 0, 0, 0.08);
|
||
font-size: 11px;
|
||
font-weight: 700;
|
||
}
|
||
.tab.active .t-count {
|
||
background: rgba(255, 255, 255, 0.25);
|
||
}
|
||
.tc-cards {
|
||
display: grid;
|
||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||
gap: 12px;
|
||
margin-top: 16px;
|
||
}
|
||
.tc-card {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 6px;
|
||
padding: 14px 16px;
|
||
border: 1px solid #dbe6f0;
|
||
border-radius: 12px;
|
||
background: #ffffff;
|
||
}
|
||
.tc-card-label {
|
||
color: #5b6f83;
|
||
font-size: 12.5px;
|
||
font-weight: 600;
|
||
}
|
||
.tc-card-value {
|
||
font-size: 24px;
|
||
font-weight: 700;
|
||
line-height: 1.1;
|
||
color: #24384d;
|
||
}
|
||
.tc-card-value.is-ok {
|
||
color: #3f7a42;
|
||
}
|
||
.tc-card-value.is-warn {
|
||
color: #b3803a;
|
||
}
|
||
.tc-card-note {
|
||
color: #93a4b5;
|
||
font-size: 11.5px;
|
||
}
|
||
.box-head {
|
||
display: flex;
|
||
align-items: baseline;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
margin-bottom: 14px;
|
||
}
|
||
.box-note {
|
||
color: #8598ab;
|
||
font-size: 12.5px;
|
||
}
|
||
.shop-filter {
|
||
position: relative;
|
||
}
|
||
/* 提示行必须退出列流:.form-row 是 align-items: flex-end,组内多一行会把「店铺」label 顶得比别的筛选项高。 */
|
||
.filter-tip {
|
||
position: absolute;
|
||
left: 0;
|
||
top: calc(100% + 4px);
|
||
white-space: nowrap;
|
||
color: #93a4b5;
|
||
font-size: 11.5px;
|
||
}
|
||
.form-row {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: flex-end;
|
||
gap: 14px 18px;
|
||
margin-bottom: 22px;
|
||
}
|
||
.form-group {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 7px;
|
||
}
|
||
.form-group label {
|
||
color: #5b6f83;
|
||
font-size: 12.5px;
|
||
font-weight: 600;
|
||
}
|
||
.form-group input,
|
||
.form-group select {
|
||
min-width: 0;
|
||
min-height: 42px;
|
||
padding: 8px 12px;
|
||
border: 1px solid #cbd9e6;
|
||
border-radius: 9px;
|
||
background: #f8fbfd;
|
||
color: #24384d;
|
||
font-size: 13.5px;
|
||
font-family: inherit;
|
||
color-scheme: light;
|
||
outline: none;
|
||
}
|
||
.form-group input:focus,
|
||
.form-group select:focus {
|
||
background: #ffffff;
|
||
border-color: #5f85ad;
|
||
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
|
||
}
|
||
.filter-actions {
|
||
display: flex;
|
||
gap: 10px;
|
||
}
|
||
.btn {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
gap: 8px;
|
||
min-height: 42px;
|
||
padding: 9px 18px;
|
||
border: 1px solid #4f78a5;
|
||
border-radius: 9px;
|
||
background: linear-gradient(135deg, #5f85ad, #4f78a5);
|
||
color: #ffffff;
|
||
font-family: inherit;
|
||
font-size: 13.5px;
|
||
cursor: pointer;
|
||
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
|
||
}
|
||
.btn:hover:not(:disabled) {
|
||
background: linear-gradient(135deg, #7094ba, #5d83ac);
|
||
}
|
||
.btn:disabled {
|
||
cursor: not-allowed;
|
||
opacity: 0.55;
|
||
}
|
||
.btn-ghost {
|
||
background: #ffffff;
|
||
border-color: #c7d7e5;
|
||
color: #4f78a5;
|
||
box-shadow: none;
|
||
}
|
||
.btn-ghost:hover:not(:disabled) {
|
||
background: #edf5fb;
|
||
border-color: #95b1cb;
|
||
color: #2f5d8b;
|
||
}
|
||
.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.web {
|
||
background: #e8f1fb;
|
||
color: #37618f;
|
||
}
|
||
.badge.warn {
|
||
background: #fbf4ea;
|
||
color: #8a6d3b;
|
||
}
|
||
.badge.danger {
|
||
background: #f8ebeb;
|
||
color: #91474f;
|
||
}
|
||
.empty-tip {
|
||
padding: 30px 24px;
|
||
text-align: center;
|
||
color: #8293a5;
|
||
font-size: 13.5px;
|
||
}
|
||
.detail-title {
|
||
margin: 18px 0 10px;
|
||
font-size: 13.5px;
|
||
font-weight: 650;
|
||
color: #24384d;
|
||
}
|
||
.detail-table {
|
||
width: 100%;
|
||
border-collapse: collapse;
|
||
font-size: 13px;
|
||
}
|
||
.detail-table th,
|
||
.detail-table td {
|
||
padding: 8px 10px;
|
||
border-bottom: 1px solid #eaf1f7;
|
||
text-align: left;
|
||
}
|
||
.detail-table .is-failed {
|
||
color: #91474f;
|
||
font-weight: 600;
|
||
}
|
||
@media (max-width: 1280px) {
|
||
.tc-cards {
|
||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||
}
|
||
}
|
||
@media (max-width: 900px) {
|
||
.tc-cards {
|
||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||
}
|
||
}
|
||
</style>
|