This commit is contained in:
BianLzhaoMin 2025-11-21 13:55:07 +08:00
parent afd8f420ba
commit e4525992eb
2 changed files with 94 additions and 13 deletions

View File

@ -267,13 +267,18 @@
<template #outerContent> <template #outerContent>
<component <component
ref="componentRef" ref="componentRef"
:selectedFiles="selectedFiles" :selectedFiles="
dialogConfig.outerComponent === 'DownloadTags'
? selectedFilesForDownload
: selectedFiles
"
:selectedNode="selectedNode" :selectedNode="selectedNode"
v-bind="dialogConfig.outerComponentProps" v-bind="dialogConfig.outerComponentProps"
:type="type" :type="type"
:id="id" :id="id"
:name="name" :name="name"
:is="dialogConfig.outerComponent" :is="dialogConfig.outerComponent"
@remove-file="handleRemoveDownloadFile"
/> />
<div class="button-footer"> <div class="button-footer">
@ -503,7 +508,7 @@ export default {
minHeight: '90vh', minHeight: '90vh',
maxHeight: '90vh', maxHeight: '90vh',
}, },
// //
selectedFilesForDownload: [], selectedFilesForDownload: [],
// //
@ -624,6 +629,8 @@ export default {
this.dialogConfig.outerTitle = '新建文档夹' this.dialogConfig.outerTitle = '新建文档夹'
this.dialogConfig.outerVisible = true this.dialogConfig.outerVisible = true
this.dialogConfig.outerComponent = 'AddWord' this.dialogConfig.outerComponent = 'AddWord'
//
this.$refs.tableRef.clearSelection()
this.dialogConfig.outerComponentProps = {} this.dialogConfig.outerComponentProps = {}
}, },
@ -633,6 +640,8 @@ export default {
this.dialogConfig.outerTitle = '上传文件' this.dialogConfig.outerTitle = '上传文件'
this.dialogConfig.outerVisible = true this.dialogConfig.outerVisible = true
this.dialogConfig.outerComponent = 'Upload' this.dialogConfig.outerComponent = 'Upload'
//
this.$refs.tableRef.clearSelection()
this.dialogConfig.outerComponentProps = {} this.dialogConfig.outerComponentProps = {}
}, },
@ -743,18 +752,14 @@ export default {
// //
this.selectedFilesForDownload = this.selectedRows.map((row) => ({ this.selectedFilesForDownload = this.selectedRows.map((row) => ({
id: row.id, id: row.id,
name: row.name,
})) }))
this.downloadGet( //
'screen/document/downLoad', this.dialogConfig.outerTitle = '批量下载'
{ this.dialogConfig.outerVisible = true
downIds: this.selectedRows.map((row) => row.id).join(','), this.dialogConfig.outerComponent = 'DownloadTags'
}, this.dialogConfig.outerComponentProps = {}
`文档_${new Date().getTime()}.zip`,
)
//
this.getTableList()
}, },
// //
@ -876,6 +881,24 @@ export default {
} }
}, },
//
handleRemoveDownloadFile(index) {
//
const removedFile = this.selectedFilesForDownload[index]
if (!removedFile) return
//
this.selectedFilesForDownload.splice(index, 1)
// id
const rowToDeselect = this.selectedRows.find(
(row) => row.id === removedFile.id,
)
if (rowToDeselect && this.$refs.tableRef) {
this.$refs.tableRef.toggleRowSelection(rowToDeselect, false)
}
},
// //
onHandleCancel() { onHandleCancel() {
this.dialogConfig.outerVisible = false this.dialogConfig.outerVisible = false
@ -884,6 +907,59 @@ export default {
// //
async onHandleConfirm() { async onHandleConfirm() {
try { try {
//
if (this.dialogConfig.outerComponent === 'DownloadTags') {
if (this.selectedFilesForDownload.length === 0) {
this.$modal.msgWarning('请至少选择一个文件进行下载')
return
}
// 2
if (this.selectedFilesForDownload.length > 2) {
this.$confirm(
'选择下载的文件和文件夹超过2个文件可能过大下载时间较长请谨慎操作',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
},
)
.then(() => {
this.downloadGet(
'screen/document/downLoad',
{
downIds: this.selectedFilesForDownload
.map((file) => file.id)
.join(','),
},
`文档_${new Date().getTime()}.zip`,
)
this.dialogConfig.outerVisible = false
//
this.getTableList()
})
.catch(() => {
this.$modal.msgInfo('已取消下载')
})
} else {
this.downloadGet(
'screen/document/downLoad',
{
downIds: this.selectedFilesForDownload
.map((file) => file.id)
.join(','),
},
`文档_${new Date().getTime()}.zip`,
)
this.dialogConfig.outerVisible = false
//
this.getTableList()
}
return
}
//
if ( if (
!this.$refs.componentRef || !this.$refs.componentRef ||
!this.$refs.componentRef.submit !this.$refs.componentRef.submit

View File

@ -7,7 +7,12 @@
:rules="addWordFormRules" :rules="addWordFormRules"
> >
<el-form-item label="文档夹名称" prop="folderName"> <el-form-item label="文档夹名称" prop="folderName">
<el-input v-model="addWordForm.folderName" /> <el-input
clearable
maxlength="50"
show-word-limit
v-model.trim="addWordForm.folderName"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>