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>
@@ -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 透传给表格')
})
/**
+1
View File
@@ -37,6 +37,7 @@ export default defineConfig({
output: {
manualChunks: {
vue: ['vue', 'vue-router', 'pinia'],
'element-plus': ['element-plus'],
},
},
},
@@ -164,71 +164,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 }">
@@ -252,6 +197,15 @@ import { userNotice } from '@/shared/utils/user-notice'
import { ElMessage } 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 {
addPatrolDeleteCandidate,
@@ -405,11 +359,6 @@ const hasQueueWork = computed(
!!activeTaskId.value,
);
function uidForStorage() {
return typeof window !== "undefined"
? window.localStorage.getItem("uid") || "0"
: "0";
}
function matchedStorageKey() {
return `patrol-delete:matched:${uidForStorage()}`;
@@ -423,13 +372,7 @@ function countryCodesStorageKey() {
return `patrol-delete:country-codes:${uidForStorage()}`;
}
function rowKeyForMatch(row: PatrolDeleteShopQueueItem) {
return `${(row.shopName || "").trim()}::${row.shopId || ""}`;
}
function historyItemKey(item: PatrolDeleteHistoryItem) {
return `${item.taskId ?? 0}:${item.resultId ?? 0}`;
}
function taskGroupKey(item: PatrolDeleteHistoryItem) {
return `task:${item.taskId ?? item.resultId ?? 0}`;
@@ -453,20 +396,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>,
@@ -493,34 +422,7 @@ function createSubmissionId(taskId: number, shopName?: string) {
return `patrol-delete:${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: PatrolDeleteShopQueueItem) {
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 buildTemplateCountrySections(): PatrolDeleteCountrySection[] {
return selectedCountryNames.value.map((country) => ({
@@ -180,37 +180,21 @@
>
<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="100" />
<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="100" show-overflow-tooltip />
<el-table-column label="状态" width="100" show-overflow-tooltip>
<template #default="{ row }">{{ formatMatchStatus(row.matchStatus) }}</template>
</el-table-column>
<el-table-column label="说明" min-width="140" 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="完成「匹配店铺」后,在此展示匹配结果,确认无误后再启动任务。"
:shop-name-min-width="100"
shop-id-label="店铺ID"
:company-min-width="100"
:status-width="100"
:remark-min-width="140"
@remove="removeMatchedRow"
/>
</template>
<template #item-actions="{ item }">
@@ -245,6 +229,7 @@ import {
import ModuleTemplateDownload from '@/shared/components/ModuleTemplateDownload.vue'
import FileUploadZone from '@/shared/components/FileUploadZone.vue'
import TaskCenterPanel from '@/shared/components/tasks/TaskCenterPanel.vue'
import BrandShopMatchTable from './BrandShopMatchTable.vue'
import type { TaskItemView, TaskStatCard } from '@/shared/components/tasks/types'
import { getPywebviewApi, type PywebviewApi } from '@/shared/bridges/pywebview'
import { useExcelFileUpload } from '@/shared/composables/useExcelFileUpload'
@@ -940,7 +925,7 @@ async function runMatch() {
}
}
function formatMatchStatus(status: string | undefined) {
function formatMatchStatus(status?: string | null) {
const s = (status || '').trim()
const map: Record<string, string> = { MATCHED: '已匹配', PENDING: '待匹配', CONFLICT: '需人工确认', INDEX_STALE: '匹配已过期' }
return map[s] || (s ? s : '—')
@@ -99,37 +99,21 @@
>
<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="100" />
<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="100" show-overflow-tooltip />
<el-table-column label="状态" width="100" show-overflow-tooltip>
<template #default="{ row }">{{ formatMatchStatus(row.matchStatus) }}</template>
</el-table-column>
<el-table-column label="说明" min-width="140" 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="完成「匹配店铺」后,在此展示匹配结果,确认无误后再启动任务。"
:shop-name-min-width="100"
shop-id-label="店铺ID"
:company-min-width="100"
:status-width="100"
:remark-min-width="140"
@remove="removeMatchedRow"
/>
</template>
<template #item-actions="{ item }">
@@ -155,6 +139,7 @@ import { userNotice } from '@/shared/utils/user-notice'
import { ElMessage } 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 type { TaskItemView, TaskStatCard } from '@/shared/components/tasks/types'
import { LISTING_FILTER_OPTIONS, RISK_LISTING_FILTER_KEY, productRiskFilterIssues, type ListingFilterValue } from '@/pages/brand/components/listingFilters'
import {
@@ -1073,7 +1058,7 @@ async function downloadResult(item: ProductRiskHistoryItem) {
}
}
function formatMatchStatus(status: string | undefined) {
function formatMatchStatus(status?: string | null) {
const s = (status || '').trim()
const map: Record<string, string> = {
MATCHED: '已匹配',
@@ -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);
@@ -0,0 +1,113 @@
<script setup lang="ts" generic="T extends BrandShopMatchRow">
import type { BrandShopMatchRow } from './brand-shop-match-shared'
const page = defineModel<number>('page', { required: true })
defineProps<{
items: T[]
total: number
pageSize: number
rowKey: (row: T) => string
statusText: (status?: string | null) => string
remarkText: (row: T) => string
emptyText: string
shopNameMinWidth?: number
shopIdLabel?: string
companyMinWidth?: number
statusWidth?: number
remarkMinWidth?: number
}>()
const emit = defineEmits<{
remove: [T]
}>()
</script>
<template>
<div v-if="!items.length" class="match-empty">{{ emptyText }}</div>
<template v-else>
<el-table
:data="items"
:row-key="rowKey"
:highlight-current-row="false"
class="result-table match-table"
>
<el-table-column prop="shopName" label="店铺名" :min-width="shopNameMinWidth ?? 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="shopIdLabel ?? '店铺 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="companyMinWidth ?? 120" show-overflow-tooltip />
<el-table-column label="状态" :width="statusWidth ?? 110" show-overflow-tooltip>
<template #default="{ row }">
{{ statusText(row.matchStatus) }}
</template>
</el-table-column>
<el-table-column label="说明" :min-width="remarkMinWidth ?? 180" show-overflow-tooltip>
<template #default="{ row }">
{{ remarkText(row) }}
</template>
</el-table-column>
<el-table-column label="操作" width="72" align="center">
<template #default="{ row }">
<button type="button" class="link-danger" @click="emit('remove', row)">删除</button>
</template>
</el-table-column>
</el-table>
<el-pagination
v-if="total > pageSize"
class="matched-pagination"
layout="total, prev, pager, next"
:total="total"
:page-size="pageSize"
v-model:current-page="page"
/>
</template>
</template>
<style scoped>
.match-empty {
color: #5e6878;
font-size: 13px;
padding: 12px 8px;
margin-bottom: 12px;
text-align: center;
}
.match-table {
margin-bottom: 18px;
}
.match-table :deep(.el-table__body tr:hover > td.el-table__cell),
.match-table :deep(.el-table__body tr.hover-row > td.el-table__cell),
.match-table :deep(.el-table__body tr.current-row > td.el-table__cell) {
background-color: var(--el-table-tr-bg-color, #242424) !important;
}
.result-table {
--el-table-bg-color: #242424;
--el-table-tr-bg-color: #242424;
--el-table-header-bg-color: #2e3a52;
--el-table-text-color: #c8d2e2;
--el-table-border-color: #333;
}
.ok {
color: #27ae60;
}
.fail {
color: #e67e22;
}
.link-danger {
background: none;
border: none;
color: #e74c3c;
cursor: pointer;
font-size: 12px;
padding: 0;
}
.link-danger:hover {
text-decoration: underline;
}
</style>
@@ -121,67 +121,16 @@
完成“匹配店铺”后,这里会展示匹配结果。
</div>
<div v-else class="match-zone-scroll">
<el-table
: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"
/>
</div>
</div>
@@ -273,6 +222,15 @@ import { formatDateTime } from '@/shared/utils/datetime'
import { RUNNING_UNTIL_DONE_STATUS_OPTIONS, taskStatusClass, taskStatusText } from '@/shared/utils/task-status-text'
import { useHistoryPolling } from '@/shared/composables/useHistoryPolling'
import { runBatchDelete } from '@/shared/utils/batch-delete'
import BrandShopMatchTable from './BrandShopMatchTable.vue'
import {
formatMatchRemark,
formatMatchStatus,
historyItemKey,
isTransientBackendError,
rowKeyForMatch,
uidForStorage,
} from './brand-shop-match-shared'
import { isRecordMissingError, parseTaskStartTimes, removeTaskStartTime, upsertTaskStartTime } from '@/shared/utils/task-queue-state.ts'
import { useTablePaging } from '@/shared/composables/useTablePaging.ts'
import { getModuleProgressLight } from '@/shared/api/progress-light.ts'
@@ -389,11 +347,6 @@ function toWithdrawTaskView(item: WithdrawTaskGroupItem): TaskItemView {
};
}
function uidForStorage() {
return typeof window !== "undefined"
? window.localStorage.getItem("uid") || "0"
: "0";
}
function matchedStorageKey() {
return `withdraw:matched:${uidForStorage()}`;
@@ -407,13 +360,7 @@ function taskStartTimeStorageKey() {
return `withdraw:start-times:${uidForStorage()}`;
}
function rowKeyForMatch(row: WithdrawShopQueueItem) {
return `${(row.shopName || "").trim()}::${row.shopId || ""}`;
}
function historyItemKey(item: WithdrawHistoryItem) {
return `${item.taskId ?? 0}:${item.resultId ?? 0}`;
}
function batchKeyForItems(items: WithdrawShopQueueItem[]) {
return items.map((item) => rowKeyForMatch(item)).join("||");
@@ -513,20 +460,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>,
@@ -553,34 +486,7 @@ function createSubmissionId(taskId: number, shopName?: string) {
return `withdraw:${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: WithdrawShopQueueItem) {
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 withWithdrawFallback<T extends WithdrawHistoryItem | WithdrawShopQueueItem>(
item: T,
@@ -0,0 +1,61 @@
/** 品牌队列类 Tab(巡店删除/取款/查 ASIN)共用的纯逻辑与存储口径。
* 这三个页面历史上各抄一份,改一处漏两处;这里只收**逐字同形**的部分。 */
export type BrandShopMatchRow = {
shopName?: string | null
shopId?: number | string | null
platform?: string | null
companyName?: string | null
matchStatus?: string | null
matchMessage?: string | null
matched?: boolean
}
const TRANSIENT_BACKEND_ERROR_PATTERNS = [
'network error',
'failed to fetch',
'timeout',
'503',
'502',
'504',
'500',
'load failed',
]
export function uidForStorage(): string {
return typeof window !== 'undefined' ? window.localStorage.getItem('uid') || '0' : '0'
}
export function isTransientBackendError(error: unknown): boolean {
const message = (error instanceof Error ? error.message : String(error || '')).toLowerCase()
return TRANSIENT_BACKEND_ERROR_PATTERNS.some((pattern) => message.includes(pattern))
}
export function formatMatchStatus(status?: string | null): string {
const value = (status || '').trim()
const map: Record<string, string> = {
MATCHED: '已匹配',
PENDING: '待匹配',
CONFLICT: '需人工确认',
INDEX_STALE: '匹配已过期',
}
return map[value] || value || '-'
}
export function formatMatchRemark(row: BrandShopMatchRow): string {
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 '未匹配成功,请检查店铺名'
}
export function rowKeyForMatch(row: { shopName?: string | null; shopId?: number | string | null }): string {
return `${(row.shopName || '').trim()}::${row.shopId || ''}`
}
export function historyItemKey(item: { taskId?: number | null; resultId?: number | null }): string {
return `${item.taskId ?? 0}:${item.resultId ?? 0}`
}
@@ -0,0 +1,24 @@
<script setup lang="ts">
const visible = defineModel<boolean>('visible', { required: true })
defineProps<{
url: string
}>()
</script>
<template>
<el-dialog v-model="visible" title="图片预览" width="760px" class="image-preview-dialog" append-to-body>
<img v-if="url" :src="url" class="image-preview-dialog__image" alt="" />
</el-dialog>
</template>
<style scoped>
.image-preview-dialog__image {
display: block;
width: 100%;
max-height: 72vh;
object-fit: contain;
border-radius: 8px;
background: #101010;
}
</style>
@@ -0,0 +1,240 @@
<script setup lang="ts">
import AiSectionCard from '@/shared/components/ai-workflow/AiSectionCard.vue'
import { safeHttpUrl } from '@/shared/utils/safe-url'
import type { WorkspaceState, WorkspaceTab } from '@/pages/image-video/delivery-video-workspace-types'
defineProps<{
workspace: WorkspaceState
activeTab: WorkspaceTab
busy: boolean
downloading: boolean
polling: boolean
executeId: string
pollCount: number
videoUrl: string
debugUrl: string
resultText: string
primaryActionText: string
canReset: boolean
}>()
const emit = defineEmits<{
primary: []
reset: []
}>()
</script>
<template>
<AiSectionCard :step="activeTab === 'remake' ? '07' : '06'" title="视频结果" description="提交后在这里等待、预览和下载成片。"
class="delivery-card delivery-card--preview">
<el-tabs v-model="workspace.generationMode" class="generation-mode-tabs">
<el-tab-pane label="样片模式" name="draft">
<p>快速生成预览视频,用于验证场景结构、镜头调度、主体动作和提示词意图,消耗更少 token。</p>
</el-tab-pane>
<el-tab-pane label="正常生成" name="standard">
<p>关闭样片模式,按正常规格生成视频。</p>
</el-tab-pane>
</el-tabs>
<div class="preview-panel__meta">
<div class="preview-row">
<span class="preview-row__label">模式</span>
<span class="preview-row__value">{{ activeTab === 'remake' ? '视频复刻' : '图生视频' }}</span>
</div>
<div class="preview-row">
<span class="preview-row__label">规格</span>
<span class="preview-row__value">{{ workspace.ratio }} / {{ workspace.resolution }} / {{
workspace.durationSeconds }}秒</span>
</div>
<div class="preview-row">
<span class="preview-row__label">产品</span>
<span class="preview-row__value">{{ workspace.productName || '未设置' }}</span>
</div>
</div>
<div class="video-result-actions">
<el-button class="delivery-primary-btn" type="primary" :loading="busy || downloading"
:disabled="busy || downloading" @click="emit('primary')">
{{ primaryActionText }}
</el-button>
<el-button v-if="canReset" class="delivery-secondary-btn"
:disabled="busy || downloading" @click="emit('reset')">
重置内容
</el-button>
</div>
<div v-if="busy || executeId" class="assembly-waiting"
:class="{ 'assembly-waiting--done': !busy && executeId }">
<div class="assembly-waiting__spinner" aria-hidden="true"></div>
<div class="assembly-waiting__content">
<strong>{{ polling ? '正在生成视频,请保持页面打开' : '工作流已提交' }}</strong>
<span v-if="executeId">执行 ID:{{ executeId }}</span>
<span v-if="polling">已查询 {{ pollCount }} 次,系统会每 5 秒自动刷新结果。</span>
</div>
</div>
<div class="video-result-panel">
<div v-if="videoUrl" class="video-result-panel__player">
<video :src="videoUrl" controls playsinline preload="metadata"></video>
</div>
<div v-else class="video-result-panel__empty">
<span>{{ polling ? '视频生成中,完成后会在这里显示结果。' : '提交生成后,这里会显示生成的视频结果。' }}</span>
</div>
<div v-if="videoUrl" class="video-result-panel__link">
<span>视频地址</span>
<a :href="safeHttpUrl(videoUrl)" target="_blank" rel="noreferrer">{{ videoUrl }}</a>
</div>
<div v-if="debugUrl" class="video-result-panel__link">
<span>调试链接</span>
<a :href="safeHttpUrl(debugUrl)" target="_blank" rel="noreferrer">{{ debugUrl }}</a>
</div>
<details v-if="resultText" class="video-result-panel__debug">
<summary>查看原始返回</summary>
<el-input :model-value="resultText" type="textarea" :rows="8" resize="none" readonly />
</details>
</div>
</AiSectionCard>
</template>
<style scoped>
.generation-mode-tabs :deep(.el-tabs__header) {
margin-bottom: 10px;
}
.generation-mode-tabs :deep(.el-tabs__item) {
color: #9b9b9b;
font-size: 12px;
}
.generation-mode-tabs :deep(.el-tabs__active-bar) {
background: #c9a260;
}
.generation-mode-tabs :deep(.el-tabs__content) {
display: none;
}
.generation-mode-tabs p {
display: none;
}
.preview-panel__meta {
display: grid;
gap: 6px;
margin-bottom: 12px;
}
.preview-row {
display: flex;
justify-content: space-between;
gap: 12px;
color: #bdbdbd;
font-size: 12px;
}
.preview-row__value {
color: #f4f4f4;
text-align: right;
}
.video-result-actions {
display: grid;
gap: 8px;
margin-bottom: 12px;
}
.delivery-primary-btn {
width: 100%;
min-height: 40px;
margin-bottom: 12px;
border-color: transparent;
background: linear-gradient(135deg, #a57d45 0%, #c9a260 100%);
color: #fff;
font-weight: 800;
}
.delivery-secondary-btn {
width: 100%;
margin-left: 0 !important;
}
.assembly-waiting {
display: flex;
gap: 10px;
align-items: flex-start;
padding: 10px 12px;
margin-bottom: 12px;
border: 1px solid #3b3224;
border-radius: 8px;
background: rgba(181, 140, 81, 0.1);
}
.assembly-waiting--done {
border-color: #2f4234;
background: rgba(74, 170, 118, 0.08);
}
.assembly-waiting__spinner {
width: 14px;
height: 14px;
margin-top: 2px;
border: 2px solid rgba(201, 162, 96, 0.3);
border-top-color: #c9a260;
border-radius: 50%;
animation: assembly-spin 0.9s linear infinite;
}
.assembly-waiting--done .assembly-waiting__spinner {
display: none;
}
.assembly-waiting__content {
display: grid;
gap: 3px;
}
.assembly-waiting__content strong {
color: #f4d392;
font-size: 12px;
}
.assembly-waiting__content span {
color: #a8a8a8;
font-size: 11px;
word-break: break-all;
}
.video-result-panel {
display: grid;
gap: 10px;
}
.video-result-panel__player,
.video-result-panel__empty {
display: flex;
align-items: center;
justify-content: center;
min-height: 180px;
border: 1px solid #303030;
border-radius: 10px;
background: #101010;
overflow: hidden;
}
.video-result-panel__player video {
width: 100%;
max-height: 360px;
}
.video-result-panel__empty {
padding: 20px;
color: #9b9b9b;
font-size: 12px;
text-align: center;
}
.video-result-panel__link {
display: grid;
gap: 3px;
color: #bdbdbd;
font-size: 11px;
word-break: break-all;
}
.video-result-panel__link span {
color: #9b9b9b;
}
.video-result-panel__link a {
color: #c9a260;
}
.video-result-panel__debug {
color: #bdbdbd;
font-size: 12px;
}
.video-result-panel__debug summary {
cursor: pointer;
}
.video-result-panel__debug :deep(.el-textarea__inner) {
margin-top: 8px;
font-family: Consolas, 'Courier New', monospace;
font-size: 11px;
}
@keyframes assembly-spin {
to {
transform: rotate(360deg);
}
}
</style>
@@ -0,0 +1,93 @@
<script setup lang="ts">
import type { SecretForm, SecretStatus } from '@/pages/image-video/delivery-video-workspace-types'
const visible = defineModel<boolean>('visible', { required: true })
defineProps<{
status: SecretStatus | null
statusText: string
expireText: string
saving: boolean
form: SecretForm
}>()
const emit = defineEmits<{
save: []
}>()
</script>
<template>
<el-dialog v-model="visible" title="视频密钥设置" width="560px" class="image-video-secret-dialog"
append-to-body destroy-on-close>
<div class="secret-status" :class="{ 'secret-status--valid': status?.valid }">
<span>{{ statusText }}</span>
<span v-if="expireText">{{ expireText }}</span>
</div>
<el-form label-position="top" class="secret-form">
<el-form-item label="爬虫密钥">
<el-input v-model="form.copyApiKey" type="password" show-password placeholder="不填写则保留当前有效值" />
<div v-if="status?.copyApiKeyMasked" class="secret-form__hint">当前:{{ status.copyApiKeyMasked }}</div>
</el-form-item>
<el-form-item label="T8密钥(海外)">
<el-input v-model="form.t8Key" type="password" show-password placeholder="不填写则保留当前有效值" />
<div v-if="status?.t8KeyMasked" class="secret-form__hint">当前:{{ status.t8KeyMasked }}</div>
</el-form-item>
<el-form-item label="T8密钥(国内)">
<el-input v-model="form.t8VideoKey" type="password" show-password placeholder="不填写则保留当前有效值" />
<div v-if="status?.t8VideoKeyMasked" class="secret-form__hint">当前:{{ status.t8VideoKeyMasked }}</div>
</el-form-item>
<el-form-item label="音频密钥">
<el-input v-model="form.voiceApiKey" type="password" show-password placeholder="不填写则保留当前有效值" />
<div v-if="status?.voiceApiKeyMasked" class="secret-form__hint">当前:{{ status.voiceApiKeyMasked }}</div>
</el-form-item>
<el-form-item label="音频团队ID">
<el-input v-model="form.voiceGroupId" type="password" show-password placeholder="不填写则保留当前有效值" />
<div v-if="status?.voiceGroupIdMasked" class="secret-form__hint">当前:{{ status.voiceGroupIdMasked }}</div>
</el-form-item>
<el-form-item label="有效期">
<el-select v-model="form.expireDays" class="delivery-select">
<el-option label="1 天" :value="1" />
<el-option label="7 天" :value="7" />
<el-option label="30 天" :value="30" />
<el-option label="永久" :value="0" />
</el-select>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" :loading="saving" @click="emit('save')">保存</el-button>
</template>
</el-dialog>
</template>
<style scoped>
.secret-status {
display: flex;
justify-content: space-between;
gap: 12px;
margin-bottom: 16px;
padding: 10px 12px;
border: 1px solid #4a3620;
border-radius: 8px;
background: rgba(181, 140, 81, 0.12);
color: #f4d392;
font-size: 13px;
}
.secret-status--valid {
border-color: rgba(74, 170, 118, 0.45);
background: rgba(74, 170, 118, 0.12);
color: #b8f0cf;
}
.secret-form {
max-height: 56vh;
overflow-y: auto;
padding-right: 4px;
}
.secret-form__hint {
margin-top: 6px;
color: #a8a8a8;
font-size: 12px;
}
</style>
@@ -0,0 +1,202 @@
<script setup lang="ts">
import AiAssetDropzone from '@/shared/components/ai-workflow/AiAssetDropzone.vue'
import type { AssetState, VoiceListItem } from '@/pages/image-video/delivery-video-workspace-types'
const visible = defineModel<boolean>('visible', { required: true })
const tab = defineModel<'list' | 'clone'>('tab', { required: true })
const keyword = defineModel<string>('keyword', { required: true })
const cloneName = defineModel<string>('cloneName', { required: true })
defineProps<{
items: VoiceListItem[]
filteredItems: VoiceListItem[]
loading: boolean
cloneAsset: AssetState
}>()
const emit = defineEmits<{
list: []
use: [VoiceListItem]
delete: [VoiceListItem]
clone: []
selectCloneAsset: [File]
urlCloneAsset: [string]
clearCloneAsset: []
}>()
</script>
<template>
<el-dialog v-model="visible" title="音色管理" width="920px" class="image-video-secret-dialog voice-dialog"
append-to-body>
<el-tabs v-model="tab" class="voice-dialog__tabs">
<el-tab-pane label="音色列表" name="list">
<div class="voice-dialog__toolbar voice-dialog__toolbar--list">
<div class="voice-list-summary">
<strong>{{ filteredItems.length }}</strong>
<span>/ {{ items.length }} 个音色</span>
</div>
<el-input v-model="keyword" class="voice-search-input" clearable placeholder="搜索音色名称或 voice_id"
@keyup.enter="emit('list')" @clear="emit('list')" />
<button type="button" class="script-primary-action-btn" :disabled="loading" @click="emit('list')">
刷新音色
</button>
</div>
<div v-if="filteredItems.length" class="voice-list">
<div v-for="item in filteredItems" :key="item.voiceId" class="voice-list__item">
<div class="voice-list__meta">
<strong>{{ item.name || item.voiceId }}</strong>
<span>{{ item.voiceId }}</span>
<em v-if="item.description">{{ item.description }}</em>
</div>
<span class="voice-list__source">{{ item.sourceLabel }}</span>
<button type="button" class="script-action-btn" @click="emit('use', item)">使用此音色</button>
<button v-if="item.sourceKey !== 'system_voice'" type="button"
class="script-action-btn script-action-btn--danger" :disabled="loading"
@click="emit('delete', item)">删除音色</button>
</div>
</div>
<el-empty v-else description="暂无可展示音色,请确认接口已返回音色数据" />
</el-tab-pane>
<el-tab-pane label="克隆音色" name="clone">
<div class="delivery-field">
<span class="delivery-field__label">音色名称</span>
<el-input v-model="cloneName" clearable placeholder="输入克隆后的音色名称" />
</div>
<AiAssetDropzone title="克隆素材" description="仅用于音色克隆,不会写入 text_info.file_url。" placeholder="上传音频或视频"
helper="支持 MP3 / WAV / MP4,或粘贴素材链接" accept="audio/*,video/*" :file-name="cloneAsset.fileName"
:preview-url="cloneAsset.previewUrl" :preview-kind="cloneAsset.previewKind"
:source-url="cloneAsset.sourceUrl" :loading="cloneAsset.uploading" allow-url compact
action-label="上传克隆素材" selected-label="克隆素材" url-label="克隆素材链接"
@select="(file) => emit('selectCloneAsset', file)"
@url-change="(url) => emit('urlCloneAsset', url)"
@clear="emit('clearCloneAsset')" />
<div class="voice-dialog__toolbar">
<button type="button" class="script-primary-action-btn" :disabled="loading" @click="emit('clone')">
开始克隆
</button>
</div>
</el-tab-pane>
</el-tabs>
</el-dialog>
</template>
<style scoped>
.voice-dialog__tabs {
gap: 10px;
}
.voice-dialog__tabs :deep(.el-tabs__item:not(.is-active)) {
color: #9b9b9b;
}
.voice-dialog__toolbar {
display: flex;
justify-content: flex-end;
margin-top: 12px;
}
.voice-dialog__toolbar--list {
align-items: center;
justify-content: flex-start;
gap: 10px;
margin-top: 0;
margin-bottom: 12px;
}
.voice-list-summary {
display: flex;
align-items: baseline;
gap: 4px;
color: #9b9b9b;
font-size: 12px;
white-space: nowrap;
}
.voice-list-summary strong {
color: #f4f4f4;
font-size: 16px;
}
.voice-search-input {
max-width: 280px;
}
.voice-list {
display: grid;
gap: 8px;
max-height: 52vh;
overflow-y: auto;
}
.voice-list__item {
display: grid;
grid-template-columns: minmax(0, 1fr) auto auto auto;
gap: 10px;
align-items: center;
padding: 10px 12px;
border: 1px solid #303030;
border-radius: 8px;
background: #111;
}
.voice-list__meta {
display: grid;
gap: 2px;
min-width: 0;
}
.voice-list__meta strong {
color: #f4f4f4;
font-size: 13px;
}
.voice-list__meta span {
color: #9b9b9b;
font-size: 11px;
word-break: break-all;
}
.voice-list__meta em {
color: #c8c8c8;
font-size: 12px;
font-style: normal;
}
.voice-list__source {
color: #b99455;
font-size: 11px;
white-space: nowrap;
}
.delivery-field {
display: grid;
gap: 6px;
margin-bottom: 12px;
}
.delivery-field__label {
color: #bdbdbd;
font-size: 12px;
}
.script-action-btn,
.script-primary-action-btn {
min-height: 36px;
border: 1px solid #484848;
border-radius: 8px;
background: #171717;
color: #f7f7ff;
font: inherit;
font-size: 13px;
font-weight: 700;
cursor: pointer;
white-space: nowrap;
}
.script-primary-action-btn {
background: linear-gradient(135deg, #a57d45 0%, #c9a260 100%);
border-color: transparent;
color: #fff;
}
.script-action-btn--danger {
color: #ff9f9f;
}
.script-action-btn:disabled,
.script-primary-action-btn:disabled {
opacity: 0.55;
cursor: not-allowed;
}
@media (max-width: 980px) {
.voice-list__item {
grid-template-columns: 1fr;
}
.voice-dialog__toolbar--list {
align-items: stretch;
flex-direction: column;
}
}
</style>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,83 @@
import type { ImageVideoSecretStatusVo } from '@/shared/api/java-modules'
export type WorkspaceTab = 'remake' | 'imageToVideo'
export type PreviewKind = 'image' | 'video' | 'file'
export type MediaType = 'image' | 'video' | 'audio' | 'file'
export type AssetKey = 'referenceAsset' | 'sceneAsset' | 'modelAsset' | 'speechAsset'
export type VoiceMode = 'textOnly' | 'uploadAudio' | 'synthesize'
export type VoiceStatusType = 'info' | 'success' | 'error'
export type AssetState = {
/** v-for 稳定 key(审查 C6):产品图可删中间行,用 index 当 key 会让上传槽组件实例错位复用 */
id: string
fileName: string
previewUrl: string
previewKind: PreviewKind
sourceUrl: string
mediaType: MediaType
uploading: boolean
}
export type AssemblyState = {
loading: boolean
resultText: string
executeId: string
polling: boolean
pollCount: number
videoUrl: string
debugUrl: string
downloading: boolean
pollTimer: number
}
export type WorkspaceState = {
referenceAsset: AssetState
productAssets: AssetState[]
sceneAsset: AssetState
modelAsset: AssetState
speechAsset: AssetState
ratio: string
resolution: string
model: string
generationMode: 'draft' | 'standard'
duration: string
durationSeconds: number
videoPrompt: string
sceneMode: string
scenePrompt: string
faceInputType: string
gender: string
modelFigure: string
language: string
audioType: string
voiceMode: VoiceMode
voiceId: string
voiceName: string
scriptText: string
scriptSourceUrl: string
categoryName: string
productName: string
productFocus: string
assembly: AssemblyState
}
export type VoiceListItem = {
voiceId: string
name: string
groupId: string
description: string
sourceKey: string
sourceLabel: string
raw: unknown
}
export type SecretForm = {
copyApiKey: string
t8Key: string
t8VideoKey: string
voiceApiKey: string
voiceGroupId: string
expireDays: number
}
export type SecretStatus = ImageVideoSecretStatusVo