mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-07 08:46:40 +08:00
feat(TransferQueue): 添加整理队列对话框及相关功能
This commit is contained in:
@@ -1100,6 +1100,7 @@ export interface FilterRuleGroup {
|
|||||||
category?: string
|
category?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 订阅下载文件详情
|
||||||
export interface SubscribeDownloadFileInfo {
|
export interface SubscribeDownloadFileInfo {
|
||||||
// 种子名称
|
// 种子名称
|
||||||
torrent_title?: string
|
torrent_title?: string
|
||||||
@@ -1113,6 +1114,7 @@ export interface SubscribeDownloadFileInfo {
|
|||||||
file_path?: string
|
file_path?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 订阅媒体库文件详情
|
||||||
export interface SubscribeLibraryFileInfo {
|
export interface SubscribeLibraryFileInfo {
|
||||||
// 存储
|
// 存储
|
||||||
storage?: string
|
storage?: string
|
||||||
@@ -1120,6 +1122,7 @@ export interface SubscribeLibraryFileInfo {
|
|||||||
file_path?: string
|
file_path?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 订阅集详情
|
||||||
export interface SubscribeEpisodeInfo {
|
export interface SubscribeEpisodeInfo {
|
||||||
// 标题
|
// 标题
|
||||||
title?: string
|
title?: string
|
||||||
@@ -1133,6 +1136,7 @@ export interface SubscribeEpisodeInfo {
|
|||||||
library?: SubscribeLibraryFileInfo[]
|
library?: SubscribeLibraryFileInfo[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 订阅详情
|
||||||
export interface SubscrbieInfo {
|
export interface SubscrbieInfo {
|
||||||
// 订阅信息
|
// 订阅信息
|
||||||
subscribe: Subscribe
|
subscribe: Subscribe
|
||||||
@@ -1140,6 +1144,7 @@ export interface SubscrbieInfo {
|
|||||||
episodes: Record<number, SubscribeEpisodeInfo>
|
episodes: Record<number, SubscribeEpisodeInfo>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 整理表单
|
||||||
export interface TransferForm {
|
export interface TransferForm {
|
||||||
// 文件项
|
// 文件项
|
||||||
fileitem: FileItem
|
fileitem: FileItem
|
||||||
@@ -1178,3 +1183,20 @@ export interface TransferForm {
|
|||||||
// 媒体库类别子目录
|
// 媒体库类别子目录
|
||||||
library_category_folder?: boolean
|
library_category_folder?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 整理队列
|
||||||
|
export interface TransferQueue {
|
||||||
|
// 媒体信息
|
||||||
|
media: MediaInfo
|
||||||
|
// 季
|
||||||
|
season?: number
|
||||||
|
// 任务列表
|
||||||
|
tasks: {
|
||||||
|
// 文件项
|
||||||
|
fileitem: FileItem
|
||||||
|
// 元数据
|
||||||
|
meta: MetaInfo
|
||||||
|
// 状态
|
||||||
|
state: string
|
||||||
|
}[]
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import api from '@/api'
|
||||||
|
import { TransferQueue } from '@/api/types'
|
||||||
|
import { useDisplay } from 'vuetify'
|
||||||
|
import { VProgressLinear } from 'vuetify/lib/components/index.mjs'
|
||||||
|
|
||||||
|
// 显示器宽度
|
||||||
|
const display = useDisplay()
|
||||||
|
// 定义触发的自定义事件
|
||||||
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
|
// 数据列表
|
||||||
|
const dataList = ref<TransferQueue[]>([])
|
||||||
|
|
||||||
|
// 加载进度SSE
|
||||||
|
const progressEventSource = ref<EventSource>()
|
||||||
|
|
||||||
|
// 整理进度文本
|
||||||
|
const progressText = ref('请稍候 ...')
|
||||||
|
|
||||||
|
// 整理进度
|
||||||
|
const progressValue = ref(0)
|
||||||
|
|
||||||
|
// 数据可刷新标志
|
||||||
|
const refreshFlag = ref(false)
|
||||||
|
|
||||||
|
// 调用API获取队列信息
|
||||||
|
async function get_transfer_queue() {
|
||||||
|
try {
|
||||||
|
dataList.value = await api.get('transfer/queue')
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用SSE监听加载进度
|
||||||
|
function startLoadingProgress() {
|
||||||
|
progressText.value = '请稍候 ...'
|
||||||
|
progressEventSource.value = new EventSource(`${import.meta.env.VITE_API_BASE_URL}system/progress/filetransfer`)
|
||||||
|
progressEventSource.value.onmessage = event => {
|
||||||
|
const progress = JSON.parse(event.data)
|
||||||
|
if (progress) {
|
||||||
|
progressText.value = progress.text
|
||||||
|
progressValue.value = progress.value
|
||||||
|
if (progress.value === 100 && refreshFlag.value) {
|
||||||
|
refreshFlag.value = false
|
||||||
|
get_transfer_queue()
|
||||||
|
} else {
|
||||||
|
refreshFlag.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 停止监听加载进度
|
||||||
|
function stopLoadingProgress() {
|
||||||
|
progressEventSource.value?.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
get_transfer_queue()
|
||||||
|
startLoadingProgress()
|
||||||
|
})
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
stopLoadingProgress()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VDialog scrollable max-width="50rem" :fullscreen="!display.mdAndUp.value">
|
||||||
|
<VCard class="mx-auto" width="100%">
|
||||||
|
<VCardItem>
|
||||||
|
<VCardTitle>整理任务队列</VCardTitle>
|
||||||
|
</VCardItem>
|
||||||
|
<VDivider />
|
||||||
|
<DialogCloseBtn @click="emit('close')" />
|
||||||
|
|
||||||
|
<VCardText v-if="dataList.length === 0" class="text-center"> 没有正在整理的任务 </VCardText>
|
||||||
|
<VCardText v-else>
|
||||||
|
<VProgressLinear v-if="progressValue > 0" :value="progressValue" color="primary" rounded indeterminate>
|
||||||
|
{{ progressText }}
|
||||||
|
</VProgressLinear>
|
||||||
|
</VCardText>
|
||||||
|
</VCard>
|
||||||
|
</VDialog>
|
||||||
|
</template>
|
||||||
+1
-30
@@ -58,7 +58,7 @@ export const SystemNavMenus = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '整理刮削',
|
title: '整理刮削',
|
||||||
icon: 'mdi-history',
|
icon: 'mdi-filmstrip-box-multiple',
|
||||||
to: '/history',
|
to: '/history',
|
||||||
header: '整理',
|
header: '整理',
|
||||||
admin: true,
|
admin: true,
|
||||||
@@ -100,35 +100,6 @@ export const SystemNavMenus = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
// 常用菜单功能
|
|
||||||
export const UserfulMenus = [
|
|
||||||
{
|
|
||||||
title: '搜索设置',
|
|
||||||
icon: 'mdi-magnify',
|
|
||||||
to: 'setting?tab=search',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '订阅设置',
|
|
||||||
icon: 'mdi-rss',
|
|
||||||
to: 'setting?tab=subscribe',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '服务',
|
|
||||||
icon: 'mdi-list-box',
|
|
||||||
to: 'setting?tab=service',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '词表',
|
|
||||||
icon: 'mdi-file-word-box',
|
|
||||||
to: 'setting?tab=words',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '整理刮削',
|
|
||||||
icon: 'mdi-history',
|
|
||||||
to: 'history',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
// 设定标签页
|
// 设定标签页
|
||||||
export const SettingTabs = [
|
export const SettingTabs = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useToast } from 'vue-toast-notification'
|
|||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import type { TransferHistory } from '@/api/types'
|
import type { TransferHistory } from '@/api/types'
|
||||||
import ReorganizeDialog from '@/components/dialog/ReorganizeDialog.vue'
|
import ReorganizeDialog from '@/components/dialog/ReorganizeDialog.vue'
|
||||||
|
import TransferQueueDialog from '@/components/dialog/TransferQueueDialog.vue'
|
||||||
import ProgressDialog from '@/components/dialog/ProgressDialog.vue'
|
import ProgressDialog from '@/components/dialog/ProgressDialog.vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
@@ -24,6 +25,9 @@ const route = useRoute()
|
|||||||
// 重新整理对话框
|
// 重新整理对话框
|
||||||
const redoDialog = ref(false)
|
const redoDialog = ref(false)
|
||||||
|
|
||||||
|
// 整理队列对话框
|
||||||
|
const transferQueueDialog = ref(false)
|
||||||
|
|
||||||
// 当前操作记录
|
// 当前操作记录
|
||||||
const currentHistory = ref<TransferHistory>()
|
const currentHistory = ref<TransferHistory>()
|
||||||
|
|
||||||
@@ -380,7 +384,12 @@ onMounted(fetchData)
|
|||||||
/>
|
/>
|
||||||
</VCol>
|
</VCol>
|
||||||
<VCol cols="4" md="6" class="text-end">
|
<VCol cols="4" md="6" class="text-end">
|
||||||
<VBtn color="primary" prepend-icon="mdi-tray-full" append-icon="mdi-dots-horizontal">
|
<VBtn
|
||||||
|
color="primary"
|
||||||
|
prepend-icon="mdi-tray-full"
|
||||||
|
append-icon="mdi-dots-horizontal"
|
||||||
|
@click="transferQueueDialog = true"
|
||||||
|
>
|
||||||
<span v-if="display.mdAndUp.value" class="ms-2">整理队列</span>
|
<span v-if="display.mdAndUp.value" class="ms-2">整理队列</span>
|
||||||
</VBtn>
|
</VBtn>
|
||||||
</VCol>
|
</VCol>
|
||||||
@@ -541,6 +550,8 @@ onMounted(fetchData)
|
|||||||
@done="transferDone"
|
@done="transferDone"
|
||||||
@close="redoDialog = false"
|
@close="redoDialog = false"
|
||||||
/>
|
/>
|
||||||
|
<!-- 整理队列进度弹窗 -->
|
||||||
|
<TransferQueueDialog v-if="transferQueueDialog" v-model="transferQueueDialog" @close="transferQueueDialog = false" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user