zlisen 4 år sedan
förälder
incheckning
f6bf289c6b

+ 76
- 0
src/components/Specialty/index.jsx Visa fil

@@ -0,0 +1,76 @@
1
+import React, { useEffect, useState } from 'react';
2
+import { Select, Spin } from 'antd';
3
+import request from '@/utils/request';
4
+
5
+export default (props) => {
6
+  const [loading, setLoading] = useState(false);
7
+  const [list, setList] = useState([]);
8
+  const [value, setValue] = useState();
9
+
10
+  const filterFunc = (input, option) => {
11
+    return option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
12
+  };
13
+
14
+  const handleChange = (val) => {
15
+    setValue(val);
16
+    const specialty = list.filter((s) => s.schoolId === val)[0];
17
+
18
+    props.onChange(val, specialty);
19
+  };
20
+
21
+  useEffect(() => {
22
+    if (props.value !== value) {
23
+      console.log('---------');
24
+      if (!value) {
25
+        setValue();
26
+      } else {
27
+        setValue(props.value);
28
+      }
29
+    }
30
+  }, [props.value, value]);
31
+
32
+  useEffect(() => {
33
+    if (props.schoolid) {
34
+      setLoading(true);
35
+
36
+      request('/specialty', { params: { schoolId: props.schoolid, pageSize: 100 } })
37
+        .then((res) => {
38
+          const records = res.records || [];
39
+          setList(records);
40
+          setLoading(false);
41
+          setValue();
42
+          // if (props.autoDefault !== false && records.length > 0) {
43
+          //   setValue(records[0].specialty);
44
+          //   props.onChange(records[0].specialtyId, records[0]);
45
+          // }
46
+        })
47
+        .catch((e) => {
48
+          // eslint-disable-next-line
49
+          console.error(e.message);
50
+          setLoading(false);
51
+        });
52
+    }
53
+
54
+    // eslint-disable-next-line
55
+  }, [props.schoolid]);
56
+
57
+  return (
58
+    <Spin spinning={loading}>
59
+      <Select
60
+        showSearch
61
+        optionFilterProp="children"
62
+        filterOption={filterFunc}
63
+        {...props}
64
+        value={value}
65
+        onChange={handleChange}
66
+        allowClear
67
+      >
68
+        {list.map((s) => (
69
+          <Select.Option key={s.specialtyId} value={s.specialtyId}>
70
+            {s.name}
71
+          </Select.Option>
72
+        ))}
73
+      </Select>
74
+    </Spin>
75
+  );
76
+};

+ 27
- 1
src/pages/Cms/Banner/List/index.jsx Visa fil

@@ -45,6 +45,25 @@ const BannerList = () => {
45 45
       });
46 46
   };
47 47
 
