From 5e2d144828ba406e29b8fea5706a59d6db729bc5 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 26 Aug 2023 23:52:15 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=89=8B=E5=8A=A8=E6=95=B4=E7=90=86UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/filebrowser/List.vue | 160 ++++++++++++++++++++++++++-- 1 file changed, 152 insertions(+), 8 deletions(-) diff --git a/src/components/filebrowser/List.vue b/src/components/filebrowser/List.vue index fa723411..d0522cfa 100644 --- a/src/components/filebrowser/List.vue +++ b/src/components/filebrowser/List.vue @@ -3,9 +3,12 @@ import type { Axios } from 'axios' import type { PropType } from 'vue' import { useConfirm } from 'vuetify-use-dialog' import axios from 'axios' +import { useToast } from 'vue-toast-notification' +import { numberValidator } from '@/@validators' import { formatBytes } from '@core/utils/formatters' import type { EndPoints, FileItem } from '@/api/types' import store from '@/store' +import api from '@/api' // 输入参数 const inProps = defineProps({ @@ -20,6 +23,9 @@ const inProps = defineProps({ // 对外事件 const emit = defineEmits(['loading', 'pathchanged', 'refreshed', 'filedeleted', 'renamed']) +// 提示框 +const $toast = useToast() + // 确认框 const createConfirm = useConfirm() @@ -47,11 +53,30 @@ const newName = ref('') // 当前名称 const currentItem = ref() -// TODO 文件转移表单 -const transferForm = ref({ +// 文件转移表单 +const transferForm = reactive({ + path: '', + target: '', + tmdbid: 0, + season: 0, + type_name: '电影', + transfer_type: '', + episode_format: '', + episode_detail: '', + episode_part: '', + episode_offset: null, + min_filesize: 0, }) +// 生成1到50季的下拉框选项 +const seasonItems = ref( + Array.from({ length: 50 }, (_, i) => i + 1).map(item => ({ + title: `第 ${item} 季`, + value: item, + })), +) + // 目录过滤 const dirs = computed(() => items.value.filter(item => item.type === 'dir' && item.basename.includes(filter.value)), @@ -192,8 +217,26 @@ function showTransfer(item: FileItem) { } // 整理文件 -function transfer() { - // TODO 整理文件 +async function transfer() { + transferForm.path = currentItem.value?.path || '' + // 开始整理文件 + try { + const result: { [key: string]: any } = await api.post('transfer/manual', {}, { + params: transferForm, + }) + transferPopper.value = false + if (result.success) { + $toast.success(`${currentItem.value?.name} 整理成功!`) + // 重新加载 + load() + } + else { + $toast.error(`${currentItem.value?.name} 整理失败:${result.message}!`) + } + } + catch (e) { + console.log(e) + } } // 监听path变化 @@ -440,22 +483,123 @@ onMounted(() => { - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
取消