feat(流程图列表): 补上状态列,重判按钮按状态置灰
教师端的流程图提交列表一直没有状态列。「排队中」「评分中」「评分失败」三种情况 在界面上长得一模一样 —— 都只是分数栏空着,老师分不出是还没评完还是评失败了。 三处一起改: - 加状态列(排队中 / 评分中 / 已完成 / 评分失败)。 - 分数列只在已完成时渲染 Grade。原来无论什么状态都渲染,没评完会显示成 0 分, 看着像「评了但得了 0 分」。 - 重判按钮按状态置灰。后端只接受已完成 / 已失败的重判(其余返回 409), 原来是点了才知道不行。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { NButton } from "naive-ui"
|
import { NButton, NTag, NText } from "naive-ui"
|
||||||
import { useRouteQuery } from "@vueuse/router"
|
import { useRouteQuery } from "@vueuse/router"
|
||||||
import {
|
import {
|
||||||
adminRejudge,
|
adminRejudge,
|
||||||
@@ -22,6 +22,19 @@ import { usePagination } from "shared/composables/pagination"
|
|||||||
import { useUserStore } from "shared/store/user"
|
import { useUserStore } from "shared/store/user"
|
||||||
import { LANGUAGE_SHOW_VALUE } from "utils/constants"
|
import { LANGUAGE_SHOW_VALUE } from "utils/constants"
|
||||||
import { renderTableTitle } from "utils/renders"
|
import { renderTableTitle } from "utils/renders"
|
||||||
|
import { FlowchartSubmissionStatus } from "utils/types"
|
||||||
|
|
||||||
|
// 流程图提交的四种状态,列表里原来一列都没有 ——
|
||||||
|
// 老师分不出「还在评」和「评失败了」,两种都只是分数栏空着
|
||||||
|
const FLOWCHART_STATUS_TAG: Record<
|
||||||
|
number,
|
||||||
|
{ text: string; type: "default" | "info" | "success" | "error" }
|
||||||
|
> = {
|
||||||
|
[FlowchartSubmissionStatus.PENDING]: { text: "排队中", type: "default" },
|
||||||
|
[FlowchartSubmissionStatus.PROCESSING]: { text: "评分中", type: "info" },
|
||||||
|
[FlowchartSubmissionStatus.COMPLETED]: { text: "已完成", type: "success" },
|
||||||
|
[FlowchartSubmissionStatus.FAILED]: { text: "评分失败", type: "error" },
|
||||||
|
}
|
||||||
import ButtonWithSearch from "./components/ButtonWithSearch.vue"
|
import ButtonWithSearch from "./components/ButtonWithSearch.vue"
|
||||||
import SubmissionLink from "./components/SubmissionLink.vue"
|
import SubmissionLink from "./components/SubmissionLink.vue"
|
||||||
import Grade from "./components/Grade.vue"
|
import Grade from "./components/Grade.vue"
|
||||||
@@ -398,17 +411,33 @@ const flowchartColumns = computed(() => {
|
|||||||
() => `${row.problem} ${row.problemTitle}`,
|
() => `${row.problem} ${row.problemTitle}`,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: renderTableTitle("状态", "fluent-emoji:hourglass-not-done"),
|
||||||
|
key: "status",
|
||||||
|
render: (row) => {
|
||||||
|
const tag = FLOWCHART_STATUS_TAG[row.status]
|
||||||
|
return h(
|
||||||
|
NTag,
|
||||||
|
{ size: "small", round: true, type: tag?.type ?? "default" },
|
||||||
|
() => tag?.text ?? "未知",
|
||||||
|
)
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: renderTableTitle(
|
title: renderTableTitle(
|
||||||
"评分",
|
"评分",
|
||||||
"streamline-ultimate-color:analytics-bars-3d",
|
"streamline-ultimate-color:analytics-bars-3d",
|
||||||
),
|
),
|
||||||
key: "ai_score",
|
key: "ai_score",
|
||||||
|
// 只有评完的才有分数。没评完也渲染 Grade 的话会显示成 0 分,
|
||||||
|
// 看着像「评了但得了 0 分」
|
||||||
render: (row) =>
|
render: (row) =>
|
||||||
h(Grade, {
|
row.status === FlowchartSubmissionStatus.COMPLETED
|
||||||
|
? h(Grade, {
|
||||||
score: row.aiScore ?? 0,
|
score: row.aiScore ?? 0,
|
||||||
grade: (row.aiGrade ?? "") as GradeValue,
|
grade: (row.aiGrade ?? "") as GradeValue,
|
||||||
}),
|
})
|
||||||
|
: h(NText, { depth: 3 }, () => "—"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: renderTableTitle(
|
title: renderTableTitle(
|
||||||
@@ -435,6 +464,8 @@ const flowchartColumns = computed(() => {
|
|||||||
res.push({
|
res.push({
|
||||||
title: renderTableTitle("选项", "streamline-emojis:wrench"),
|
title: renderTableTitle("选项", "streamline-emojis:wrench"),
|
||||||
key: "retry",
|
key: "retry",
|
||||||
|
// 后端只接受已完成 / 已失败的重判(其余返回 409),这里同步置灰,
|
||||||
|
// 免得老师点了才发现不行
|
||||||
render: (row) =>
|
render: (row) =>
|
||||||
h(
|
h(
|
||||||
NButton,
|
NButton,
|
||||||
@@ -442,6 +473,9 @@ const flowchartColumns = computed(() => {
|
|||||||
quaternary: true,
|
quaternary: true,
|
||||||
size: "small",
|
size: "small",
|
||||||
type: "primary",
|
type: "primary",
|
||||||
|
disabled:
|
||||||
|
row.status !== FlowchartSubmissionStatus.COMPLETED &&
|
||||||
|
row.status !== FlowchartSubmissionStatus.FAILED,
|
||||||
onClick: () => retryFlowchart(row.id),
|
onClick: () => retryFlowchart(row.id),
|
||||||
},
|
},
|
||||||
() => "重新判题",
|
() => "重新判题",
|
||||||
|
|||||||
Reference in New Issue
Block a user