Your Name 4 年之前
父節點
當前提交
349f0e2f20
共有 3 個檔案被更改,包括 39 行新增8 行删除
  1. 0
    5
      src/components/Specialty/index.jsx
  2. 18
    2
      src/pages/Medical/Visit/Edit/index.jsx
  3. 21
    1
      src/pages/Post/Type/index.jsx

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

20
 
20
 
21
   useEffect(() => {
21
   useEffect(() => {
22
     if (props.value !== value) {
22
     if (props.value !== value) {
23
-      console.log(props.value,value,'---------');
24
       if (!value) {
23
       if (!value) {
25
         setValue(value);
24
         setValue(value);
26
       } else {
25
       } else {
39
           setList(records);
38
           setList(records);
40
           setLoading(false);
39
           setLoading(false);
41
           setValue();
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
         .catch((e) => {
42
         .catch((e) => {
48
           // eslint-disable-next-line
43
           // eslint-disable-next-line

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

7
 import ProForm, { ProFormText, ProFormTextArea, ProFormSelect } from '@ant-design/pro-form';
7
 import ProForm, { ProFormText, ProFormTextArea, ProFormSelect } from '@ant-design/pro-form';
8
 import request from '@/utils/request';
8
 import request from '@/utils/request';
9
 import School from '@/components/School';
9
 import School from '@/components/School';
10
+import Specialty from '@/components/Specialty'
10
 
11
 
11
 const { Search } = Input;
12
 const { Search } = Input;
12
 const VisitEdit = (props) => {
13
 const VisitEdit = (props) => {
14
 
15
 
15
   const [searchLoading, setSearchLoading] = useState(false);
16
   const [searchLoading, setSearchLoading] = useState(false);
16
   const [school, setSchool] = useState();
17
   const [school, setSchool] = useState();
18
+  const [specialtyId, setSpecialtyId] = useState()
17
   const [searchValue, setSearchValue] = useState();
19
   const [searchValue, setSearchValue] = useState();
18
   
20
   
19
   const [form] = Form.useForm();
21
   const [form] = Form.useForm();
63
   };
65
   };
64
 
66
 
65
   const handleSubmit = (value) => {
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
       .then(() => {
74
       .then(() => {
68
         notification.success({ message: '新建成功' });
75
         notification.success({ message: '新建成功' });
69
         history.go('-1');
76
         history.go('-1');
77
     setSchool(value)
84
     setSchool(value)
78
     setSearchValue('')
85
     setSearchValue('')
79
     form.resetFields()
86
     form.resetFields()
80
-
81
   };
87
   };
82
 
88
 
83
   return (
89
   return (
106
             </ProForm.Group>
112
             </ProForm.Group>
107
           )}
113
           )}
108
           <ProForm.Group layout="inline" title="就诊信息">
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
             <ProFormText
125
             <ProFormText
110
               label="姓名"
126
               label="姓名"
111
               placeholder="输入名称"
127
               placeholder="输入名称"

+ 21
- 1
src/pages/Post/Type/index.jsx 查看文件

3
 import { PageContainer } from '@ant-design/pro-layout';
3
 import { PageContainer } from '@ant-design/pro-layout';
4
 import ProTable from '@ant-design/pro-table';
4
 import ProTable from '@ant-design/pro-table';
5
 import { PlusOutlined } from '@ant-design/icons';
5
 import { PlusOutlined } from '@ant-design/icons';
6
-import { Button, notification } from 'antd';
6
+import { Button, Popconfirm, notification } from 'antd';
7
 import {
7
 import {
8
   ModalForm,
8
   ModalForm,
9
   ProFormText,
9
   ProFormText,
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
   const actions = [
64
   const actions = [
54
     <Button key="button" icon={<PlusOutlined />} type="primary" onClick={() => handleEdit()}>
65
     <Button key="button" icon={<PlusOutlined />} type="primary" onClick={() => handleEdit()}>
55
       新建
66
       新建
99
         <a key="up" onClick={() => emitPublishOrNot(item)}>
110
         <a key="up" onClick={() => emitPublishOrNot(item)}>
100
           {item.status === 1 ? '下架' : '上架'}
111
           {item.status === 1 ? '下架' : '上架'}
101
         </a>,
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
   ];