fix(task-board): 任务卡片假死自救——轮询失败退避重试+面板刷新按钮+补检轮进度文案
task 31769:外观专利任务后端 18:08 已 SUCCESS,但页面卡片冻在「正在组装 xlsx 92%」 一天多——Patent 轮询配的 propagate 让一次瞬时错误永久杀死轮询,且无自救出口。 - useLiveTaskBoard 摘除 pollErrorMode:失败一律吞掉重试,连续失败按倍数降频(封顶 5x) - TaskCenterPanel 头部新增「刷新」按钮,外观专利/货源查询两页接上(强拉 history+dashboard) - 补检轮触发时进度文案改「有 N 行未完成检测,补检中」,不再停在「正在组装 xlsx」假死 - 回归:AppearancePatentRecheckProgressMessageTest+task-board-poll-resilience.test.ts
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
<template>
|
||||
<div class="task-center-panel">
|
||||
<div class="panel-header">
|
||||
<span class="panel-header__title">{{ title }}</span>
|
||||
<div class="panel-header__left">
|
||||
<span class="panel-header__title">{{ title }}</span>
|
||||
<button v-if="onRefresh" type="button" class="panel-refresh" :disabled="refreshing" @click="handleRefresh">
|
||||
{{ refreshing ? '刷新中…' : '刷新' }}
|
||||
</button>
|
||||
</div>
|
||||
<HistoryTaskLayer
|
||||
:count="historyItems.length"
|
||||
:history-title="historyTitle"
|
||||
@@ -45,12 +50,14 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import HistoryTaskLayer from './HistoryTaskLayer.vue'
|
||||
import TaskItemCard from './TaskItemCard.vue'
|
||||
import TaskStatCards from './TaskStatCards.vue'
|
||||
import type { TaskItemView, TaskStatCard } from './types'
|
||||
|
||||
withDefaults(defineProps<{
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 面板标题(右侧 panel-header) */
|
||||
title: string
|
||||
/** 统计卡 */
|
||||
@@ -68,6 +75,8 @@ withDefaults(defineProps<{
|
||||
historyEmptyText?: string
|
||||
/** 历史记录批量删除回调(传入后历史弹层支持勾选批量删除) */
|
||||
onBatchDelete?: (items: TaskItemView[]) => Promise<void> | void
|
||||
/** 手动刷新回调(传入后面板头部出现「刷新」按钮) */
|
||||
onRefresh?: () => Promise<void> | void
|
||||
}>(), {
|
||||
cards: () => [],
|
||||
currentItems: () => [],
|
||||
@@ -77,6 +86,20 @@ withDefaults(defineProps<{
|
||||
currentEmptyText: '暂无当前任务',
|
||||
historyEmptyText: '暂无历史任务',
|
||||
})
|
||||
|
||||
const refreshing = ref(false)
|
||||
|
||||
async function handleRefresh() {
|
||||
if (!props.onRefresh || refreshing.value) return
|
||||
refreshing.value = true
|
||||
try {
|
||||
await props.onRefresh()
|
||||
} catch {
|
||||
ElMessage.error('刷新失败,请稍后重试')
|
||||
} finally {
|
||||
refreshing.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -96,12 +119,32 @@ withDefaults(defineProps<{
|
||||
border-bottom: 1px solid #2e3a52;
|
||||
}
|
||||
|
||||
.panel-header__left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.panel-header__title {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: #c8d2e2;
|
||||
}
|
||||
|
||||
.panel-refresh {
|
||||
padding: 4px 12px;
|
||||
border: 1px solid #2e3a52;
|
||||
border-radius: 6px;
|
||||
background: transparent;
|
||||
color: #6ea8fe;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.panel-refresh:hover { border-color: #3498db; }
|
||||
.panel-refresh:disabled { opacity: .55; cursor: not-allowed; }
|
||||
|
||||
.task-list-wrap {
|
||||
flex: 1;
|
||||
padding: 16px 20px;
|
||||
|
||||
Reference in New Issue
Block a user