张延森 3 年前
父节点
当前提交
bd7e113bd6

+ 6
- 6
config/routes.js 查看文件

@@ -175,12 +175,12 @@ export default [
175 175
                     hideInMenu: true,
176 176
                     component: './Medical/Test/Batch',
177 177
                   },
178
-                  {
179
-                    path: '/medical/hospital',
180
-                    name: '诊室管理',
181
-                    menuCode: 'medical.hospital',
182
-                    component: './Medical/Hospital',
183
-                  },
178
+                  // {
179
+                  //   path: '/medical/hospital',
180
+                  //   name: '诊室管理',
181
+                  //   menuCode: 'medical.hospital',
182
+                  //   component: './Medical/Hospital',
183
+                  // },
184 184
                 ],
185 185
               },
186 186
               {

+ 5
- 3
src/components/Specialty/index.jsx 查看文件

@@ -3,6 +3,8 @@ import { Select, Spin } from 'antd';
3 3
 import request from '@/utils/request';
4 4
 
5 5
 export default (props) => {
6
+  const { schoolId } = props
7
+
6 8
   const [loading, setLoading] = useState(false);
7 9
   const [list, setList] = useState([]);
8 10
   const [value, setValue] = useState();
@@ -29,10 +31,10 @@ export default (props) => {
29 31
   }, [props.value, value]);
30 32
 
31 33
   useEffect(() => {
32
-    if (props.schoolid) {
34
+    if (schoolId) {
33 35
       setLoading(true);
34 36
 
35
-      request('/specialty', { params: { schoolId: props.schoolid, pageSize: 100 } })
37
+      request('/specialty', { params: { school: schoolId, pageSize: 100 } })
36 38
         .then((res) => {
37 39
           const records = res.records || [];
38 40
           setList(records);
@@ -47,7 +49,7 @@ export default (props) => {
47 49
     }
48 50
 
49 51
     // eslint-disable-next-line
50
-  }, [props.schoolid]);
52
+  }, [schoolId]);
51 53
 
52 54
   return (
53 55
     <Spin spinning={loading}>

+ 0
- 2
src/pages/Medical/Hospital/index.jsx 查看文件

@@ -51,8 +51,6 @@ export default () => {
51 51
       .catch((e) => {
52 52
         notification.error({ message: e.message });
53 53
       });
54
-
55
-
56 54
   };
57 55
 
58 56
   const renderFormItem = (item, config, form) => {

+ 15
- 28
src/pages/Medical/Test/List/index.jsx 查看文件

@@ -10,9 +10,7 @@ import Specialty from '@/components/Specialty';
10 10
 
11 11
 const VisitList = () => {
12 12
 
13
-  const [school, setSchool] = useState({});
14
-  const [abc, setA] = useState();
15
-  
13
+  const [school, setSchool] = useState({});  
16 14
   const ref = useRef();
17 15
 
18 16
   const handleMedicalClick = useCallback((id) => {
@@ -32,18 +30,6 @@ const VisitList = () => {
32 30
     </Button>,
33 31
   ];
34 32
 
35
-  
36
-  const renderFormItem = (item, config, form) => {
37
-    const handleSchoolChange = (schoolId, schoolInfo) => {
38
-      form.setFieldsValue({ schoolId });
39
-      form.submit();
40
-      console.log(schoolInfo, 'schoolInfo');
41
-      setSchool({ ...schoolInfo });
42
-    };
43
-
44
-    return <School onChange={handleSchoolChange} allowClear />;
45
-  };
46
-
47 33
   const columns = [
48 34
     {
49 35
       title: '编号',
@@ -60,13 +46,24 @@ const VisitList = () => {
60 46
       renderFormItem: (item, config, form) => (
61 47
         <School
62 48
           autoDefault={false}
63
-          onChange={(schoolId) => {form.resetFields(['specialtyId']);form.setFieldsValue({ schoolId });}}
49
+          value={school?.schoolId}
50
+          onChange={(schoolId, v) => {
51
+            setSchool(v)
52
+            form.setFieldsValue({ schoolId, specialtyId: null })
53
+          }}
64 54
           allowClear
65 55
         ></School>
66 56
       ),
67 57
     },
68
-   
69
-
58
+    {
59
+      title: '专业',
60
+      dataIndex: 'specialtyId',
61
+      align: 'center',
62
+      render: (_, row) => row.specialtyName||'-',
63
+      renderFormItem: (item, config, form) => {
64
+        return <Specialty schoolId={school?.schoolId} disabled={!school?.schoolId}></Specialty>;
65
+      },
66
+    },
70 67
     {
71 68
       title: '学号',
72 69
       dataIndex: 'studentNo',
@@ -90,16 +87,6 @@ const VisitList = () => {
90 87
         2: { text: '女' },
91 88
       },
92 89
     },
93
-    {
94
-      title: '专业',
95
-      dataIndex: 'specialtyId',
96
-      align: 'center',
97
-      render: (_, row) => row.specialtyName||'-',
98
-      renderFormItem: (item, config, form) => {
99
-        const schoolId = form.getFieldValue('schoolId');
100
-        return <Specialty schoolid={schoolId} disabled={!schoolId}></Specialty>;
101
-      },
102
-    },
103 90
     {
104 91
       title: '创建时间',
105 92
       dataIndex: 'createDate',

+ 1
- 1
src/pages/Medical/Visit/Edit/index.jsx 查看文件

@@ -115,7 +115,7 @@ const VisitEdit = (props) => {
115 115
             <Form.Item label="专业" required>
116 116
               <Specialty
117 117
                 value={specialtyId}
118
-                schoolid={schoolId || school}
118
+                schoolId={schoolId || school}
119 119
                 onChange={(x) => setSpecialtyId(x)}
120 120
                 style={{ minWidth: '150px' }}
121 121
                 placeholder="请选择专业"

+ 15
- 14
src/pages/Medical/Visit/List/index.jsx 查看文件

@@ -82,12 +82,26 @@ const VisitList = () => {
82 82
       renderFormItem: (item, config, form) => (
83 83
         <School
84 84
           autoDefault={false}
85
-          onChange={(schoolId) => {form.resetFields(['specialtyId']);form.setFieldsValue({ schoolId });}}
85
+          value={school?.schoolId}
86
+          onChange={(schoolId, v) => {
87
+            setSchool(v)
88
+            form.setFieldsValue({ schoolId, specialtyId: null })
89
+          }}
86 90
           allowClear
87 91
         ></School>
88 92
       ),
89 93
     },
90 94
 
95
+    {
96
+      title: '专业',
97
+      dataIndex: 'specialtyId',
98
+      align: 'center',
99
+      render: (_, row) => row.specialtyName||'-',
100
+      renderFormItem: (item, config, form) => {    
101
+        return <Specialty schoolId={school?.schoolId} disabled={!school?.schoolId}></Specialty>;
102
+      },
103
+    },
104
+
91 105
     {
92 106
       title: '学号',
93 107
       dataIndex: 'studentNo',
@@ -110,19 +124,6 @@ const VisitList = () => {
110 124
         2: { text: '女' },
111 125
       },
112 126
     },
113
-
114
-    {
115
-      title: '专业',
116
-      dataIndex: 'specialtyId',
117
-      align: 'center',
118
-      render: (_, row) => row.specialtyName||'-',
119
-      renderFormItem: (item, config, form) => {
120
-     
121
-        const schoolId = form.getFieldValue('schoolId');
122
-    
123
-        return <Specialty schoolid={schoolId} disabled={!schoolId}></Specialty>;
124
-      },
125
-    },
126 127
     {
127 128
       title: '医生',
128 129
       dataIndex: 'doctorName',

+ 10
- 4
src/pages/Student/Student/List/index.jsx 查看文件

@@ -1,4 +1,4 @@
1
-import React, { useCallback } from 'react';
1
+import React, { useCallback, useState } from 'react';
2 2
 import { history } from 'umi';
3 3
 import { Space } from 'antd';
4 4
 import { PageContainer } from '@ant-design/pro-layout';
@@ -8,6 +8,9 @@ import { queryTable } from '@/utils/request';
8 8
 import Specialty from '@/components/Specialty';
9 9
 
10 10
 const StudentList = () => {
11
+
12
+  const [school, setSchool] = useState({});
13
+
11 14
   const handleStudentClick = useCallback((id) => {
12 15
     if (id) {
13 16
       history.push(`/student/student/edit?id=${id}`);
@@ -41,7 +44,11 @@ const StudentList = () => {
41 44
       renderFormItem: (item, config, form) => (
42 45
         <School
43 46
           autoDefault={false}
44
-          onChange={(schoolId) => {form.resetFields(['specialtyId']);form.setFieldsValue({ schoolId });}}
47
+          value={school?.schoolId}
48
+          onChange={(schoolId, v) => {
49
+            setSchool(v)
50
+            form.setFieldsValue({ schoolId, specialtyId: null })
51
+          }}
45 52
           allowClear
46 53
         ></School>
47 54
       ),
@@ -52,8 +59,7 @@ const StudentList = () => {
52 59
       align: 'center',
53 60
       render: (_, row) => row.specialtyName||'-',
54 61
       renderFormItem: (item, config, form) => {
55
-        const schoolId = form.getFieldValue('schoolId');
56
-        return <Specialty schoolid={schoolId} disabled={!schoolId}></Specialty>;
62
+        return <Specialty schoolId={school?.schoolId} disabled={!school?.schoolId}></Specialty>;
57 63
       },
58 64
     },
59 65
     {