9TH_FIX REPORT
This commit is contained in:
@@ -107,8 +107,17 @@ export const adminAPI = {
|
||||
|
||||
/**
|
||||
* 清理舊檔案
|
||||
* @param {Object} options - 清理選項
|
||||
*/
|
||||
cleanupOldFiles() {
|
||||
return request.post('/admin/cleanup')
|
||||
cleanupOldFiles(options = {}) {
|
||||
const defaultOptions = {
|
||||
cleanup_files: true,
|
||||
cleanup_logs: false,
|
||||
cleanup_cache: false,
|
||||
files_days: 7,
|
||||
logs_days: 30,
|
||||
cache_days: 90
|
||||
}
|
||||
return request.post('/admin/maintenance/cleanup', { ...defaultOptions, ...options })
|
||||
}
|
||||
}
|
@@ -245,7 +245,11 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="user_name" label="用戶" width="120" />
|
||||
<el-table-column label="用戶" width="120">
|
||||
<template #default="{ row }">
|
||||
{{ row.user?.display_name || row.user?.username || '未知用戶' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="target_languages" label="目標語言" width="150">
|
||||
<template #default="{ row }">
|
||||
|
@@ -48,6 +48,13 @@
|
||||
>
|
||||
下載 {{ getLanguageText(lang) }} 版本
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
v-if="job.target_languages.length > 1 && hasCombinedFile"
|
||||
command="download_combined"
|
||||
divided
|
||||
>
|
||||
下載組合翻譯檔案 (多語言)
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="download_all" divided>
|
||||
下載全部檔案 (ZIP)
|
||||
</el-dropdown-item>
|
||||
@@ -316,7 +323,9 @@
|
||||
<div class="file-details">
|
||||
<span class="file-size">{{ formatFileSize(file.file_size) }}</span>
|
||||
<span class="file-type">
|
||||
{{ file.file_type === 'ORIGINAL' ? '原始檔案' : `翻譯檔案 (${getLanguageText(file.language_code)})` }}
|
||||
{{ file.file_type === 'ORIGINAL' ? '原始檔案' :
|
||||
file.language_code === 'combined' ? '組合翻譯檔案 (多語言)' :
|
||||
`翻譯檔案 (${getLanguageText(file.language_code)})` }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -325,7 +334,7 @@
|
||||
v-if="file.file_type === 'TRANSLATED'"
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="downloadFile(file.language_code, file.filename)"
|
||||
@click="file.language_code === 'combined' ? downloadCombinedFile() : downloadFile(file.language_code, file.filename)"
|
||||
>
|
||||
<el-icon><Download /></el-icon>
|
||||
下載
|
||||
@@ -376,6 +385,11 @@ const languageMap = {
|
||||
// 計算屬性
|
||||
const jobUuid = computed(() => route.params.uuid)
|
||||
|
||||
// 檢查是否有combined檔案
|
||||
const hasCombinedFile = computed(() => {
|
||||
return jobFiles.value.some(file => file.language_code === 'combined')
|
||||
})
|
||||
|
||||
// 方法
|
||||
const loadJobDetail = async () => {
|
||||
loading.value = true
|
||||
@@ -419,6 +433,8 @@ const handleAction = async (command) => {
|
||||
const langCode = command.replace('download_', '')
|
||||
if (langCode === 'all') {
|
||||
await downloadAllFiles()
|
||||
} else if (langCode === 'combined') {
|
||||
await downloadCombinedFile()
|
||||
} else {
|
||||
await downloadFile(langCode)
|
||||
}
|
||||
@@ -435,6 +451,20 @@ const downloadFile = async (langCode, customFilename = null) => {
|
||||
}
|
||||
}
|
||||
|
||||
const downloadCombinedFile = async () => {
|
||||
try {
|
||||
// 找到combined檔案
|
||||
const combinedFile = jobFiles.value.find(file => file.language_code === 'combined')
|
||||
if (combinedFile) {
|
||||
await jobsStore.downloadFile(jobUuid.value, 'combined', combinedFile.filename)
|
||||
} else {
|
||||
ElMessage.error('找不到組合翻譯檔案')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('下載組合檔案失敗:', error)
|
||||
}
|
||||
}
|
||||
|
||||
const downloadAllFiles = async () => {
|
||||
try {
|
||||
const filename = `${job.value.original_filename.replace(/\.[^/.]+$/, '')}_translated.zip`
|
||||
|
Reference in New Issue
Block a user