feat: del one super admin
parent
6b16c1b901
commit
24a7eeb5e3
|
@ -26,7 +26,7 @@ const AddSupderAdmin = (props: PropTypes) => {
|
|||
const values = await form.validateFields();
|
||||
const result = await addSupderAdminAPI(values);
|
||||
if (result.code === 200) {
|
||||
message.success(`套餐${editRow?.id ? '修改' : '添加'}成功`);
|
||||
message.success(`管理员${editRow?.id ? '修改' : '添加'}成功`);
|
||||
handleOnCancel();
|
||||
tableRef.current?.reload();
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
import { getSupderAdminListAPI } from '@/services/system/supderAdmin';
|
||||
import { delSuperAdminAPI, getSupderAdminListAPI } from '@/services/system/supderAdmin';
|
||||
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { Button } from 'antd';
|
||||
import { App, Button, message } from 'antd';
|
||||
import { useRef, useState } from 'react';
|
||||
import AddSupderAdmin from './AddSupderAdmin';
|
||||
|
||||
const Page = () => {
|
||||
const { modal } = App.useApp();
|
||||
const tableRef = useRef<ActionType>();
|
||||
|
||||
const [createModalVisible, setCreateModalVisible] = useState<boolean>(false);
|
||||
const [editRow] = useState<EditRow<SuperAdmin.SuperAdminItem>>();
|
||||
const [editRow, setEditRow] = useState<EditRow<SuperAdmin.SuperAdminItem>>();
|
||||
|
||||
const columns: ProColumns[] = [
|
||||
{
|
||||
|
@ -53,6 +54,49 @@ const Page = () => {
|
|||
align: 'center',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'option',
|
||||
valueType: 'option',
|
||||
align: 'center',
|
||||
render: (_: React.ReactNode, record: SuperAdmin.SuperAdminItem) => (
|
||||
<div className="space-x-4">
|
||||
<Button
|
||||
className="app-btn warning"
|
||||
key={'edit'}
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
setEditRow(record);
|
||||
setCreateModalVisible(true);
|
||||
}}
|
||||
>
|
||||
修改管理员
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
danger
|
||||
key={'del'}
|
||||
onClick={() => {
|
||||
modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除该管理员?',
|
||||
async onOk() {
|
||||
const flag = await delSuperAdminAPI(record.id);
|
||||
if (flag) {
|
||||
message.success('删除成功');
|
||||
tableRef.current?.reload();
|
||||
} else {
|
||||
message.error('删除失败');
|
||||
}
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
删除管理员
|
||||
</Button>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
|
|
|
@ -10,3 +10,7 @@ export const getSupderAdminListAPI = (
|
|||
export const addSupderAdminAPI = (data: Record<string, any>): Promise<API.ResponstBody> => {
|
||||
return request.post(`/system/superAdmin`, data);
|
||||
};
|
||||
|
||||
export const delSuperAdminAPI = (id: string): Promise<API.ResponstBody> => {
|
||||
return request.delete(`/system/superAdmin/${id}`);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue