forked from Gitlink/forgeplus-react
添加专家库页面 删除专家功能
This commit is contained in:
parent
694fd1c394
commit
009c511592
|
@ -18,6 +18,14 @@ export async function expertList(params) {
|
|||
}
|
||||
}
|
||||
|
||||
//删除专家
|
||||
export function deleteExpert(expertId) {
|
||||
return fetch({
|
||||
url: `/api/experts/${expertId}?isDelete=1`,
|
||||
method: 'delete'
|
||||
});
|
||||
}
|
||||
|
||||
// 获取用户信息
|
||||
export function getUserInfo() {
|
||||
return fetch({
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import React, { useState, useMemo, useEffect } from "react";
|
||||
import { Input, Select, Button, Form, Table, Upload, Modal } from 'antd';
|
||||
import { Input, Select, Button, Form, Table, Upload, Modal, Popconfirm, message } from 'antd';
|
||||
import cookie from 'react-cookies';
|
||||
import { exportExcel } from '../components/exportExcel.js';
|
||||
import Paginationtable from "../../components/paginationTable";
|
||||
import { Info } from '../../components/ModalFun';
|
||||
import { expertList } from "../api";
|
||||
import { expertList, deleteExpert } from "../api";
|
||||
import { professionalType, reviewArea } from "../static";
|
||||
import { httpUrl } from '../fetch';
|
||||
|
||||
|
@ -186,6 +186,15 @@ function RegisterList({ showNotification }) {
|
|||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'id',
|
||||
key: 'action',
|
||||
fixed: 'right',
|
||||
render: (text, record)=>{
|
||||
return <Popconfirm placement="bottom" title="你确认要删除此专家吗?" onConfirm={() => { delExpert(text);}} okText="是" cancelText="否"><Button size="small" type="primary">删除</Button></Popconfirm>
|
||||
}
|
||||
}
|
||||
];
|
||||
}, []);
|
||||
|
||||
|
@ -233,6 +242,20 @@ function RegisterList({ showNotification }) {
|
|||
});
|
||||
}, [download]);
|
||||
|
||||
// 删除专家
|
||||
const delExpert=(expertId)=>{
|
||||
setLoading(true);
|
||||
deleteExpert(expertId).then(response=>{
|
||||
if(response && response.message === "删除专家成功"){
|
||||
message.success("删除成功");
|
||||
setReload(Math.random());
|
||||
}else{
|
||||
message.error("删除失败");
|
||||
}
|
||||
}).finally(()=>{
|
||||
setLoading(false);
|
||||
})
|
||||
}
|
||||
|
||||
function beforeUpload(file) {
|
||||
const isExcel = file.type.indexOf('xlsx') || file.type.indexOf('xls') || file.type.indexOf('sheet');
|
||||
|
@ -350,7 +373,6 @@ function RegisterList({ showNotification }) {
|
|||
rowKey={(row) => row.id}
|
||||
/>
|
||||
|
||||
|
||||
<Modal
|
||||
title="上传"
|
||||
visible={visible}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
.center-right-but{
|
||||
flex:auto;
|
||||
justify-content: space-between;
|
||||
margin:0 4em 2em 0;
|
||||
margin-right: 4em;
|
||||
}
|
||||
|
||||
.ant-form-item-control-wrapper{
|
||||
|
|
Loading…
Reference in New Issue