--部门管理的国际化

This commit is contained in:
lai
2023-11-10 15:35:37 +08:00
parent 9778244167
commit 973534a6ab
3 changed files with 140 additions and 73 deletions

View File

@@ -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',
}
},
},

View File

@@ -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:'邮箱',
},
},
},
};

View File

@@ -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(() => {
<a-form :model="queryParams" name="queryParams" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="部门名称" name="deptName">
<a-form-item
:label="t('views.system.dept.className')"
name="deptName"
>
<a-input
v-model:value="queryParams.deptName"
allow-clear
placeholder="请输入部门名称"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="岗位状态" name="status">
<a-form-item :label="t('views.system.dept.status')" name="status">
<a-select
v-model:value="queryParams.status"
allow-clear
placeholder="请选择"
:options="dict.sysNormalDisable"
>
</a-select>
@@ -436,11 +452,11 @@ onMounted(() => {
<a-space :size="8">
<a-button type="primary" @click.prevent="fnGetList">
<template #icon><SearchOutlined /></template>
搜索</a-button
>
{{ t('common.search') }}
</a-button>
<a-button type="default" @click.prevent="fnQueryReset">
<template #icon><ClearOutlined /></template>
重置</a-button
{{ t('common.reset') }}</a-button
>
</a-space>
</a-form-item>
@@ -459,7 +475,7 @@ onMounted(() => {
v-perms:has="['system:dept:add']"
>
<template #icon><PlusOutlined /></template>
新建
{{ t('common.addText') }}
</a-button>
</a-space>
</template>
@@ -468,41 +484,41 @@ onMounted(() => {
<template #extra>
<a-space :size="8" align="center">
<a-tooltip>
<template #title>展开/折叠</template>
<template #title>{{ t('views.system.role.openSwitch') }}</template>
<a-switch
v-model:checked="tableState.expandedRowAll"
checked-children=""
un-checked-children=""
:checked-children="t('views.system.dept.open')"
:un-checked-children="t('views.system.dept.open')"
size="small"
@change="fnTableExpandedRowsAll"
/>
</a-tooltip>
<a-tooltip>
<template #title>搜索栏</template>
<template #title>{{ t('common.searchBarText') }}</template>
<a-switch
v-model:checked="tableState.seached"
checked-children=""
un-checked-children=""
:checked-children="t('common.switch.show')"
:un-checked-children="t('common.switch.hide')"
size="small"
/>
</a-tooltip>
<a-tooltip>
<template #title>表格斑马纹</template>
<template #title>{{ t('common.zebra') }}</template>
<a-switch
v-model:checked="tableState.striped"
checked-children=""
un-checked-children=""
:checked-children="t('common.switch.show')"
:un-checked-children="t('common.switch.hide')"
size="small"
/>
</a-tooltip>
<a-tooltip>
<template #title>刷新</template>
<template #title>{{ t('common.reloadText') }}</template>
<a-button type="text" @click.prevent="fnGetList">
<template #icon><ReloadOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip placement="topRight">
<template #title>密度</template>
<template #title>{{ t('common.sizeText') }}</template>
<a-dropdown placement="bottomRight" trigger="click">
<a-button type="text">
<template #icon><ColumnHeightOutlined /></template>
@@ -512,9 +528,15 @@ onMounted(() => {
:selected-keys="[tableState.size as string]"
@click="fnTableSize"
>
<a-menu-item key="default">默认</a-menu-item>
<a-menu-item key="middle">中等</a-menu-item>
<a-menu-item key="small">紧凑</a-menu-item>
<a-menu-item key="default"
>{{ t('common.size.default') }}
</a-menu-item>
<a-menu-item key="middle"
>{{ t('common.size.middle') }}
</a-menu-item>
<a-menu-item key="small"
>{{ t('common.size.small') }}
</a-menu-item>
</a-menu>
</template>
</a-dropdown>
@@ -543,7 +565,7 @@ onMounted(() => {
<template v-if="column.key === 'deptId'">
<a-space :size="8" align="center">
<a-tooltip>
<template #title>查看详情</template>
<template #title>{{ t('common.viewText') }}</template>
<a-button
type="link"
@click.prevent="fnModalVisibleByVive(record.deptId)"
@@ -553,7 +575,7 @@ onMounted(() => {
</a-button>
</a-tooltip>
<a-tooltip>
<template #title>编辑</template>
<template #title>{{ t('common.editText') }}</template>
<a-button
type="link"
@click.prevent="fnModalVisibleByEdit(record.deptId)"
@@ -563,7 +585,7 @@ onMounted(() => {
</a-button>
</a-tooltip>
<a-tooltip v-if="record.parentId !== '0'">
<template #title>删除</template>
<template #title>{{ t('common.deleteText') }}</template>
<a-button
type="link"
@click.prevent="fnRecordDelete(record.deptId)"
@@ -573,7 +595,9 @@ onMounted(() => {
</a-button>
</a-tooltip>
<a-tooltip v-if="record.status !== '0'">
<template #title>新增子部门</template>
<template #title>{{
t('views.system.dept.addClass')
}}</template>
<a-button
type="link"
@click.prevent="
@@ -600,10 +624,12 @@ onMounted(() => {
<a-form layout="horizontal">
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="上级部门" name="parentId">
<a-form-item
:label="t('views.system.dept.highClass')"
name="parentId"
>
<a-tree-select
:value="modalState.from.parentId"
placeholder="上级部门"
disabled
:tree-data="modalState.treeData"
:field-names="{
@@ -618,14 +644,17 @@ onMounted(() => {
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="显示排序" name="orderNum">
<a-form-item
:label="t('views.system.dept.showSort')"
name="orderNum"
>
{{ modalState.from.orderNum }}
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="部门状态" name="status">
<a-form-item :label="t('views.system.dept.status')" name="status">
<DictTag
:options="dict.sysNormalDisable"
:value="modalState.from.status"
@@ -633,38 +662,43 @@ onMounted(() => {
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="部门编号" name="deptId">
<a-form-item :label="t('views.system.dept.classId')" name="deptId">
{{ modalState.from.deptId }}
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="部门名称" name="deptName">
<a-form-item
:label="t('views.system.dept.className')"
name="deptName"
>
{{ modalState.from.deptName }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="负责人" name="leader">
<a-form-item :label="t('views.system.dept.admin')" name="leader">
{{ modalState.from.leader }}
</a-form-item>
</a-col>
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="联系电话" name="phone">
<a-form-item :label="t('views.system.dept.phone')" name="phone">
{{ modalState.from.phone }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="邮箱" name="email">
<a-form-item :label="t('views.system.dept.email')" name="email">
{{ modalState.from.email }}
</a-form-item>
</a-col>
</a-row>
</a-form>
<template #footer>
<a-button key="cancel" @click="fnModalCancel">关闭</a-button>
<a-button key="cancel" @click="fnModalCancel">{{
t('common.cancel')
}}</a-button>
</template>
</a-modal>
@@ -681,13 +715,12 @@ onMounted(() => {
>
<a-form name="modalStateFrom" layout="horizontal">
<a-form-item
label="上级部门"
:label="t('views.system.dept.highClass')"
name="parentId"
v-bind="modalStateFrom.validateInfos.parentId"
>
<a-tree-select
v-model:value="modalState.from.parentId"
placeholder="上级部门"
show-search
tree-default-expand-all
:tree-data="modalState.treeData"
@@ -705,7 +738,7 @@ onMounted(() => {
</a-form-item>
<a-form-item
label="部门名称"
:label="t('views.system.dept.className')"
name="deptName"
v-bind="modalStateFrom.validateInfos.deptName"
>
@@ -713,43 +746,39 @@ onMounted(() => {
v-model:value="modalState.from.deptName"
allow-clear
:maxlength="30"
placeholder="请输入部门名称"
></a-input>
</a-form-item>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="负责人"
:label="t('views.system.dept.admin')"
name="leader"
v-bind="modalStateFrom.validateInfos.leader"
>
<a-input
v-model:value="modalState.from.leader"
allow-clear
placeholder="请输入负责人名称"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="岗位状态" name="status">
<a-form-item :label="t('views.system.dept.status')" name="status">
<a-select
v-model:value="modalState.from.status"
default-value="0"
placeholder="岗位状态"
:options="dict.sysNormalDisable"
>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="6" :xs="24">
<a-form-item label="显示顺序" name="orderNum">
<a-form-item :label="t('views.system.dept.showSort')" name="orderNum">
<a-input-number
v-model:value="modalState.from.orderNum"
:min="0"
:max="9999"
:step="1"
placeholder="排序值"
></a-input-number>
</a-form-item>
</a-col>
@@ -758,7 +787,7 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="联系电话"
:label="t('views.system.dept.phone')"
name="phone"
v-bind="modalStateFrom.validateInfos.phone"
>
@@ -766,13 +795,12 @@ onMounted(() => {
v-model:value="modalState.from.phone"
allow-clear
:maxlength="11"
placeholder="请输入负责人联系电话"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="邮箱"
:label="t('views.system.dept.email')"
name="email"
v-bind="modalStateFrom.validateInfos.email"
>
@@ -780,7 +808,6 @@ onMounted(() => {
v-model:value="modalState.from.email"
allow-clear
:maxlength="40"
placeholder="请输入负责人邮箱"
></a-input>
</a-form-item>
</a-col>