From 8b66b2a5c60aec7c13a9f07b8512269d6cd8ec9f Mon Sep 17 00:00:00 2001
From: linfeng <2819853134@qq.com>
Date: Tue, 25 Mar 2025 09:40:03 +0800
Subject: [PATCH] lin
---
.../assessment-standardpage.tsx | 180 +++++++++++++++++-
1 file changed, 179 insertions(+), 1 deletion(-)
diff --git a/apps/web/src/app/admin/assessmentstandard/assessment-standardpage.tsx b/apps/web/src/app/admin/assessmentstandard/assessment-standardpage.tsx
index e01ef41..42af287 100644
--- a/apps/web/src/app/admin/assessmentstandard/assessment-standardpage.tsx
+++ b/apps/web/src/app/admin/assessmentstandard/assessment-standardpage.tsx
@@ -1,3 +1,181 @@
+import { Table, Select, Form, Button, Space, InputNumber, Modal } from 'antd';
+import { useState } from 'react';
+
+// 模拟接口调用函数
+const addAgeRangeApi = async (start: number, end: number | null) => {
+ // 这里替换为实际的接口调用
+ console.log(`调用接口添加年龄范围: start=${start}, end=${end}`);
+};
+
+const addScoreStandardApi = async (score: number, standards: (number | null)[]) => {
+ // 这里替换为实际的接口调用
+ console.log(`调用接口添加分数标准: score=${score}, standards=${standards}`);
+};
+
export default function AssessmentStandardPage() {
- return
AssessmentStandardPage
;
+ const [form] = Form.useForm();
+ const [ageRanges, setAgeRanges] = useState<{ start: number; end: number; label: string; }[]>([
+ { start: 18, end: 24, label: '18-24岁' },
+ { start: 25, end: 34, label: '25-34岁' },
+ { start: 35, end: 44, label: '35-44岁' },
+ { start: 45, end: null, label: '45岁以上' },
+ ]);
+ const [isAgeModalVisible, setIsAgeModalVisible] = useState(false);
+ const [isScoreModalVisible, setIsScoreModalVisible] = useState(false);
+
+ const columns = [
+ {
+ title: '分数',
+ dataIndex: 'score',
+ key: 'score',
+ width: 100,
+ },
+ ...ageRanges.map((range, index) => ({
+ title: range.label,
+ dataIndex: `standard_${index}`,
+ key: `standard_${index}`,
+ render: (_: any, record: any) => (
+ handleStandardChange(record.score, index, value)}
+ />
+ ),
+ })),
+ ];
+
+ const handleStandardChange = (score: number, ageIndex: number, value: number | null) => {
+ // 处理标准值变化
+ };
+
+ const showAgeModal = () => {
+ setIsAgeModalVisible(true);
+ };
+
+ const handleAgeOk = async (values: any) => {
+ const { start, end } = values;
+ await addAgeRangeApi(start, end);
+ const newRange = {
+ start,
+ end,
+ label: end ? `${start}-${end}岁` : `${start}岁以上`,
+ };
+ setAgeRanges([...ageRanges, newRange]);
+ setIsAgeModalVisible(false);
+ };
+
+ const handleAgeCancel = () => {
+ setIsAgeModalVisible(false);
+ };
+
+ const showScoreModal = () => {
+ setIsScoreModalVisible(true);
+ };
+
+ const handleScoreOk = async (values: any) => {
+ const { score, standards } = values;
+ await addScoreStandardApi(score, standards);
+ // 这里可以更新表格的数据源
+ setIsScoreModalVisible(false);
+ };
+
+ const handleScoreCancel = () => {
+ setIsScoreModalVisible(false);
+ };
+
+ return (
+
+
考核标准管理
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {ageRanges.map((range, index) => (
+
+
+
+ ))}
+
+
+
+ );
}