From 338914656938e9cf2b71ebbd4d08515e6cf00db0 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Sat, 11 Nov 2023 17:25:23 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E5=AD=97=E5=85=B8=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=A4=9A=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/locales/en-US.ts | 28 +++- src/i18n/locales/zh-CN.ts | 26 ++- src/views/system/dict/data.vue | 270 ++++++++++++++++++++------------ src/views/system/dict/index.vue | 2 +- 4 files changed, 224 insertions(+), 102 deletions(-) diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 0b925980..317303d8 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -1190,7 +1190,7 @@ export default { dictId:'Dictionary Number', dictName:'Dictionary Name', dictType:'Dictionary Type', - dictSatus:'Dictionary Status', + dictSatus:'Status', createTime:'Creation Time', realDictName:'Please enter the dictionary name correctly', realDictType:'Please enter the dictionary type correctly', @@ -1200,7 +1200,31 @@ export default { dictData:'Dictionary Data', reload:'Refresh Cache', mark:'Dictionary Description', - } + }, + dictData: { + dictType: "Dictionary name", + dictCode: "Data Code", + dictLabel: "Data Label", + dictLabelPleac: "Please enter the data labels correctly", + dictValue: "Data key", + dictValuePleac: "Please enter the data keys correctly", + dictSort: "Data Sort", + status: "Status", + createTime: "CreateTime", + tagType: "Tag Type", + tagTypeShow: "Tag Type Show", + tagClass: "Tag Class", + remark: "Remark", + viewInfo: "Dictionary Data Info", + viewInfoErr: "Failed to get dictionary data information", + addInfo: "Add Dictionary Data", + editInfo: "Modifying Dictionary Data", + delTip: "Confirm deleting the data item with dictionary data code [{txt}]?", + delOk: "Deleted successfully", + exportTip: "Confirm exporting xlsx table files based on search criteria?", + exportOk: "Completed export", + typeDataErr: "Failed to get dictionary type information", + }, }, mmlManage: { operationtitle: "Interface Settings", diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 6cad890e..6186be01 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -1200,7 +1200,31 @@ export default { dictData:'字典数据', reload:'刷新缓存', mark:'字典说明', - } + }, + dictData: { + dictType: "字典名称", + dictCode: "数据代码", + dictLabel: "数据标签", + dictLabelPleac: "请正确输入数据标签", + dictValue: "数据键值", + dictValuePleac: "请正确输入数据键值", + dictSort: "数据排序", + status: "数据状态", + createTime: "创建时间", + tagType: "标签类型", + tagTypeShow: "回显预览", + tagClass: "样式属性", + remark: "数据说明", + viewInfo: "字典数据信息", + viewInfoErr: "获取字典数据信息失败", + addInfo: "添加字典数据", + editInfo: "修改字典数据", + delTip: "确认删除字典数据代码为 【{txt}】 的数据项?", + delOk: "删除成功", + exportTip: "确认根据搜索条件导出xlsx表格文件吗?", + exportOk: "已完成导出", + typeDataErr: "获取字典类型信息失败", + }, }, mmlManage: { cmdTitle: "命令导航", diff --git a/src/views/system/dict/data.vue b/src/views/system/dict/data.vue index 21ecdd51..ba5766d1 100644 --- a/src/views/system/dict/data.vue +++ b/src/views/system/dict/data.vue @@ -21,7 +21,7 @@ import useTabsStore from '@/store/modules/tabs'; import useDictStore from '@/store/modules/dict'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import useI18n from '@/hooks/useI18n'; -const { t } = useI18n(); +const { t, currentLocale } = useI18n(); const tabsStore = useTabsStore(); const { parseDataDict, getDict } = useDictStore(); const route = useRoute(); @@ -30,27 +30,29 @@ const router = useRouter(); // 获取地址栏参数 const dictId = route.params && (route.params.dictId as string); +const zh = currentLocale.value === 'zh_CN'; + /**标签类型数据固定项 */ const tagTypeOptions = ref([ - { value: '', label: '普通文本' }, - { value: 'default', label: '默认(default)' }, - { value: 'blue ', label: '蓝色(blue)' }, - { value: 'cyan', label: '青色(cyan)' }, - { value: 'gold', label: '金色(gold)' }, - { value: 'green', label: '绿色(green)' }, - { value: 'lime', label: '亮绿(lime)' }, - { value: 'magenta', label: '紫红(magenta)' }, - { value: 'orange', label: '橘黄(orange)' }, - { value: 'pink', label: '粉色(pink)' }, - { value: 'purple', label: '紫色(purple)' }, - { value: 'red', label: '红色(red)' }, - { value: 'yellow', label: '黄色(yellow)' }, - { value: 'geekblue', label: '深蓝(geekblue)' }, - { value: 'volcano', label: '棕色(volcano)' }, - { value: 'processing', label: '进行(processing)' }, - { value: 'warning', label: '警告(warning)' }, - { value: 'error', label: '错误(error)' }, - { value: 'success', label: '成功(success)' }, + { value: '', label: zh ? '普通文本' : 'Plain text' }, + { value: 'default', label: zh ? '默认(default)' : 'Default' }, + { value: 'blue ', label: zh ? '蓝色(blue)' : 'Blue' }, + { value: 'cyan', label: zh ? '青色(cyan)' : 'Cyan' }, + { value: 'gold', label: zh ? '金色(gold)' : 'Gold' }, + { value: 'green', label: zh ? '绿色(green)' : 'Green' }, + { value: 'lime', label: zh ? '亮绿(lime)' : 'Lime' }, + { value: 'magenta', label: zh ? '紫红(magenta)' : 'Magenta' }, + { value: 'orange', label: zh ? '橘黄(orange)' : 'Orange' }, + { value: 'pink', label: zh ? '粉色(pink)' : 'Pink' }, + { value: 'purple', label: zh ? '紫色(purple)' : 'Purple' }, + { value: 'red', label: zh ? '红色(red)' : 'Red' }, + { value: 'yellow', label: zh ? '黄色(yellow)' : 'Yellow' }, + { value: 'geekblue', label: zh ? '深蓝(geekblue)' : 'Geekblue' }, + { value: 'volcano', label: zh ? '棕色(volcano)' : 'Volcano' }, + { value: 'processing', label: zh ? '进行(processing)' : 'Processing' }, + { value: 'warning', label: zh ? '警告(warning)' : 'Warning' }, + { value: 'error', label: zh ? '错误(error)' : 'Error' }, + { value: 'success', label: zh ? '成功(success)' : 'Success' }, ]); /**字典数据 */ @@ -130,33 +132,33 @@ let tableState: TabeStateType = reactive({ /**表格字段列 */ let tableColumns: ColumnsType = [ { - title: '数据代码', + title: t('views.system.dictData.dictCode'), dataIndex: 'dictCode', align: 'center', }, { - title: '数据标签', + title: t('views.system.dictData.dictLabel'), dataIndex: 'dictLabel', align: 'center', }, { - title: '数据键值', + title: t('views.system.dictData.dictValue'), dataIndex: 'dictValue', align: 'center', }, { - title: '数据排序', + title: t('views.system.dictData.dictSort'), dataIndex: 'dictSort', align: 'center', }, { - title: '数据状态', + title: t('views.system.dictData.status'), dataIndex: 'status', key: 'status', align: 'center', }, { - title: '创建时间', + title: t('views.system.dictData.createTime'), dataIndex: 'createTime', align: 'center', customRender(opt) { @@ -165,7 +167,7 @@ let tableColumns: ColumnsType = [ }, }, { - title: '操作', + title: t('common.operate'), key: 'dictCode', align: 'center', }, @@ -189,7 +191,8 @@ let tablePagination = reactive({ showSizeChanger: true, /**数据总数 */ total: 0, - showTotal: (total: number) => `总共 ${total} 条`, + showTotal: (total: number) => + t('common.tablePaginationTotal', { total: total }), onChange: (page: number, pageSize: number) => { tablePagination.current = page; tablePagination.pageSize = pageSize; @@ -254,10 +257,20 @@ const modalStateFrom = Form.useForm( modalState.from, reactive({ dictLabel: [ - { required: true, min: 1, max: 50, message: '请正确输入数据标签' }, + { + required: true, + min: 1, + max: 50, + message: t('views.system.dictData.dictLabelPleac'), + }, ], dictValue: [ - { required: true, min: 1, max: 50, message: '请正确输入数据键值' }, + { + required: true, + min: 1, + max: 50, + message: t('views.system.dictData.dictValuePleac'), + }, ], }) ); @@ -268,7 +281,7 @@ const modalStateFrom = Form.useForm( */ function fnModalVisibleByVive(row: Record) { modalState.from = Object.assign(modalState.from, row); - modalState.title = '字典数据信息'; + modalState.title = t('views.system.dictData.viewInfo'); modalState.visibleByView = true; } @@ -280,7 +293,7 @@ function fnModalVisibleByEdit(dictCode?: string | number) { if (!dictCode) { modalStateFrom.resetFields(); modalState.from.dictType = queryParams.dictType; - modalState.title = '添加字典数据'; + modalState.title = t('views.system.dictData.addInfo'); modalState.visibleByEdit = true; } else { if (modalState.confirmLoading) return; @@ -291,10 +304,10 @@ function fnModalVisibleByEdit(dictCode?: string | number) { hide(); if (res.code === RESULT_CODE_SUCCESS) { modalState.from = Object.assign(modalState.from, res.data); - modalState.title = '修改字典数据'; + modalState.title = t('views.system.dictData.editInfo'); modalState.visibleByEdit = true; } else { - message.error(`获取字典数据信息失败`, 2); + message.error(t('views.system.dictData.viewInfoErr'), 2); } }); } @@ -317,7 +330,7 @@ function fnModalOk() { .then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: `${modalState.title}成功`, + content: t('common.msgSuccess', { msg: modalState.title }), key, duration: 2, }); @@ -337,7 +350,7 @@ function fnModalOk() { }); }) .catch(e => { - message.error(`请正确填写 ${e.errorFields.length} 处必填信息!`, 2); + message.error(t('common.errorFields', { num: e.errorFields.length }), 2); }); } @@ -361,14 +374,14 @@ function fnRecordDelete(dictCode: string = '0') { } Modal.confirm({ title: t('common.tipTitle'), - content: `确认删除字典数据代码为 【${dictCode}】 的数据项?`, + content: t('views.system.dictData.delTip', { txt: dictCode }), onOk() { const key = 'delData'; message.loading({ content: t('common.loading'), key }); delData(dictCode).then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: `删除成功`, + content: t('views.system.dictData.delOk'), key, duration: 2, }); @@ -389,14 +402,14 @@ function fnRecordDelete(dictCode: string = '0') { function fnExportList() { Modal.confirm({ title: t('common.tipTitle'), - content: `确认根据搜索条件导出xlsx表格文件吗?`, + content: t('views.system.dictData.exportTip'), onOk() { const key = 'exportData'; message.loading({ content: t('common.loading'), key }); exportData(toRaw(queryParams)).then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: `已完成导出`, + content: t('views.system.dictData.exportOk'), key, duration: 2, }); @@ -427,7 +440,7 @@ function fnClose() { function fnGetList(pageNum?: number) { if (tableState.loading) return; tableState.loading = true; - if(pageNum){ + if (pageNum) { queryParams.pageNum = pageNum; } listData(toRaw(queryParams)).then(res => { @@ -466,7 +479,7 @@ onMounted(() => { queryParams.dictType = res.data.dictType; fnGetList(); } else { - message.error(`获取字典类型信息失败`, 3); + message.error(t('views.system.dictData.typeDataErr'), 3); } }); } else { @@ -487,32 +500,41 @@ onMounted(() => { - + - + - + @@ -523,12 +545,12 @@ onMounted(() => { - 搜索 + {{ t('common.search') }} + - 重置 + {{ t('common.reset') }} + @@ -542,7 +564,7 @@ onMounted(() => { - 关闭 + {{ t('common.close') }} { v-perms:has="['system:dict:add']" > - 新增 + {{ t('common.addText') }} { v-perms:has="['system:dict:remove']" > - 删除 + {{ t('common.deleteText') }} { v-perms:has="['system:dict:export']" > - 导出 + {{ t('common.export') }} @@ -577,31 +599,31 @@ onMounted(() => { @@ -645,7 +673,7 @@ onMounted(() => {