diff --git a/src/components/switch/index.tsx b/src/components/switch/index.tsx index 626049b..846c931 100644 --- a/src/components/switch/index.tsx +++ b/src/components/switch/index.tsx @@ -3,7 +3,6 @@ import { Switch as AntSwitch, SwitchProps } from 'antd' export const Switch = ({ value, ...props }: SwitchProps) => { - console.log(value, props) return ( ) diff --git a/src/locales/lang/pages/system/roles/en-US.ts b/src/locales/lang/pages/system/roles/en-US.ts index fa21c42..fd5d255 100644 --- a/src/locales/lang/pages/system/roles/en-US.ts +++ b/src/locales/lang/pages/system/roles/en-US.ts @@ -10,7 +10,10 @@ export default { description: 'Remarks', option: 'Operation', }, + search: { + placeholder: 'Please enter a name' + }, edit: { title: 'Edit Role', }, -}; \ No newline at end of file +} \ No newline at end of file diff --git a/src/locales/lang/pages/system/roles/zh-CN.ts b/src/locales/lang/pages/system/roles/zh-CN.ts index 226f1ee..50ba023 100644 --- a/src/locales/lang/pages/system/roles/zh-CN.ts +++ b/src/locales/lang/pages/system/roles/zh-CN.ts @@ -9,9 +9,11 @@ export default { sort: '排序', description: '备注', option: '操作', - }, - edit:{ + search: { + placeholder: '请输入名称' + }, + edit: { title: '编辑角色', }, } \ No newline at end of file diff --git a/src/pages/system/roles/index.tsx b/src/pages/system/roles/index.tsx index d72a458..5bc17ce 100644 --- a/src/pages/system/roles/index.tsx +++ b/src/pages/system/roles/index.tsx @@ -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 + checkedKeys={getTreeCheckedStatus(menuList!, value)}/> } @@ -54,7 +55,7 @@ const Roles = memo(() => { const [ form ] = Form.useForm() const actionRef = useRef() 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: [