mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
feat:在转移历史视图中添加分组功能
This commit is contained in:
@@ -16,7 +16,7 @@ html.v-overlay-scroll-blocked {
|
|||||||
#nprogress .peg {
|
#nprogress .peg {
|
||||||
width: 5px;
|
width: 5px;
|
||||||
box-shadow: 0 0 10px rgb(var(--v-theme-primary)), 0 0 5px rgb(var(--v-theme-primary)) !important;
|
box-shadow: 0 0 10px rgb(var(--v-theme-primary)), 0 0 5px rgb(var(--v-theme-primary)) !important;
|
||||||
transform: rotate(0deg) translate(0, -2px);
|
transform: rotate(0deg) translate(0, 0px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.v-toast--bottom {
|
.v-toast--bottom {
|
||||||
|
|||||||
@@ -48,7 +48,41 @@ const headers = [
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '目录',
|
title: '路径',
|
||||||
|
key: 'src',
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '转移方式',
|
||||||
|
key: 'mode',
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '时间',
|
||||||
|
key: 'date',
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
key: 'status',
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
key: 'actions',
|
||||||
|
sortable: false,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
// 分组表头
|
||||||
|
const groupHeaders = [
|
||||||
|
{
|
||||||
|
title: '季集/类别',
|
||||||
|
key: 'title',
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '路径',
|
||||||
key: 'src',
|
key: 'src',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
@@ -98,6 +132,16 @@ const loading = ref(false)
|
|||||||
// 总条数
|
// 总条数
|
||||||
const totalItems = ref(0)
|
const totalItems = ref(0)
|
||||||
|
|
||||||
|
// 是否要分组
|
||||||
|
const group = ref(false)
|
||||||
|
|
||||||
|
// 分组条件
|
||||||
|
const groupBy = ref<any>([
|
||||||
|
{
|
||||||
|
key: 'title',
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
// 每页条数
|
// 每页条数
|
||||||
const itemsPerPage = ref<number>(ensureNumber(route.query.itemsPerPage, 50))
|
const itemsPerPage = ref<number>(ensureNumber(route.query.itemsPerPage, 50))
|
||||||
|
|
||||||
@@ -407,7 +451,107 @@ onMounted(fetchData)
|
|||||||
</VRow>
|
</VRow>
|
||||||
</VCardTitle>
|
</VCardTitle>
|
||||||
</VCardItem>
|
</VCardItem>
|
||||||
|
<!-- 分组模式 -->
|
||||||
<VDataTableVirtual
|
<VDataTableVirtual
|
||||||
|
v-if="group"
|
||||||
|
v-model="selected"
|
||||||
|
:groupBy="groupBy"
|
||||||
|
:headers="groupHeaders"
|
||||||
|
:items="dataList"
|
||||||
|
:loading="loading"
|
||||||
|
density="compact"
|
||||||
|
return-object
|
||||||
|
fixed-header
|
||||||
|
show-select
|
||||||
|
loading-text="加载中..."
|
||||||
|
hover
|
||||||
|
:style="tableStyle"
|
||||||
|
>
|
||||||
|
<template #header.data-table-group>
|
||||||
|
<span>标题</span>
|
||||||
|
</template>
|
||||||
|
<template v-slot:group-header="{ item, columns, toggleGroup, isGroupOpen }">
|
||||||
|
<tr>
|
||||||
|
<td :colspan="columns.length">
|
||||||
|
<VBtn
|
||||||
|
:icon="isGroupOpen(item) ? '$expand' : '$next'"
|
||||||
|
size="small"
|
||||||
|
variant="text"
|
||||||
|
@click="toggleGroup(item)"
|
||||||
|
/>
|
||||||
|
{{ item.value }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</template>
|
||||||
|
<template #item.title="{ item }">
|
||||||
|
<div class="d-flex align-center">
|
||||||
|
<VAvatar>
|
||||||
|
<VIcon :icon="getIcon(item.type || '')" />
|
||||||
|
</VAvatar>
|
||||||
|
<div class="d-flex flex-column ms-1">
|
||||||
|
<span v-if="item.type === '电视剧'" class="d-block text-high-emphasis min-w-20">
|
||||||
|
{{ item?.seasons }}{{ item?.episodes }}
|
||||||
|
</span>
|
||||||
|
<small>{{ item?.category }}</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #item.src="{ item }">
|
||||||
|
<div>
|
||||||
|
<span>
|
||||||
|
<VChip variant="tonal" size="small" label class="my-1"> {{ storageDict[item?.src_storage || ''] }}</VChip>
|
||||||
|
<small>{{ item?.src }}</small>
|
||||||
|
</span>
|
||||||
|
<span class="text-high-emphasis text-bold"> => </span>
|
||||||
|
<br />
|
||||||
|
<span v-if="item?.dest">
|
||||||
|
<VChip variant="tonal" size="small" label class="my-1"> {{ storageDict[item?.dest_storage || ''] }}</VChip>
|
||||||
|
<small>{{ item?.dest }}</small>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #item.mode="{ item }">
|
||||||
|
<VChip variant="outlined" color="primary" size="small">
|
||||||
|
{{ TransferDict[item?.mode ?? ''] || '未知' }}
|
||||||
|
</VChip>
|
||||||
|
</template>
|
||||||
|
<template #item.status="{ item }">
|
||||||
|
<VChip v-if="item?.status" color="success" size="small"> 成功 </VChip>
|
||||||
|
<VTooltip v-else :text="item?.errmsg">
|
||||||
|
<template #activator="{ props }">
|
||||||
|
<VChip v-bind="props" color="error" size="small"> 失败 </VChip>
|
||||||
|
</template>
|
||||||
|
</VTooltip>
|
||||||
|
</template>
|
||||||
|
<template #item.date="{ item }">
|
||||||
|
<small>{{ item?.date }}</small>
|
||||||
|
</template>
|
||||||
|
<template #item.actions="{ item }">
|
||||||
|
<IconBtn>
|
||||||
|
<VIcon icon="mdi-dots-vertical" />
|
||||||
|
<VMenu activator="parent" close-on-content-click>
|
||||||
|
<VList>
|
||||||
|
<VListItem
|
||||||
|
v-for="(menu, i) in dropdownItems"
|
||||||
|
:key="i"
|
||||||
|
variant="plain"
|
||||||
|
:base-color="menu.props.color"
|
||||||
|
@click="menu.props.click(item)"
|
||||||
|
>
|
||||||
|
<template #prepend>
|
||||||
|
<VIcon :icon="menu.props.prependIcon" />
|
||||||
|
</template>
|
||||||
|
<VListItemTitle v-text="menu.title" />
|
||||||
|
</VListItem>
|
||||||
|
</VList>
|
||||||
|
</VMenu>
|
||||||
|
</IconBtn>
|
||||||
|
</template>
|
||||||
|
<template #no-data> 没有数据 </template>
|
||||||
|
</VDataTableVirtual>
|
||||||
|
<!-- 列表模式 -->
|
||||||
|
<VDataTableVirtual
|
||||||
|
v-else
|
||||||
v-model="selected"
|
v-model="selected"
|
||||||
:headers="headers"
|
:headers="headers"
|
||||||
:items="dataList"
|
:items="dataList"
|
||||||
@@ -489,7 +633,7 @@ onMounted(fetchData)
|
|||||||
</template>
|
</template>
|
||||||
<template #no-data> 没有数据 </template>
|
<template #no-data> 没有数据 </template>
|
||||||
</VDataTableVirtual>
|
</VDataTableVirtual>
|
||||||
<div class="flex items-center justify-end">
|
<div class="flex items-center justify-center">
|
||||||
<div class="w-auto">
|
<div class="w-auto">
|
||||||
<VSelect v-model="itemsPerPage" :items="pageRange" density="compact" variant="solo" flat />
|
<VSelect v-model="itemsPerPage" :items="pageRange" density="compact" variant="solo" flat />
|
||||||
</div>
|
</div>
|
||||||
@@ -506,9 +650,8 @@ onMounted(fetchData)
|
|||||||
</VCard>
|
</VCard>
|
||||||
|
|
||||||
<!-- 底部操作按钮 -->
|
<!-- 底部操作按钮 -->
|
||||||
<div v-if="isRefreshed">
|
<div v-if="isRefreshed && selected.length > 0">
|
||||||
<VFab
|
<VFab
|
||||||
v-if="selected.length > 0"
|
|
||||||
icon="mdi-trash-can-outline"
|
icon="mdi-trash-can-outline"
|
||||||
color="error"
|
color="error"
|
||||||
location="bottom"
|
location="bottom"
|
||||||
@@ -520,7 +663,6 @@ onMounted(fetchData)
|
|||||||
:class="{ 'mb-12': appMode }"
|
:class="{ 'mb-12': appMode }"
|
||||||
/>
|
/>
|
||||||
<VFab
|
<VFab
|
||||||
v-if="selected.length > 0"
|
|
||||||
:class="appMode ? 'mb-28' : 'mb-16'"
|
:class="appMode ? 'mb-28' : 'mb-16'"
|
||||||
icon="mdi-redo-variant"
|
icon="mdi-redo-variant"
|
||||||
location="bottom"
|
location="bottom"
|
||||||
@@ -531,6 +673,19 @@ onMounted(fetchData)
|
|||||||
@click="retransferBatch"
|
@click="retransferBatch"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="isRefreshed">
|
||||||
|
<VFab
|
||||||
|
:icon="group ? 'mdi-format-list-bulleted' : 'mdi-format-list-group'"
|
||||||
|
color="primary"
|
||||||
|
location="bottom"
|
||||||
|
size="x-large"
|
||||||
|
fixed
|
||||||
|
app
|
||||||
|
appear
|
||||||
|
@click="group = !group"
|
||||||
|
:class="{ 'mb-12': appMode }"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<!-- 底部弹窗 -->
|
<!-- 底部弹窗 -->
|
||||||
<VBottomSheet v-model="deleteConfirmDialog" inset>
|
<VBottomSheet v-model="deleteConfirmDialog" inset>
|
||||||
<VCard class="text-center rounded-t">
|
<VCard class="text-center rounded-t">
|
||||||
|
|||||||
Reference in New Issue
Block a user