mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-07 16:56:40 +08:00
优化文件管理多选操作体验 (#483)
This commit is contained in:
@@ -239,6 +239,12 @@ function changeSelectMode() {
|
|||||||
if (!selectMode.value) selected.value = []
|
if (!selectMode.value) selected.value = []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 退出多选模式
|
||||||
|
function exitSelectMode() {
|
||||||
|
selectMode.value = false
|
||||||
|
selected.value = []
|
||||||
|
}
|
||||||
|
|
||||||
// 调API加载文件夹内的内容
|
// 调API加载文件夹内的内容
|
||||||
async function list_files(context: KeepAliveRefreshContext = {}) {
|
async function list_files(context: KeepAliveRefreshContext = {}) {
|
||||||
const silentRefresh = Boolean(context.silent && items.value.length > 0)
|
const silentRefresh = Boolean(context.silent && items.value.length > 0)
|
||||||
@@ -316,6 +322,8 @@ async function deleteItem(item: FileItem, confirm: boolean = true) {
|
|||||||
|
|
||||||
// 批量删除
|
// 批量删除
|
||||||
async function batchDelete() {
|
async function batchDelete() {
|
||||||
|
if (!selected.value.length) return
|
||||||
|
|
||||||
const confirmed = await createConfirm({
|
const confirmed = await createConfirm({
|
||||||
title: t('common.confirm'),
|
title: t('common.confirm'),
|
||||||
content: t('file.confirmBatchDelete', { count: selected.value.length }),
|
content: t('file.confirmBatchDelete', { count: selected.value.length }),
|
||||||
@@ -327,18 +335,24 @@ async function batchDelete() {
|
|||||||
progressValue.value = 0
|
progressValue.value = 0
|
||||||
openProgressDialog(progressText.value, progressValue.value)
|
openProgressDialog(progressText.value, progressValue.value)
|
||||||
|
|
||||||
// 删除选中的项目
|
try {
|
||||||
selected.value.every(async item => {
|
const selectedItems = dedupeFileItems(selected.value)
|
||||||
progressText.value = t('file.deleting', { name: item.name })
|
|
||||||
progressDialogController?.updateProps({ text: progressText.value })
|
|
||||||
await deleteItem(item, false)
|
|
||||||
})
|
|
||||||
|
|
||||||
// 关闭进度条
|
// 删除选中的项目
|
||||||
closeProgressDialog()
|
for (const item of selectedItems) {
|
||||||
|
progressText.value = t('file.deleting', { name: item.name })
|
||||||
|
progressDialogController?.updateProps({ text: progressText.value })
|
||||||
|
await deleteItem(item, false)
|
||||||
|
}
|
||||||
|
|
||||||
// 重新加载
|
exitSelectMode()
|
||||||
list_files()
|
} finally {
|
||||||
|
// 关闭进度条
|
||||||
|
closeProgressDialog()
|
||||||
|
|
||||||
|
// 重新加载
|
||||||
|
list_files()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 切换路径
|
// 切换路径
|
||||||
@@ -528,6 +542,7 @@ function showBatchTransfer() {
|
|||||||
|
|
||||||
// 整理完成
|
// 整理完成
|
||||||
function transferDone() {
|
function transferDone() {
|
||||||
|
exitSelectMode()
|
||||||
list_files()
|
list_files()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -688,6 +703,8 @@ async function scrape(item: FileItem, confirm: boolean = true) {
|
|||||||
|
|
||||||
// 批量刮削
|
// 批量刮削
|
||||||
async function batchScrape() {
|
async function batchScrape() {
|
||||||
|
if (!selected.value.length) return
|
||||||
|
|
||||||
// 确认
|
// 确认
|
||||||
const confirmed = await createConfirm({
|
const confirmed = await createConfirm({
|
||||||
title: t('common.confirm'),
|
title: t('common.confirm'),
|
||||||
@@ -695,9 +712,17 @@ async function batchScrape() {
|
|||||||
})
|
})
|
||||||
if (!confirmed) return
|
if (!confirmed) return
|
||||||
|
|
||||||
selected.value.map(item => {
|
try {
|
||||||
scrape(item, false)
|
const selectedItems = dedupeFileItems(selected.value)
|
||||||
})
|
|
||||||
|
for (const item of selectedItems) {
|
||||||
|
await scrape(item, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
exitSelectMode()
|
||||||
|
} finally {
|
||||||
|
list_files({ silent: true })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 进度SSE消息处理函数
|
// 进度SSE消息处理函数
|
||||||
|
|||||||
Reference in New Issue
Block a user