|
@@ -6,24 +6,28 @@ import Container from '@/components/Container';
|
6
|
6
|
import { Input, Form, Button, notification } from 'antd';
|
7
|
7
|
import ProForm, { ProFormText, ProFormTextArea, ProFormSelect } from '@ant-design/pro-form';
|
8
|
8
|
import request from '@/utils/request';
|
|
9
|
+import School from '@/components/School';
|
9
|
10
|
|
10
|
11
|
const { Search } = Input;
|
11
|
12
|
const VisitEdit = (props) => {
|
12
|
13
|
const { id, schoolId } = props.location.query;
|
13
|
14
|
|
14
|
15
|
const [searchLoading, setSearchLoading] = useState(false);
|
15
|
|
-
|
|
16
|
+ const [school, setSchool] = useState();
|
16
|
17
|
const [form] = Form.useForm();
|
17
|
18
|
|
|
19
|
+ // eslint-disable-next-line no-shadow
|
18
|
20
|
const getData = (id) => {
|
19
|
21
|
if (id) {
|
20
|
|
- request(`/student-no/${id}`)
|
|
22
|
+ request(`/student-no/${id}`,{params:{schoolId:school}})
|
21
|
23
|
.then((res) => {
|
22
|
24
|
form.setFieldsValue(res);
|
23
|
25
|
setSearchLoading(false);
|
24
|
26
|
})
|
25
|
27
|
.catch((e) => {
|
26
|
28
|
setSearchLoading(false);
|
|
29
|
+ notification.error({ message: '未找到该学生' })
|
|
30
|
+ form.resetFields()
|
27
|
31
|
});
|
28
|
32
|
} else {
|
29
|
33
|
// this.setState({ data: [] });
|
|
@@ -66,6 +70,20 @@ const VisitEdit = (props) => {
|
66
|
70
|
notification.error({ message: e.message });
|
67
|
71
|
});
|
68
|
72
|
};
|
|
73
|
+
|
|
74
|
+ const handleSchoolChange = (value) => {
|
|
75
|
+ setSchool(value)
|
|
76
|
+ console.log(value)
|
|
77
|
+ // request('/medicalLog', { method: 'post', data: { schoolId, ...value } })
|
|
78
|
+ // .then(() => {
|
|
79
|
+ // notification.success({ message: '新建成功' });
|
|
80
|
+ // history.go('-1');
|
|
81
|
+ // })
|
|
82
|
+ // .catch((e) => {
|
|
83
|
+ // notification.error({ message: e.message });
|
|
84
|
+ // });
|
|
85
|
+ };
|
|
86
|
+
|
69
|
87
|
return (
|
70
|
88
|
<PageContainer
|
71
|
89
|
header={{
|
|
@@ -79,12 +97,15 @@ const VisitEdit = (props) => {
|
79
|
97
|
<Container>
|
80
|
98
|
<ProForm form={form} submitter={!id} onFinish={handleSubmit}>
|
81
|
99
|
{!id && (
|
82
|
|
- <Search
|
83
|
|
- placeholder="请输入学号"
|
84
|
|
- loading={searchLoading}
|
85
|
|
- style={{ width: 200, marginBottom: '20px' }}
|
86
|
|
- onSearch={onSearch}
|
87
|
|
- />
|
|
100
|
+ <ProForm.Group layout="inline">
|
|
101
|
+ <School value={school} onChange={handleSchoolChange} style={{ width: 200, marginBottom: '20px' }} allowClear />
|
|
102
|
+ <Search
|
|
103
|
+ placeholder="请输入学号"
|
|
104
|
+ loading={searchLoading}
|
|
105
|
+ style={{ width: 200, marginBottom: '20px' }}
|
|
106
|
+ onSearch={onSearch}
|
|
107
|
+ />
|
|
108
|
+ </ProForm.Group>
|
88
|
109
|
)}
|
89
|
110
|
<ProForm.Group layout="inline" title="就诊信息">
|
90
|
111
|
<ProFormText
|