zlisen 4 år sedan
förälder
incheckning
31f345b0b8

+ 8
- 6
config/routes.js Visa fil

@@ -127,6 +127,13 @@ export default [
127 127
                     menuCode: 'student.student',
128 128
                     component: './Student/Student/List',
129 129
                   },
130
+                  {
131
+                    path: '/student/student/edit',
132
+                    name: '学生管理',
133
+                    menuCode: 'student.student',
134
+                    hideInMenu: true,
135
+                    component: './Student/Student/Edit',
136
+                  },
130 137
                   {
131 138
                     path: '/student/school',
132 139
                     name: '学校管理',
@@ -209,12 +216,7 @@ export default [
209 216
                     menuCode: 'system.params',
210 217
                     component: '../layouts/BlankLayout',
211 218
                   },
212
-                  {
213
-                    path: '/system/school',
214
-                    name: '学校管理',
215
-                    menuCode: 'system.school',
216
-                    component: '../layouts/BlankLayout',
217
-                  },
219
+              
218 220
                   {
219 221
                     path: '/system/clinic',
220 222
                     name: '诊室管理',

+ 134
- 0
src/pages/Student/School/Edit/Specialty.jsx Visa fil

@@ -0,0 +1,134 @@
1
+import React, { useRef, useCallback, useState } from 'react';
2
+import { connect, history } from 'umi';
3
+import { PageContainer } from '@ant-design/pro-layout';
4
+import ProTable from '@ant-design/pro-table';
5
+import { PlusOutlined } from '@ant-design/icons';
6
+import { Button, Popconfirm, Modal, Space, notification } from 'antd';
7
+import request, { queryTable } from '@/utils/request';
8
+import SpecialtyModel from './components/SpecialtyModel';
9
+
10
+// const stateList = { post: '科普' };
11
+
12
+const Specialty = (props) => {
13
+  console.log(props, 'props');
14
+  const [, setLoading] = useState(false);
15
+  const [visible, setVisible] = useState(false);
16
+
17
+  const ref = useRef();
18
+
19
+  const actions = [
20
+    <Button key="button" icon={<PlusOutlined />} type="primary" onClick={() => setVisible(true)}>
21
+      新建
22
+    </Button>,
23
+  ];
24
+
25
+  const handleSubmit = (values) => {
26
+    return request('/specialty', {
27
+      method: 'post',
28
+      data: { schoolId: props.data.schoolId, name: values.name },
29
+    })
30
+      .then(() => {
31
+        notification.info({ message: '添加成功' });
32
+        setVisible(false);
33
+        // setLoading(false);
34
+      })
35
+      .catch((e) => {
36
+        notification.error({ message: e.message });
37
+        setLoading(false);
38
+        return Promise.reject(e.message);
39
+      });
40
+  };
41
+  //     setLoading(true);
42
+  //     return request(`/school/${id}`, { method: 'put', data: { schoolId: id, ...values } })
43
+  //       .then(() => {
44
+  //         notification.info({ message: '修改成功' });
45
+  //         setLoading(false);
46
+  //         history.go('-1');
47
+  //       })
48
+  //       .catch((e) => {
49
+  //         notification.error({ message: e.message });
50
+  //         setLoading(false);
51
+  //         return Promise.reject(e.message);
52
+  //       });
53
+  //   };
54
+
55
+  const deleteSchoolClick = (id) => {
56
+      console.log(ref)
57
+    ref.current.reload();
58
+    //   request(`/specialty/${id}`, { method: 'delete' })
59
+    //     .then(() => {
60
+    //       notification.success({ message: '删除成功' });
61
+    //       ref.current.submit();
62
+    //     })
63
+    //     .catch((e) => {
64
+
65
+    //       notification.error({ message: e.message });
66
+    //     });
67
+  };
68
+
69
+  const columns = [
70
+    {
71
+      title: '专业名称',
72
+      dataIndex: 'name',
73
+      align: 'center',
74
+      hideInSearch: true,
75
+      // render: (text) => <Image src={text} />,
76
+    },
77
+    {
78
+      title: '所属学校',
79
+      dataIndex: 'schoolNmae',
80
+      align: 'center',
81
+      hideInSearch: true,
82
+    },
83
+
84
+    {
85
+      title: '创建时间',
86
+      dataIndex: 'createDate',
87
+      align: 'center',
88
+      hideInSearch: true,
89
+      valueType: 'date',
90
+    },
91
+    {
92
+      title: '操作',
93
+      dataIndex: 'action',
94
+      align: 'center',
95
+      hideInSearch: true,
96
+      render: (text, record) => (
97
+        <Space size="middle">
98
+          {/* <a onClick={() => handleSchoolClick(record.schoolId)}>编辑</a> */}
99
+          <Popconfirm
100
+            key="popconfirm"
101
+            title={`确认删除吗?`}
102
+            onConfirm={() => deleteSchoolClick(record.specialtyId)}
103
+            okText="是"
104
+            cancelText="否"
105
+          >
106
+            <a>删除</a>
107
+          </Popconfirm>
108
+        </Space>
109
+      ),
110
+    },
111
+  ];
112
+
113
+  return (
114
+    <>
115
+      <ProTable
116
+        columns={columns}
117
+        request={(params)=>queryTable('/specialty')({...params,school:props.data.schoolId})}
118
+        actionRef={ref}
119
+        search={false}
120
+        rowKey="specialtyId"
121
+        // headerTitle="专业列表"
122
+
123
+        toolBarRender={() => actions}
124
+      />
125
+      <Modal title="添加专业" visible={visible} footer={null}>
126
+        <SpecialtyModel data={props.data} handleSubmit={(value) => handleSubmit(value)} />
127
+      </Modal>
128
+    </>
129
+  );
130
+};
131
+
132
+export default connect((s) => ({
133
+  typeList: s.post.typeList,
134
+}))(Specialty);

+ 52
- 0
src/pages/Student/School/Edit/components/SchoolFrom.jsx Visa fil

@@ -0,0 +1,52 @@
1
+import React, { useEffect } from 'react';
2
+import { connect } from 'umi';
3
+
4
+import ProForm, { ProFormText, ProFormTextArea } from '@ant-design/pro-form';
5
+import UploadImage from '@/components/UploadImage';
6
+import {  Form } from 'antd';
7
+
8
+const SchoolFrom = (props) => {
9
+
10
+  const [form] = Form.useForm();
11
+  //   const [bannerData, setBannerData] = useState({});
12
+
13
+  useEffect(() => {
14
+ 
15
+        form.setFieldsValue(props.data);
16
+     
17
+  }, [props.data]);
18
+
19
+
20
+  return (
21
+
22
+    
23
+        <ProForm form={form} onFinish={props.handleSubmit}>
24
+          <Form.Item
25
+            name="logo"
26
+            label="logo"
27
+            placeholder="请选择logo"
28
+            extra="支持jpg/png文件,且不超过500kb"
29
+            rules={[{ required: true, message: '请上传logo' }]}
30
+          >
31
+            <UploadImage />
32
+          </Form.Item>
33
+
34
+          <ProFormText
35
+            label="名称"
36
+            placeholder="输入名称"
37
+            name="name"
38
+            rules={[{ required: true, message: '请填写名称' }]}
39
+          />
40
+
41
+          <ProFormTextArea
42
+            label="简介"
43
+            placeholder="输入简介"
44
+            name="desc"
45
+            rules={[{ required: true, message: '请填写简介' }]}
46
+          />
47
+        </ProForm>
48
+
49
+  );
50
+};
51
+
52
+export default connect(() => ({}))(SchoolFrom);

+ 34
- 0
src/pages/Student/School/Edit/components/SpecialtyModel.jsx Visa fil

@@ -0,0 +1,34 @@
1
+import React, { useEffect } from 'react';
2
+import { connect } from 'umi';
3
+
4
+import ProForm, { ProFormText, ProFormTextArea } from '@ant-design/pro-form';
5
+
6
+import { Form } from 'antd';
7
+
8
+const SpecialtyModel = (props) => {
9
+  console.log(props, 'SpecialtyModel');
10
+
11
+  const [form] = Form.useForm();
12
+
13
+  return (
14
+    <ProForm form={form} onFinish={props.handleSubmit}>
15
+      <ProFormText
16
+        label="学校名称"
17
+        placeholder="输入学校名称"
18
+        initialValue={props.data.name}
19
+        name="SchoolName"
20
+        disabled
21
+        required
22
+      />
23
+
24
+      <ProFormText
25
+        label="专业名称"
26
+        placeholder="输入专业名称"
27
+        name="name"
28
+        rules={[{ required: true, message: '请填写专业名称' }]}
29
+      />
30
+    </ProForm>
31
+  );
32
+};
33
+
34
+export default SpecialtyModel;

+ 49
- 38
src/pages/Student/School/Edit/index.jsx Visa fil

@@ -3,15 +3,15 @@ import { connect, history } from 'umi';
3 3
 import { PageContainer } from '@ant-design/pro-layout';
4 4
 import Container from '@/components/Container';
5 5
 import request from '@/utils/request';
6
+import { notification, Tabs } from 'antd';
7
+import SchoolFrom from './components/SchoolFrom';
8
+import Specialty from './Specialty';
6 9
 
7
-import ProForm, { ProFormText, ProFormTextArea } from '@ant-design/pro-form';
8
-import UploadImage from '@/components/UploadImage';
9
-import { notification, Form } from 'antd';
10
-
10
+const { TabPane } = Tabs;
11 11
 const SchoolEdit = (props) => {
12 12
   const { id } = props.location.query;
13 13
   const [loading, setLoading] = useState(false);
14
-  const [form] = Form.useForm();
14
+  const [data, setData] = useState({});
15 15
   //   const [bannerData, setBannerData] = useState({});
16 16
 
17 17
   useEffect(() => {
@@ -19,9 +19,7 @@ const SchoolEdit = (props) => {
19 19
       setLoading(true);
20 20
       request(`/school/${id}`)
21 21
         .then((res) => {
22
-          form.setFieldsValue(res);
23
-          //   setBannerData(res);
24
-          //   set
22
+          setData(res);
25 23
           setLoading(false);
26 24
         })
27 25
         .catch((e) => {
@@ -29,10 +27,9 @@ const SchoolEdit = (props) => {
29 27
           notification.error({ message: e.message });
30 28
         });
31 29
     }
32
-  }, [form, id]);
30
+  }, [id]);
33 31
 
34 32
   const handleSubmit = (values) => {
35
-    console.log(values, form.getFieldsValue(), 'handleSubmit');
36 33
     if (!id) {
37 34
       setLoading(true);
38 35
       return request('/school', { method: 'post', data: values })
@@ -52,8 +49,6 @@ const SchoolEdit = (props) => {
52 49
     setLoading(true);
53 50
     return request(`/school/${id}`, { method: 'put', data: { schoolId: id, ...values } })
54 51
       .then(() => {
55
-        // props.onChange(res)
56
-        // form.setFieldsValue(res)
57 52
         notification.info({ message: '修改成功' });
58 53
         setLoading(false);
59 54
         history.go('-1');
@@ -67,34 +62,50 @@ const SchoolEdit = (props) => {
67 62
 
68 63
   return (
69 64
     <PageContainer>
70
-      <Container loading={loading}>
71
-        <ProForm form={form} onFinish={handleSubmit}>
72
-          <Form.Item
73
-            name="logo"
74
-            label="logo"
75
-            placeholder="请选择logo"
76
-            extra="支持jpg/png文件,且不超过500kb"
77
-            rules={[{ required: true, message: '请上传logo' }]}
78
-          >
79
-            <UploadImage />
80
-          </Form.Item>
81
-
82
-          <ProFormText
83
-            label="名称"
84
-            placeholder="输入名称"
85
-            name="name"
86
-            rules={[{ required: true, message: '请填写名称' }]}
87
-          />
88
-
89
-          <ProFormTextArea
90
-            label="简介"
91
-            placeholder="输入简介"
92
-            name="desc"
93
-            rules={[{ required: true, message: '请填写简介' }]}
94
-          />
95
-        </ProForm>
65
+      <Container>
66
+        <Tabs>
67
+          <TabPane tab="学校" key="1">
68
+            <Container loading={loading}>
69
+              <SchoolFrom data={data} handleSubmit={handleSubmit}></SchoolFrom>
70
+            </Container>
71
+          </TabPane>
72
+          {id && (
73
+            <TabPane tab="专业" key="2">
74
+              <Specialty data={data}></Specialty>
75
+            </TabPane>
76
+          )}
77
+        </Tabs>
96 78
       </Container>
97 79
     </PageContainer>
80
+    // <PageContainer>
81
+    //   <Container loading={loading}>
82
+    //     <ProForm form={form} onFinish={handleSubmit}>
83
+    //       <Form.Item
84
+    //         name="logo"
85
+    //         label="logo"
86
+    //         placeholder="请选择logo"
87
+    //         extra="支持jpg/png文件,且不超过500kb"
88
+    //         rules={[{ required: true, message: '请上传logo' }]}
89
+    //       >
90
+    //         <UploadImage />
91
+    //       </Form.Item>
92
+
93
+    //       <ProFormText
94
+    //         label="名称"
95
+    //         placeholder="输入名称"
96
+    //         name="name"
97
+    //         rules={[{ required: true, message: '请填写名称' }]}
98
+    //       />
99
+
100
+    //       <ProFormTextArea
101
+    //         label="简介"
102
+    //         placeholder="输入简介"
103
+    //         name="desc"
104
+    //         rules={[{ required: true, message: '请填写简介' }]}
105
+    //       />
106
+    //     </ProForm>
107
+    //   </Container>
108
+    // </PageContainer>
98 109
   );
99 110
 };
100 111
 

+ 29
- 49
src/pages/Student/Student/List/index.jsx Visa fil

@@ -6,13 +6,10 @@ import { PlusOutlined } from '@ant-design/icons';
6 6
 import { Button, Popconfirm, Image, Space, notification } from 'antd';
7 7
 import request, { queryTable } from '@/utils/request';
8 8
 
9
-const typeList = { post: '科普' };
10
-// const stateList = { post: '科普' };
11
-
12
-const BannerList = () => {
9
+const StudentList = () => {
13 10
   const [, setLoading] = useState(false);
14
-  const handleBannerClick = useCallback((id) => {
15
-    history.push(id ? `/cms/banner/edit?id=${id}` : '/cms/banner/edit');
11
+  const handleStudentClick = useCallback((id) => {
12
+    history.push(id ? `/student/student/edit?id=${id}` : '/student/student/edit');
16 13
   }, []);
17 14
 
18 15
   const actions = [
@@ -21,56 +18,48 @@ const BannerList = () => {
21 18
     </Button>,
22 19
   ];
23 20
 
24
-  const deleteBannerClick = (id) => {
25
-    setLoading(true);
26
-
27
-    request(`/banner/${id}`, { method: 'delete' })
28
-      .then(() => {
29
-        notification.success({ message: '删除成功' });
30
-        // ref.current.submit();
31
-      })
32
-      .catch((e) => {
33
-        setLoading(false);
34
-        notification.error({ message: e.message });
35
-      });
36
-  };
37 21
 
38 22
   const columns = [
39 23
     {
40
-      title: '排序',
41
-      dataIndex: 'sort',
42
-      width: 60,
24
+      title: '编号',
25
+      dataIndex: 'person_id',
26
+      align: 'center',
43 27
       hideInSearch: true,
28
+    },
29
+    {
30
+      title: '姓名',
31
+      dataIndex: 'name',
44 32
       align: 'center',
45 33
     },
46 34
     {
47
-      title: '主图',
48
-      dataIndex: 'image',
35
+      title: '昵称',
36
+      dataIndex: 'nickName',
37
+      align: 'center',
49 38
       hideInSearch: true,
39
+    },
40
+    {
41
+      title: '联系方式',
42
+      dataIndex: 'phone',
50 43
 
51 44
       align: 'center',
52
-      render: (text) => <Image width={64} height={64} src={text} />,
53 45
     },
54 46
     {
55
-      title: '名称',
56
-      dataIndex: 'title',
47
+      title: '学校',
48
+      dataIndex: 'schoolName',
49
+
57 50
       align: 'center',
58
-      className: 'drag-visible',
59 51
     },
60 52
     {
61
-      title: '板块',
62
-      dataIndex: 'targetType',
63
-      hideInSearch: true,
53
+      title: '专业',
54
+      dataIndex: 'specialtyName',
55
+
64 56
       align: 'center',
65
-      render: (text) => typeList[text] || '',
66 57
     },
67 58
 
68 59
     {
69
-      title: '状态',
60
+      title: '学号',
70 61
       dataIndex: 'status',
71 62
       align: 'center',
72
-      hideInSearch: true,
73
-      // render: (text) => <Image src={text} />,
74 63
     },
75 64
     {
76 65
       title: '操作',
@@ -79,16 +68,7 @@ const BannerList = () => {
79 68
       hideInSearch: true,
80 69
       render: (text, record) => (
81 70
         <Space size="middle">
82
-          <a onClick={() => handleBannerClick(record.serialNo)}>编辑</a>
83
-          <Popconfirm
84
-            key="popconfirm"
85
-            title={`确认删除吗?`}
86
-            onConfirm={() => deleteBannerClick(record.serialNo)}
87
-            okText="是"
88
-            cancelText="否"
89
-          >
90
-            <a>删除</a>
91
-          </Popconfirm>
71
+          <a onClick={() => handleStudentClick(record.serialNo)}>用户详情 </a>
92 72
         </Space>
93 73
       ),
94 74
     },
@@ -98,13 +78,13 @@ const BannerList = () => {
98 78
     <PageContainer>
99 79
       <ProTable
100 80
         columns={columns}
101
-        request={queryTable('/school')}
81
+        request={queryTable('/person')}
102 82
         rowKey="schoolId"
103 83
         headerTitle="学校列表"
104 84
         search={{
105 85
           labelWidth: '4em',
106
-        }}
107
-        toolBarRender={() => actions}
86
+        }} 
87
+       
108 88
       />
109 89
     </PageContainer>
110 90
   );
@@ -112,4 +92,4 @@ const BannerList = () => {
112 92
 
113 93
 export default connect((s) => ({
114 94
   typeList: s.post.typeList,
115
-}))(BannerList);
95
+}))(StudentList);