Commit 01ebec5a by 焦子成

1

parent 1cb39071
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>文件下载器 - 类似迅雷的下载工具</title> <title>文件下载器 - 类似迅雷的下载工具</title>
<script type="module" crossorigin src="/assets/index-4ea3f23e.js"></script> <script type="module" crossorigin src="/assets/index-cab3a0b8.js"></script>
<link rel="stylesheet" href="/assets/index-1cc07315.css"> <link rel="stylesheet" href="/assets/index-d79ea04f.css">
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
......
...@@ -30,6 +30,7 @@ const config = { ...@@ -30,6 +30,7 @@ const config = {
downLoadStatus: `${domain}/uploadDetail/downLoadStatus`, downLoadStatus: `${domain}/uploadDetail/downLoadStatus`,
fileUploadDetail: `${domain}/uploadBatch/fileUploadDetail`, fileUploadDetail: `${domain}/uploadBatch/fileUploadDetail`,
queryFileAll: `${domain}/uploadBatch/queryFileAll`, queryFileAll: `${domain}/uploadBatch/queryFileAll`,
detailInfo: `${domain}/uploadDetail/detailInfo`,
}; };
export default config; export default config;
...@@ -288,7 +288,6 @@ ...@@ -288,7 +288,6 @@
<div v-else class="download-table-container"> <div v-else class="download-table-container">
<!-- 分页表格 --> <!-- 分页表格 -->
<!-- :data="paginatedDownloads" -->
<el-table :data="paginatedDownloads" style="width: 100%" border stripe highlight-current-row> <el-table :data="paginatedDownloads" style="width: 100%" border stripe highlight-current-row>
<el-table-column label="Excel文件" width="180"> <el-table-column label="Excel文件" width="180">
...@@ -315,6 +314,9 @@ ...@@ -315,6 +314,9 @@
<!-- <span v-if="downloadStore.customSubFolder" class="file-prefix"> <!-- <span v-if="downloadStore.customSubFolder" class="file-prefix">
{{ downloadStore.customSubFolder }}_ {{ downloadStore.customSubFolder }}_
</span> --> </span> -->
<span v-if="row.filePrefix" class="file-prefix">
{{ row.filePrefix }}_
</span>
{{ row.fileName }} {{ row.fileName }}
</div> </div>
<div class="file-url">{{ row.url }}</div> <div class="file-url">{{ row.url }}</div>
...@@ -359,11 +361,10 @@ ...@@ -359,11 +361,10 @@
</el-table-column> --> </el-table-column> -->
<el-table-column label="大小" width="120" align="center"> <el-table-column label="大小" width="120" align="center">
<template #default="{ row }"> <template #default="{ row }">
<span v-if="row.fileSize" class="size-info"> <span v-if="row.status == 'pending'">-</span>
<!-- {{ formatBytes(row.downloadedBytes) }} / {{ formatBytes(row.totalBytes) }} --> <span v-else class="size-info">
{{ row.fileSize }} {{ row.fileSize }}
</span> </span>
<span v-else class="size-info">-</span>
</template> </template>
</el-table-column> </el-table-column>
...@@ -375,15 +376,15 @@ ...@@ -375,15 +376,15 @@
开始 开始
</el-button> </el-button>
<el-button v-if="row.status === 'downloading'" @click="downloadStore.pauseDownload(row.id)" <!-- <el-button v-if="row.status === 'downloading'" @click="downloadStore.pauseDownload(row.id)"
type="warning" size="small"> type="warning" size="small">
暂停 暂停
</el-button> </el-button> -->
<el-button v-if="row.status === 'paused'" @click="resumeSingleDownload(row.id)" type="success" <!-- <el-button v-if="row.status === 'paused'" @click="resumeSingleDownload(row.id)" type="success"
size="small"> size="small">
继续 继续
</el-button> </el-button> -->
<el-button v-if="row.status === 'error'" @click="startSingleDownload(row.id)" type="warning" <el-button v-if="row.status === 'error'" @click="startSingleDownload(row.id)" type="warning"
size="small"> size="small">
...@@ -424,6 +425,7 @@ import * as XLSX from 'xlsx' ...@@ -424,6 +425,7 @@ import * as XLSX from 'xlsx'
import http from '@/utils/request.js'; import http from '@/utils/request.js';
import config from '@/api/api.js'; import config from '@/api/api.js';
import axios from "axios"; import axios from "axios";
import { el, ro } from 'element-plus/es/locales.mjs'
const router = useRouter() const router = useRouter()
...@@ -496,15 +498,16 @@ const loadUpTableData = () => { ...@@ -496,15 +498,16 @@ const loadUpTableData = () => {
const paginatedDownloads = computed(() => { const paginatedDownloads = computed(() => {
const start = (currentPage.value - 1) * pageSize.value const start = (currentPage.value - 1) * pageSize.value
const end = start + pageSize.value const end = start + pageSize.value
return filteredDownloads.value.slice(start, end) // return filteredDownloads.value.slice(start, end)
return filteredDownloads.value.slice(0)
}) })
// 计算筛选后的下载列表 // 计算筛选后的下载列表
const filteredDownloads = computed(() => { const filteredDownloads = computed(() => {
return downloadStore.downloads.filter(item => { return downloadStore.downloads.filter(item => {
if (statusFilter.value) { // if (statusFilter.value) {
return item.status === statusFilter.value // return item.status === statusFilter.value
} // }
return true return true
}) })
}) })
...@@ -792,20 +795,20 @@ const getFileExtensionFromUrl = (url) => { ...@@ -792,20 +795,20 @@ const getFileExtensionFromUrl = (url) => {
} }
// 选择下载路径 // 选择下载路径
const selectDownloadPath = () => { // const selectDownloadPath = () => {
ElMessageBox.prompt('请输入自定义子文件夹名称', '设置下载子文件夹', { // ElMessageBox.prompt('请输入自定义子文件夹名称', '设置下载子文件夹', {
confirmButtonText: '确定', // confirmButtonText: '确定',
cancelButtonText: '取消', // cancelButtonText: '取消',
inputValue: customSubFolder.value, // inputValue: customSubFolder.value,
inputPlaceholder: '例如: vue-downloader-files (留空则直接下载到默认路径)' // inputPlaceholder: '例如: vue-downloader-files (留空则直接下载到默认路径)'
}).then(({ value }) => { // }).then(({ value }) => {
customSubFolder.value = value // customSubFolder.value = value
updateDownloadPath() // updateDownloadPath()
ElMessage.success('下载路径已设置') // ElMessage.success('下载路径已设置')
}).catch(() => { // }).catch(() => {
// 用户取消 // // 用户取消
}) // })
} // }
// 清空文件名前缀 // 清空文件名前缀
const clearFileNamePrefix = () => { const clearFileNamePrefix = () => {
...@@ -855,7 +858,9 @@ function loadDetailTableData() { ...@@ -855,7 +858,9 @@ function loadDetailTableData() {
}).then(res => { }).then(res => {
if (res.code === 200) { if (res.code === 200) {
var list = [] var list = []
var filePrefix = ''
for (const element of res.data.rows) { for (const element of res.data.rows) {
filePrefix = element.filePrefix
list.push({ list.push({
"id": element.detailId, "id": element.detailId,
"fileName": element.fileName, "fileName": element.fileName,
...@@ -872,12 +877,14 @@ function loadDetailTableData() { ...@@ -872,12 +877,14 @@ function loadDetailTableData() {
"error": null, "error": null,
"retryCount": 0, "retryCount": 0,
"maxRetries": 3, "maxRetries": 3,
"controller": null "controller": null,
"filePrefix": element.filePrefix
}) })
} }
// console.log('--lsit:',list) // console.log('--lsit:',list)
// deTableData = res.data.rows // deTableData = res.data.rows
downloadStore.downloads = list downloadStore.downloads = list
downloadStore.setCustomSubFolder(filePrefix)
deTotal.value = res.data.total deTotal.value = res.data.total
loadUploadDetailTotalNum() loadUploadDetailTotalNum()
} else { } else {
...@@ -965,6 +972,11 @@ const parseExcelFile = async () => { ...@@ -965,6 +972,11 @@ const parseExcelFile = async () => {
ElMessage.warning('请先选择Excel文件并配置列映射') ElMessage.warning('请先选择Excel文件并配置列映射')
return return
} }
const url = previewData.value[0]?.url
if (!url || !/^https?:\/\//i.test(url)) {
ElMessage.warning('预览数据中的URL格式不正确,请检查列映射')
return
}
parsing.value = true parsing.value = true
processingProgress.value = 0 processingProgress.value = 0
...@@ -1317,6 +1329,7 @@ const startSingleDownload = async (downloadId) => { ...@@ -1317,6 +1329,7 @@ const startSingleDownload = async (downloadId) => {
downloadStore.isSingleDownloading = true downloadStore.isSingleDownloading = true
try { try {
await downloadStore.startDownload(downloadId) await downloadStore.startDownload(downloadId)
loadDetailTableData()
} finally { } finally {
downloadStore.isSingleDownloading = false downloadStore.isSingleDownloading = false
} }
......
...@@ -182,8 +182,10 @@ ...@@ -182,8 +182,10 @@
</el-tag> </el-tag>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="进度">{{ selectedRecord.progress || 0 }}%</el-descriptions-item> <el-descriptions-item label="进度">{{ selectedRecord.progress || 0 }}%</el-descriptions-item>
<el-descriptions-item label="文件大小">{{ formatFileSize(selectedRecord.fileSize) }}</el-descriptions-item> <!-- <el-descriptions-item label="文件大小">{{ formatFileSize(selectedRecord.fileSize) }}</el-descriptions-item> -->
<el-descriptions-item label="已下载">{{ formatFileSize(selectedRecord.downloadedBytes) }}</el-descriptions-item> <el-descriptions-item label="文件大小">{{ selectedRecord.fileSize }}</el-descriptions-item>
<!-- <el-descriptions-item label="已下载">{{ formatFileSize(selectedRecord.downloadedBytes) }}</el-descriptions-item> -->
<el-descriptions-item label="已下载">{{ selectedRecord.downloadedBytes }}</el-descriptions-item>
<el-descriptions-item label="开始时间">{{ formatDate(selectedRecord.startTime) }}</el-descriptions-item> <el-descriptions-item label="开始时间">{{ formatDate(selectedRecord.startTime) }}</el-descriptions-item>
<el-descriptions-item label="结束时间">{{ formatDate(selectedRecord.endTime) }}</el-descriptions-item> <el-descriptions-item label="结束时间">{{ formatDate(selectedRecord.endTime) }}</el-descriptions-item>
<el-descriptions-item v-if="selectedRecord.error" label="错误信息"> <el-descriptions-item v-if="selectedRecord.error" label="错误信息">
...@@ -277,16 +279,15 @@ const loadHistory = () => { ...@@ -277,16 +279,15 @@ const loadHistory = () => {
"downloadedBytes": 0, "downloadedBytes": 0,
"startTime": element.createTime, "startTime": element.createTime,
"endTime": '', "endTime": '',
"error": null "error": null,
"fileNamePrefix": element.filePrefix
}) })
} }
historyData.value = [ historyData.value = [{
{
downloads: list, downloads: list,
timestamp: updateTime, timestamp: updateTime,
userId: '' userId: ''
} }]
]
// deTableData = res.data.rows // deTableData = res.data.rows
deTotal.value = res.data.total deTotal.value = res.data.total
} else { } else {
...@@ -354,24 +355,24 @@ const filteredHistory = computed(() => { ...@@ -354,24 +355,24 @@ const filteredHistory = computed(() => {
) )
// 状态筛选 // 状态筛选
if (statusFilter.value) { // if (statusFilter.value) {
filtered = filtered.filter(item => item.status === statusFilter.value) // filtered = filtered.filter(item => item.status === statusFilter.value)
} // }
// Excel文件筛选 // Excel文件筛选
if (excelFileFilter.value) { // if (excelFileFilter.value) {
filtered = filtered.filter(item => item.excelFileName === excelFileFilter.value) // filtered = filtered.filter(item => item.excelFileName === excelFileFilter.value)
} // }
// 关键词搜索 // 关键词搜索
if (searchKeyword.value) { // if (searchKeyword.value) {
const keyword = searchKeyword.value.toLowerCase() // const keyword = searchKeyword.value.toLowerCase()
filtered = filtered.filter(item => // filtered = filtered.filter(item =>
item.fileName.toLowerCase().includes(keyword) || // item.fileName.toLowerCase().includes(keyword) ||
item.url.toLowerCase().includes(keyword) || // item.url.toLowerCase().includes(keyword) ||
(item.excelFileName && item.excelFileName.toLowerCase().includes(keyword)) // (item.excelFileName && item.excelFileName.toLowerCase().includes(keyword))
) // )
} // }
return filtered return filtered
}) })
...@@ -435,8 +436,28 @@ const getStatusText = (status) => { ...@@ -435,8 +436,28 @@ const getStatusText = (status) => {
// 查看详情 // 查看详情
const viewDetails = (record) => { const viewDetails = (record) => {
selectedRecord.value = record // selectedRecord.value = record
http.post(config.detailInfo,{detailId: record.id}).then(res=>{
if (res.code === 200){
selectedRecord.value = {
"id": res.data.detailId,
"fileName": res.data.fileName,
"fileNamePrefix": res.data.filePrefix,
"excelFileName": res.data.uploadName,
"url": res.data.fileUrl,
"status": statusMap[res.data.fileStatus],
"progress": res.data.fileStatus == 3 ? 100: 0,
"fileSize": res.data.fileLength,
"downloadedBytes": res.data.fileStatus == 3 ? res.data.fileLength: '0 KB',
"startTime": res.data.createTime,
"endTime": '',
"error": res.data.errorMsg
}
detailsVisible.value = true detailsVisible.value = true
}else {
ElMessage.error(res.message)
}
})
} }
// 重试下载 // 重试下载
......
...@@ -214,6 +214,13 @@ const deleteUserData = async () => { ...@@ -214,6 +214,13 @@ const deleteUserData = async () => {
Object.assign(downloadSettings, defaultSettings) Object.assign(downloadSettings, defaultSettings)
ElMessage.success('用户数据已删除') ElMessage.success('用户数据已删除')
http.post(config.uploadDetailDeleteAll, {
type: 2
}).then(res => {
if (res.code === 200) {
} else {
}
})
} catch { } catch {
// 用户取消 // 用户取消
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment