新增复制单个链接功能,优化批次下载对话框逻辑,提升用户体验

This commit is contained in:
yahaozhang
2025-09-16 01:32:11 +08:00
parent de107c0f06
commit 843ff2a440

View File

@@ -451,6 +451,14 @@
<el-icon><Download /></el-icon>
立即下载
</el-button>
<el-button
v-if="batchDownloadDialog.count === 1"
type="success"
@click="copyCurrentBatchSingleLink"
>
<el-icon><DocumentCopy /></el-icon>
复制
</el-button>
</div>
</template>
</el-dialog>
@@ -571,7 +579,8 @@ const batchDownloadDialog = reactive({
visible: false,
downloading: false,
batchId: '',
count: 0
count: 0,
singleCodeNo: ''
})
// 状态选项
@@ -630,7 +639,8 @@ const handleGenerate = async () => {
// 弹出批次下载对话框
if (result && result.batchId && result.codeNos && result.codeNos.length > 0) {
showBatchDownloadDialog(result.batchId, result.codeNos.length)
const maybeSingle = result.codeNos.length === 1 ? result.codeNos[0] : ''
showBatchDownloadDialog(result.batchId, result.codeNos.length, maybeSingle)
}
// 重置表单
@@ -971,10 +981,11 @@ const closeBatchDeleteByStatusDialog = () => {
}
// 批次下载对话框相关方法
const showBatchDownloadDialog = (batchId, count) => {
const showBatchDownloadDialog = (batchId, count, singleCodeNo = '') => {
batchDownloadDialog.visible = true
batchDownloadDialog.batchId = batchId
batchDownloadDialog.count = count
batchDownloadDialog.singleCodeNo = singleCodeNo
batchDownloadDialog.downloading = false
}
@@ -983,6 +994,7 @@ const closeBatchDownloadDialog = () => {
batchDownloadDialog.batchId = ''
batchDownloadDialog.count = 0
batchDownloadDialog.downloading = false
batchDownloadDialog.singleCodeNo = ''
}
const downloadCurrentBatch = async () => {
@@ -1038,6 +1050,13 @@ const downloadCurrentBatch = async () => {
}
}
// 复制本次单个链接
const copyCurrentBatchSingleLink = async () => {
if (batchDownloadDialog.count !== 1 || !batchDownloadDialog.singleCodeNo) return
const url = generateLinkUrl(batchDownloadDialog.singleCodeNo)
await copyToClipboard(url)
}
const handleBatchDeleteByStatus = async () => {
try {
// 表单验证
@@ -1570,6 +1589,13 @@ onUnmounted(() => {
text-align: center;
}
/* 批次下载对话框按钮区域布局(桌面端) */
.batch-download-dialog .dialog-footer {
display: flex;
gap: 8px;
justify-content: flex-end;
}
.download-content {
padding: 20px 0;
}
@@ -1626,6 +1652,16 @@ onUnmounted(() => {
.info-text p {
font-size: 13px;
}
/* 批次下载对话框按钮区域布局(移动端) */
.batch-download-dialog .dialog-footer {
flex-direction: column;
}
.batch-download-dialog .dialog-footer .el-button {
width: 100%;
height: 44px;
}
}
@media (max-width: 480px) {