diff --git a/src/i18n.ts b/src/i18n.ts
index d7ca59d..93e2c61 100644
--- a/src/i18n.ts
+++ b/src/i18n.ts
@@ -1,7 +1,7 @@
import { changeLanguage } from '@/store/system.ts'
-import i18n, { InitOptions } from 'i18next'
+import i18n, { InitOptions, t } from 'i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
-import { initReactI18next, useTranslation } from 'react-i18next'
+import { initReactI18next, useTranslation, } from 'react-i18next'
import { zh, en } from './locales'
const detectionOptions = {
@@ -43,10 +43,9 @@ export const initI18n = (options?: InitOptions) => {
...options,
})
-
}
export {
- useTranslation
+ useTranslation, t
}
export default i18n
\ No newline at end of file
diff --git a/src/locales/lang/en-US.ts b/src/locales/lang/en-US.ts
index fe3de35..1c8a386 100644
--- a/src/locales/lang/en-US.ts
+++ b/src/locales/lang/en-US.ts
@@ -60,7 +60,8 @@ export default {
warningTitle: 'Warning',
batchDelete: 'Are you sure to delete the selected data?',
deleteConfirm: 'Are you sure to delete it?',
- success: 'Submission successful',
+ success: 'Submission successfully',
+ deleteSuccess: 'Delete successfully',
fail: 'Submission failed',
saveSuccess: 'Save successfully',
saveFail: 'Save failed',
diff --git a/src/locales/lang/zh-CN.ts b/src/locales/lang/zh-CN.ts
index 1d4f455..3e5ec17 100644
--- a/src/locales/lang/zh-CN.ts
+++ b/src/locales/lang/zh-CN.ts
@@ -63,6 +63,7 @@ export default {
success: '提交成功',
fail: '提交失败',
saveSuccess: '保存成功',
+ deleteSuccess: '删除成功',
saveFail: '保存失败',
emptyData: '暂无数据',
emptyDataAdd: '暂无数据,点击添加',
diff --git a/src/pages/system/menus/components/BatchButton.tsx b/src/pages/system/menus/components/BatchButton.tsx
index ec15cfd..8e5a45c 100644
--- a/src/pages/system/menus/components/BatchButton.tsx
+++ b/src/pages/system/menus/components/BatchButton.tsx
@@ -5,28 +5,30 @@ import { useTranslation } from '@/i18n.ts'
const BatchButton = () => {
- const { t } = useTranslation()
- const { isPending, mutate, } = useAtomValue(deleteMenuAtom)
- const ids = useAtomValue(batchIdsAtom)
- if (ids.length === 0) {
- return null
- }
+ const { t } = useTranslation()
+ const { isPending, mutate, } = useAtomValue(deleteMenuAtom)
+ const ids = useAtomValue(batchIdsAtom)
- return (
- {
- mutate(ids as number[])
- }}
- title={t('message.batchDelete', '确定要删除所选数据吗?')}>
-
-
- )
+
+ if (ids.length === 0) {
+ return null
+ }
+
+ return (
+ {
+ mutate(ids as number[])
+ }}
+ title={t('message.batchDelete', '确定要删除所选数据吗?')}>
+
+
+ )
}
export default BatchButton
\ No newline at end of file
diff --git a/src/pages/system/menus/components/TreeNodeRender.tsx b/src/pages/system/menus/components/TreeNodeRender.tsx
index 8091ae6..4d479b6 100644
--- a/src/pages/system/menus/components/TreeNodeRender.tsx
+++ b/src/pages/system/menus/components/TreeNodeRender.tsx
@@ -10,49 +10,49 @@ import { PlusOutlined } from '@ant-design/icons'
import ActionIcon, { DeleteAction } from '@/components/icon/action'
export const TreeNodeRender = memo(({ node, form }: { node: MenuItem & TreeDataNode, form: FormInstance }) => {
- const { title } = node
- const { t } = useTranslation()
- const { styles } = useStyle()
- const { mutate, } = useAtomValue(deleteMenuAtom)
+ const { title } = node
+ const { t } = useTranslation()
+ const { styles } = useStyle()
+ const { mutate } = useAtomValue(deleteMenuAtom)
- const setMenuData = useSetAtom(selectedMenuAtom)
+ const setMenuData = useSetAtom(selectedMenuAtom)
- return (
-
-
{title as any}
-
+ return (
+
+
{title as any}
+
}
- title={t('actions.add', '添加')}
- onClick={(e) => {
- // console.log('add')
- e.stopPropagation()
- e.preventDefault()
- const menu = {
- ...defaultMenu,
- parent_id: node.id,
- }
- setMenuData(menu)
- form.setFieldsValue(menu)
+ size={12}
+ icon={}
+ title={t('actions.add', '添加')}
+ onClick={(e) => {
+ // console.log('add')
+ e.stopPropagation()
+ e.preventDefault()
+ const menu = {
+ ...defaultMenu,
+ parent_id: node.id,
+ }
+ setMenuData(menu)
+ form.setFieldsValue(menu)
- }}/>
+ }}/>
{
- mutate([ (node as any).id ])
- }}
+ title={t('message.deleteConfirm', '确定要删除吗?')}
+ onConfirm={() => {
+ mutate([ (node as any).id ])
+ }}
>
{
- e.stopPropagation()
- e.stopPropagation()
- }}/>
+ size={12}
+ onClick={(e) => {
+ e.stopPropagation()
+ e.stopPropagation()
+ }}/>
-
- )
+
+ )
})
\ No newline at end of file
diff --git a/src/pages/system/menus/index.tsx b/src/pages/system/menus/index.tsx
index 5478a56..534ae77 100644
--- a/src/pages/system/menus/index.tsx
+++ b/src/pages/system/menus/index.tsx
@@ -1,7 +1,7 @@
import Glass from '@/components/glass'
import { useTranslation } from '@/i18n.ts'
import { PageContainer, ProCard } from '@ant-design/pro-components'
-import { Button, Form, Input, message, Radio, TreeSelect, InputNumber, notification, Alert } from 'antd'
+import { Button, Form, Input, Radio, TreeSelect, InputNumber, notification, Alert } from 'antd'
import { useAtomValue } from 'jotai'
import { menuDataAtom, saveOrUpdateMenuAtom, selectedMenuAtom } from './store.ts'
import IconPicker from '@/components/icon/picker'
@@ -26,9 +26,6 @@ const Menus = () => {
const currentMenu = useAtomValue