|
|
|
|
@ -8,7 +8,7 @@
|
|
|
|
|
<p class="page-desc">Task History Management</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 状态筛选 Tab (保留原有的状态切换) -->
|
|
|
|
|
<!-- 状态筛选 -->
|
|
|
|
|
<div class="filter-tabs">
|
|
|
|
|
<div v-for="tab in statusTabs" :key="tab.key" class="tab-item"
|
|
|
|
|
:class="{ active: currentStatus === tab.key }"
|
|
|
|
|
@ -22,7 +22,7 @@
|
|
|
|
|
<div class="main-content">
|
|
|
|
|
<div class="ui-card modern-table-card">
|
|
|
|
|
|
|
|
|
|
<!-- 【新增】工具栏:搜索与类型筛选 -->
|
|
|
|
|
<!-- 工具栏:搜索与类型筛选 -->
|
|
|
|
|
<div class="toolbar-section">
|
|
|
|
|
<div class="search-box">
|
|
|
|
|
<i class="fas fa-search search-icon"></i>
|
|
|
|
|
@ -46,7 +46,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 桌面表头 (汉化) -->
|
|
|
|
|
<!-- 桌面表头 -->
|
|
|
|
|
<div class="list-header-row desktop-only-flex">
|
|
|
|
|
<div class="col-id sortable" @click="handleSort('task_id', $event)">
|
|
|
|
|
ID <i :class="getSortIcon('task_id')"></i>
|
|
|
|
|
@ -96,6 +96,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col-info desktop-only-cell">
|
|
|
|
|
<!-- 这里的 class 样式已修改,支持换行 -->
|
|
|
|
|
<span class="task-name">{{ getTaskName(task) }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@ -205,8 +206,8 @@ const userStore = useUserStore()
|
|
|
|
|
|
|
|
|
|
// 筛选状态
|
|
|
|
|
const currentStatus = ref('all')
|
|
|
|
|
const searchKeyword = ref('') // 新增:搜索关键词
|
|
|
|
|
const selectedTaskType = ref('all') // 新增:类型筛选
|
|
|
|
|
const searchKeyword = ref('')
|
|
|
|
|
const selectedTaskType = ref('all')
|
|
|
|
|
|
|
|
|
|
const statusTabs = [
|
|
|
|
|
{ key: 'all', label: '全部' },
|
|
|
|
|
@ -221,7 +222,6 @@ const showPreview = ref(false)
|
|
|
|
|
const previewTaskId = ref(null)
|
|
|
|
|
const previewTaskType = ref('')
|
|
|
|
|
|
|
|
|
|
// 日志状态
|
|
|
|
|
const showLogModal = ref(false)
|
|
|
|
|
const currentLogTaskId = ref(null)
|
|
|
|
|
const logContent = ref('')
|
|
|
|
|
@ -231,7 +231,6 @@ const normalizeStatus = (status) => {
|
|
|
|
|
return status
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 状态汉化
|
|
|
|
|
const formatStatusLabel = (s) => {
|
|
|
|
|
const map = {
|
|
|
|
|
running: '运行中', processing: '处理中', pending: '排队中', waiting: '排队中',
|
|
|
|
|
@ -240,7 +239,6 @@ const formatStatusLabel = (s) => {
|
|
|
|
|
return map[s] || s
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 类型汉化
|
|
|
|
|
const formatTypeLabel = (t) => {
|
|
|
|
|
const map = {
|
|
|
|
|
perturbation: '通用防护',
|
|
|
|
|
@ -263,33 +261,26 @@ const formatDate = (iso) => iso ? new Date(iso).toLocaleString('zh-CN', { hour12
|
|
|
|
|
|
|
|
|
|
const handleStatusChange = (status) => { currentStatus.value = status; currentPage.value = 1 }
|
|
|
|
|
|
|
|
|
|
// === 核心过滤逻辑修改 ===
|
|
|
|
|
const filteredAndSortedTasks = computed(() => {
|
|
|
|
|
let result = [...(taskStore.tasks || [])]
|
|
|
|
|
|
|
|
|
|
// 1. 状态筛选
|
|
|
|
|
if (currentStatus.value !== 'all') {
|
|
|
|
|
result = result.filter(t => normalizeStatus(t.status) === currentStatus.value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 2. 类型筛选 (新增)
|
|
|
|
|
if (selectedTaskType.value !== 'all') {
|
|
|
|
|
result = result.filter(t => t.task_type === selectedTaskType.value)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 3. 关键词搜索 (新增)
|
|
|
|
|
if (searchKeyword.value.trim()) {
|
|
|
|
|
const keyword = searchKeyword.value.toLowerCase().trim()
|
|
|
|
|
result = result.filter(t => {
|
|
|
|
|
// 搜索 ID
|
|
|
|
|
const idMatch = String(t.task_id).includes(keyword)
|
|
|
|
|
// 搜索 任务名称
|
|
|
|
|
const nameMatch = getTaskName(t).toLowerCase().includes(keyword)
|
|
|
|
|
return idMatch || nameMatch
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 4. 排序
|
|
|
|
|
if (sortRules.value.length > 0) {
|
|
|
|
|
result.sort((a, b) => {
|
|
|
|
|
const rule = sortRules.value[0]
|
|
|
|
|
@ -399,6 +390,7 @@ onMounted(() => taskStore.fetchTasks())
|
|
|
|
|
box-sizing: border-box; padding: 40px 20px 120px 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Header */
|
|
|
|
|
.header-section {
|
|
|
|
|
flex: 0 0 auto; margin-bottom: 30px;
|
|
|
|
|
display: flex; justify-content: space-between; align-items: flex-end;
|
|
|
|
|
@ -409,6 +401,7 @@ onMounted(() => taskStore.fetchTasks())
|
|
|
|
|
}
|
|
|
|
|
.page-desc { color: #94a3b8; margin-top: 6px; font-weight: 500; }
|
|
|
|
|
|
|
|
|
|
/* Filter Tabs */
|
|
|
|
|
.filter-tabs {
|
|
|
|
|
display: flex; background: rgba(255,255,255,0.6);
|
|
|
|
|
padding: 5px; border-radius: 12px; gap: 5px;
|
|
|
|
|
@ -483,7 +476,7 @@ onMounted(() => taskStore.fetchTasks())
|
|
|
|
|
border: 1px solid #e2e8f0; border-radius: 8px;
|
|
|
|
|
font-size: 0.9rem; color: #334155;
|
|
|
|
|
background: #f8fafc; cursor: pointer;
|
|
|
|
|
appearance: none; /* remove default arrow */
|
|
|
|
|
appearance: none;
|
|
|
|
|
}
|
|
|
|
|
.filter-select:focus {
|
|
|
|
|
background: #fff; border-color: var(--color-accent-secondary);
|
|
|
|
|
@ -497,11 +490,31 @@ onMounted(() => taskStore.fetchTasks())
|
|
|
|
|
*/
|
|
|
|
|
.list-header-row {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: 80px 2fr 120px 180px 140px 160px;
|
|
|
|
|
/*
|
|
|
|
|
全列自适应比例分配:
|
|
|
|
|
不再使用固定宽度,而是用 minmax + fr 组合。
|
|
|
|
|
总权重约 8份,按内容重要性分配:
|
|
|
|
|
1. ID: 0.5fr (最小60px)
|
|
|
|
|
2. 任务名: 3fr (最小200px,占主要空间)
|
|
|
|
|
3. 类型: 1fr (最小100px)
|
|
|
|
|
4. 时间: 1.5fr (最小160px,时间较长)
|
|
|
|
|
5. 状态: 1fr (最小100px)
|
|
|
|
|
6. 操作: 1fr (最小120px)
|
|
|
|
|
|
|
|
|
|
效果:无论屏幕多宽,所有列都会均匀拉伸,不再有死角空白。
|
|
|
|
|
*/
|
|
|
|
|
grid-template-columns:
|
|
|
|
|
minmax(60px, 0.5fr)
|
|
|
|
|
minmax(200px, 3fr)
|
|
|
|
|
minmax(100px, 1fr)
|
|
|
|
|
minmax(160px, 1.5fr)
|
|
|
|
|
minmax(100px, 1fr)
|
|
|
|
|
minmax(120px, 1fr);
|
|
|
|
|
|
|
|
|
|
padding: 20px 30px;
|
|
|
|
|
align-items: center;
|
|
|
|
|
background: transparent;
|
|
|
|
|
border-bottom: 2px solid #e2e8f0; /* 加深线条 */
|
|
|
|
|
border-bottom: 2px solid #e2e8f0;
|
|
|
|
|
|
|
|
|
|
font-size: 0.9rem;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
@ -518,33 +531,43 @@ onMounted(() => taskStore.fetchTasks())
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
------------------------------------------
|
|
|
|
|
Table Rows (Clean Style)
|
|
|
|
|
Table Rows (Clean Style + Multiline Support)
|
|
|
|
|
------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
.list-row {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: 80px 2fr 120px 180px 140px 160px;
|
|
|
|
|
padding: 18px 30px;
|
|
|
|
|
align-items: center;
|
|
|
|
|
/* 与 Header 保持完全一致的列定义 */
|
|
|
|
|
grid-template-columns:
|
|
|
|
|
minmax(60px, 0.5fr)
|
|
|
|
|
minmax(200px, 3fr)
|
|
|
|
|
minmax(100px, 1fr)
|
|
|
|
|
minmax(160px, 1.5fr)
|
|
|
|
|
minmax(100px, 1fr)
|
|
|
|
|
minmax(120px, 1fr);
|
|
|
|
|
|
|
|
|
|
padding: 20px 30px;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
/* 分隔线设计 */
|
|
|
|
|
border-bottom: 1px solid #e2e8f0;
|
|
|
|
|
border-bottom: 1px solid #e2e8f0;
|
|
|
|
|
background: #fff;
|
|
|
|
|
transition: background-color 0.2s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 移除悬浮特效,仅保留背景色微调 */
|
|
|
|
|
.list-row:hover {
|
|
|
|
|
background-color: #f8fafc; /* 极淡的灰色 */
|
|
|
|
|
/* transform: none; box-shadow: none; removed */
|
|
|
|
|
background-color: #f8fafc; /* 仅背景色微调 */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.id-text { font-family: monospace; color: #94a3b8; font-weight: 600; }
|
|
|
|
|
|
|
|
|
|
/* 任务名称样式:允许换行 */
|
|
|
|
|
.task-name {
|
|
|
|
|
font-weight: 600; color: #334155; font-size: 0.95rem;
|
|
|
|
|
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
|
|
|
white-space: normal; /* 允许换行 */
|
|
|
|
|
word-break: break-word; /* 防止长单词溢出 */
|
|
|
|
|
line-height: 1.5; /* 增加行高,多行时更好看 */
|
|
|
|
|
padding-right: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.time-text { color: #64748b; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
|
|
|
|
|
|
|
|
|
|
.type-tag {
|
|
|
|
|
@ -589,7 +612,7 @@ onMounted(() => taskStore.fetchTasks())
|
|
|
|
|
.pagination-footer {
|
|
|
|
|
padding: 20px 30px;
|
|
|
|
|
display: flex; justify-content: flex-end; align-items: center;
|
|
|
|
|
border-top: 1px solid #e2e8f0; /* 分隔线 */
|
|
|
|
|
border-top: 1px solid #e2e8f0;
|
|
|
|
|
background: #fff;
|
|
|
|
|
}
|
|
|
|
|
.page-info { margin: 0 15px; color: #64748b; font-size: 0.9rem; font-weight: 500; }
|
|
|
|
|
@ -616,7 +639,6 @@ onMounted(() => taskStore.fetchTasks())
|
|
|
|
|
.header-section { flex-direction: column; align-items: flex-start; gap: 15px; }
|
|
|
|
|
.filter-tabs { width: 100%; overflow-x: auto; padding-bottom: 5px; -webkit-overflow-scrolling: touch; }
|
|
|
|
|
|
|
|
|
|
/* 移动端隐藏工具栏的部分样式,或者调整布局 */
|
|
|
|
|
.toolbar-section { flex-direction: column; align-items: stretch; padding: 15px; }
|
|
|
|
|
.search-box { width: 100%; }
|
|
|
|
|
|
|
|
|
|
@ -629,13 +651,16 @@ onMounted(() => taskStore.fetchTasks())
|
|
|
|
|
align-items: stretch;
|
|
|
|
|
padding: 20px;
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
border-bottom: 10px solid #f1f5f9; /* 移动端用粗线条分隔 */
|
|
|
|
|
border-bottom: 10px solid #f1f5f9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.mobile-row-header { display: flex; justify-content: space-between; align-items: center; }
|
|
|
|
|
.id-badge { background: #f1f5f9; padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; color: #64748b; font-weight: 700; }
|
|
|
|
|
|
|
|
|
|
.mobile-task-name { font-size: 1.1rem; font-weight: 700; color: #1e293b; margin: 5px 0; }
|
|
|
|
|
.mobile-task-name {
|
|
|
|
|
font-size: 1.1rem; font-weight: 700; color: #1e293b; margin: 5px 0;
|
|
|
|
|
white-space: normal; word-break: break-word; line-height: 1.4;
|
|
|
|
|
}
|
|
|
|
|
.mobile-meta-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; color: #94a3b8; }
|
|
|
|
|
|
|
|
|
|
.col-action {
|
|
|
|
|
@ -694,4 +719,150 @@ onMounted(() => taskStore.fetchTasks())
|
|
|
|
|
align-items: center; justify-content: center; gap: 15px; color: #888;
|
|
|
|
|
}
|
|
|
|
|
.loading-log i { font-size: 2rem; color: var(--color-accent-secondary); }
|
|
|
|
|
|
|
|
|
|
html.dark-mode .view-container {
|
|
|
|
|
/* 确保容器本身背景融合 */
|
|
|
|
|
color: #e2e8f0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .page-header {
|
|
|
|
|
color: #f1f5f9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .modern-table-card {
|
|
|
|
|
background: #1e293b; /* Slate 800 */
|
|
|
|
|
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
|
|
|
box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* --- 搜索栏 --- */
|
|
|
|
|
html.dark-mode .toolbar-section {
|
|
|
|
|
border-bottom-color: rgba(255, 255, 255, 0.08);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .search-input,
|
|
|
|
|
html.dark-mode .filter-select {
|
|
|
|
|
background: #0f172a; /* Slate 900 */
|
|
|
|
|
border-color: rgba(255, 255, 255, 0.1);
|
|
|
|
|
color: #f1f5f9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .search-input:focus,
|
|
|
|
|
html.dark-mode .filter-select:focus {
|
|
|
|
|
border-color: var(--color-accent-secondary);
|
|
|
|
|
background: #0f172a;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* --- 表头 --- */
|
|
|
|
|
html.dark-mode .list-header-row {
|
|
|
|
|
border-bottom-color: rgba(255, 255, 255, 0.08);
|
|
|
|
|
color: #94a3b8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* --- 表格行 --- */
|
|
|
|
|
html.dark-mode .list-row {
|
|
|
|
|
background: #1e293b;
|
|
|
|
|
border-bottom-color: rgba(255, 255, 255, 0.05);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .list-row:hover {
|
|
|
|
|
background-color: rgba(255, 255, 255, 0.04); /* 微弱的悬浮高亮 */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 文本颜色修正 */
|
|
|
|
|
html.dark-mode .task-name {
|
|
|
|
|
color: #f8fafc; /* 亮白色 */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .id-text,
|
|
|
|
|
html.dark-mode .time-text {
|
|
|
|
|
color: #94a3b8; /* 灰色 */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .type-tag {
|
|
|
|
|
background: rgba(255, 255, 255, 0.05);
|
|
|
|
|
border-color: rgba(255, 255, 255, 0.1);
|
|
|
|
|
color: #cbd5e1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* --- 状态胶囊 (降低亮度,增加透明度) --- */
|
|
|
|
|
html.dark-mode .status-pill.completed {
|
|
|
|
|
background: rgba(22, 163, 74, 0.2);
|
|
|
|
|
color: #4ade80;
|
|
|
|
|
}
|
|
|
|
|
html.dark-mode .status-pill.running {
|
|
|
|
|
background: rgba(7, 89, 133, 0.3);
|
|
|
|
|
color: #38bdf8;
|
|
|
|
|
}
|
|
|
|
|
html.dark-mode .status-pill.failed {
|
|
|
|
|
background: rgba(153, 27, 27, 0.3);
|
|
|
|
|
color: #f87171;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* --- 操作按钮 --- */
|
|
|
|
|
html.dark-mode .action-btn {
|
|
|
|
|
color: #94a3b8;
|
|
|
|
|
}
|
|
|
|
|
html.dark-mode .action-btn:hover {
|
|
|
|
|
background: rgba(255, 255, 255, 0.1);
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* --- 分页器 --- */
|
|
|
|
|
html.dark-mode .pagination-footer {
|
|
|
|
|
background: #1e293b;
|
|
|
|
|
border-top-color: rgba(255, 255, 255, 0.08);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .page-btn {
|
|
|
|
|
background: #0f172a;
|
|
|
|
|
border-color: rgba(255, 255, 255, 0.1);
|
|
|
|
|
color: #cbd5e1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .page-btn:hover:not(:disabled) {
|
|
|
|
|
background: #334155;
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .page-btn:disabled {
|
|
|
|
|
background: #1e293b;
|
|
|
|
|
opacity: 0.3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .empty-state {
|
|
|
|
|
color: #64748b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* --- 移动端卡片 --- */
|
|
|
|
|
html.dark-mode .list-row {
|
|
|
|
|
/* 移动端复用了 list-row,但如果在窄屏下有特定边框需要处理 */
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .id-badge {
|
|
|
|
|
background: rgba(255, 255, 255, 0.05);
|
|
|
|
|
color: #94a3b8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .mobile-task-name {
|
|
|
|
|
color: #f1f5f9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (max-width: 900px) {
|
|
|
|
|
html.dark-mode .list-row {
|
|
|
|
|
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
|
|
|
background: #1e293b;
|
|
|
|
|
border-bottom: 10px solid #0f172a; /* 深色背景间隙 */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .col-action {
|
|
|
|
|
border-top-color: rgba(255, 255, 255, 0.1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html.dark-mode .action-btn {
|
|
|
|
|
background: rgba(255, 255, 255, 0.05);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|