mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-07 06:42:53 +08:00
feat merge form
This commit is contained in:
BIN
public/plugin_icon/world.png
Normal file
BIN
public/plugin_icon/world.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
@@ -234,13 +234,15 @@ const dropdownItems = ref([
|
||||
</VCardText>
|
||||
</VCard>
|
||||
<!-- 插件配置页面 -->
|
||||
<VDialog
|
||||
<VBottomSheet
|
||||
v-model="pluginConfigDialog"
|
||||
max-width="50rem"
|
||||
scrollable
|
||||
persistent
|
||||
inset
|
||||
>
|
||||
<VCard :title="`${props.plugin?.plugin_name} - 配置`">
|
||||
<VCard
|
||||
:title="`${props.plugin?.plugin_name} - 配置`"
|
||||
class="rounded-t"
|
||||
>
|
||||
<DialogCloseBtn @click="pluginConfigDialog = false" />
|
||||
<VCardText>
|
||||
<FormRender
|
||||
@@ -263,16 +265,18 @@ const dropdownItems = ref([
|
||||
</VBtn>
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</VBottomSheet>
|
||||
|
||||
<!-- 插件详情页面 -->
|
||||
<VDialog
|
||||
<VBottomSheet
|
||||
v-model="pluginInfoDialog"
|
||||
max-width="62.5rem"
|
||||
scrollable
|
||||
persistent
|
||||
inset
|
||||
>
|
||||
<VCard :title="`${props.plugin?.plugin_name}`">
|
||||
<VCard
|
||||
:title="`${props.plugin?.plugin_name}`"
|
||||
class="rounded-t"
|
||||
>
|
||||
<DialogCloseBtn @click="pluginInfoDialog = false" />
|
||||
<VCardText>
|
||||
<PageRender
|
||||
@@ -296,7 +300,7 @@ const dropdownItems = ref([
|
||||
</VBtn>
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</VBottomSheet>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -4,13 +4,12 @@ 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 ReorganizeForm from '../form/ReorganizeForm.vue'
|
||||
import { formatBytes } from '@core/utils/formatters'
|
||||
import type { Context, EndPoints, FileItem } from '@/api/types'
|
||||
import store from '@/store'
|
||||
import api from '@/api'
|
||||
import MediaInfoCard from '@/components/cards/MediaInfoCard.vue'
|
||||
import TmdbSelectorCard from '@/components/cards/TmdbSelectorCard.vue'
|
||||
|
||||
// 输入参数
|
||||
const inProps = defineProps({
|
||||
@@ -32,6 +31,15 @@ const $toast = useToast()
|
||||
// 是否正在加载
|
||||
const loading = ref(true)
|
||||
|
||||
// 识别进度条
|
||||
const progressDialog = ref(false)
|
||||
|
||||
// 识别进度文本
|
||||
const progressText = ref('请稍候 ...')
|
||||
|
||||
// 识别进度
|
||||
const progressValue = ref(0)
|
||||
|
||||
// 确认框
|
||||
const createConfirm = useConfirm()
|
||||
|
||||
@@ -53,57 +61,18 @@ const renamePopper = ref(false)
|
||||
// 整理弹窗
|
||||
const transferPopper = ref(false)
|
||||
|
||||
// 整理进度条
|
||||
const progressDialog = ref(false)
|
||||
|
||||
// 整理进度文本
|
||||
const progressText = ref('请稍候 ...')
|
||||
|
||||
// 整理进度
|
||||
const progressValue = ref(0)
|
||||
|
||||
// 加载进度SSE
|
||||
const progressEventSource = ref<EventSource>()
|
||||
|
||||
// 新名称
|
||||
const newName = ref('')
|
||||
|
||||
// 当前名称
|
||||
const currentItem = ref<FileItem>()
|
||||
|
||||
// 文件转移表单
|
||||
const transferForm = reactive({
|
||||
path: '',
|
||||
target: '',
|
||||
tmdbid: null,
|
||||
season: null,
|
||||
type_name: '',
|
||||
transfer_type: '',
|
||||
episode_format: '',
|
||||
episode_detail: '',
|
||||
episode_part: '',
|
||||
episode_offset: null,
|
||||
min_filesize: 0,
|
||||
|
||||
})
|
||||
|
||||
// 识别结果
|
||||
const nameTestResult = ref<Context>()
|
||||
|
||||
// 识别结果对话框
|
||||
const nameTestDialog = ref(false)
|
||||
|
||||
// TMDB选择对话框
|
||||
const tmdbSelectorDialog = ref(false)
|
||||
|
||||
// 生成1到50季的下拉框选项
|
||||
const seasonItems = ref(
|
||||
Array.from({ length: 51 }, (_, i) => i).map(item => ({
|
||||
title: `第 ${item} 季`,
|
||||
value: item,
|
||||
})),
|
||||
)
|
||||
|
||||
// 目录过滤
|
||||
const dirs = computed(() =>
|
||||
items.value.filter(item => item.type === 'dir' && item.basename.includes(filter.value)),
|
||||
@@ -248,41 +217,6 @@ function showTransfer(item: FileItem) {
|
||||
transferPopper.value = true
|
||||
}
|
||||
|
||||
// 整理文件
|
||||
async function transfer() {
|
||||
transferForm.path = currentItem.value?.path ?? ''
|
||||
// 开始整理文件
|
||||
try {
|
||||
// 关闭弹窗
|
||||
transferPopper.value = false
|
||||
// 显示进度条
|
||||
progressDialog.value = true
|
||||
// 开始监听进度
|
||||
startLoadingProgress()
|
||||
// 异步调API,结束后关闭进度条
|
||||
api.post('transfer/manual', {}, {
|
||||
params: transferForm,
|
||||
}).then((res: any) => {
|
||||
// 关闭进度条
|
||||
progressDialog.value = false
|
||||
// 停止监听进度
|
||||
stopLoadingProgress()
|
||||
// 显示结果
|
||||
if (res.success) {
|
||||
$toast.success(`${currentItem.value?.name} 整理完成!`)
|
||||
// 重新加载
|
||||
load()
|
||||
}
|
||||
else {
|
||||
$toast.error(`${currentItem.value?.name} 整理失败:${res.message}!`)
|
||||
}
|
||||
})
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
// 将文件修改时间(timestape)转换为本地时间
|
||||
function formatTime(timestape: number) {
|
||||
return new Date(timestape * 1000).toLocaleString()
|
||||
@@ -310,29 +244,6 @@ watch(
|
||||
},
|
||||
)
|
||||
|
||||
// 使用SSE监听加载进度
|
||||
function startLoadingProgress() {
|
||||
progressText.value = '请稍候 ...'
|
||||
|
||||
const token = store.state.auth.token
|
||||
|
||||
progressEventSource.value = new EventSource(
|
||||
`${import.meta.env.VITE_API_BASE_URL}system/progress/filetransfer?token=${token}`,
|
||||
)
|
||||
progressEventSource.value.onmessage = (event) => {
|
||||
const progress = JSON.parse(event.data)
|
||||
if (progress) {
|
||||
progressText.value = progress.text
|
||||
progressValue.value = progress.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 停止监听加载进度
|
||||
function stopLoadingProgress() {
|
||||
progressEventSource.value?.close()
|
||||
}
|
||||
|
||||
// 调用API识别
|
||||
async function recognize(path: string) {
|
||||
try {
|
||||
@@ -589,11 +500,6 @@ onMounted(() => {
|
||||
v-model="renamePopper"
|
||||
max-width="50rem"
|
||||
>
|
||||
<template #activator="{ props }">
|
||||
<IconBtn title="重命名" v-bind="props">
|
||||
<VIcon icon="mdi-rename-outline" />
|
||||
</IconBtn>
|
||||
</template>
|
||||
<VCard title="重命名">
|
||||
<VCardText>
|
||||
<VTextField v-model="newName" label="名称" />
|
||||
@@ -615,184 +521,44 @@ onMounted(() => {
|
||||
</VCard>
|
||||
</VDialog>
|
||||
<!-- 文件整理弹窗 -->
|
||||
<VDialog
|
||||
<ReorganizeForm
|
||||
v-model="transferPopper"
|
||||
max-width="50rem"
|
||||
scrollable
|
||||
>
|
||||
<template #activator="{ props }">
|
||||
<IconBtn title="整理" v-bind="props">
|
||||
<VIcon icon="mdi-folder-arrow-right-outline" />
|
||||
</IconBtn>
|
||||
</template>
|
||||
<VCard :title="`文件整理 - ${currentItem?.name}`">
|
||||
<DialogCloseBtn @click="transferPopper = false" />
|
||||
<VCardText class="pt-2">
|
||||
<VForm @submit.prevent="() => {}">
|
||||
<VRow>
|
||||
<VCol
|
||||
cols="12"
|
||||
md="8"
|
||||
>
|
||||
<VTextField
|
||||
v-model="transferForm.target"
|
||||
label="目的路径"
|
||||
placeholder="留空自动"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol
|
||||
cols="12"
|
||||
md="4"
|
||||
>
|
||||
<VSelect
|
||||
v-model="transferForm.transfer_type"
|
||||
label="整理方式"
|
||||
:items="[
|
||||
{ title: '默认', value: '' },
|
||||
{ title: '移动', value: 'move' },
|
||||
{ title: '复制', value: 'copy' },
|
||||
{ title: '硬链接', value: 'link' },
|
||||
{ title: '软链接', value: 'softlink' },
|
||||
{ title: 'Rclone复制', value: 'rclone_copy' },
|
||||
{ title: 'Rclone移动', value: 'rclone_move' },
|
||||
]"
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
<VRow>
|
||||
<VCol
|
||||
cols="12"
|
||||
md="4"
|
||||
>
|
||||
<VSelect
|
||||
v-model="transferForm.type_name"
|
||||
label="类型"
|
||||
:items="[{ title: '请选择', value: '' }, { title: '电影', value: '电影' }, { title: '电视剧', value: '电视剧' }]"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol
|
||||
cols="12"
|
||||
md="4"
|
||||
>
|
||||
<VTextField
|
||||
v-model="transferForm.tmdbid"
|
||||
:disabled="transferForm.type_name === ''"
|
||||
label="TMDBID"
|
||||
placeholder="留空自动识别"
|
||||
:rules="[numberValidator]"
|
||||
append-inner-icon="mdi-magnify"
|
||||
@click:append-inner="tmdbSelectorDialog = true"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol
|
||||
cols="12"
|
||||
md="4"
|
||||
>
|
||||
<VSelect
|
||||
v-show="transferForm.type_name === '电视剧'"
|
||||
v-model.number="transferForm.season"
|
||||
label="季"
|
||||
:items="seasonItems"
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
<VRow>
|
||||
<VCol cols="12" md="8">
|
||||
<VTextField
|
||||
v-model="transferForm.episode_format"
|
||||
label="集数定位"
|
||||
placeholder="使用{ep}定位集数"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="4">
|
||||
<VTextField
|
||||
v-model="transferForm.episode_detail"
|
||||
label="指定集数"
|
||||
placeholder="起始集,终止集,如1或1,2"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="4">
|
||||
<VTextField
|
||||
v-model="transferForm.episode_part"
|
||||
label="指定Part"
|
||||
placeholder="如part1"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="4">
|
||||
<VTextField
|
||||
v-model.number="transferForm.episode_offset"
|
||||
label="集数偏移"
|
||||
placeholder="如-10"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="4">
|
||||
<VTextField
|
||||
v-model.number="transferForm.min_filesize"
|
||||
label="最小文件大小(MB)"
|
||||
:rules="[numberValidator]"
|
||||
placeholder="0"
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VForm>
|
||||
</VCardText>
|
||||
<VCardActions>
|
||||
<VBtn depressed @click="transferPopper = false">
|
||||
取消
|
||||
</VBtn>
|
||||
<VSpacer />
|
||||
<VBtn
|
||||
variant="tonal"
|
||||
@click="transfer"
|
||||
>
|
||||
开始整理
|
||||
</VBtn>
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
:path="currentItem?.path"
|
||||
@done="load"
|
||||
@close="transferPopper = false"
|
||||
/>
|
||||
<!-- 手动整理进度框 -->
|
||||
<vDialog
|
||||
<VDialog
|
||||
v-model="progressDialog"
|
||||
:scrim="false"
|
||||
width="25rem"
|
||||
>
|
||||
<vCard
|
||||
<VCard
|
||||
color="primary"
|
||||
>
|
||||
<vCardText class="text-center">
|
||||
<VCardText class="text-center">
|
||||
{{ progressText }}
|
||||
<vProgressLinear
|
||||
<VProgressLinear
|
||||
v-if="progressValue"
|
||||
color="white"
|
||||
class="mb-0 mt-1"
|
||||
:model-value="progressValue"
|
||||
/>
|
||||
</vCardText>
|
||||
</vCard>
|
||||
</vDialog>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
<!-- 识别结果对话框 -->
|
||||
<vDialog
|
||||
<VDialog
|
||||
v-model="nameTestDialog"
|
||||
width="50rem"
|
||||
>
|
||||
<vCard>
|
||||
<VCard>
|
||||
<DialogCloseBtn @click="nameTestDialog = false" />
|
||||
<VCardItem>
|
||||
<MediaInfoCard :context="nameTestResult" />
|
||||
</VCardItem>
|
||||
</vCard>
|
||||
</vDialog>
|
||||
<!-- TMDB ID搜索框 -->
|
||||
<vDialog
|
||||
v-model="tmdbSelectorDialog"
|
||||
width="40rem"
|
||||
scrollable
|
||||
>
|
||||
<TmdbSelectorCard
|
||||
v-model="transferForm.tmdbid"
|
||||
@close="tmdbSelectorDialog = false"
|
||||
/>
|
||||
</vDialog>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
309
src/components/form/ReorganizeForm.vue
Normal file
309
src/components/form/ReorganizeForm.vue
Normal file
@@ -0,0 +1,309 @@
|
||||
<script lang="ts" setup>
|
||||
import { useToast } from 'vue-toast-notification'
|
||||
import store from '@/store'
|
||||
import api from '@/api'
|
||||
import { numberValidator } from '@/@validators'
|
||||
|
||||
// 输入参数
|
||||
const props = defineProps({
|
||||
path: String,
|
||||
target: String,
|
||||
logids: Array<number>,
|
||||
})
|
||||
|
||||
// 定义事件
|
||||
const emit = defineEmits(['done', 'close'])
|
||||
|
||||
// 生成1到50季的下拉框选项
|
||||
const seasonItems = ref(
|
||||
Array.from({ length: 51 }, (_, i) => i).map(item => ({
|
||||
title: `第 ${item} 季`,
|
||||
value: item,
|
||||
})),
|
||||
)
|
||||
|
||||
// 提示框
|
||||
const $toast = useToast()
|
||||
|
||||
// TMDB选择对话框
|
||||
const tmdbSelectorDialog = ref(false)
|
||||
|
||||
// 加载进度SSE
|
||||
const progressEventSource = ref<EventSource>()
|
||||
|
||||
// 整理进度条
|
||||
const progressDialog = ref(false)
|
||||
|
||||
// 整理进度文本
|
||||
const progressText = ref('请稍候 ...')
|
||||
|
||||
// 整理进度
|
||||
const progressValue = ref(0)
|
||||
|
||||
// 文件转移表单
|
||||
const transferForm = reactive({
|
||||
logid: 0,
|
||||
path: '',
|
||||
target: props.target ?? '',
|
||||
tmdbid: null,
|
||||
season: null,
|
||||
type_name: '',
|
||||
transfer_type: '',
|
||||
episode_format: '',
|
||||
episode_detail: '',
|
||||
episode_part: '',
|
||||
episode_offset: null,
|
||||
min_filesize: 0,
|
||||
|
||||
})
|
||||
|
||||
watchEffect(() => {
|
||||
if (props.path)
|
||||
transferForm.path = props.path
|
||||
})
|
||||
|
||||
// 使用SSE监听加载进度
|
||||
function startLoadingProgress() {
|
||||
progressText.value = '请稍候 ...'
|
||||
|
||||
const token = store.state.auth.token
|
||||
|
||||
progressEventSource.value = new EventSource(
|
||||
`${import.meta.env.VITE_API_BASE_URL}system/progress/filetransfer?token=${token}`,
|
||||
)
|
||||
progressEventSource.value.onmessage = (event) => {
|
||||
const progress = JSON.parse(event.data)
|
||||
if (progress) {
|
||||
progressText.value = progress.text
|
||||
progressValue.value = progress.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 停止监听加载进度
|
||||
function stopLoadingProgress() {
|
||||
progressEventSource.value?.close()
|
||||
}
|
||||
|
||||
// 整理文件
|
||||
async function transfer() {
|
||||
if (!props.logids && !props.path)
|
||||
return
|
||||
|
||||
// 显示进度条
|
||||
progressDialog.value = true
|
||||
// 开始监听进度
|
||||
startLoadingProgress()
|
||||
|
||||
if (props.path) {
|
||||
// 文件整理
|
||||
try {
|
||||
api.post('transfer/manual', {}, {
|
||||
params: transferForm,
|
||||
}).then((res: any) => {
|
||||
// 关闭进度条
|
||||
progressDialog.value = false
|
||||
// 显示结果
|
||||
if (res.success) {
|
||||
$toast.success(`${props.path} 整理完成!`)
|
||||
// 重新加载
|
||||
emit('done')
|
||||
}
|
||||
else {
|
||||
$toast.error(`${props.path} 整理失败:${res.message}!`)
|
||||
}
|
||||
})
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
else if (props.logids) {
|
||||
// 日志整理
|
||||
for (const logid of props.logids) {
|
||||
transferForm.logid = logid
|
||||
try {
|
||||
await api.post('transfer/manual', {}, {
|
||||
params: transferForm,
|
||||
})
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
// 重新加载
|
||||
emit('done')
|
||||
}
|
||||
|
||||
// 停止监听进度
|
||||
stopLoadingProgress()
|
||||
// 关闭进度条
|
||||
progressDialog.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VBottomSheet
|
||||
scrollable
|
||||
inset
|
||||
>
|
||||
<VCard
|
||||
:title="`${props.path ? `整理 - ${props.path}` : `整理 - ${props.logids?.length} 条记录`}`"
|
||||
class="rounded-t"
|
||||
>
|
||||
<DialogCloseBtn @click="emit('close')" />
|
||||
<VCardText class="pt-2">
|
||||
<VForm @submit.prevent="() => {}">
|
||||
<VRow>
|
||||
<VCol
|
||||
cols="12"
|
||||
md="8"
|
||||
>
|
||||
<VTextField
|
||||
v-model="transferForm.target"
|
||||
label="目的路径"
|
||||
placeholder="留空自动"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol
|
||||
cols="12"
|
||||
md="4"
|
||||
>
|
||||
<VSelect
|
||||
v-model="transferForm.transfer_type"
|
||||
label="整理方式"
|
||||
:items="[
|
||||
{ title: '默认', value: '' },
|
||||
{ title: '移动', value: 'move' },
|
||||
{ title: '复制', value: 'copy' },
|
||||
{ title: '硬链接', value: 'link' },
|
||||
{ title: '软链接', value: 'softlink' },
|
||||
{ title: 'Rclone复制', value: 'rclone_copy' },
|
||||
{ title: 'Rclone移动', value: 'rclone_move' },
|
||||
]"
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
<VRow>
|
||||
<VCol
|
||||
cols="12"
|
||||
md="4"
|
||||
>
|
||||
<VSelect
|
||||
v-model="transferForm.type_name"
|
||||
label="类型"
|
||||
:items="[{ title: '自动', value: '' }, { title: '电影', value: '电影' }, { title: '电视剧', value: '电视剧' }]"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol
|
||||
cols="12"
|
||||
md="4"
|
||||
>
|
||||
<VTextField
|
||||
v-model="transferForm.tmdbid"
|
||||
:disabled="transferForm.type_name === ''"
|
||||
label="TMDBID"
|
||||
placeholder="留空自动识别"
|
||||
:rules="[numberValidator]"
|
||||
append-inner-icon="mdi-magnify"
|
||||
@click:append-inner="tmdbSelectorDialog = true"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol
|
||||
cols="12"
|
||||
md="4"
|
||||
>
|
||||
<VSelect
|
||||
v-show="transferForm.type_name === '电视剧'"
|
||||
v-model.number="transferForm.season"
|
||||
label="季"
|
||||
:items="seasonItems"
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
<VRow>
|
||||
<VCol cols="12" md="8">
|
||||
<VTextField
|
||||
v-model="transferForm.episode_format"
|
||||
label="集数定位"
|
||||
placeholder="使用{ep}定位集数"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="4">
|
||||
<VTextField
|
||||
v-model="transferForm.episode_detail"
|
||||
label="指定集数"
|
||||
placeholder="起始集,终止集,如1或1,2"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="4">
|
||||
<VTextField
|
||||
v-model="transferForm.episode_part"
|
||||
label="指定Part"
|
||||
placeholder="如part1"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="4">
|
||||
<VTextField
|
||||
v-model.number="transferForm.episode_offset"
|
||||
label="集数偏移"
|
||||
placeholder="如-10"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="4">
|
||||
<VTextField
|
||||
v-model.number="transferForm.min_filesize"
|
||||
label="最小文件大小(MB)"
|
||||
:rules="[numberValidator]"
|
||||
placeholder="0"
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VForm>
|
||||
</VCardText>
|
||||
<VCardActions>
|
||||
<VBtn depressed @click="emit('close')">
|
||||
取消
|
||||
</VBtn>
|
||||
<VSpacer />
|
||||
<VBtn
|
||||
variant="tonal"
|
||||
@click="transfer"
|
||||
>
|
||||
开始整理
|
||||
</VBtn>
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
</VBottomSheet>
|
||||
<!-- 手动整理进度框 -->
|
||||
<VDialog
|
||||
v-model="progressDialog"
|
||||
:scrim="false"
|
||||
width="25rem"
|
||||
>
|
||||
<VCard
|
||||
color="primary"
|
||||
>
|
||||
<VBottomSheetCardText class="text-center">
|
||||
{{ progressText }}
|
||||
<VProgressLinear
|
||||
v-if="progressValue"
|
||||
color="white"
|
||||
class="mb-0 mt-1"
|
||||
:model-value="progressValue"
|
||||
/>
|
||||
</VBottomSheetCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
<!-- TMDB ID搜索框 -->
|
||||
<VDialog
|
||||
v-model="tmdbSelectorDialog"
|
||||
width="40rem"
|
||||
scrollable
|
||||
>
|
||||
<TmdbSelectorCard
|
||||
v-model="transferForm.tmdbid"
|
||||
@close="tmdbSelectorDialog = false"
|
||||
/>
|
||||
</VDialog>
|
||||
</template>
|
||||
@@ -123,7 +123,10 @@ async function updateSiteInfo() {
|
||||
inset
|
||||
scrollable
|
||||
>
|
||||
<VCard :title="`${props.oper === 'add' ? '新增' : '编辑'}站点${props.oper !== 'add' ? ` - ${siteForm.name}` : ''}`">
|
||||
<VCard
|
||||
:title="`${props.oper === 'add' ? '新增' : '编辑'}站点${props.oper !== 'add' ? ` - ${siteForm.name}` : ''}`"
|
||||
class="rounded-t"
|
||||
>
|
||||
<DialogCloseBtn @click="emit('close')" />
|
||||
<VCardText class="pt-2">
|
||||
<VForm @submit.prevent="() => {}">
|
||||
@@ -267,5 +270,5 @@ async function updateSiteInfo() {
|
||||
</VBtn>
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
</vBottomSheet>
|
||||
</VBottomSheet>
|
||||
</template>
|
||||
|
||||
@@ -173,21 +173,21 @@ const avatar = store.state.auth.avatar
|
||||
<!-- !SECTION -->
|
||||
</VAvatar>
|
||||
<!-- 重启进度框 -->
|
||||
<vDialog
|
||||
<VDialog
|
||||
v-model="progressDialog"
|
||||
width="25rem"
|
||||
>
|
||||
<vCard
|
||||
<VCard
|
||||
color="primary"
|
||||
>
|
||||
<vCardText class="text-center">
|
||||
<VCardText class="text-center">
|
||||
正在重启 ...
|
||||
<vProgressLinear
|
||||
<VProgressLinear
|
||||
indeterminate
|
||||
color="white"
|
||||
class="mb-0 mt-1"
|
||||
/>
|
||||
</vCardText>
|
||||
</vCard>
|
||||
</vDialog>
|
||||
</VCardText>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
</template>
|
||||
|
||||
@@ -169,7 +169,7 @@ onMounted(() => {
|
||||
>
|
||||
{{ resolution }}
|
||||
</VChip>
|
||||
</vchipgroup>
|
||||
</VChipGroup>
|
||||
</VListItem>
|
||||
<VListSubheader v-if="releaseGroupFilterOptions.length > 0">
|
||||
制作组
|
||||
@@ -186,7 +186,7 @@ onMounted(() => {
|
||||
>
|
||||
{{ releaseGroup }}
|
||||
</VChip>
|
||||
</vchipgroup>
|
||||
</VChipGroup>
|
||||
</VListItem>
|
||||
<VListSubheader v-if="videoCodeFilterOptions.length > 0">
|
||||
视频编码
|
||||
@@ -203,7 +203,7 @@ onMounted(() => {
|
||||
>
|
||||
{{ videoCode }}
|
||||
</VChip>
|
||||
</vchipgroup>
|
||||
</VChipGroup>
|
||||
</VListItem>
|
||||
<VListSubheader v-if="freeStateFilterOptions.length > 0">
|
||||
促销状态
|
||||
@@ -220,7 +220,7 @@ onMounted(() => {
|
||||
>
|
||||
{{ freeState }}
|
||||
</VChip>
|
||||
</vchipgroup>
|
||||
</VChipGroup>
|
||||
</VListItem>
|
||||
<VListSubheader v-if="seasonFilterOptions.length > 0">
|
||||
季集
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useToast } from 'vue-toast-notification'
|
||||
import { numberValidator } from '@/@validators'
|
||||
import api from '@/api'
|
||||
import type { TransferHistory } from '@/api/types'
|
||||
import TmdbSelectorCard from '@/components/cards/TmdbSelectorCard.vue'
|
||||
import ReorganizeForm from '@/components/form/ReorganizeForm.vue'
|
||||
|
||||
// 提示框
|
||||
const $toast = useToast()
|
||||
@@ -12,22 +11,15 @@ const $toast = useToast()
|
||||
// 重新整理对话框
|
||||
const redoDialog = ref(false)
|
||||
|
||||
// TMDB编号
|
||||
const redoTmdbId = ref('')
|
||||
|
||||
// 类型
|
||||
const redoType = ref('电影')
|
||||
|
||||
// 类型下拉框:电影、电视剧
|
||||
const redoTypeItems = ref([
|
||||
{ title: '自动', value: '' },
|
||||
{ title: '电影', value: '电影' },
|
||||
{ title: '电视剧', value: '电视剧' },
|
||||
])
|
||||
|
||||
// 当前操作记录
|
||||
const currentHistory = ref<TransferHistory>()
|
||||
|
||||
// 重新整理IDS
|
||||
const redoIds = ref<number[]>([])
|
||||
|
||||
// 重新整理target
|
||||
const redoTarget = ref('')
|
||||
|
||||
// 已选中的数据
|
||||
const selected = ref<TransferHistory[]>([])
|
||||
|
||||
@@ -69,9 +61,6 @@ const progressText = ref('请稍候 ...')
|
||||
// 进度值
|
||||
const progressValue = ref(0)
|
||||
|
||||
// TMDB选择对话框
|
||||
const tmdbSelectorDialog = ref(false)
|
||||
|
||||
// 删除确认对话框
|
||||
const deleteConfirmDialog = ref(false)
|
||||
|
||||
@@ -227,85 +216,17 @@ async function retransferBatch() {
|
||||
return
|
||||
// 清空当前操作记录
|
||||
currentHistory.value = undefined
|
||||
// 重新整理IDS
|
||||
redoIds.value = selected.value.map(item => item.id)
|
||||
// 重新整理target
|
||||
if (selected.value.length === 1)
|
||||
redoTarget.value = selected.value[0].dest ?? ''
|
||||
else
|
||||
redoTarget.value = ''
|
||||
// 打开识别弹窗
|
||||
redoType.value = ''
|
||||
redoTmdbId.value = ''
|
||||
redoDialog.value = true
|
||||
}
|
||||
|
||||
// 调API重新整理
|
||||
async function retransfer(item: TransferHistory, redoType = '', redoTmdbId = 0) {
|
||||
try {
|
||||
const result: { [key: string]: any } = await api.post(
|
||||
'history/transfer',
|
||||
item,
|
||||
{
|
||||
params: {
|
||||
mtype: redoType,
|
||||
new_tmdbid: redoTmdbId,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
if (result.success) {
|
||||
fetchData({
|
||||
page: currentPage.value,
|
||||
itemsPerPage: itemsPerPage.value,
|
||||
})
|
||||
}
|
||||
else {
|
||||
$toast.error(`重新整理失败: ${result.message}!`)
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
// 重新整理
|
||||
async function rehandleHistory() {
|
||||
try {
|
||||
// 关闭弹窗
|
||||
redoDialog.value = false
|
||||
|
||||
let tmdbid = 0
|
||||
|
||||
if (redoTmdbId.value)
|
||||
tmdbid = parseInt(redoTmdbId.value)
|
||||
|
||||
// 转移当前选中记录
|
||||
if (currentHistory.value) {
|
||||
$toast.info(`正在重新整理 ${currentHistory.value?.title} ...`)
|
||||
await retransfer(currentHistory.value, redoType.value, tmdbid)
|
||||
}
|
||||
else if (selected.value.length > 0) {
|
||||
// 总条数
|
||||
const total = selected.value.length
|
||||
if (total === 0)
|
||||
return
|
||||
// 已处理条数
|
||||
let handled = 0
|
||||
// 显示进度条
|
||||
progressDialog.value = true
|
||||
for (const item of selected.value) {
|
||||
progressText.value = `正在重新整理 ${item.src} ...`
|
||||
await retransfer(item, redoType.value, tmdbid)
|
||||
handled++
|
||||
progressValue.value = handled / total * 100
|
||||
}
|
||||
// 清空选中项
|
||||
selected.value = []
|
||||
// 隐藏进度条
|
||||
progressDialog.value = false
|
||||
}
|
||||
// 批量转移
|
||||
else { $toast.error('没有选中任何记录!') }
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
// 弹出菜单
|
||||
const dropdownItems = ref([
|
||||
{
|
||||
@@ -314,10 +235,8 @@ const dropdownItems = ref([
|
||||
props: {
|
||||
prependIcon: 'mdi-redo-variant',
|
||||
click: (item: TransferHistory) => {
|
||||
redoTmdbId.value = ''
|
||||
redoType.value = ''
|
||||
redoDialog.value = true
|
||||
currentHistory.value = item
|
||||
redoDialog.value = true
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -444,48 +363,11 @@ const dropdownItems = ref([
|
||||
</template>
|
||||
</VDataTableServer>
|
||||
</VCard>
|
||||
<VDialog
|
||||
v-model="redoDialog"
|
||||
max-width="50rem"
|
||||
<!-- 底部操作按钮 -->
|
||||
<span
|
||||
v-if="selected.length > 0"
|
||||
class="fixed right-5 bottom-5"
|
||||
>
|
||||
<!-- Dialog Content -->
|
||||
<VCard title="重新整理">
|
||||
<VCardText>
|
||||
<VRow>
|
||||
<VCol cols="12" md="4">
|
||||
<VSelect
|
||||
v-model="redoType"
|
||||
label="类型"
|
||||
:items="redoTypeItems"
|
||||
/>
|
||||
</VCol>
|
||||
<VCol cols="12" md="8">
|
||||
<VTextField
|
||||
v-model="redoTmdbId"
|
||||
label="TMDB编号"
|
||||
placeholder="留空自动识别"
|
||||
:disabled="redoType === ''"
|
||||
:rules="[numberValidator]"
|
||||
append-inner-icon="mdi-magnify"
|
||||
@click:append-inner.stop="tmdbSelectorDialog = true"
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</VCardText>
|
||||
|
||||
<VCardActions>
|
||||
<VSpacer />
|
||||
<VBtn
|
||||
variant="tonal"
|
||||
@click="rehandleHistory"
|
||||
@keydown.enter="rehandleHistory"
|
||||
>
|
||||
确定
|
||||
</VBtn>
|
||||
</VCardActions>
|
||||
</VCard>
|
||||
</VDialog>
|
||||
<span v-if="selected.length > 0" class="fixed right-5 bottom-5">
|
||||
<VBtn
|
||||
icon="mdi-redo-variant"
|
||||
class="me-2"
|
||||
@@ -500,39 +382,9 @@ const dropdownItems = ref([
|
||||
@click="removeHistoryBatch"
|
||||
/>
|
||||
</span>
|
||||
<!-- 进度框 -->
|
||||
<vDialog
|
||||
v-model="progressDialog"
|
||||
:scrim="false"
|
||||
width="25rem"
|
||||
>
|
||||
<vCard
|
||||
color="primary"
|
||||
>
|
||||
<vCardText class="text-center">
|
||||
{{ progressText }}
|
||||
<vProgressLinear
|
||||
color="white"
|
||||
class="mb-0 mt-1"
|
||||
:model-value="progressValue"
|
||||
/>
|
||||
</vCardText>
|
||||
</vCard>
|
||||
</vDialog>
|
||||
<!-- TMDB ID搜索框 -->
|
||||
<vDialog
|
||||
v-model="tmdbSelectorDialog"
|
||||
width="600"
|
||||
scrollable
|
||||
>
|
||||
<TmdbSelectorCard
|
||||
v-model="redoTmdbId"
|
||||
@close="tmdbSelectorDialog = false"
|
||||
/>
|
||||
</vDialog>
|
||||
<!-- 底部弹窗 -->
|
||||
<VBottomSheet v-model="deleteConfirmDialog" inset>
|
||||
<VCard class="text-center">
|
||||
<VCard class="text-center rounded-t">
|
||||
<DialogCloseBtn @click="deleteConfirmDialog = false" />
|
||||
<VCardTitle class="pe-10">
|
||||
{{ confirmTitle }}
|
||||
@@ -569,6 +421,20 @@ const dropdownItems = ref([
|
||||
</div>
|
||||
</VCard>
|
||||
</VBottomSheet>
|
||||
<!-- 文件整理弹窗 -->
|
||||
<ReorganizeForm
|
||||
v-model="redoDialog"
|
||||
:logids="redoIds"
|
||||
:target="redoTarget"
|
||||
@done="() => {
|
||||
// 刷新
|
||||
fetchData({
|
||||
page: currentPage,
|
||||
itemsPerPage,
|
||||
})
|
||||
}"
|
||||
@close="redoDialog = false"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
@@ -99,7 +99,7 @@ onMounted(() => {
|
||||
/>
|
||||
</VCol>
|
||||
</VRow>
|
||||
</vform>
|
||||
</VForm>
|
||||
</VCardText>
|
||||
<VCardItem>
|
||||
<VBtn
|
||||
|
||||
Reference in New Issue
Block a user