mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 07:28:37 +08:00
Merge pull request #248 from wikrin/rfc-247
This commit is contained in:
@@ -6,7 +6,7 @@ import { storageOptions } from '@/api/constants'
|
|||||||
import { numberValidator } from '@/@validators'
|
import { numberValidator } from '@/@validators'
|
||||||
import { useDisplay } from 'vuetify'
|
import { useDisplay } from 'vuetify'
|
||||||
import ProgressDialog from './ProgressDialog.vue'
|
import ProgressDialog from './ProgressDialog.vue'
|
||||||
import { FileItem } from '@/api/types'
|
import { FileItem, TransferDirectoryConf } from '@/api/types'
|
||||||
import { transferTypeOptions } from '@/api/constants'
|
import { transferTypeOptions } from '@/api/constants'
|
||||||
|
|
||||||
// 显示器宽度
|
// 显示器宽度
|
||||||
@@ -88,13 +88,42 @@ const transferForm = reactive({
|
|||||||
library_category_folder: false,
|
library_category_folder: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 下载路径更新
|
// 所有媒体库目录
|
||||||
function updateTargetPath(value: string) {
|
const directories = ref<TransferDirectoryConf[]>([])
|
||||||
if (value !== transferForm.target_path) {
|
|
||||||
transferForm.target_path = value // 仅在值真正改变时更新
|
// 查询目录
|
||||||
|
async function loadDirectories() {
|
||||||
|
try {
|
||||||
|
const result: { [key: string]: any } = await api.get('system/setting/Directories')
|
||||||
|
directories.value = result.data?.value ?? []
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 目的目录下拉框
|
||||||
|
const targetDirectories = computed(() => {
|
||||||
|
const libraryDirectories = directories.value.map(item => item.library_path)
|
||||||
|
return [...new Set(libraryDirectories)]
|
||||||
|
})
|
||||||
|
|
||||||
|
// 监听目的路径变化,配置默认值
|
||||||
|
watch(
|
||||||
|
() => transferForm.target_path,
|
||||||
|
async newPath => {
|
||||||
|
if (newPath) {
|
||||||
|
const directory = directories.value.find(item => item.library_path === newPath)
|
||||||
|
if (directory) {
|
||||||
|
transferForm.target_storage = directory.storage ?? 'local'
|
||||||
|
transferForm.transfer_type = directory.transfer_type ?? ''
|
||||||
|
transferForm.scrape = directory.scraping ?? false
|
||||||
|
transferForm.library_category_folder = directory.library_category_folder ?? false
|
||||||
|
transferForm.library_type_folder = directory.library_type_folder ?? false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
// 使用SSE监听加载进度
|
// 使用SSE监听加载进度
|
||||||
function startLoadingProgress() {
|
function startLoadingProgress() {
|
||||||
progressText.value = '请稍候 ...'
|
progressText.value = '请稍候 ...'
|
||||||
@@ -167,6 +196,10 @@ async function handleTransferLog(logid: number) {
|
|||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadDirectories()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -197,19 +230,14 @@ async function handleTransferLog(logid: number) {
|
|||||||
/>
|
/>
|
||||||
</VCol>
|
</VCol>
|
||||||
<VCol cols="12">
|
<VCol cols="12">
|
||||||
<VPathField @update:modelValue="updateTargetPath" :storage="transferForm.target_storage">
|
<VCombobox
|
||||||
<template #activator="{ menuprops }">
|
v-model="transferForm.target_path"
|
||||||
<VTextField
|
:items="targetDirectories"
|
||||||
v-model="transferForm.target_path"
|
label="目的路径"
|
||||||
v-bind="menuprops"
|
placeholder="留空自动"
|
||||||
label="目的路径"
|
hint="整理目的路径,留空将自动匹配"
|
||||||
placeholder="留空自动"
|
persistent-hint
|
||||||
hint="整理目的路径,留空将自动匹配"
|
/>
|
||||||
persistent-hint
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</VPathField>
|
|
||||||
</VCol>
|
</VCol>
|
||||||
</VRow>
|
</VRow>
|
||||||
<VRow>
|
<VRow>
|
||||||
|
|||||||
Reference in New Issue
Block a user