张延森 3 years ago
parent
commit
83da249e0e
2 changed files with 24 additions and 2 deletions
  1. 22
    2
      src/pages/Medical/Test/List/index.jsx
  2. 2
    0
      src/services/test.js

+ 22
- 2
src/pages/Medical/Test/List/index.jsx View File

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, GroupOutlined } from '@ant-design/icons';
5
 import { PlusOutlined, GroupOutlined } from '@ant-design/icons';
6
-import { Button,  Space,Image } from 'antd';
6
+import { Button,  Space, Popconfirm, message } from 'antd';
7
 import  { queryTable } from '@/utils/request';
7
 import  { queryTable } from '@/utils/request';
8
 import School from '@/components/School';
8
 import School from '@/components/School';
9
 import Specialty from '@/components/Specialty';
9
 import Specialty from '@/components/Specialty';
10
+import { deleteTestLog } from '@/services/test';
10
 
11
 
11
 const VisitList = () => {
12
 const VisitList = () => {
12
 
13
 
13
   const [school, setSchool] = useState({});  
14
   const [school, setSchool] = useState({});  
14
   const ref = useRef();
15
   const ref = useRef();
16
+  const actionRef = useRef();
15
 
17
 
16
   const handleMedicalClick = useCallback((id) => {
18
   const handleMedicalClick = useCallback((id) => {
17
     history.push(id ? `/medical/Test/edit?id=${id}&schoolId=${school?.schoolId}` : `/medical/Test/edit?schoolId=${school?.schoolId}`);
19
     history.push(id ? `/medical/Test/edit?id=${id}&schoolId=${school?.schoolId}` : `/medical/Test/edit?schoolId=${school?.schoolId}`);
21
     history.push('/medical/Test/batch')
23
     history.push('/medical/Test/batch')
22
   }
24
   }
23
 
25
 
26
+  const handleConfirm = (item) => {
27
+    deleteTestLog(item.serialNo).then(() => {
28
+      actionRef.current.reload()
29
+      message.success("删除成功")
30
+    }).catch(() => {
31
+      message.error("操作失败, 请重试")
32
+    })
33
+  }
34
+
24
   const actions = [
35
   const actions = [
25
     <Button key="batch" icon={<GroupOutlined />} type="primary" ghost onClick={handleBatch}>
36
     <Button key="batch" icon={<GroupOutlined />} type="primary" ghost onClick={handleBatch}>
26
       批量处理
37
       批量处理
68
       title: '学号',
79
       title: '学号',
69
       dataIndex: 'studentNo',
80
       dataIndex: 'studentNo',
70
       align: 'center',
81
       align: 'center',
71
-     
82
+    },
83
+    {
84
+      title: '体检编号',
85
+      dataIndex: 'testNo',
86
+      align: 'center',
72
     },
87
     },
73
     {
88
     {
74
       title: '姓名',
89
       title: '姓名',
104
         <Space size="middle">
119
         <Space size="middle">
105
           <a href={record.attchment} target="_blank" rel="noreferrer">查看报告</a>
120
           <a href={record.attchment} target="_blank" rel="noreferrer">查看报告</a>
106
           {/* <a onClick={()=>setA(record.attchment)}>查看报告</a> */}
121
           {/* <a onClick={()=>setA(record.attchment)}>查看报告</a> */}
122
+          <Popconfirm
123
+            title="确认删除数据?"
124
+            onConfirm={() => handleConfirm(record)}
125
+          ><a href="#">删除</a></Popconfirm>
107
         </Space>
126
         </Space>
108
       ),
127
       ),
109
     },
128
     },
122
           labelWidth: '4em',
141
           labelWidth: '4em',
123
         }}
142
         }}
124
         toolBarRender={() => actions}
143
         toolBarRender={() => actions}
144
+        actionRef={actionRef}
125
       />
145
       />
126
     </PageContainer>
146
     </PageContainer>
127
   );
147
   );

+ 2
- 0
src/services/test.js View File

3
 export const saveTestPDF = (formData) => request('/taTestLog/upload/pdf', { data: formData, method: 'POST' } )
3
 export const saveTestPDF = (formData) => request('/taTestLog/upload/pdf', { data: formData, method: 'POST' } )
4
 
4
 
5
 export const saveTestExcel = (formData) => request('/taTestLog/upload/excel', { data: formData, method: 'POST' } )
5
 export const saveTestExcel = (formData) => request('/taTestLog/upload/excel', { data: formData, method: 'POST' } )
6
+
7
+export const deleteTestLog = (id) => request(`/taTestLog/${id}`, { method: 'DELETE' } )