feat(task): task detail

This commit is contained in:
2026-02-09 18:20:33 +08:00
parent f0298b91e3
commit 3f284d057c
19 changed files with 435 additions and 279 deletions

View File

@@ -2,7 +2,16 @@
import { projectConfig } from "@/components/label/api/project"
import { ProjectDetail } from "@/components/label/api/project/typing"
import { Button, Checkbox, Group, NumberInput, Paper, SimpleGrid, Stack, Text } from "@mantine/core"
import {
Button,
Checkbox,
Group,
NumberInput,
Paper,
SimpleGrid,
Stack,
Text,
} from "@mantine/core"
import { useForm } from "@mantine/form"
import { notifications } from "@mantine/notifications"
import { useEffect } from "react"
@@ -54,9 +63,18 @@ export default function SamplingPlanContainer(props: {
check_task: form.values.check_task,
check_frame: form.values.check_frame,
user_grade: {
A: { task: toRatio(form.values.A_task), frame: toRatio(form.values.A_frame) },
B: { task: toRatio(form.values.B_task), frame: toRatio(form.values.B_frame) },
C: { task: toRatio(form.values.C_task), frame: toRatio(form.values.C_frame) },
A: {
task: toRatio(form.values.A_task),
frame: toRatio(form.values.A_frame),
},
B: {
task: toRatio(form.values.B_task),
frame: toRatio(form.values.B_frame),
},
C: {
task: toRatio(form.values.C_task),
frame: toRatio(form.values.C_frame),
},
},
})
notifications.show({
@@ -75,7 +93,11 @@ export default function SamplingPlanContainer(props: {
}
return (
<Paper withBorder p="sm" radius="md" style={{ borderColor: "rgba(0,0,0,0.06)" }}>
<Paper
withBorder
p="sm"
radius="md"
style={{ borderColor: "rgba(0,0,0,0.06)" }}>
<Stack gap="sm">
<Group justify="space-between" wrap="wrap">
<Text fw={700}></Text>
@@ -88,12 +110,16 @@ export default function SamplingPlanContainer(props: {
<Checkbox
label="抽检任务"
checked={form.values.check_task}
onChange={(e) => form.setFieldValue("check_task", e.currentTarget.checked)}
onChange={(e) =>
form.setFieldValue("check_task", e.currentTarget.checked)
}
/>
<Checkbox
label="抽检帧"
checked={form.values.check_frame}
onChange={(e) => form.setFieldValue("check_frame", e.currentTarget.checked)}
onChange={(e) =>
form.setFieldValue("check_frame", e.currentTarget.checked)
}
/>
</Group>
@@ -113,7 +139,9 @@ export default function SamplingPlanContainer(props: {
max={100}
decimalScale={2}
value={form.values[`${g}_task` as const]}
onChange={(v) => form.setFieldValue(`${g}_task` as any, Number(v ?? 0))}
onChange={(v) =>
form.setFieldValue(`${g}_task` as any, Number(v ?? 0))
}
hideControls
/>
<NumberInput
@@ -122,7 +150,9 @@ export default function SamplingPlanContainer(props: {
max={100}
decimalScale={2}
value={form.values[`${g}_frame` as const]}
onChange={(v) => form.setFieldValue(`${g}_frame` as any, Number(v ?? 0))}
onChange={(v) =>
form.setFieldValue(`${g}_frame` as any, Number(v ?? 0))
}
hideControls
/>
</Stack>
@@ -133,4 +163,3 @@ export default function SamplingPlanContainer(props: {
</Paper>
)
}