|
|
@ -1,4 +1,5 @@ |
|
|
|
import Switch from '@/components/switch' |
|
|
|
import { IMenu } from '@/types/menus' |
|
|
|
import { |
|
|
|
ActionType, |
|
|
|
PageContainer, |
|
|
@ -9,7 +10,7 @@ import { |
|
|
|
import { createLazyFileRoute } from '@tanstack/react-router' |
|
|
|
import { useStyle } from './style.ts' |
|
|
|
import { memo, useEffect, useMemo, useRef, useState } from 'react' |
|
|
|
import { useAtom, useAtomValue, useSetAtom } from 'jotai' |
|
|
|
import { useAtom, useAtomValue } from 'jotai' |
|
|
|
import { |
|
|
|
deleteRoleAtom, |
|
|
|
pageAtom, |
|
|
@ -42,7 +43,7 @@ const MenuTree = (props: any) => { |
|
|
|
return <Tree treeData={menuList} |
|
|
|
fieldNames={{ title: 'title', key: 'id' }} |
|
|
|
disabled={mode !== 'edit'} checkable={true} onCheck={onCheck} |
|
|
|
checkedKeys={getTreeCheckedStatus(menuList, value)}/> |
|
|
|
checkedKeys={getTreeCheckedStatus<IMenu>(menuList!, value)}/> |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
@ -54,7 +55,7 @@ const Roles = memo(() => { |
|
|
|
const [ form ] = Form.useForm() |
|
|
|
const actionRef = useRef<ActionType>() |
|
|
|
const [ page, setPage ] = useAtom(pageAtom) |
|
|
|
const setSearch = useSetAtom(searchAtom) |
|
|
|
const [ search, setSearch ] = useAtom(searchAtom) |
|
|
|
const [ roleIds, setRoleIds ] = useAtom(roleIdsAtom) |
|
|
|
const { data, isLoading, isFetching, refetch } = useAtomValue(rolesAtom) |
|
|
|
const { isPending, mutate, isSuccess } = useAtomValue(saveOrUpdateRoleAtom) |
|
|
@ -178,9 +179,11 @@ const Roles = memo(() => { |
|
|
|
}} |
|
|
|
toolbar={{ |
|
|
|
search: { |
|
|
|
loading: isFetching && !!search.key, |
|
|
|
onSearch: (value: string) => { |
|
|
|
setSearch({ key: value }) |
|
|
|
}, |
|
|
|
placeholder: t('system.roles.search.placeholder') |
|
|
|
}, |
|
|
|
actions: [ |
|
|
|
<Button |
|
|
|