From 787648827c356e3806caf91d655fc4c788b36c90 Mon Sep 17 00:00:00 2001 From: Vectorune Date: Wed, 12 Nov 2025 09:49:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=95=E6=9D=A1=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E9=87=8F=E6=95=B0=E6=8D=AE=E6=8A=BD=E5=B1=89=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataManager/AddDataManageDrawer.jsx | 158 ++++++++++++++++++ .../Dashboard/DataManager/DataManageTable.jsx | 19 ++- .../DataManager/ManageTableColumn.js | 4 +- 3 files changed, 176 insertions(+), 5 deletions(-) create mode 100644 src/page/Dashboard/DataManager/AddDataManageDrawer.jsx diff --git a/src/page/Dashboard/DataManager/AddDataManageDrawer.jsx b/src/page/Dashboard/DataManager/AddDataManageDrawer.jsx new file mode 100644 index 0000000..cca90ef --- /dev/null +++ b/src/page/Dashboard/DataManager/AddDataManageDrawer.jsx @@ -0,0 +1,158 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Button, Drawer, Flex, Form, Input, Select, Typography } from "antd"; +import CourseTypeTag from "../../../component/Workload/CourseTypeTag"; + +const AddDataManageDrawer = props => { + const { open, setOpen, commonAxios, fetchWorkload, messageApi } = props; + + // 表单布局配置 + const formLayout = { + labelCol: { span: 5 }, + wrapperCol: { span: 20 }, + }; + + const [form] = Form.useForm(); + const { Title } = Typography; + + // 课程性质选项 + const courseNatureOptions = [ + { label: '公共课', value: '01' }, + { label: '专业课', value: '02' }, + { label: '校选课', value: '03' }, + ]; + + // 当抽屉关闭时重置表单 + React.useEffect(() => { + if (!open) { + form.resetFields(); + } + }, [open, form]); + + // 提交添加表单 + const onSubmit = (values) => { + commonAxios.post('/api/v1/workload/addWorkload', values).then(response => { + const result = response.data.data || false; + if (result) { + messageApi.success('添加工作量信息成功'); + setOpen(false); + fetchWorkload(); // 刷新列表 + } else { + messageApi.error('添加工作量信息失败'); + } + }).catch(error => { + messageApi.error('网络错误,添加失败'); + }); + }; + + return ( + setOpen(false)} + title={'添加工作量'} + destroyOnClose + > +
+ 添加工作量信息 +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ ); +}; + +AddDataManageDrawer.propTypes = { + open: PropTypes.bool.isRequired, + setOpen: PropTypes.func.isRequired, + commonAxios: PropTypes.func.isRequired, + fetchWorkload: PropTypes.func.isRequired, + messageApi: PropTypes.object.isRequired +}; + +export default AddDataManageDrawer; \ No newline at end of file diff --git a/src/page/Dashboard/DataManager/DataManageTable.jsx b/src/page/Dashboard/DataManager/DataManageTable.jsx index e04efbc..9fd7048 100644 --- a/src/page/Dashboard/DataManager/DataManageTable.jsx +++ b/src/page/Dashboard/DataManager/DataManageTable.jsx @@ -4,6 +4,7 @@ import ManageTableColumn from "./ManageTableColumn"; import ImportDataDrawer from "./ImportDataDrawer"; import EditDataManageDrawer from './EditDataManageDrawer'; import creatMessageCommonAxios from "../../../http/CreatMessageCommonAxios"; +import AddDataManageDrawer from './AddDataManageDrawer'; // 导入新增的组件 const DataManageTable = props => { @@ -17,6 +18,9 @@ const DataManageTable = props => { // 新增编辑抽屉相关状态 const [editDrawerOpen, setEditDrawerOpen] = useState(false); const [currentEditData, setCurrentEditData] = useState({}); + // 添加添加数据抽屉的状态 + const [addDrawerOpen, setAddDrawerOpen] = useState(false); + const rowSelection = { type: 'checkbox', onChange: (selectedRowKeys, selectedRows) => { @@ -59,19 +63,28 @@ const DataManageTable = props => { fetchWorkloadData={fetWorkload} /> {/* 编辑抽屉 */} - {/**/} - + /> + {/* 添加数据抽屉 */} +

数据管理

共{workloadData.total}条数据 + {/* 添加"添加数据"按钮 */} +
diff --git a/src/page/Dashboard/DataManager/ManageTableColumn.js b/src/page/Dashboard/DataManager/ManageTableColumn.js index 483e965..cb08712 100644 --- a/src/page/Dashboard/DataManager/ManageTableColumn.js +++ b/src/page/Dashboard/DataManager/ManageTableColumn.js @@ -78,13 +78,13 @@ const ManageTableColumn = (commonAxios, messageApi, fetchWorkload, handleEdit) = return ( - {/**/} +