From 973534a6ab10349592c233e29ebac76c21c31d78 Mon Sep 17 00:00:00 2001 From: lai <371757574@qq.com> Date: Fri, 10 Nov 2023 15:35:37 +0800 Subject: [PATCH] =?UTF-8?q?--=E9=83=A8=E9=97=A8=E7=AE=A1=E7=90=86=E7=9A=84?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/locales/en-US.ts | 20 ++++ src/i18n/locales/zh-CN.ts | 22 +++- src/views/system/dept/index.vue | 171 ++++++++++++++++++-------------- 3 files changed, 140 insertions(+), 73 deletions(-) diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index f3348e5f..e11bcb20 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -668,6 +668,26 @@ export default { stop:'Pause', preScope:'Scope of authority', dataPer:'Data permission', + }, + dept:{ + classInfo:'Department information', + className:'Department name', + classId:'Department Number', + classSort:'Department sorting', + status:'Position status', + createTime:'Creation time', + highClass:'Higher office', + emailTip:'Please input the correct email address', + phoneTip:'Please enter the correct phone number', + node:'Root node', + delSure:'Are you sure to delete the data item with department number [{deptId}]?', + open:'Exhibition', + close:'Fold', + addClass:'Add new sub-department', + showSort:'Show sort', + admin:'Principal', + phone:'Contact number', + email:'Mail', } }, }, diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 5b4989ee..517ea9e4 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -668,7 +668,27 @@ export default { stop:'暂停', preScope:'权限范围', dataPer:'数据权限', - } + }, + dept:{ + classInfo:'部门信息', + className:'部门名称', + classId:'部门编号', + classSort:'部门排序', + status:'岗位状态', + createTime:'创建时间', + highClass:'上级部门', + emailTip:'请输入正确的邮箱地址', + phoneTip:'请输入正确的手机号码', + node:'根节点', + delSure:'确认删除部门编号为 【{deptId}】 的数据项?', + open:'展', + close:'折', + addClass:'新增子部门', + showSort:'显示排序', + admin:'负责人', + phone:'联系电话', + email:'邮箱', + }, }, }, }; diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index 163280f6..27f2bbf2 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -82,28 +82,28 @@ let tableState: TabeStateType = reactive({ /**表格字段列 */ let tableColumns: ColumnsType = [ { - title: '部门名称', + title: t('views.system.dept.className'), dataIndex: 'deptName', align: 'center', }, { - title: '部门编号', + title: t('views.system.dept.classId'), dataIndex: 'deptId', align: 'center', }, { - title: '部门排序', + title: t('views.system.dept.className'), dataIndex: 'orderNum', align: 'center', }, { - title: '岗位状态', + title: t('views.system.dept.status'), dataIndex: 'status', key: 'status', align: 'center', }, { - title: '创建时间', + title: t('views.system.dept.createTime'), dataIndex: 'createTime', align: 'center', customRender(opt) { @@ -112,7 +112,7 @@ let tableColumns: ColumnsType = [ }, }, { - title: '操作', + title: t('common.operate'), key: 'deptId', align: 'center', }, @@ -182,22 +182,32 @@ let modalState: ModalStateType = reactive({ const modalStateFrom = Form.useForm( modalState.from, reactive({ - parentId: [{ required: true, message: '上级部门不能为空' }], + parentId: [ + { + required: true, + message: t('views.system.dept.highClass') + t('common.unableNull'), + }, + ], deptName: [ - { required: true, min: 1, max: 30, message: '请正确输入部门名称' }, + { + required: true, + min: 1, + max: 30, + message: t('views.system.dept.className') + t('common.unableNull'), + }, ], email: [ { required: false, pattern: regExpEmail, - message: '请输入正确的邮箱地址', + message: t('views.system.dept.emailTip'), }, ], phone: [ { required: false, pattern: regExpMobile, - message: '请输入正确的手机号码', + message: t('views.system.dept.phoneTip'), }, ], }) @@ -209,7 +219,7 @@ const modalStateFrom = Form.useForm( */ function fnModalVisibleByVive(deptId: string | number) { if (!deptId) { - message.error(`部门记录存在错误`, 2); + message.error(t('common.getInfoFail'), 2); return; } if (modalState.confirmLoading) return; @@ -221,16 +231,16 @@ function fnModalVisibleByVive(deptId: string | number) { if (res.code === RESULT_CODE_SUCCESS && res.data) { if (res.data.parentId === '0') { modalState.treeData = [ - { deptId: '0', parentId: '0', deptName: '根节点' }, + { deptId: '0', parentId: '0', deptName: t('views.system.dept.node') }, ]; } else { modalState.treeData = treeDataAll; } modalState.from = Object.assign(modalState.from, res.data); - modalState.title = '部门信息'; + modalState.title = t('views.system.dept.classInfo'); modalState.visibleByView = true; } else { - message.error(`获取部门信息失败`, 2); + message.error(t('common.getInfoFail'), 2); } }); } @@ -250,7 +260,7 @@ function fnModalVisibleByEdit( modalState.from.parentId = parentId; } modalState.treeData = treeDataAll; - modalState.title = '添加部门信息'; + modalState.title = t('common.addText') + t('views.system.dept.classInfo'); modalState.visibleByEdit = true; } else { if (modalState.confirmLoading) return; @@ -267,16 +277,21 @@ function fnModalVisibleByEdit( ) { if (resArr[1].data.length === 0) { modalState.treeData = [ - { deptId: '0', parentId: '0', deptName: '根节点' }, + { + deptId: '0', + parentId: '0', + deptName: t('views.system.dept.node'), + }, ]; } else { modalState.treeData = parseDataToTree(resArr[1].data, 'deptId'); } } - modalState.title = '修改部门信息'; + modalState.title = + t('common.editText') + t('views.system.dept.classInfo'); modalState.visibleByEdit = true; } else { - message.error(`获取部门信息失败`, 2); + message.error(t('common.getInfoFail'), 2); } }) .finally(() => { @@ -302,7 +317,7 @@ function fnModalOk() { .then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: `${modalState.title}成功`, + content: t('common.msgSuccess', { msg: modalState.title }), duration: 2, }); modalState.visibleByEdit = false; @@ -325,7 +340,7 @@ function fnModalOk() { }); }) .catch(e => { - message.error(`请正确填写 ${e.errorFields.length} 处必填信息!`, 2); + message.error(t('common.errorFields', { num: e.errorFields.length }), 2); }); } @@ -346,14 +361,14 @@ function fnModalCancel() { function fnRecordDelete(deptId: string | number) { Modal.confirm({ title: t('common.tipTitle'), - content: `确认删除部门编号为 【${deptId}】 的数据项?`, + content: t('views.system.dept.delSure', { deptId: deptId }), onOk() { const hide = message.loading(t('common.loading'), 0); delDept(deptId).then(res => { hide(); if (res.code === RESULT_CODE_SUCCESS) { message.success({ - content: `删除成功`, + content: t('common.msgSuccess', { msg: t('common.deleteText ') }), duration: 2, }); fnGetList(); @@ -412,20 +427,21 @@ onMounted(() => { - + - + @@ -436,11 +452,11 @@ onMounted(() => { - 搜索 + {{ t('common.search') }} + - 重置 @@ -459,7 +475,7 @@ onMounted(() => { v-perms:has="['system:dept:add']" > - 新建 + {{ t('common.addText') }} @@ -468,41 +484,41 @@ onMounted(() => { @@ -543,7 +565,7 @@ onMounted(() => {