更新任务队列列表页工具栏

This commit is contained in:
jingrow 2025-11-01 21:50:26 +08:00
parent dfe13b11d3
commit 7e6821f807

View File

@ -24,16 +24,7 @@
<i :class="loading ? 'fa fa-spinner fa-spin' : 'fa fa-refresh'"></i> <i :class="loading ? 'fa fa-spinner fa-spin' : 'fa fa-refresh'"></i>
</button> </button>
<button <button
v-if="selectedJobs.length === 0" v-if="selectedJobs.length > 0"
class="stats-btn"
@click="showStats"
:disabled="loading"
>
<i class="fa fa-bar-chart"></i>
{{ t('Job Statistics') }}
</button>
<button
v-else
class="delete-btn" class="delete-btn"
@click="handleDeleteSelected" @click="handleDeleteSelected"
:disabled="deleting || loading" :disabled="deleting || loading"
@ -135,7 +126,7 @@ import { ref, onMounted, computed, watch } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { t } from '@/shared/i18n' import { t } from '@/shared/i18n'
import { NInput, NSelect, NPagination, useDialog, useMessage } from 'naive-ui' import { NInput, NSelect, NPagination, useDialog, useMessage } from 'naive-ui'
import { getLocalJobList, deleteLocalJob, batchDeleteLocalJobs, stopLocalJob, getLocalJobStats } from '@/shared/api/localJobs' import { getLocalJobList, deleteLocalJob, batchDeleteLocalJobs, stopLocalJob } from '@/shared/api/localJobs'
const router = useRouter() const router = useRouter()
const dialog = useDialog() const dialog = useDialog()
@ -306,23 +297,6 @@ async function stopJob(jobId: string) {
}) })
} }
async function showStats() {
try {
const result = await getLocalJobStats()
if (result.success) {
//
dialog.info({
title: t('Job Statistics'),
content: JSON.stringify(result.stats, null, 2),
positiveText: t('OK')
})
}
} catch (error) {
console.error('Stats error:', error)
message.error('Failed to load statistics')
}
}
function formatDateTime(dateStr: string) { function formatDateTime(dateStr: string) {
if (!dateStr) return '—' if (!dateStr) return '—'
try { try {
@ -438,36 +412,6 @@ onMounted(() => {
box-shadow: none; box-shadow: none;
} }
/* 统计按钮 */
.stats-btn {
height: 36px;
padding: 0 16px;
border: none;
border-radius: 8px;
background: #10b981;
color: white;
cursor: pointer;
display: flex;
align-items: center;
gap: 6px;
font-size: 14px;
font-weight: 500;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.stats-btn:hover {
background: #059669;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.stats-btn:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
/* 删除按钮 */ /* 删除按钮 */
.delete-btn { .delete-btn {
background: #ef4444; background: #ef4444;