fix history

This commit is contained in:
jxxghp
2023-06-28 12:34:21 +08:00
parent 7401ef7941
commit 824b27020c
5 changed files with 141 additions and 56 deletions

View File

@@ -1,53 +1,10 @@
<script setup lang="ts">
import DemoSimpleTableBasics from '@/views/pages/tables/DemoSimpleTableBasics.vue'
import DemoSimpleTableDensity from '@/views/pages/tables/DemoSimpleTableDensity.vue'
import DemoSimpleTableFixedHeader from '@/views/pages/tables/DemoSimpleTableFixedHeader.vue'
import DemoSimpleTableHeight from '@/views/pages/tables/DemoSimpleTableHeight.vue'
import DemoSimpleTableTheme from '@/views/pages/tables/DemoSimpleTableTheme.vue'
import TransferHistoryView from '@/views/reorganize/TransferHistoryView.vue';
</script>
<template>
<VRow>
<VCol cols="12">
<VCard title="Basic">
<DemoSimpleTableBasics />
</VCard>
</VCol>
<VCol cols="12">
<VCard title="Theme">
<VCardText>
use <code>theme</code> prop to switch table to the dark theme.
</VCardText>
<DemoSimpleTableTheme />
</VCard>
</VCol>
<VCol cols="12">
<VCard title="Density">
<VCardText>
You can show a dense version of the table by using the <code>density</code> prop.
</VCardText>
<DemoSimpleTableDensity />
</VCard>
</VCol>
<VCol cols="12">
<VCard title="Height">
<VCardText>
You can set the height of the table by using the <code>height</code> prop.
</VCardText>
<DemoSimpleTableHeight />
</VCard>
</VCol>
<VCol cols="12">
<VCard title="Fixed Header">
<VCardText>
You can fix the header of table by using the <code>fixed-header</code> prop.
</VCardText>
<DemoSimpleTableFixedHeader />
</VCard>
</VCol>
</VRow>
<div>
<TransferHistoryView />
</div>
</template>

View File

@@ -42,7 +42,7 @@ const fetchBackgroundImage = async () => {
const login = () => {
errorMessage.value = ''
// 进行表单校验
if (refForm.value && !refForm.value.validate()) {
if (!form.value.username || !form.value.password) {
return
}
@@ -135,7 +135,7 @@ onMounted(() => {
</VCardText>
<VCardText>
<VForm @submit.prevent="login" ref="refForm">
<VForm @submit.prevent="()=>{}" ref="refForm">
<VRow>
<!-- username -->
<VCol cols="12">
@@ -180,6 +180,7 @@ onMounted(() => {
<VBtn
block
type="submit"
@click="login"
>
登录
</VBtn>

View File

@@ -0,0 +1,127 @@
<script setup lang="ts">
import api from "@/api";
import { onMounted, ref } from "vue";
interface TransferHistory {
// ID
id: number;
// 源目录
src?: string;
// 目的目录
dest?: string;
// 转移模式link/copy/move/softlink
mode?: string;
// 类型:电影、电视剧
type?: string;
// 二级分类
category?: string;
// 标题
title?: string;
// 年份
year?: string;
// TMDBID
tmdbid?: number;
// IMDBID
imdbid?: string;
// TVDBID
tvdbid?: number;
// 豆瓣ID
doubanid?: string;
// 季Sxx
seasons?: string;
// 集Exx
episodes?: string;
// 海报
image?: string;
// 下载器Hash
download_hash?: string;
// 状态 1-成功0-失败
status: boolean;
// 失败原因
errmsg?: string;
// 日期
date?: string;
}
// 表头
const headers = [
{ title: "标题", key: "title" },
{ title: "目录", key: "src"},
{ title: "转移方式", key: "mode"},
{ title: "状态", key: "status"},
{ title: "失败原因", key: "errmsg"},
];
// 数据列表
const dataList = ref<TransferHistory[]>([]);
// 获取订阅列表数据
const fetchData = async () => {
try {
dataList.value = await api.get("/history/transfer");
} catch (error) {
console.error(error);
}
};
// 根据 type 返回不同的图标
const getIcon = (type: string) => {
if (type === "电影") {
return "mdi-movie";
} else if (type === "电视剧") {
return "mdi-television-classic";
} else {
return "mdi-help-circle";
}
};
// 计算颜色
const getStatusColor = (status: boolean) => {
return status ? 'success' : 'error';
};
// 加载时获取数据
onMounted(fetchData);
const search = ref("");
</script>
<template>
<VCard title="历史记录">
<VDataTable
:headers="headers"
:items="dataList"
show-select
>
<template #item.title="{ item }">
<div class="d-flex">
<VAvatar><VIcon :icon="getIcon(item.raw.type || '')"></VIcon></VAvatar>
<div class="d-flex flex-column ms-1 text-high-emphasis">
<span class="d-block">
{{ item.raw.title }} {{ item.raw.seasons }}{{ item.raw.episodes }}
</span>
<small>{{ item.raw.category }}</small>
</div>
</div>
</template>
<template #item.src="{ item }">
<small>{{ item.raw.src }} <br>=> {{ item.raw.dest }}</small>
</template>
<template #item.mode="{ item }">
<VChip variant="outlined" color="primary" size="small">{{ item.raw.mode }}</VChip>
</template>
<template #item.status="{ item }">
<VChip :color="getStatusColor(item.raw.status)" size="small">
{{ item.raw.status ? '成功' : '失败' }}
</VChip>
</template>
<template #item.errmsg="{ item }">
{{ item.raw.errmsg }}
</template>
<template #no-data>
没有数据
</template>
</VDataTable>
</VCard>
</template>