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