mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
fix(transfer): 显示并确认重新整理
This commit is contained in:
@@ -1587,6 +1587,8 @@ export interface TransferForm {
|
|||||||
episode_group?: string | null
|
episode_group?: string | null
|
||||||
// 预览模式
|
// 预览模式
|
||||||
preview?: boolean
|
preview?: boolean
|
||||||
|
// 清理已有成功记录后重新整理
|
||||||
|
reorganize: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
// 手动整理请求
|
// 手动整理请求
|
||||||
@@ -1613,6 +1615,14 @@ export interface ManualTransferTargetPathData {
|
|||||||
library_category_folder?: boolean | null
|
library_category_folder?: boolean | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 手动整理命中的成功历史摘要
|
||||||
|
export interface ManualTransferHistoryInfo {
|
||||||
|
// 是否应执行重新整理
|
||||||
|
reorganize: boolean
|
||||||
|
// 命中的成功历史数量
|
||||||
|
history_count: number
|
||||||
|
}
|
||||||
|
|
||||||
// 手动整理预览统计
|
// 手动整理预览统计
|
||||||
export interface ManualTransferPreviewSummary {
|
export interface ManualTransferPreviewSummary {
|
||||||
// 总数
|
// 总数
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { transferTypeOptions } from '@/api/constants'
|
|||||||
import {
|
import {
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
FileItem,
|
FileItem,
|
||||||
|
ManualTransferHistoryInfo,
|
||||||
ManualTransferPayload,
|
ManualTransferPayload,
|
||||||
ManualTransferPreviewData,
|
ManualTransferPreviewData,
|
||||||
ManualTransferPreviewItem,
|
ManualTransferPreviewItem,
|
||||||
@@ -99,6 +100,10 @@ const previewLoaded = ref(false)
|
|||||||
// 预览数据
|
// 预览数据
|
||||||
const previewData = ref<ManualTransferPreviewData>()
|
const previewData = ref<ManualTransferPreviewData>()
|
||||||
|
|
||||||
|
// 手动整理历史查询状态
|
||||||
|
const manualHistoryLoading = ref(false)
|
||||||
|
const manualHistoryCount = ref(0)
|
||||||
|
|
||||||
interface EpisodeFormatRecommendData {
|
interface EpisodeFormatRecommendData {
|
||||||
rule_name?: string
|
rule_name?: string
|
||||||
rule_index?: number
|
rule_index?: number
|
||||||
@@ -323,8 +328,12 @@ const transferForm = reactive<TransferForm>({
|
|||||||
library_type_folder: null,
|
library_type_folder: null,
|
||||||
library_category_folder: null,
|
library_category_folder: null,
|
||||||
episode_group: 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')
|
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)
|
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() {
|
async function loadEpisodeFormatRuleConfiguration() {
|
||||||
try {
|
try {
|
||||||
@@ -1353,7 +1385,7 @@ async function transfer(background: boolean = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await loadDirectories()
|
await Promise.all([loadDirectories(), loadManualTransferHistory()])
|
||||||
loadStorages()
|
loadStorages()
|
||||||
loadEpisodeFormatRuleConfiguration()
|
loadEpisodeFormatRuleConfiguration()
|
||||||
})
|
})
|
||||||
@@ -1386,6 +1418,16 @@ onUnmounted(() => {
|
|||||||
<div class="reorganize-form-pane">
|
<div class="reorganize-form-pane">
|
||||||
<div class="reorganize-form-pane__content pa-6">
|
<div class="reorganize-form-pane__content pa-6">
|
||||||
<VForm @submit.prevent="() => {}">
|
<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>
|
<VRow>
|
||||||
<VCol cols="12" md="6">
|
<VCol cols="12" md="6">
|
||||||
<VSelect
|
<VSelect
|
||||||
@@ -1631,10 +1673,11 @@ onUnmounted(() => {
|
|||||||
color="primary"
|
color="primary"
|
||||||
variant="flat"
|
variant="flat"
|
||||||
@click="transfer(false)"
|
@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"
|
class="reorganize-action-btn reorganize-action-btn--primary"
|
||||||
|
:loading="manualHistoryLoading"
|
||||||
>
|
>
|
||||||
{{ t('dialog.reorganize.reorganizeNow') }}
|
{{ isReorganize ? t('dialog.reorganize.reorganizeAgain') : t('dialog.reorganize.reorganizeNow') }}
|
||||||
</VBtn>
|
</VBtn>
|
||||||
</VCardActions>
|
</VCardActions>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3176,6 +3176,9 @@ export default {
|
|||||||
copyFailed: 'Copy failed',
|
copyFailed: 'Copy failed',
|
||||||
addToQueue: 'Add to Organization Queue',
|
addToQueue: 'Add to Organization Queue',
|
||||||
reorganizeNow: 'Organize Now',
|
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',
|
auto: 'Auto',
|
||||||
processing: 'Processing ...',
|
processing: 'Processing ...',
|
||||||
successMessage: 'File {name} has been added to the organization queue!',
|
successMessage: 'File {name} has been added to the organization queue!',
|
||||||
|
|||||||
@@ -3123,6 +3123,8 @@ export default {
|
|||||||
copyFailed: '复制失败',
|
copyFailed: '复制失败',
|
||||||
addToQueue: '加入整理队列',
|
addToQueue: '加入整理队列',
|
||||||
reorganizeNow: '立即整理',
|
reorganizeNow: '立即整理',
|
||||||
|
reorganizeAgain: '重新整理',
|
||||||
|
historyFound: '检测到 {count} 条成功整理记录。重新整理会清理旧目标和历史记录;移动模式会保留当前源文件。',
|
||||||
auto: '自动',
|
auto: '自动',
|
||||||
processing: '正在处理 ...',
|
processing: '正在处理 ...',
|
||||||
successMessage: '文件 {name} 已加入整理队列!',
|
successMessage: '文件 {name} 已加入整理队列!',
|
||||||
|
|||||||
@@ -3122,6 +3122,8 @@ export default {
|
|||||||
copyFailed: '複製失敗',
|
copyFailed: '複製失敗',
|
||||||
addToQueue: '加入整理隊列',
|
addToQueue: '加入整理隊列',
|
||||||
reorganizeNow: '立即整理',
|
reorganizeNow: '立即整理',
|
||||||
|
reorganizeAgain: '重新整理',
|
||||||
|
historyFound: '偵測到 {count} 筆成功整理記錄。重新整理會清理舊目標和歷史記錄;移動模式會保留目前來源檔案。',
|
||||||
auto: '自動',
|
auto: '自動',
|
||||||
processing: '正在處理 ...',
|
processing: '正在處理 ...',
|
||||||
successMessage: '文件 {name} 已加入整理隊列!',
|
successMessage: '文件 {name} 已加入整理隊列!',
|
||||||
|
|||||||
Reference in New Issue
Block a user