feat(doclib): 文档库支持多选文档后批量设置分享。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-11-12 17:43:16 +08:00
1 parent dd4fdf1e6e
commit 0baa6880f7
3 files changed
+55 -20

No files matched your search

+16 -8
View File
@@ -78,7 +78,7 @@
>
<el-button
:disabled="!actions.share || loading || busy"
@click="openShare(selected[0])"
@click="openShare(selected)"
><el-icon><Share /></el-icon>设置分享</el-button
>
<el-button
@@ -195,7 +195,7 @@
@download="download([$event])"
@view="openDetail"
/>
<ShareDialog v-model="shareVisible" :document="shareDocument" @saved="shareSaved" />
<ShareDialog v-model="shareVisible" :documents="shareDocuments" @saved="shareSaved" />
<el-dialog
v-model="folderVisible"
:title="renameMode ? '重命名文件夹' : '新建文件夹'"
@@ -489,14 +489,22 @@
}
}
const shareVisible = ref(false)
const shareDocument = ref<DoclibDocument | null>(null)
function openShare(row: DoclibDocument) {
if (!row?.canManage) return
shareDocument.value = row
const shareDocuments = ref<DoclibDocument[]>([])
function openShare(rows: DoclibDocument | DoclibDocument[] | null | undefined) {
const list = (Array.isArray(rows) ? rows : rows ? [rows] : []).filter(
(row): row is DoclibDocument => !!row?.id && row.canManage
)
if (!list.length) return
shareDocuments.value = list
shareVisible.value = true
}
function shareSaved(row: DoclibDocument) {
if (detail.value?.id === row.id) detail.value = row
function shareSaved(rows: DoclibDocument[]) {
const updated = Array.isArray(rows) ? rows : []
const current = detail.value
if (current) {
const match = updated.find((row) => row.id === current.id)
if (match) detail.value = match
}
void refresh()
}
const detailVisible = ref(false)