This commit is contained in:
parent
afd8f420ba
commit
e4525992eb
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue