--部门管理的国际化

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', stop:'Pause',
preScope:'Scope of authority', preScope:'Scope of authority',
dataPer:'Data permission', 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:'暂停', stop:'暂停',
preScope:'权限范围', preScope:'权限范围',
dataPer:'数据权限', 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 = [ let tableColumns: ColumnsType = [
{ {
title: '部门名称', title: t('views.system.dept.className'),
dataIndex: 'deptName', dataIndex: 'deptName',
align: 'center', align: 'center',
}, },
{ {
title: '部门编号', title: t('views.system.dept.classId'),
dataIndex: 'deptId', dataIndex: 'deptId',
align: 'center', align: 'center',
}, },
{ {
title: '部门排序', title: t('views.system.dept.className'),
dataIndex: 'orderNum', dataIndex: 'orderNum',
align: 'center', align: 'center',
}, },
{ {
title: '岗位状态', title: t('views.system.dept.status'),
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
align: 'center', align: 'center',
}, },
{ {
title: '创建时间', title: t('views.system.dept.createTime'),
dataIndex: 'createTime', dataIndex: 'createTime',
align: 'center', align: 'center',
customRender(opt) { customRender(opt) {
@@ -112,7 +112,7 @@ let tableColumns: ColumnsType = [
}, },
}, },
{ {
title: '操作', title: t('common.operate'),
key: 'deptId', key: 'deptId',
align: 'center', align: 'center',
}, },
@@ -182,22 +182,32 @@ let modalState: ModalStateType = reactive({
const modalStateFrom = Form.useForm( const modalStateFrom = Form.useForm(
modalState.from, modalState.from,
reactive({ reactive({
parentId: [{ required: true, message: '上级部门不能为空' }], parentId: [
{
required: true,
message: t('views.system.dept.highClass') + t('common.unableNull'),
},
],
deptName: [ deptName: [
{ required: true, min: 1, max: 30, message: '请正确输入部门名称' }, {
required: true,
min: 1,
max: 30,
message: t('views.system.dept.className') + t('common.unableNull'),
},
], ],
email: [ email: [
{ {
required: false, required: false,
pattern: regExpEmail, pattern: regExpEmail,
message: '请输入正确的邮箱地址', message: t('views.system.dept.emailTip'),
}, },
], ],
phone: [ phone: [
{ {
required: false, required: false,
pattern: regExpMobile, pattern: regExpMobile,
message: '请输入正确的手机号码', message: t('views.system.dept.phoneTip'),
}, },
], ],
}) })
@@ -209,7 +219,7 @@ const modalStateFrom = Form.useForm(
*/ */
function fnModalVisibleByVive(deptId: string | number) { function fnModalVisibleByVive(deptId: string | number) {
if (!deptId) { if (!deptId) {
message.error(`部门记录存在错误`, 2); message.error(t('common.getInfoFail'), 2);
return; return;
} }
if (modalState.confirmLoading) return; if (modalState.confirmLoading) return;
@@ -221,16 +231,16 @@ function fnModalVisibleByVive(deptId: string | number) {
if (res.code === RESULT_CODE_SUCCESS && res.data) { if (res.code === RESULT_CODE_SUCCESS && res.data) {
if (res.data.parentId === '0') { if (res.data.parentId === '0') {
modalState.treeData = [ modalState.treeData = [
{ deptId: '0', parentId: '0', deptName: '根节点' }, { deptId: '0', parentId: '0', deptName: t('views.system.dept.node') },
]; ];
} else { } else {
modalState.treeData = treeDataAll; modalState.treeData = treeDataAll;
} }
modalState.from = Object.assign(modalState.from, res.data); modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '部门信息'; modalState.title = t('views.system.dept.classInfo');
modalState.visibleByView = true; modalState.visibleByView = true;
} else { } else {
message.error(`获取部门信息失败`, 2); message.error(t('common.getInfoFail'), 2);
} }
}); });
} }
@@ -250,7 +260,7 @@ function fnModalVisibleByEdit(
modalState.from.parentId = parentId; modalState.from.parentId = parentId;
} }
modalState.treeData = treeDataAll; modalState.treeData = treeDataAll;
modalState.title = '添加部门信息'; modalState.title = t('common.addText') + t('views.system.dept.classInfo');
modalState.visibleByEdit = true; modalState.visibleByEdit = true;
} else { } else {
if (modalState.confirmLoading) return; if (modalState.confirmLoading) return;
@@ -267,16 +277,21 @@ function fnModalVisibleByEdit(
) { ) {
if (resArr[1].data.length === 0) { if (resArr[1].data.length === 0) {
modalState.treeData = [ modalState.treeData = [
{ deptId: '0', parentId: '0', deptName: '根节点' }, {
deptId: '0',
parentId: '0',
deptName: t('views.system.dept.node'),
},
]; ];
} else { } else {
modalState.treeData = parseDataToTree(resArr[1].data, 'deptId'); modalState.treeData = parseDataToTree(resArr[1].data, 'deptId');
} }
} }
modalState.title = '修改部门信息'; modalState.title =
t('common.editText') + t('views.system.dept.classInfo');
modalState.visibleByEdit = true; modalState.visibleByEdit = true;
} else { } else {
message.error(`获取部门信息失败`, 2); message.error(t('common.getInfoFail'), 2);
} }
}) })
.finally(() => { .finally(() => {
@@ -302,7 +317,7 @@ function fnModalOk() {
.then(res => { .then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
message.success({ message.success({
content: `${modalState.title}成功`, content: t('common.msgSuccess', { msg: modalState.title }),
duration: 2, duration: 2,
}); });
modalState.visibleByEdit = false; modalState.visibleByEdit = false;
@@ -325,7 +340,7 @@ function fnModalOk() {
}); });
}) })
.catch(e => { .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) { function fnRecordDelete(deptId: string | number) {
Modal.confirm({ Modal.confirm({
title: t('common.tipTitle'), title: t('common.tipTitle'),
content: `确认删除部门编号为 【${deptId}】 的数据项?`, content: t('views.system.dept.delSure', { deptId: deptId }),
onOk() { onOk() {
const hide = message.loading(t('common.loading'), 0); const hide = message.loading(t('common.loading'), 0);
delDept(deptId).then(res => { delDept(deptId).then(res => {
hide(); hide();
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
message.success({ message.success({
content: `删除成功`, content: t('common.msgSuccess', { msg: t('common.deleteText ') }),
duration: 2, duration: 2,
}); });
fnGetList(); fnGetList();
@@ -412,20 +427,21 @@ onMounted(() => {
<a-form :model="queryParams" name="queryParams" layout="horizontal"> <a-form :model="queryParams" name="queryParams" layout="horizontal">
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24"> <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 <a-input
v-model:value="queryParams.deptName" v-model:value="queryParams.deptName"
allow-clear allow-clear
placeholder="请输入部门名称"
></a-input> ></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :xs="24"> <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 <a-select
v-model:value="queryParams.status" v-model:value="queryParams.status"
allow-clear allow-clear
placeholder="请选择"
:options="dict.sysNormalDisable" :options="dict.sysNormalDisable"
> >
</a-select> </a-select>
@@ -436,11 +452,11 @@ onMounted(() => {
<a-space :size="8"> <a-space :size="8">
<a-button type="primary" @click.prevent="fnGetList"> <a-button type="primary" @click.prevent="fnGetList">
<template #icon><SearchOutlined /></template> <template #icon><SearchOutlined /></template>
搜索</a-button {{ t('common.search') }}
> </a-button>
<a-button type="default" @click.prevent="fnQueryReset"> <a-button type="default" @click.prevent="fnQueryReset">
<template #icon><ClearOutlined /></template> <template #icon><ClearOutlined /></template>
重置</a-button {{ t('common.reset') }}</a-button
> >
</a-space> </a-space>
</a-form-item> </a-form-item>
@@ -459,7 +475,7 @@ onMounted(() => {
v-perms:has="['system:dept:add']" v-perms:has="['system:dept:add']"
> >
<template #icon><PlusOutlined /></template> <template #icon><PlusOutlined /></template>
新建 {{ t('common.addText') }}
</a-button> </a-button>
</a-space> </a-space>
</template> </template>
@@ -468,41 +484,41 @@ onMounted(() => {
<template #extra> <template #extra>
<a-space :size="8" align="center"> <a-space :size="8" align="center">
<a-tooltip> <a-tooltip>
<template #title>展开/折叠</template> <template #title>{{ t('views.system.role.openSwitch') }}</template>
<a-switch <a-switch
v-model:checked="tableState.expandedRowAll" v-model:checked="tableState.expandedRowAll"
checked-children="" :checked-children="t('views.system.dept.open')"
un-checked-children="" :un-checked-children="t('views.system.dept.open')"
size="small" size="small"
@change="fnTableExpandedRowsAll" @change="fnTableExpandedRowsAll"
/> />
</a-tooltip> </a-tooltip>
<a-tooltip> <a-tooltip>
<template #title>搜索栏</template> <template #title>{{ t('common.searchBarText') }}</template>
<a-switch <a-switch
v-model:checked="tableState.seached" v-model:checked="tableState.seached"
checked-children="" :checked-children="t('common.switch.show')"
un-checked-children="" :un-checked-children="t('common.switch.hide')"
size="small" size="small"
/> />
</a-tooltip> </a-tooltip>
<a-tooltip> <a-tooltip>
<template #title>表格斑马纹</template> <template #title>{{ t('common.zebra') }}</template>
<a-switch <a-switch
v-model:checked="tableState.striped" v-model:checked="tableState.striped"
checked-children="" :checked-children="t('common.switch.show')"
un-checked-children="" :un-checked-children="t('common.switch.hide')"
size="small" size="small"
/> />
</a-tooltip> </a-tooltip>
<a-tooltip> <a-tooltip>
<template #title>刷新</template> <template #title>{{ t('common.reloadText') }}</template>
<a-button type="text" @click.prevent="fnGetList"> <a-button type="text" @click.prevent="fnGetList">
<template #icon><ReloadOutlined /></template> <template #icon><ReloadOutlined /></template>
</a-button> </a-button>
</a-tooltip> </a-tooltip>
<a-tooltip placement="topRight"> <a-tooltip placement="topRight">
<template #title>密度</template> <template #title>{{ t('common.sizeText') }}</template>
<a-dropdown placement="bottomRight" trigger="click"> <a-dropdown placement="bottomRight" trigger="click">
<a-button type="text"> <a-button type="text">
<template #icon><ColumnHeightOutlined /></template> <template #icon><ColumnHeightOutlined /></template>
@@ -512,9 +528,15 @@ onMounted(() => {
:selected-keys="[tableState.size as string]" :selected-keys="[tableState.size as string]"
@click="fnTableSize" @click="fnTableSize"
> >
<a-menu-item key="default">默认</a-menu-item> <a-menu-item key="default"
<a-menu-item key="middle">中等</a-menu-item> >{{ t('common.size.default') }}
<a-menu-item key="small">紧凑</a-menu-item> </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> </a-menu>
</template> </template>
</a-dropdown> </a-dropdown>
@@ -543,7 +565,7 @@ onMounted(() => {
<template v-if="column.key === 'deptId'"> <template v-if="column.key === 'deptId'">
<a-space :size="8" align="center"> <a-space :size="8" align="center">
<a-tooltip> <a-tooltip>
<template #title>查看详情</template> <template #title>{{ t('common.viewText') }}</template>
<a-button <a-button
type="link" type="link"
@click.prevent="fnModalVisibleByVive(record.deptId)" @click.prevent="fnModalVisibleByVive(record.deptId)"
@@ -553,7 +575,7 @@ onMounted(() => {
</a-button> </a-button>
</a-tooltip> </a-tooltip>
<a-tooltip> <a-tooltip>
<template #title>编辑</template> <template #title>{{ t('common.editText') }}</template>
<a-button <a-button
type="link" type="link"
@click.prevent="fnModalVisibleByEdit(record.deptId)" @click.prevent="fnModalVisibleByEdit(record.deptId)"
@@ -563,7 +585,7 @@ onMounted(() => {
</a-button> </a-button>
</a-tooltip> </a-tooltip>
<a-tooltip v-if="record.parentId !== '0'"> <a-tooltip v-if="record.parentId !== '0'">
<template #title>删除</template> <template #title>{{ t('common.deleteText') }}</template>
<a-button <a-button
type="link" type="link"
@click.prevent="fnRecordDelete(record.deptId)" @click.prevent="fnRecordDelete(record.deptId)"
@@ -573,7 +595,9 @@ onMounted(() => {
</a-button> </a-button>
</a-tooltip> </a-tooltip>
<a-tooltip v-if="record.status !== '0'"> <a-tooltip v-if="record.status !== '0'">
<template #title>新增子部门</template> <template #title>{{
t('views.system.dept.addClass')
}}</template>
<a-button <a-button
type="link" type="link"
@click.prevent=" @click.prevent="
@@ -600,10 +624,12 @@ onMounted(() => {
<a-form layout="horizontal"> <a-form layout="horizontal">
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24"> <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 <a-tree-select
:value="modalState.from.parentId" :value="modalState.from.parentId"
placeholder="上级部门"
disabled disabled
:tree-data="modalState.treeData" :tree-data="modalState.treeData"
:field-names="{ :field-names="{
@@ -618,14 +644,17 @@ onMounted(() => {
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12" :md="12" :xs="24"> <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 }} {{ modalState.from.orderNum }}
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24"> <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 <DictTag
:options="dict.sysNormalDisable" :options="dict.sysNormalDisable"
:value="modalState.from.status" :value="modalState.from.status"
@@ -633,38 +662,43 @@ onMounted(() => {
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12" :md="12" :xs="24"> <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 }} {{ modalState.from.deptId }}
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24"> <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 }} {{ modalState.from.deptName }}
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12" :md="12" :xs="24"> <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 }} {{ modalState.from.leader }}
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24"> <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 }} {{ modalState.from.phone }}
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12" :md="12" :xs="24"> <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 }} {{ modalState.from.email }}
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
<template #footer> <template #footer>
<a-button key="cancel" @click="fnModalCancel">关闭</a-button> <a-button key="cancel" @click="fnModalCancel">{{
t('common.cancel')
}}</a-button>
</template> </template>
</a-modal> </a-modal>
@@ -681,13 +715,12 @@ onMounted(() => {
> >
<a-form name="modalStateFrom" layout="horizontal"> <a-form name="modalStateFrom" layout="horizontal">
<a-form-item <a-form-item
label="上级部门" :label="t('views.system.dept.highClass')"
name="parentId" name="parentId"
v-bind="modalStateFrom.validateInfos.parentId" v-bind="modalStateFrom.validateInfos.parentId"
> >
<a-tree-select <a-tree-select
v-model:value="modalState.from.parentId" v-model:value="modalState.from.parentId"
placeholder="上级部门"
show-search show-search
tree-default-expand-all tree-default-expand-all
:tree-data="modalState.treeData" :tree-data="modalState.treeData"
@@ -705,7 +738,7 @@ onMounted(() => {
</a-form-item> </a-form-item>
<a-form-item <a-form-item
label="部门名称" :label="t('views.system.dept.className')"
name="deptName" name="deptName"
v-bind="modalStateFrom.validateInfos.deptName" v-bind="modalStateFrom.validateInfos.deptName"
> >
@@ -713,43 +746,39 @@ onMounted(() => {
v-model:value="modalState.from.deptName" v-model:value="modalState.from.deptName"
allow-clear allow-clear
:maxlength="30" :maxlength="30"
placeholder="请输入部门名称"
></a-input> ></a-input>
</a-form-item> </a-form-item>
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24"> <a-col :lg="12" :md="12" :xs="24">
<a-form-item <a-form-item
label="负责人" :label="t('views.system.dept.admin')"
name="leader" name="leader"
v-bind="modalStateFrom.validateInfos.leader" v-bind="modalStateFrom.validateInfos.leader"
> >
<a-input <a-input
v-model:value="modalState.from.leader" v-model:value="modalState.from.leader"
allow-clear allow-clear
placeholder="请输入负责人名称"
></a-input> ></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="6" :xs="24"> <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 <a-select
v-model:value="modalState.from.status" v-model:value="modalState.from.status"
default-value="0" default-value="0"
placeholder="岗位状态"
:options="dict.sysNormalDisable" :options="dict.sysNormalDisable"
> >
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="6" :xs="24"> <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 <a-input-number
v-model:value="modalState.from.orderNum" v-model:value="modalState.from.orderNum"
:min="0" :min="0"
:max="9999" :max="9999"
:step="1" :step="1"
placeholder="排序值"
></a-input-number> ></a-input-number>
</a-form-item> </a-form-item>
</a-col> </a-col>
@@ -758,7 +787,7 @@ onMounted(() => {
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24"> <a-col :lg="12" :md="12" :xs="24">
<a-form-item <a-form-item
label="联系电话" :label="t('views.system.dept.phone')"
name="phone" name="phone"
v-bind="modalStateFrom.validateInfos.phone" v-bind="modalStateFrom.validateInfos.phone"
> >
@@ -766,13 +795,12 @@ onMounted(() => {
v-model:value="modalState.from.phone" v-model:value="modalState.from.phone"
allow-clear allow-clear
:maxlength="11" :maxlength="11"
placeholder="请输入负责人联系电话"
></a-input> ></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="12" :md="12" :xs="24"> <a-col :lg="12" :md="12" :xs="24">
<a-form-item <a-form-item
label="邮箱" :label="t('views.system.dept.email')"
name="email" name="email"
v-bind="modalStateFrom.validateInfos.email" v-bind="modalStateFrom.validateInfos.email"
> >
@@ -780,7 +808,6 @@ onMounted(() => {
v-model:value="modalState.from.email" v-model:value="modalState.from.email"
allow-clear allow-clear
:maxlength="40" :maxlength="40"
placeholder="请输入负责人邮箱"
></a-input> ></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>