功能(任务与复习): 增加材料地址与复习总览表格
This commit is contained in:
@@ -1,11 +1,61 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import request from "@/utils/request";
|
||||
|
||||
interface ReviewTask {
|
||||
taskNum: string;
|
||||
taskName: string;
|
||||
reportCount: number | string;
|
||||
fragmentCount: number | string;
|
||||
effectiveTime: number | string;
|
||||
}
|
||||
|
||||
const loading = ref(false);
|
||||
const tasks = ref<ReviewTask[]>([]);
|
||||
|
||||
const loadTasks = async () => {
|
||||
loading.value = true;
|
||||
try {
|
||||
const res = await request.get("/tasks", { pageSize: 100, pageNum: 1 });
|
||||
tasks.value = (res?.data?.records || []).map((item: any) => ({
|
||||
taskNum: item.taskNum,
|
||||
taskName: item.taskName,
|
||||
reportCount: item.reportCount ?? "-",
|
||||
fragmentCount: item.fragmentCount ?? "-",
|
||||
effectiveTime: item.effectiveTime ?? "-",
|
||||
}));
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadTasks();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
复习页面
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="header">
|
||||
<span>复习任务总览</span>
|
||||
<el-button type="primary" plain @click="loadTasks">刷新</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="tasks" stripe>
|
||||
<el-table-column prop="taskName" label="任务名" min-width="180" />
|
||||
<el-table-column prop="effectiveTime" label="累计有效学习时长" min-width="140" />
|
||||
<el-table-column prop="reportCount" label="学习报告数" min-width="120" />
|
||||
<el-table-column prop="fragmentCount" label="学习残片数" min-width="120" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -13,6 +13,7 @@ const buttonName = route.meta.buttonText;
|
||||
|
||||
const taskName = ref('');
|
||||
const taskDescription = ref('');
|
||||
const materialURL = ref('');
|
||||
const priority = ref({
|
||||
urgency: 0,
|
||||
importance: 0,
|
||||
@@ -33,6 +34,7 @@ const createTask = () => {
|
||||
request.post("/tasks", {
|
||||
taskName: taskName.value,
|
||||
taskDescription: taskDescription.value,
|
||||
materialURL: materialURL.value,
|
||||
...priority.value
|
||||
}).then(result => {
|
||||
if (result.code == 200) {
|
||||
@@ -52,6 +54,7 @@ const loadTask = () => {
|
||||
const data = result.data;
|
||||
taskName.value = data.taskName;
|
||||
taskDescription.value = data.taskDescription;
|
||||
materialURL.value = data.materialURL || data.materialUrl || "";
|
||||
priority.value = {
|
||||
urgency: data.urgency,
|
||||
importance: data.importance,
|
||||
@@ -77,6 +80,7 @@ const updateTask = () => {
|
||||
id: taskId,
|
||||
taskName: taskName.value,
|
||||
taskDescription: taskDescription.value,
|
||||
materialURL: materialURL.value,
|
||||
...priority.value
|
||||
}).then(result => {
|
||||
if (result.code == 200) {
|
||||
@@ -142,6 +146,10 @@ const columnSpan = computed(() => {
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="材料地址:">
|
||||
<el-input v-model="materialURL" placeholder="请输入学习材料URL"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="优先级:">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="columnSpan">
|
||||
|
||||
Reference in New Issue
Block a user