diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index a130eec0..5a8344cd 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -12,6 +12,7 @@ export default { msgSuccess: 'Success {msg}', errorFields: 'Please fill in the required information in {num} correctly!', tablePaginationTotal: 'A total of {total} items', + zebra:'Tabular zebra pattern', ok: 'Ok', cancel: 'Cancel', close: 'Close', @@ -538,7 +539,7 @@ export default { delSure:'Confirm deletion of data item with user ID {userId}?', export:'Export', import:'Import', - exportSure:'Are you sure to export the xlsx table file based on search criteria??', + exportSure:'Are you sure to export the xlsx table file based on search criteria?', phone:'Phone Number', createTime:'Creation time', userTop:'User profile', @@ -550,7 +551,20 @@ export default { loginPwd:'Login password', updateSure:'Do you want to update existing data', downloadObj:'Download Tpl', - } + }, + role:{ + allScopeOptions:'All data permissions', + byMyselfScopeOptions:'Custom data permissions', + onlyClassScopeOptions:'Data permissions of this department', + classAllScopeOptions:'Data permissions for this department and the following', + myselfScopeOptions:'Only personal data permissions', + roleId:'Role number', + roleName:'Role Name', + roleKey:'Role key', + roleSort:'Role order', + roleStatus:'Role status', + createTime:'Creation time', + } }, }, }; diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index a232684f..153f4b80 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -12,6 +12,7 @@ export default { msgSuccess: '{msg}成功 ', errorFields: '请正确填写 {num} 处必填信息!', tablePaginationTotal: '总共 {total} 条', + zebraL:'表格斑马纹', ok: '确定', cancel: '取消', close: '关闭', @@ -515,7 +516,7 @@ export default { } }, system:{ - user: { + user:{ userInfo:'用户信息', userNum: '用户编号', account: '登录账号', @@ -550,7 +551,39 @@ export default { loginPwd:'登入密码', updateSure:'是否更新已经存在的数据', downloadObj:'下载模板', - }, + }, + role:{ + allScopeOptions:'全部数据权限', + byMyselfScopeOptions:'自定数据权限', + onlyClassScopeOptions:'本部门数据权限', + classAllScopeOptions:'本部门及以下数据权限', + myselfScopeOptions:'仅本人数据权限', + roleId:'角色编号', + roleName:'角色名称', + roleKey:'角色键值', + roleSort:'角色顺序', + roleStatus:'角色状态', + createTime:'创建时间', + trueValue:'请正确输入{msg}', + roleInfo:'角色信息', + distribute:'分配数据权限', + open:'启用', + close:'停用', + statusSure:'确定要 {text} {roleName} 角色吗?', + statusFailed:'${roleName} {text}失败', + delSure:'确认删除角色编号为 【{roleId}】 的数据项?', + distributeUser:'分配用户', + roleMark:'角色说明', + menu:'菜单权限', + roleKeyTip:"权限标识示例:dba 控制器中使用权限标识,如: @PreAuthorize({ hasRoles: ['dba'] })", + openSwitch:'展开/折叠', + selAllSwitch:'全选/全不选', + relationSwitch:'父子联动', + normal:'正常', + stop:'暂停', + preScope:'权限范围', + dataPer:'数据权限', + } }, }, }; diff --git a/src/views/monitor/online/index.vue b/src/views/monitor/online/index.vue index fb25f7ab..ba23172c 100644 --- a/src/views/monitor/online/index.vue +++ b/src/views/monitor/online/index.vue @@ -165,14 +165,16 @@ function fnGetList() { function fnForceLogout(row: Record) { Modal.confirm({ title: t('common.tipTitle'), - content: t('views.monitor.online.getOutSure',{userName:row.userName}), + content: t('views.monitor.online.getOutSure', { userName: row.userName }), onOk() { const hide = message.loading(t('common.loading'), 0); forceLogout(row.tokenId) .then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: t('common.msgSuccess', { msg: t('views.monitor.online.getOut') }), + content: t('common.msgSuccess', { + msg: t('views.monitor.online.getOut'), + }), duration: 3, }); } else { @@ -206,34 +208,36 @@ onMounted(() => { - + - + + - 搜索 + {{ t('common.search') }} - 重置 + {{ t('common.reset') }} @@ -247,31 +251,31 @@ onMounted(() => { diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index 1230013d..ed329c9e 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -108,33 +108,33 @@ let tableState: TabeStateType = reactive({ /**表格字段列 */ let tableColumns: ColumnsType = [ { - title: '角色编号', + title: t('views.system.role.roleId'), dataIndex: 'roleId', align: 'center', }, { - title: '角色名称', + title: t('views.system.role.roleName'), dataIndex: 'roleName', align: 'center', }, { - title: '角色键值', + title: t('views.system.role.roleKey'), dataIndex: 'roleKey', align: 'center', }, { - title: '角色顺序', + title: t('views.system.role.roleSort'), dataIndex: 'roleSort', align: 'center', }, { - title: '角色状态', + title: t('views.system.role.roleStatus'), dataIndex: 'status', key: 'status', align: 'center', }, { - title: '创建时间', + title: t('views.system.role.createTime'), dataIndex: 'createTime', align: 'center', customRender(opt) { @@ -143,7 +143,7 @@ let tableColumns: ColumnsType = [ }, }, { - title: '操作', + title: t('common.operate'), key: 'roleId', align: 'center', }, @@ -167,7 +167,7 @@ let tablePagination = reactive({ showSizeChanger: true, /**数据总数 */ total: 0, - showTotal: (total: number) => `总共 ${total} 条`, + showTotal: (total: number) => t('common.tablePaginationTotal', { total }), onChange: (page: number, pageSize: number) => { tablePagination.current = page; tablePagination.pageSize = pageSize; @@ -194,11 +194,11 @@ function fnTableSelectedRowKeys(keys: (string | number)[]) { /**数据范围选项 */ const dataScopeOptions = ref<{ value: string; label: string }[]>([ - { value: '1', label: '全部数据权限' }, - { value: '2', label: '自定数据权限' }, - { value: '3', label: '本部门数据权限' }, - { value: '4', label: '本部门及以下数据权限' }, - { value: '5', label: '仅本人数据权限' }, + { value: '1', label: t('views.system.role.allScopeOptions') }, + { value: '2', label: t('views.system.role.byMyselfScopeOptions') }, + { value: '3', label: t('views.system.role.onlyClassScopeOptions') }, + { value: '4', label: t('views.system.role.classAllScopeOptions') }, + { value: '5', label: t('views.system.role.myselfScopeOptions') }, ]); type TreeDataType = { @@ -282,10 +282,24 @@ const modalStateFrom = Form.useForm( modalState.from, reactive({ roleName: [ - { required: true, min: 1, max: 30, message: '请正确输入角色名称' }, + { + required: true, + min: 1, + max: 30, + message: t('views.system.role.trueValue', { + msg: t('views.system.role.roleName'), + }), + }, ], roleKey: [ - { required: true, min: 1, max: 50, message: '请正确输入角色键值' }, + { + required: true, + min: 1, + max: 50, + message: t('views.system.role.trueValue', { + msg: t('views.system.role.roleKey'), + }), + }, ], }) ); @@ -296,7 +310,7 @@ const modalStateFrom = Form.useForm( */ function fnModalVisibleByVive(roleId: string | number) { if (!roleId) { - message.error(`角色记录存在错误`, 2); + message.error(t('common.getInfoFail'), 2); return; } if (modalState.confirmLoading) return; @@ -317,10 +331,10 @@ function fnModalVisibleByVive(roleId: string | number) { modalState.menuTree.checkedKeys = checkedKeys; modalState.from.menuIds = checkedKeys; } - modalState.title = '角色信息'; + modalState.title = t('views.system.role.roleInfo'); modalState.visibleByView = true; } else { - message.error(`获取角色信息失败`, 2); + message.error(t('common.getInfoFail'), 2); } }); } @@ -334,7 +348,7 @@ function fnModalVisibleByEdit(roleId?: string | number) { modalStateFrom.resetFields(); if (menuTree.treeData.length > 0) { modalState.menuTree.treeData = menuTree.treeData; - modalState.title = '添加角色信息'; + modalState.title = t('common.addText') + t('views.system.role.roleInfo'); modalState.visibleByEdit = true; } else { if (modalState.confirmLoading) return; @@ -349,7 +363,8 @@ function fnModalVisibleByEdit(roleId?: string | number) { menuTree.expandedKeys = parseTreeNodeKeys(res.data, 'id'); menuTree.treeData = res.data; modalState.menuTree.treeData = res.data; - modalState.title = '添加角色信息'; + modalState.title = + t('common.addText') + t('views.system.role.roleInfo'); modalState.visibleByEdit = true; } }); @@ -373,10 +388,11 @@ function fnModalVisibleByEdit(roleId?: string | number) { modalState.menuTree.checkedKeys = checkedKeys; modalState.from.menuIds = checkedKeys; } - modalState.title = '修改角色信息'; + modalState.title = + t('common.editText') + t('views.system.role.roleInfo'); modalState.visibleByEdit = true; } else { - message.error(`获取角色信息失败`, 2); + message.error(t('common.getInfoFail'), 2); } }); } @@ -399,7 +415,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, }); @@ -419,7 +435,7 @@ function fnModalOk() { }); }) .catch(e => { - message.error(`请正确填写 ${e.errorFields.length} 处必填信息!`, 2); + message.error(t('common.errorFields', { num: e.errorFields.length }), 3); }); } @@ -510,7 +526,7 @@ function fnModalOkDataScope() { .then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: `${modalState.title}成功`, + content: t('common.msgSuccess', { msg: modalState.title }), duration: 2, }); modalState.visibleByDataScope = false; @@ -534,7 +550,7 @@ function fnModalOkDataScope() { */ function fnRecordDataScope(roleId: string | number) { if (!roleId) { - message.error(`角色记录存在错误`, 2); + message.error(t('common.getInfoFail'), 2); return; } if (modalState.confirmLoading) return; @@ -554,10 +570,10 @@ function fnRecordDataScope(roleId: string | number) { modalState.deptTree.checkedKeys = checkedKeys; modalState.from.deptIds = checkedKeys; } - modalState.title = '分配数据权限'; + modalState.title = t('views.system.role.distribute'); modalState.visibleByDataScope = true; } else { - message.error(`获取角色信息失败`, 2); + message.error(t('common.getInfoFail'), 2); } }) .finally(() => { @@ -584,22 +600,31 @@ function fnRecordAuthUser(row: Record) { * @param row 角色记录对象 */ function fnRecordStatus(row: Record) { - const text = row.status === '1' ? '启用' : '停用'; + const text = + row.status === '1' + ? t('views.system.role.open') + : t('views.system.role.close'); Modal.confirm({ title: t('common.tipTitle'), - content: `确定要${text} ${row.roleName} 角色吗?`, + content: t('views.system.role.statusSure', { + text: text, + roleName: row.roleName, + }), onOk() { const hide = message.loading(t('common.loading'), 0); changeRoleStatus(row.roleId, row.status).then(res => { hide(); if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: `${row.roleName} ${text}成功`, + content: `${row.roleName} ${text} ${t('common.msgSuccess')}`, duration: 2, }); } else { message.error({ - content: `${row.roleName} ${text}失败`, + content: t('views.system.role.statusSure', { + text: text, + roleName: row.roleName, + }), duration: 2, }); } @@ -622,14 +647,14 @@ function fnRecordDelete(roleId: string = '0') { } Modal.confirm({ title: t('common.tipTitle'), - content: `确认删除角色编号为 【${roleId}】 的数据项?`, + content: t('views.system.role.delSure', { roleId: roleId }), onOk() { const key = 'delRole'; message.loading({ content: t('common.loading'), key }); delRole(roleId).then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: `删除成功`, + content: t('common.msgSuccess', { msg: t('common.deleteText ') }), key, duration: 2, }); @@ -650,14 +675,16 @@ function fnRecordDelete(roleId: string = '0') { function fnExportList() { Modal.confirm({ title: t('common.tipTitle'), - content: `确认根据搜索条件导出xlsx表格文件吗?`, + content: t('views.system.user.exportSure'), onOk() { const key = 'exportRole'; message.loading({ content: t('common.loading'), key }); exportRole(toRaw(queryParams)).then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: `已完成导出`, + content: t('common.msgSuccess', { + msg: t('views.system.user.export'), + }), key, duration: 2, }); @@ -678,7 +705,7 @@ function fnExportList() { function fnGetList(pageNum?: number) { if (tableState.loading) return; tableState.loading = true; - if(pageNum){ + if (pageNum) { queryParams.pageNum = pageNum; } if (!queryRangePicker.value) { @@ -722,42 +749,47 @@ onMounted(() => { - + - + - + - + @@ -767,11 +799,11 @@ onMounted(() => { - 搜索 + {{ t('common.search') }} - 重置 + {{ t('common.reset') }} @@ -790,7 +822,7 @@ onMounted(() => { v-perms:has="['system:role:add']" > - 新建 + {{ t('common.addText') }} { v-perms:has="['system:role:remove']" > - 删除 + {{ t('common.deleteText') }} { v-perms:has="['system:role:export']" > - 导出 + {{ t('common.export') }} @@ -817,31 +849,31 @@ onMounted(() => { @@ -886,9 +924,9 @@ onMounted(() => { " v-model:checked="record.status" checked-value="1" - checked-children="正常" + :checked-children="t('views.system.role.normal')" un-checked-value="0" - un-checked-children="暂停" + :un-checked-children="t('views.system.role.stop')" size="small" @change="fnRecordStatus(record)" /> @@ -901,7 +939,7 @@ onMounted(() => {