48
+  const changeStatus = (row) => {
49
+    setLoading(true);
50
+
51
+    request(`/banner/${row.serialNo}`, {
52
+      method: 'put',
53
+      data: { ...row, status: row.status === 1 ? 0 : 1 },
54
+    })
55
+      .then(() => {
56
+        notification.info({ message: '修改成功' });
57
+        setLoading(false);
58
+        ref.current.submit();
59
+      })
60
+      .catch((e) => {
61
+        notification.error({ message: e.message });
62
+        setLoading(false);
63
+        return Promise.reject(e.message);
64
+      });
65
+  };
66
+
48 67
   const columns = [
49 68
     {
50 69
       title: '排序',
@@ -82,7 +101,11 @@ const BannerList = () => {
82 101
       dataIndex: 'status',
83 102
       align: 'center',
84 103
       hideInSearch: true,
85
-      // render: (text) => <Image src={text} />,
104
+
105
+      valueEnum: {
106
+        0: { text: '未启用', status: 'Default' },
107
+        1: { text: '启用', status: 'Success' },
108
+      },
86 109
     },
87 110
     {
88 111
       title: '操作',
@@ -91,6 +114,9 @@ const BannerList = () => {
91 114
       hideInSearch: true,
92 115
       render: (text, record) => (
93 116
         <Space size="middle">
117
+          <a key="status" onClick={() => changeStatus(record)}>
118
+            {record.status === 1 ? '弃用' : '启用'}
119
+          </a>
94 120
           <a onClick={() => handleBannerClick(record.serialNo)}>编辑</a>
95 121
           <Popconfirm
96 122
             key="popconfirm"

+ 27
- 2
src/pages/Cms/Hot/List/index.jsx Visa fil

@@ -45,6 +45,25 @@ const HotList = () => {
45 45
       });
46 46
   };
47 47
 
48
+  const changeStatus = (row) => {
49
+    setLoading(true);
50
+
51
+    request(`/topic/${row.serialNo}`, {
52
+      method: 'put',
53
+      data: { ...row, status: row.status === 1 ? 0 : 1 },
54
+    })
55
+      .then(() => {
56
+        notification.info({ message: '修改成功' });
57
+        setLoading(false);
58
+        ref.current.submit();
59
+      })
60
+      .catch((e) => {
61
+        notification.error({ message: e.message });
62
+        setLoading(false);
63
+        return Promise.reject(e.message);
64
+      });
65
+  };
66
+
48 67
   const columns = [
49 68
     {
50 69
       title: '排序',
@@ -65,7 +84,7 @@ const HotList = () => {
65 84
     },
66 85
     {
67 86
       title: '文章标题',
68
-      dataIndex: 'title',
87
+      dataIndex: 'targetTitle',
69 88
       align: 'center',
70 89
       className: 'drag-visible',
71 90
     },
@@ -82,7 +101,10 @@ const HotList = () => {
82 101
       dataIndex: 'status',
83 102
       align: 'center',
84 103
       hideInSearch: true,
85
-      // render: (text) => <Image src={text} />,
104
+      valueEnum: {
105
+        0: { text: '未启用', status: 'Default' },
106
+        1: { text: '启用', status: 'Success' },
107
+      },
86 108
     },
87 109
     {
88 110
       title: '操作',
@@ -91,6 +113,9 @@ const HotList = () => {
91 113
       hideInSearch: true,
92 114
       render: (text, record) => (
93 115
         <Space size="middle">
116
+           <a key="status" onClick={() => changeStatus(record)}>
117
+            {record.status === 1 ? '弃用' : '启用'}
118
+          </a>
94 119
           <a onClick={() => handleHotClick(record.serialNo)}>编辑</a>
95 120
           <Popconfirm
96 121
             key="popconfirm"

+ 1
- 1
src/pages/Medical/Hospital/index.jsx Visa fil

@@ -156,7 +156,7 @@ export default () => {
156 156
         actionRef={tableRef}
157 157
         columns={columns}
158 158
         request={queryFunc}
159
-        rowKey="schoolId"
159
+        rowKey="hospitalId"
160 160
         headerTitle="诊室列表"
161 161
         toolBarRender={() => actions}
162 162
       />

+ 45
- 81
src/pages/Medical/Visit/Edit/index.jsx Visa fil

@@ -1,17 +1,16 @@
1 1
 import React, { useEffect, useState } from 'react';
2 2
 import { connect, history } from 'umi';
3
-import ProCard from '@ant-design/pro-card';
3
+
4 4
 import { PageContainer } from '@ant-design/pro-layout';
5 5
 import Container from '@/components/Container';
6
-import { Input, Select, Form, Button, notification } from 'antd';
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 9
 
10
-const { Option } = Select;
11 10
 const { Search } = Input;
12 11
 const VisitEdit = (props) => {
13 12
   const { id, schoolId } = props.location.query;
14
-  const [list, setList] = useState([]);
13
+
15 14
   const [searchLoading, setSearchLoading] = useState(false);
16 15
 
17 16
   const [form] = Form.useForm();
@@ -20,7 +19,6 @@ const VisitEdit = (props) => {
20 19
     if (id) {
21 20
       request(`/student/${id}`)
22 21
         .then((res) => {
23
-          console.log(res, 'res');
24 22
           form.setFieldsValue(res);
25 23
           setSearchLoading(false);
26 24
         })
@@ -32,23 +30,22 @@ const VisitEdit = (props) => {
32 30
     }
33 31
   };
34 32
 
35
-  useEffect(()=>{
36
-if(id){
37
-  if (id) {
38
-    request(`/medical-log/${id}`)
39
-      .then((res) => {
40
-        console.log(res, 'res');
41
-        form.setFieldsValue(res);
42
-        setSearchLoading(false);
43
-      })
44
-      .catch((e) => {
45
-        setSearchLoading(false);
46
-      });
47
-  } else {
48
-    // this.setState({ data: [] });
49
-  }
50
-}
51
-  },[id])
33
+  useEffect(() => {
34
+    if (id) {
35
+      if (id) {
36
+        request(`/medical-log/${id}`)
37
+          .then((res) => {
38
+            form.setFieldsValue(res);
39
+            setSearchLoading(false);
40
+          })
41
+          .catch((e) => {
42
+            setSearchLoading(false);
43
+          });
44
+      } else {
45
+        // this.setState({ data: [] });
46
+      }
47
+    }
48
+  }, [id]);
52 49
 
53 50
   const onSearch = (value) => {
54 51
     if (value) {
@@ -59,21 +56,15 @@ if(id){
59 56
     }
60 57
   };
61 58
 
62
-  const handleChange = (value) => {
63
-    // this.setState({ value });
64
-  };
65 59
   const handleSubmit = (value) => {
66
-    // this.setState({ value });
67
-    console.log(value, 'handleSubmit');
68
-    request('/medicalLog', { method: 'post', data: {schoolId, ...value } })
69
-    .then(() => {
70
-
71
-      notification.success({ message: '新建成功' });
72
-      history.go('-1')
73
-    })
74
-    .catch((e) => {
75
-      notification.error({ message: e.message });
76
-    });
60
+    request('/medicalLog', { method: 'post', data: { schoolId, ...value } })
61
+      .then(() => {
62
+        notification.success({ message: '新建成功' });
63
+        history.go('-1');
64
+      })
65
+      .catch((e) => {
66
+        notification.error({ message: e.message });
67
+      });
77 68
   };
78 69
   return (
79 70
     <PageContainer
@@ -87,16 +78,15 @@ if(id){
87 78
     >
88 79
       <Container>
89 80
         <ProForm form={form} submitter={!id} onFinish={handleSubmit}>
90
-          <ProCard.Group title="就诊信息" bodyStyle={{ padding: 20 }}>
91
-            {!id && (
92
-              <Search
93
-                placeholder="请输入学号"
94
-                loading={searchLoading}
95
-                style={{ width: 200, marginBottom: '20px' }}
96
-                onSearch={onSearch}
97
-              />
98
-            )}
99
-
81
+          {!id && (
82
+            <Search
83
+              placeholder="请输入学号"
84
+              loading={searchLoading}
85
+              style={{ width: 200, marginBottom: '20px' }}
86
+              onSearch={onSearch}
87
+            />
88
+          )}
89
+          <ProForm.Group layout="inline" title="就诊信息">
100 90
             <ProFormText
101 91
               label="姓名"
102 92
               placeholder="输入名称"
@@ -137,42 +127,16 @@ if(id){
137 127
               fieldProps={{ bordered: !id, readOnly: !!id }}
138 128
               rules={[{ required: true, message: '请填写联系方式' }]}
139 129
             />
140
-          </ProCard.Group>
141
-          <ProCard.Group title="诊断" bodyStyle={{ padding: 20 }}>
142
-            <ProFormSelect
143
-              label="就诊科室"
144
-              placeholder="输选择"
145
-              name="hospitalId"
146
-              fieldProps={{ bordered: !id, open: id ? false : undefined }}
147
-              request={async ({ keyWords }) => {
148
-                // console.log()
149
-                // if (keyWords) {
150
-                return request('/hospital', {
151
-                  method: 'get',
152
-                  params: { name: keyWords, schoolId, pageNum: 1, pageSize: 1000 },
153
-                })
154
-                  .then((res) => {
155
-                    return res?.records?.map((x) => {
156
-                      return { label: x.name, value: x.hospitalId };
157
-                    });
158
-                  })
159
-                  .catch((e) => {
160
-                    return Promise.reject(e.message);
161
-                  });
162
-                // }
163
-              }}
164
-              rules={[{ required: true, message: '请选择科室' }]}
165
-            />
130
+          </ProForm.Group>
166 131
 
167
-            <ProFormTextArea
168
-              label="诊断报告"
169
-              placeholder="输入诊断报告"
170
-              name="attchment"
171
-             
172
-              fieldProps={{readOnly: !!id }}
173
-              rules={[{ required: true, message: '请填写诊断报告' }]}
174
-            />
175
-          </ProCard.Group>
132
+          <ProFormTextArea
133
+            label="诊断报告"
134
+            placeholder="输入诊断报告"
135
+            name="attchment"
136
+            fieldProps={{ readOnly: !!id, rows: 10 }}
137
+            rules={[{ required: true, message: '请填写诊断报告' }]}
138
+            style={{ width: '100%' }}
139
+          />
176 140
         </ProForm>
177 141
       </Container>
178 142
     </PageContainer>

+ 33
- 16
src/pages/Medical/Visit/List/index.jsx Visa fil

@@ -6,6 +6,7 @@ import { PlusOutlined } from '@ant-design/icons';
6 6
 import { Button,  Space } from 'antd';
7 7
 import  { queryTable } from '@/utils/request';
8 8
 import School from '@/components/School';
9
+import Specialty from '@/components/Specialty';
9 10
 
10 11
 const VisitList = () => {
11 12
 
@@ -41,7 +42,7 @@ const VisitList = () => {
41 42
       setSchool({...schoolInfo});
42 43
     };
43 44
 
44
-    return <School onChange={handleSchoolChange} />;
45
+    return <School onChange={handleSchoolChange} allowClear/>;
45 46
   };
46 47
 
47 48
   const columns = [
@@ -52,23 +53,30 @@ const VisitList = () => {
52 53
 
53 54
       align: 'center',
54 55
     },
56
+    // {
57
+    //   title: '学校',
58
+    //   key: 'schoolId',
59
+    //   dataIndex: 'schoolId',
60
+    //   valueType: 'select',
61
+    //   renderFormItem,
62
+    // },
55 63
     {
56
-      title: '所属学校',
57
-      key: 'schoolId',
64
+      title: '学校',
58 65
       dataIndex: 'schoolId',
59
-      valueType: 'select',
66
+      align: 'center',
67
+      render: (_, row) => row.schoolName,
60 68
       renderFormItem,
61 69
     },
62 70
 
63 71
     {
64 72
       title: '学号',
65
-      dataIndex: 'd',
73
+      dataIndex: 'studentId',
66 74
       align: 'center',
67 75
      
68 76
     },
69 77
     {
70 78
       title: '姓名',
71
-      dataIndex: 'status',
79
+      dataIndex: 'name',
72 80
       align: 'center',
73 81
       hideInSearch: true,
74 82
       // hideInTable: true,
@@ -78,27 +86,36 @@ const VisitList = () => {
78 86
       dataIndex: 'status',
79 87
       align: 'center',
80 88
       hideInSearch: true,
89
+      valueEnum: {
90
+        1: { text: '男' },
91
+        2: { text: '女' },
92
+      },
81 93
     },
94
+
95
+   
82 96
     {
83 97
       title: '专业',
84
-      dataIndex: 'status',
98
+      dataIndex: 'specialtyId',
85 99
       align: 'center',
86
-      // hideInTable: true,
100
+      render: (_, row) => row.specialtyName,
101
+      renderFormItem: (item, config, form) => {
102
+        const schoolId = form.getFieldValue('schoolId');
103
+        return <Specialty schoolid={schoolId} disabled={!schoolId}></Specialty>;
104
+      },
87 105
     },
88 106
     {
89 107
       title: '医生',
90
-      dataIndex: 'createDate',
108
+      dataIndex: 'doctorName',
91 109
       align: 'center',
92 110
       hideInSearch: true,
93
-      valueType: 'date',
94 111
     },
95
-    {
96
-      title: '就诊科室',
97
-      dataIndex: 'createDate',
98
-      align: 'center',
99
-      hideInSearch: true,
112
+    // {
113
+    //   title: '就诊科室',
114
+    //   dataIndex: 'createDate',
115
+    //   align: 'center',
116
+    //   hideInSearch: true,
100 117
 
101
-    },
118
+    // },
102 119
     {
103 120
       title: '就诊时间',
104 121
       dataIndex: 'recordDate',

+ 2
- 1
src/pages/Student/School/Edit/Specialty.jsx Visa fil

@@ -50,7 +50,7 @@ const Specialty = (props) => {
50 50
   //   };
51 51
 
52 52
   const deleteSchoolClick = () => {
53
-      console.log(ref)
53
+
54 54
     ref.current.reload();
55 55
     //   request(`/specialty/${id}`, { method: 'delete' })
56 56
     //     .then(() => {
@@ -76,6 +76,7 @@ const Specialty = (props) => {
76 76
       dataIndex: 'schoolNmae',
77 77
       align: 'center',
78 78
       hideInSearch: true,
79
+      render: () => props.data.name
79 80
     },
80 81
 
81 82
     {

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

@@ -36,6 +36,25 @@ const SchoolList = () => {
36 36
       });
37 37
   };
38 38
 
39
+  const changeStatus = (row) => {
40
+    setLoading(true);
41
+
42
+    request(`/school/${row.schoolId}`, {
43
+      method: 'put',
44
+      data: { ...row, status: row.status === 1 ? 0 : 1 },
45
+    })
46
+      .then(() => {
47
+        notification.info({ message: '修改成功' });
48
+        setLoading(false);
49
+        ref.current.submit();
50
+      })
51
+      .catch((e) => {
52
+        notification.error({ message: e.message });
53
+        setLoading(false);
54
+        return Promise.reject(e.message);
55
+      });
56
+  };
57
+
39 58
   const columns = [
40 59
     {
41 60
       title: 'logo',
@@ -64,26 +83,22 @@ const SchoolList = () => {
64 83
       title: '上架状态',
65 84
       dataIndex: 'status',
66 85
       align: 'center',
67
-      // hideInTable: true,
86
+      hideInTable: true,
68 87
       valueType: 'select',
69
-      valueEnum:{
70
-        0: {
71
-          text: '已下架',
72
-          status: 'Processing',
73
-        },
74
-        1: {
75
-          text: '已上架',
76
-          status: 'Success',
77
-        },
88
+      valueEnum: {
89
+       
90
+        0: { text: '未上架', status: 'Default' },
91
+        1: { text: '已上架', status: 'Success' },
78 92
       },
79 93
     },
80 94
     {
81
-      title: '上传时间',
95
+      title: '创建时间',
82 96
       dataIndex: 'createDate',
83 97
       align: 'center',
84 98
       hideInSearch: true,
85 99
       valueType: 'date',
86 100
     },
101
+    // autoDefault
87 102
     {
88 103
       title: '操作',
89 104
       dataIndex: 'action',
@@ -91,6 +106,9 @@ const SchoolList = () => {
91 106
       hideInSearch: true,
92 107
       render: (text, record) => (
93 108
         <Space size="middle">
109
+          <a key="status" onClick={() => changeStatus(record)}>
110
+            {record.status === 1 ? '下架' : '上架'}
111
+          </a>
94 112
           <a onClick={() => handleSchoolClick(record.schoolId)}>编辑</a>
95 113
           <Popconfirm
96 114
             key="popconfirm"

+ 11
- 4
src/pages/Student/Student/Edit/index.jsx Visa fil

@@ -26,12 +26,19 @@ const BannerEdit = (props) => {
26 26
   }, [id]);
27 27
 
28 28
   return (
29
-    <PageContainer>
29
+    <PageContainer
30
+    header={{
31
+      extra: [
32
+        <Button key="1" onClick={() => history.go('-1')}>
33
+          返回
34
+        </Button>,
35
+      ],
36
+    }}>
30 37
       <Container loading={loading}>
31
-        <div style={{ textAlign: 'right' }}>
38
+        {/* <div style={{ textAlign: 'right' }}>
32 39
           {' '}
33 40
           <Button onClick={() => history.go('-1')}>返回</Button>
34
-        </div>
41
+        </div> */}
35 42
 
36 43
         <Card bordered={false}>
37 44
           {/* <div style={{ display: 'flex' }}>
@@ -45,7 +52,7 @@ const BannerEdit = (props) => {
45 52
               <Descriptions.Item label="积分">{data.createDate}</Descriptions.Item>
46 53
               <Descriptions.Item label="微信昵称">{data.nickName}</Descriptions.Item>
47 54
               <Descriptions.Item label="联系方式">{data.phone}</Descriptions.Item>
48
-              <Descriptions.Item label="邮箱">{data.eMail}</Descriptions.Item>
55
+              <Descriptions.Item label="邮箱">{data.email}</Descriptions.Item>
49 56
             </Descriptions>
50 57
           {/* </div> */}
51 58
 

+ 14
- 8
src/pages/Student/Student/List/index.jsx Visa fil

@@ -1,9 +1,11 @@
1 1
 import React, { useCallback } from 'react';
2 2
 import { connect, history } from 'umi';
3
+import { Space } from 'antd';
3 4
 import { PageContainer } from '@ant-design/pro-layout';
4 5
 import ProTable from '@ant-design/pro-table';
5
-import { Space } from 'antd';
6
+import School from '@/components/School';
6 7
 import { queryTable } from '@/utils/request';
8
+import Specialty from '@/components/Specialty';
7 9
 
8 10
 const StudentList = () => {
9 11
   const handleStudentClick = useCallback((id) => {
@@ -17,6 +19,7 @@ const StudentList = () => {
17 19
       title: '编号',
18 20
       dataIndex: 'personId',
19 21
       align: 'center',
22
+      width: 300,
20 23
       hideInSearch: true,
21 24
     },
22 25
     {
@@ -25,7 +28,7 @@ const StudentList = () => {
25 28
       align: 'center',
26 29
     },
27 30
     {
28
-      title: '昵称',
31
+      title: '微信昵称',
29 32
       dataIndex: 'nickName',
30 33
       align: 'center',
31 34
       hideInSearch: true,
@@ -39,17 +42,20 @@ const StudentList = () => {
39 42
     {
40 43
       title: '学校',
41 44
       dataIndex: 'schoolId',
42
-
43 45
       align: 'center',
44
-
46
+      render: (_, row) => row.schoolName,
47
+      renderFormItem: () => <School autoDefault={false} allowClear></School>,
45 48
     },
46 49
     {
47 50
       title: '专业',
48
-      dataIndex: 'specialtyName',
49
-
51
+      dataIndex: 'specialtyId',
50 52
       align: 'center',
53
+      render: (_, row) => row.specialtyName,
54
+      renderFormItem: (item, config, form) => {
55
+        const schoolId = form.getFieldValue('schoolId');
56
+        return <Specialty schoolid={schoolId} disabled={!schoolId}></Specialty>;
57
+      },
51 58
     },
52
-
53 59
     {
54 60
       title: '学号',
55 61
       dataIndex: 'studentId',
@@ -73,7 +79,7 @@ const StudentList = () => {
73 79
       <ProTable
74 80
         columns={columns}
75 81
         request={queryTable('/person')}
76
-        rowKey="schoolId"
82
+        rowKey="personId"
77 83
         headerTitle="学校列表"
78 84
         search={{
79 85
           labelWidth: '4em',