This commit is contained in:
jxxghp
2023-07-12 13:00:22 +08:00
parent f96156057d
commit 7e22486d44
3 changed files with 106 additions and 37 deletions
+28 -9
View File
@@ -116,6 +116,26 @@ const getVolumeFactorColor = (downloadVolume: number, uploadVolume: number) => {
onMounted(() => { onMounted(() => {
getSiteIcon(); getSiteIcon();
}); });
// 弹出菜单
const dropdownItems = ref([
{
title: "查看详情",
value: 1,
props: {
prependIcon: "mdi-information",
click: openTorrentDetail,
},
},
{
title: "下载种子",
value: 2,
props: {
prependIcon: "mdi-download",
click: downloadTorrentFile,
},
},
]);
</script> </script>
<template> <template>
<VCard :width="props.width" :height="props.height" @click="handleAddDownload"> <VCard :width="props.width" :height="props.height" @click="handleAddDownload">
@@ -136,17 +156,16 @@ onMounted(() => {
<VIcon icon="mdi-dots-vertical" color="white" /> <VIcon icon="mdi-dots-vertical" color="white" />
<VMenu activator="parent" close-on-content-click> <VMenu activator="parent" close-on-content-click>
<VList> <VList>
<VListItem variant="plain" @click="openTorrentDetail"> <VListItem
v-for="(item, i) in dropdownItems"
variant="plain"
:key="i"
@click="item.props.click"
>
<template #prepend> <template #prepend>
<VIcon icon="mdi-information"></VIcon> <VIcon :icon="item.props.prependIcon"></VIcon>
</template> </template>
<VListItemTitle>查看详情</VListItemTitle> <VListItemTitle v-text="item.title"></VListItemTitle>
</VListItem>
<VListItem variant="plain" @click="downloadTorrentFile">
<template #prepend>
<VIcon icon="mdi-download"></VIcon>
</template>
<VListItemTitle>下载种子</VListItemTitle>
</VListItem> </VListItem>
</VList> </VList>
</VMenu> </VMenu>
@@ -14,18 +14,20 @@ const allSites = ref<Site[]>([]);
// 种子优先规则下拉框 // 种子优先规则下拉框
const TorrentPriorityItems = [ const TorrentPriorityItems = [
{ title: "站点优先", value: 'site' }, { title: "站点优先", value: "site" },
{ title: "做种数优先", value: 'seeder' }, { title: "做种数优先", value: "seeder" },
]; ];
// 种子优先规则 // 种子优先规则
const selectedTorrentPriority = ref<string>('seeder'); const selectedTorrentPriority = ref<string>("seeder");
// 查询所有站点 // 查询所有站点
const querySites = async () => { const querySites = async () => {
try { try {
const data: Site[] = await api.get("site"); const data: Site[] = await api.get("site");
allSites.value = data; // 过滤站点,只有启用的站点才显示
allSites.value = data.filter((item) => item.is_active);
querySelectedSites();
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
@@ -44,7 +46,9 @@ const querySelectedSites = async () => {
// 查询种子优先规则 // 查询种子优先规则
const queryTorrentPriority = async () => { const queryTorrentPriority = async () => {
try { try {
const result: { [key: string]: any } = await api.get("system/setting/TorrentsPriority"); const result: { [key: string]: any } = await api.get(
"system/setting/TorrentsPriority"
);
selectedTorrentPriority.value = result.data?.value; selectedTorrentPriority.value = result.data?.value;
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@@ -89,7 +93,6 @@ const saveTorrentPriority = async () => {
onMounted(() => { onMounted(() => {
querySites(); querySites();
querySelectedSites();
queryTorrentPriority(); queryTorrentPriority();
}); });
</script> </script>
@@ -102,7 +105,13 @@ onMounted(() => {
<VCardItem> <VCardItem>
<VChipGroup v-model="selectedSites" column multiple> <VChipGroup v-model="selectedSites" column multiple>
<VChip filter variant="outlined" v-for="site in allSites" :key="site.id" :value="site.id"> <VChip
filter
variant="outlined"
v-for="site in allSites"
:key="site.id"
:value="site.id"
>
{{ site.name }} {{ site.name }}
</VChip> </VChip>
</VChipGroup> </VChipGroup>
@@ -116,7 +125,12 @@ onMounted(() => {
<VCol cols="12"> <VCol cols="12">
<VCard title="优先规则"> <VCard title="优先规则">
<VCardText> <VCardText>
<VSelect v-model="selectedTorrentPriority" :items="TorrentPriorityItems" label="下载优先规则" outlined></VSelect> <VSelect
v-model="selectedTorrentPriority"
:items="TorrentPriorityItems"
label="下载优先规则"
outlined
></VSelect>
</VCardText> </VCardText>
<VCardItem> <VCardItem>
<VBtn type="submit" @click="saveTorrentPriority"> 保存 </VBtn> <VBtn type="submit" @click="saveTorrentPriority"> 保存 </VBtn>
+56 -20
View File
@@ -45,25 +45,6 @@ const getStatusColor = (status: boolean) => {
return status ? "success" : "error"; return status ? "success" : "error";
}; };
// 弹出菜单
const dropdownItems = ref([
{
title: "重新整理",
value: 1,
props: {
prependIcon: "mdi-redo-variant",
},
},
{
title: "删除",
value: 2,
props: {
prependIcon: "mdi-trash-can-outline",
color: "error",
},
},
]);
// 转移方式字典 // 转移方式字典
const TransferDict: { [key: string]: string } = { const TransferDict: { [key: string]: string } = {
copy: "复制", copy: "复制",
@@ -72,8 +53,45 @@ const TransferDict: { [key: string]: string } = {
softlink: "软链接", softlink: "软链接",
}; };
// 删除历史记录
const removeHistory = async () => {
try {
} catch (error) {
console.error(error);
}
};
// 重新整理
const rehandleHistory = async () => {
try {
} catch (e) {
console.log(e);
}
};
// 加载时获取数据 // 加载时获取数据
onMounted(fetchData); onMounted(fetchData);
// 弹出菜单
const dropdownItems = ref([
{
title: "重新整理",
value: 1,
props: {
prependIcon: "mdi-redo-variant",
click: rehandleHistory,
},
},
{
title: "删除",
value: 2,
props: {
prependIcon: "mdi-trash-can-outline",
color: "error",
click: removeHistory,
},
},
]);
</script> </script>
<template> <template>
@@ -121,7 +139,25 @@ onMounted(fetchData);
{{ item.raw.errmsg }} {{ item.raw.errmsg }}
</template> </template>
<template #item.actions="{ item }"> <template #item.actions="{ item }">
<MoreBtn :item-props="true" :menu-list="dropdownItems" /> <IconBtn>
<VIcon icon="mdi-dots-vertical" />
<VMenu activator="parent" close-on-content-click>
<VList>
<VListItem
v-for="(item, i) in dropdownItems"
variant="plain"
:base-color="item.props.color"
:key="i"
@click="item.props.click"
>
<template #prepend>
<VIcon :icon="item.props.prependIcon"></VIcon>
</template>
<VListItemTitle v-text="item.title"></VListItemTitle>
</VListItem>
</VList>
</VMenu>
</IconBtn>
</template> </template>
<template #no-data> 没有数据 </template> <template #no-data> 没有数据 </template>
</VDataTable> </VDataTable>