删除本地APP项目
This commit is contained in:
@@ -179,6 +179,7 @@
|
||||
</div>
|
||||
<div class="task-right">
|
||||
<span class="status" :class="statusClass(item)">{{ statusText(item) }}</span>
|
||||
<button v-if="canDownload(item)" type="button" class="download" @click="downloadResult(item)">下载</button>
|
||||
<button v-if="item.resultId" type="button" class="btn-delete" @click="deleteTaskRecord(item)">删除</button>
|
||||
</div>
|
||||
</li>
|
||||
@@ -198,6 +199,7 @@ import { expandBrandFolderRecursive, type BrandExpandFolderItem } from '@/shared
|
||||
import { getPywebviewApi } from '@/shared/bridges/pywebview'
|
||||
import { useTaskProgressLoop } from '@/shared/composables/useTaskProgressLoop'
|
||||
import { createCategorizedTimers } from '@/shared/utils/categorized-timers'
|
||||
import { saveUrlWithProgress } from '@/shared/utils/download-progress'
|
||||
import {
|
||||
parseCollectData,
|
||||
activateCollectDataTask,
|
||||
@@ -538,6 +540,27 @@ function statusClass(item: CollectDataHistoryItem) {
|
||||
return 'pending'
|
||||
}
|
||||
|
||||
function canDownload(item: CollectDataHistoryItem) {
|
||||
const status = normalizeTaskStatus(item)
|
||||
return Boolean(item.downloadUrl && (item.success || status === 'SUCCESS'))
|
||||
}
|
||||
|
||||
async function downloadResult(item: CollectDataHistoryItem) {
|
||||
if (!item.downloadUrl) {
|
||||
ElMessage.warning('当前结果没有下载地址')
|
||||
return
|
||||
}
|
||||
|
||||
const filename = item.resultFilename || `${item.sourceFilename || 'collect-data-result'}.xlsx`
|
||||
const downloadId = `collect-data:${item.resultId || item.taskId || Date.now()}`
|
||||
const result = await saveUrlWithProgress(item.downloadUrl, filename, downloadId)
|
||||
if (result.success) {
|
||||
ElMessage.success(`已保存: ${result.path || filename}`)
|
||||
} else if (result.error && result.error !== '用户取消') {
|
||||
ElMessage.error(result.error)
|
||||
}
|
||||
}
|
||||
|
||||
async function loadDashboard() {
|
||||
try {
|
||||
dashboard.value = await getCollectDataDashboard()
|
||||
@@ -721,6 +744,7 @@ onBeforeUnmount(() => {
|
||||
.status.failed { background: rgba(231, 76, 60, .18); color: #ff6b6b; }
|
||||
.status.running { background: rgba(52, 152, 219, .18); color: #3498db; }
|
||||
.status.pending { background: rgba(149, 165, 166, .18); color: #bdc3c7; }
|
||||
.download { padding: 6px 10px; color: #d6ecff; background: rgba(52, 152, 219, .18); }
|
||||
.btn-delete { padding: 6px 10px; color: #ff8f8f; background: rgba(231, 76, 60, .12); }
|
||||
@media (max-width: 1100px) {
|
||||
.main-content { flex-direction: column; height: auto; }
|
||||
|
||||
Reference in New Issue
Block a user