mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 15:36:49 +08:00
fix(transfer): 显示并确认重新整理
This commit is contained in:
@@ -1587,6 +1587,8 @@ export interface TransferForm {
|
||||
episode_group?: string | null
|
||||
// 预览模式
|
||||
preview?: boolean
|
||||
// 清理已有成功记录后重新整理
|
||||
reorganize: boolean
|
||||
}
|
||||
|
||||
// 手动整理请求
|
||||
@@ -1613,6 +1615,14 @@ export interface ManualTransferTargetPathData {
|
||||
library_category_folder?: boolean | null
|
||||
}
|
||||
|
||||
// 手动整理命中的成功历史摘要
|
||||
export interface ManualTransferHistoryInfo {
|
||||
// 是否应执行重新整理
|
||||
reorganize: boolean
|
||||
// 命中的成功历史数量
|
||||
history_count: number
|
||||
}
|
||||
|
||||
// 手动整理预览统计
|
||||
export interface ManualTransferPreviewSummary {
|
||||
// 总数
|
||||
|
||||
@@ -7,6 +7,7 @@ import { transferTypeOptions } from '@/api/constants'
|
||||
import {
|
||||
ApiResponse,
|
||||
FileItem,
|
||||
ManualTransferHistoryInfo,
|
||||
ManualTransferPayload,
|
||||
ManualTransferPreviewData,
|
||||
ManualTransferPreviewItem,
|
||||
@@ -99,6 +100,10 @@ const previewLoaded = ref(false)
|
||||
// 预览数据
|
||||
const previewData = ref<ManualTransferPreviewData>()
|
||||
|
||||
// 手动整理历史查询状态
|
||||
const manualHistoryLoading = ref(false)
|
||||
const manualHistoryCount = ref(0)
|
||||
|
||||
interface EpisodeFormatRecommendData {
|
||||
rule_name?: string
|
||||
rule_index?: number
|
||||
@@ -323,8 +328,12 @@ const transferForm = reactive<TransferForm>({
|
||||
library_type_folder: null,
|
||||
library_category_folder: null,
|
||||
episode_group: null,
|
||||
reorganize: Boolean(props.logids?.length),
|
||||
})
|
||||
|
||||
// 历史记录入口和文件浏览器命中的成功历史都属于重新整理。
|
||||
const isReorganize = computed(() => Boolean(props.logids?.length || transferForm.reorganize))
|
||||
|
||||
// 当前手动识别与刮削数据源。
|
||||
const mediaSource = computed(() => transferForm.media_source ?? 'themoviedb')
|
||||
|
||||
@@ -920,6 +929,29 @@ async function requestManualTransfer<T = any>(
|
||||
return await api.post<ApiResponse<T>, ApiResponse<T>>(`transfer/manual?background=${background}`, payload)
|
||||
}
|
||||
|
||||
// 查询当前文件或目录是否存在成功整理历史,决定是否展示重新整理语义。
|
||||
async function loadManualTransferHistory() {
|
||||
if (props.logids?.length || !normalizedItems.value.length) return
|
||||
|
||||
manualHistoryLoading.value = true
|
||||
try {
|
||||
const payload =
|
||||
normalizedItems.value.length === 1 ? { fileitem: normalizedItems.value[0] } : { fileitems: normalizedItems.value }
|
||||
const result = await api.post<ApiResponse<ManualTransferHistoryInfo>, ApiResponse<ManualTransferHistoryInfo>>(
|
||||
'transfer/manual/history',
|
||||
payload,
|
||||
)
|
||||
if (!result.success) return
|
||||
|
||||
manualHistoryCount.value = result.data?.history_count ?? 0
|
||||
transferForm.reorganize = Boolean(result.data?.reorganize)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
manualHistoryLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 加载剧集格式规则配置状态,用于决定是否允许自动推荐。
|
||||
async function loadEpisodeFormatRuleConfiguration() {
|
||||
try {
|
||||
@@ -1353,7 +1385,7 @@ async function transfer(background: boolean = false) {
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await loadDirectories()
|
||||
await Promise.all([loadDirectories(), loadManualTransferHistory()])
|
||||
loadStorages()
|
||||
loadEpisodeFormatRuleConfiguration()
|
||||
})
|
||||
@@ -1386,6 +1418,16 @@ onUnmounted(() => {
|
||||
<div class="reorganize-form-pane">
|
||||
<div class="reorganize-form-pane__content pa-6">
|
||||
<VForm @submit.prevent="() => {}">
|
||||
<VAlert
|
||||
v-if="manualHistoryCount > 0"
|
||||
type="warning"
|
||||
variant="tonal"
|
||||
density="compact"
|
||||
icon="mdi-history"
|
||||
class="mb-4"
|
||||
>
|
||||
{{ t('dialog.reorganize.historyFound', { count: manualHistoryCount }) }}
|
||||
</VAlert>
|
||||
<VRow>
|
||||
<VCol cols="12" md="6">
|
||||
<VSelect
|
||||
@@ -1631,10 +1673,11 @@ onUnmounted(() => {
|
||||
color="primary"
|
||||
variant="flat"
|
||||
@click="transfer(false)"
|
||||
prepend-icon="mdi-arrow-right-bold"
|
||||
:prepend-icon="isReorganize ? 'mdi-refresh' : 'mdi-arrow-right-bold'"
|
||||
class="reorganize-action-btn reorganize-action-btn--primary"
|
||||
:loading="manualHistoryLoading"
|
||||
>
|
||||
{{ t('dialog.reorganize.reorganizeNow') }}
|
||||
{{ isReorganize ? t('dialog.reorganize.reorganizeAgain') : t('dialog.reorganize.reorganizeNow') }}
|
||||
</VBtn>
|
||||
</VCardActions>
|
||||
</div>
|
||||
|
||||
@@ -3176,6 +3176,9 @@ export default {
|
||||
copyFailed: 'Copy failed',
|
||||
addToQueue: 'Add to Organization Queue',
|
||||
reorganizeNow: 'Organize Now',
|
||||
reorganizeAgain: 'Reorganize',
|
||||
historyFound:
|
||||
'{count} successful organization record(s) found. Reorganizing removes the old target and history; move mode keeps the current source file.',
|
||||
auto: 'Auto',
|
||||
processing: 'Processing ...',
|
||||
successMessage: 'File {name} has been added to the organization queue!',
|
||||
|
||||
@@ -3123,6 +3123,8 @@ export default {
|
||||
copyFailed: '复制失败',
|
||||
addToQueue: '加入整理队列',
|
||||
reorganizeNow: '立即整理',
|
||||
reorganizeAgain: '重新整理',
|
||||
historyFound: '检测到 {count} 条成功整理记录。重新整理会清理旧目标和历史记录;移动模式会保留当前源文件。',
|
||||
auto: '自动',
|
||||
processing: '正在处理 ...',
|
||||
successMessage: '文件 {name} 已加入整理队列!',
|
||||
|
||||
@@ -3122,6 +3122,8 @@ export default {
|
||||
copyFailed: '複製失敗',
|
||||
addToQueue: '加入整理隊列',
|
||||
reorganizeNow: '立即整理',
|
||||
reorganizeAgain: '重新整理',
|
||||
historyFound: '偵測到 {count} 筆成功整理記錄。重新整理會清理舊目標和歷史記錄;移動模式會保留目前來源檔案。',
|
||||
auto: '自動',
|
||||
processing: '正在處理 ...',
|
||||
successMessage: '文件 {name} 已加入整理隊列!',
|
||||
|
||||
Reference in New Issue
Block a user