后端架构更新
This commit is contained in:
@@ -144,7 +144,7 @@
|
||||
<span class="status" :class="item.success ? 'success' : 'failed'">
|
||||
{{ item.success ? '已完成' : '失败' }}
|
||||
</span>
|
||||
<button v-if="item.success && item.downloadUrl" type="button" class="download"
|
||||
<button v-if="item.success && (item.downloadUrl || item.resultId)" type="button" class="download"
|
||||
@click="downloadSplitResult(item)">
|
||||
下载压缩包
|
||||
</button>
|
||||
@@ -167,7 +167,7 @@ import { computed, onMounted, ref } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import BrandTopBar from './BrandTopBar.vue'
|
||||
import { expandBrandFolderRecursive, type BrandExpandFolderItem } from '@/shared/api/brand'
|
||||
import { deleteSplitHistory, getExcelInfo, getSplitHistory, runSplit, type SplitResultItem, type SplitRunVo } from '@/shared/api/java-modules'
|
||||
import { deleteSplitHistory, getExcelInfo, getSplitHistory, getSplitResultDownloadUrl, runSplit, type SplitResultItem, type SplitRunVo } from '@/shared/api/java-modules'
|
||||
import { getPywebviewApi, type UploadedJavaFile } from '@/shared/bridges/pywebview'
|
||||
|
||||
const splitSelectedPaths = ref<string[]>([])
|
||||
@@ -348,14 +348,15 @@ function formatSplitEntries(entries: NonNullable<SplitResultItem['entries']>) {
|
||||
|
||||
async function downloadSplitResult(item: SplitResultItem) {
|
||||
const api = getPywebviewApi()
|
||||
if (!item.downloadUrl) {
|
||||
const url = item.downloadUrl || (item.resultId ? getSplitResultDownloadUrl(item.resultId) : '')
|
||||
if (!url) {
|
||||
ElMessage.warning('当前结果没有下载地址')
|
||||
return
|
||||
}
|
||||
|
||||
const filename = item.outputFilename || `${new Date().toISOString().slice(0, 10).replace(/-/g, '')}.zip`
|
||||
if (api?.save_file_from_url_new) {
|
||||
const result = await api.save_file_from_url_new(item.downloadUrl, filename)
|
||||
const result = await api.save_file_from_url_new(url, filename)
|
||||
if (result.success) {
|
||||
ElMessage.success(`已保存:${result.path || filename}`)
|
||||
} else if (result.error && result.error !== '用户取消') {
|
||||
|
||||
Reference in New Issue
Block a user