Your Name 4 years ago
parent
commit
349f0e2f20

+ 0
- 5
src/components/Specialty/index.jsx View File

@@ -20,7 +20,6 @@ export default (props) => {
20 20
 
21 21
   useEffect(() => {
22 22
     if (props.value !== value) {
23
-      console.log(props.value,value,'---------');
24 23
       if (!value) {
25 24
         setValue(value);
26 25
       } else {
@@ -39,10 +38,6 @@ export default (props) => {
39 38
           setList(records);
40 39
           setLoading(false);
41 40
           setValue();
42
-          // if (props.autoDefault !== false && records.length > 0) {
43
-          //   setValue(records[0].specialty);
44
-          //   props.onChange(records[0].specialtyId, records[0]);
45
-          // }
46 41
         })
47 42
         .catch((e) => {
48 43
           // eslint-disable-next-line

+ 18
- 2
src/pages/Medical/Visit/Edit/index.jsx View File

@@ -7,6 +7,7 @@ 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
 import School from '@/components/School';
10
+import Specialty from '@/components/Specialty'
10 11
 
11 12
 const { Search } = Input;
12 13
 const VisitEdit = (props) => {
@@ -14,6 +15,7 @@ const VisitEdit = (props) => {
14 15
 
15 16
   const [searchLoading, setSearchLoading] = useState(false);
16 17
   const [school, setSchool] = useState();
18
+  const [specialtyId, setSpecialtyId] = useState()
17 19
   const [searchValue, setSearchValue] = useState();
18 20
   
19 21
   const [form] = Form.useForm();
@@ -63,7 +65,12 @@ const VisitEdit = (props) => {
63 65
   };
64 66
 
65 67
   const handleSubmit = (value) => {
66
-    request('/medicalLog', { method: 'post', data: { schoolId:school, ...value } })
68
+    if (!specialtyId) {
69
+      notification.warn({ message: '请选择专业' })
70
+      return;
71
+    }
72
+
73
+    request('/medicalLog', { method: 'post', data: { schoolId: school, specialtyId, ...value } })
67 74
       .then(() => {
68 75
         notification.success({ message: '新建成功' });
69 76
         history.go('-1');
@@ -77,7 +84,6 @@ const VisitEdit = (props) => {
77 84
     setSchool(value)
78 85
     setSearchValue('')
79 86
     form.resetFields()
80
-
81 87
   };
82 88
 
83 89
   return (
@@ -106,6 +112,16 @@ const VisitEdit = (props) => {
106 112
             </ProForm.Group>
107 113
           )}
108 114
           <ProForm.Group layout="inline" title="就诊信息">
115
+            <Form.Item label="专业" required>
116
+              <Specialty
117
+                value={specialtyId}
118
+                schoolid={schoolId || school}
119
+                onChange={(x) => setSpecialtyId(x)}
120
+                style={{ minWidth: '150px' }}
121
+                placeholder="请选择专业"
122
+              />
123
+            </Form.Item>
124
+
109 125
             <ProFormText
110 126
               label="姓名"
111 127
               placeholder="输入名称"

+ 21
- 1
src/pages/Post/Type/index.jsx View File

@@ -3,7 +3,7 @@ import { connect } from 'umi';
3 3
 import { PageContainer } from '@ant-design/pro-layout';
4 4
 import ProTable from '@ant-design/pro-table';
5 5
 import { PlusOutlined } from '@ant-design/icons';
6
-import { Button, notification } from 'antd';
6
+import { Button, Popconfirm, notification } from 'antd';
7 7
 import {
8 8
   ModalForm,
9 9
   ProFormText,
@@ -50,6 +50,17 @@ const PostTypeList = (props) => {
50 50
     })
51 51
   }
52 52
 
53
+  const handleDelete = (row) => {
54
+    return request(`/post-type/${row.typeId}`, { method: 'delete' }).then(() => {
55
+      notification.success({ message: '操作成功' })
56
+      tableRef.current.reload()
57
+      setVisible(false)
58
+    }).catch((e) => {
59
+      console.error(e)
60
+      notification.warn({ message: e.message })
61
+    })
62
+  }
63
+
53 64
   const actions = [
54 65
     <Button key="button" icon={<PlusOutlined />} type="primary" onClick={() => handleEdit()}>
55 66
       新建
@@ -99,6 +110,15 @@ const PostTypeList = (props) => {
99 110
         <a key="up" onClick={() => emitPublishOrNot(item)}>
100 111
           {item.status === 1 ? '下架' : '上架'}
101 112
         </a>,
113
+        <Popconfirm
114
+          key="popconfirm"
115
+          title={`确认删除吗?`}
116
+          onConfirm={() => handleDelete(item)}
117
+          okText="是"
118
+          cancelText="否"
119
+        >
120
+          <a>删除</a>
121
+        </Popconfirm>
102 122
       ],
103 123
     },
104 124
   ];