mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-08 17:26:41 +08:00
fix: handle episode group values in preview transfer (#480)
This commit is contained in:
@@ -426,6 +426,16 @@ watch(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => transferForm.episode_group,
|
||||||
|
episodeGroup => {
|
||||||
|
const normalizedEpisodeGroup = normalizeEpisodeGroup(episodeGroup)
|
||||||
|
if (episodeGroup !== normalizedEpisodeGroup) {
|
||||||
|
transferForm.episode_group = normalizedEpisodeGroup
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
// 过滤后的预览数据
|
// 过滤后的预览数据
|
||||||
const filteredPreviewItems = computed(() => {
|
const filteredPreviewItems = computed(() => {
|
||||||
return previewData.value?.items ?? []
|
return previewData.value?.items ?? []
|
||||||
@@ -485,6 +495,22 @@ function normalizeTargetPath(path?: string | null) {
|
|||||||
return normalizedPath || null
|
return normalizedPath || null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 归一化剧集组值,兼容历史对象态值。
|
||||||
|
function normalizeEpisodeGroup(
|
||||||
|
episodeGroup?: string | { value?: string | null } | null,
|
||||||
|
) {
|
||||||
|
if (!episodeGroup) return null
|
||||||
|
if (typeof episodeGroup === 'string') {
|
||||||
|
const normalizedEpisodeGroup = episodeGroup.trim()
|
||||||
|
return normalizedEpisodeGroup || null
|
||||||
|
}
|
||||||
|
if (typeof episodeGroup === 'object' && typeof episodeGroup.value === 'string') {
|
||||||
|
const normalizedEpisodeGroup = episodeGroup.value.trim()
|
||||||
|
return normalizedEpisodeGroup || null
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
// 统一解析接口返回的数字字段,兼容 string/number
|
// 统一解析接口返回的数字字段,兼容 string/number
|
||||||
function toPreviewNumber(value: unknown) {
|
function toPreviewNumber(value: unknown) {
|
||||||
if (value === undefined || value === null || value === '') return undefined
|
if (value === undefined || value === null || value === '') return undefined
|
||||||
@@ -725,7 +751,7 @@ function createTransferPayload(options: { item?: FileItem; items?: FileItem[]; l
|
|||||||
fileitem: sourceItem,
|
fileitem: sourceItem,
|
||||||
logid: options.logid ?? 0,
|
logid: options.logid ?? 0,
|
||||||
target_path: normalizeTargetPath(transferForm.target_path),
|
target_path: normalizeTargetPath(transferForm.target_path),
|
||||||
episode_group: transferForm.episode_group?.trim() || null,
|
episode_group: normalizeEpisodeGroup(transferForm.episode_group),
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.items?.length) {
|
if (options.items?.length) {
|
||||||
@@ -1324,9 +1350,11 @@ onUnmounted(() => {
|
|||||||
</VRow>
|
</VRow>
|
||||||
<VRow v-show="transferForm.type_name === '电视剧'">
|
<VRow v-show="transferForm.type_name === '电视剧'">
|
||||||
<VCol v-if="mediaSource === 'themoviedb'" cols="12" md="6">
|
<VCol v-if="mediaSource === 'themoviedb'" cols="12" md="6">
|
||||||
<VCombobox
|
<VSelect
|
||||||
v-model="transferForm.episode_group"
|
v-model="transferForm.episode_group"
|
||||||
:items="episodeGroupOptions"
|
:items="episodeGroupOptions"
|
||||||
|
item-title="title"
|
||||||
|
item-value="value"
|
||||||
:item-props="episodeGroupItemProps"
|
:item-props="episodeGroupItemProps"
|
||||||
:loading="episodeGroupLoading"
|
:loading="episodeGroupLoading"
|
||||||
:disabled="!transferForm.tmdbid"
|
:disabled="!transferForm.tmdbid"
|
||||||
|
|||||||
Reference in New Issue
Block a user