|
|
@@ -1,4 +1,4 @@
|
|
|
-import {useContext, useContextSection} from '@hooks';
|
|
|
+import {useContext, usePage} from '@hooks';
|
|
|
import {context, pageContext} from '../context';
|
|
|
import {useMutation, useQuery} from '@tanstack/react-query';
|
|
|
import {deleteRole, getRoleList} from '@apis';
|
|
|
@@ -10,7 +10,7 @@ import {useBoolean} from 'ahooks';
|
|
|
import {deleteConfirm} from '@utils';
|
|
|
|
|
|
export function useList() {
|
|
|
- const {page, pageSize} = useContextSection(pageContext, state => state[0]);
|
|
|
+ const [{page, pageSize}] = usePage(pageContext);
|
|
|
const [count, setCount] = useState(0);
|
|
|
const [{name}, dispatch] = useContext(context);
|
|
|
|
|
|
@@ -100,6 +100,15 @@ export function useHandle(data: RoleListData[], refetch: () => void) {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ const [pdaId, setPdaId] = useState('');
|
|
|
+ const [pdaVisible, {setTrue: pdaSetTrue, setFalse: onPdaClose}] = useBoolean();
|
|
|
+ function onSetPda(id: string) {
|
|
|
+ return function() {
|
|
|
+ setPdaId(id);
|
|
|
+ pdaSetTrue();
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
const columns: ColumnsType<RoleListData> = [
|
|
|
{title: '角色编号', dataIndex: 'roleCode', key: 'roleCode'},
|
|
|
{title: '角色名', dataIndex: 'roleName', key: 'roleName'},
|
|
|
@@ -109,7 +118,7 @@ export function useHandle(data: RoleListData[], refetch: () => void) {
|
|
|
title: '操作',
|
|
|
dataIndex: 'id',
|
|
|
key: 'id',
|
|
|
- width: 260,
|
|
|
+ width: 400,
|
|
|
render(_, {id}) {
|
|
|
return (
|
|
|
<>
|
|
|
@@ -135,6 +144,13 @@ export function useHandle(data: RoleListData[], refetch: () => void) {
|
|
|
>
|
|
|
菜单权限
|
|
|
</Button>
|
|
|
+ <Button
|
|
|
+ type='text'
|
|
|
+ disabled={deleteId === String(id)}
|
|
|
+ onClick={onSetPda(String(id))}
|
|
|
+ >
|
|
|
+ PDA菜单权限
|
|
|
+ </Button>
|
|
|
</>
|
|
|
);
|
|
|
},
|
|
|
@@ -142,7 +158,7 @@ export function useHandle(data: RoleListData[], refetch: () => void) {
|
|
|
];
|
|
|
|
|
|
return [
|
|
|
- {columns, visible, editId, roleVisible, roleId},
|
|
|
- {onAdd, onClose: setFalse, onRoleClose},
|
|
|
+ {columns, visible, editId, roleVisible, roleId, pdaVisible, pdaId},
|
|
|
+ {onAdd, onClose: setFalse, onRoleClose, onPdaClose},
|
|
|
] as const;
|
|
|
}
|