--新增岗位管理国际化

This commit is contained in:
lai
2023-11-10 15:57:49 +08:00
parent 0bc4db4a52
commit 1d4db90b1e
3 changed files with 140 additions and 67 deletions

View File

@@ -699,7 +699,7 @@ export default {
dataPer:'Data permission',
},
dept:{
classInfo:'Department information',
classInfo:' Department information',
className:'Department name',
classId:'Department Number',
classSort:'Department sorting',
@@ -717,6 +717,19 @@ export default {
admin:'Principal',
phone:'Contact number',
email:'Mail',
},
post:{
positionInfo:'Position information',
positionId:'Position number',
positionCode:'Position code',
positionName:'Position name',
positionSort:'Position sorting',
positionStatus:'Position status',
positionMark:'Position description',
createTime:'Creation time',
codeTip:'Please enter the position code correctly',
nameTip:'Please enter the position name correctly',
delSure:'Confirm to delete the data item with post number [{postId}]?',
}
},
},

View File

@@ -718,6 +718,19 @@ export default {
phone:'联系电话',
email:'邮箱',
},
post:{
positionInfo:'岗位信息',
positionId:'岗位编号',
positionCode:'岗位编码',
positionName:'岗位名称',
positionSort:'岗位排序',
positionStatus:'岗位状态',
positionMark:'岗位说明',
createTime:'创建时间',
codeTip:'请正确输入岗位编码',
nameTip:'请正确输入岗位名称',
delSure:'确认删除岗位编号为 【{postId}】 的数据项?',
}
},
},
};

View File

@@ -86,33 +86,33 @@ let tableState: TabeStateType = reactive({
/**表格字段列 */
let tableColumns: ColumnsType = [
{
title: '岗位编号',
title: t('views.system.post.positionId'),
dataIndex: 'postId',
align: 'center',
},
{
title: '岗位编码',
title: t('views.system.post.positionCode'),
dataIndex: 'postCode',
align: 'center',
},
{
title: '岗位名称',
title: t('views.system.post.positionName'),
dataIndex: 'postName',
align: 'center',
},
{
title: '岗位排序',
title: t('views.system.post.positionSort'),
dataIndex: 'postSort',
align: 'center',
},
{
title: '岗位状态',
title: t('views.system.post.positionStatus'),
dataIndex: 'status',
key: 'status',
align: 'center',
},
{
title: '创建时间',
title: t('views.system.post.createTime'),
dataIndex: 'createTime',
align: 'center',
customRender(opt) {
@@ -121,7 +121,7 @@ let tableColumns: ColumnsType = [
},
},
{
title: '操作',
title: t('common.operate'),
key: 'postId',
align: 'center',
},
@@ -145,7 +145,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;
@@ -206,10 +206,20 @@ const modalStateFrom = Form.useForm(
modalState.from,
reactive({
postName: [
{ required: true, min: 1, max: 50, message: '请正确输入岗位编码' },
{
required: true,
min: 1,
max: 50,
message: t('views.system.post.codeTip'),
},
],
postCode: [
{ required: true, min: 1, max: 50, message: '请正确输入岗位名称' },
{
required: true,
min: 1,
max: 50,
message: t('views.system.post.nameTip'),
},
],
})
);
@@ -220,7 +230,7 @@ const modalStateFrom = Form.useForm(
*/
function fnModalVisibleByVive(postId: string | number) {
if (!postId) {
message.error(`岗位记录存在错误`, 2);
message.error(t('common.getInfoFail'), 2);
return;
}
if (modalState.confirmLoading) return;
@@ -231,10 +241,10 @@ function fnModalVisibleByVive(postId: string | number) {
hide();
if (res.code === RESULT_CODE_SUCCESS && res.data) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '岗位信息';
modalState.title = t('views.system.post.positionInfo');
modalState.visibleByView = true;
} else {
message.error(`获取岗位信息失败`, 2);
message.error(t('common.getInfoFail'), 2);
}
});
}
@@ -246,7 +256,8 @@ function fnModalVisibleByVive(postId: string | number) {
function fnModalVisibleByEdit(postId?: string | number) {
if (!postId) {
modalStateFrom.resetFields();
modalState.title = '添加岗位信息';
modalState.title =
t('common.addText') + t('views.system.post.positionInfo');
modalState.visibleByEdit = true;
} else {
if (modalState.confirmLoading) return;
@@ -257,10 +268,11 @@ function fnModalVisibleByEdit(postId?: string | number) {
hide();
if (res.code === RESULT_CODE_SUCCESS && res.data) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '修改岗位信息';
modalState.title =
t('common.editText') + t('views.system.post.positionInfo');
modalState.visibleByEdit = true;
} else {
message.error(`获取岗位信息失败`, 2);
message.error(t('common.getInfoFail'), 2);
}
});
}
@@ -283,7 +295,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,
});
@@ -303,7 +315,7 @@ function fnModalOk() {
});
})
.catch(e => {
message.error(`请正确填写 ${e.errorFields.length} 处必填信息!`, 2);
message.error(t('common.errorFields', { num: e.errorFields.length }), 2);
});
}
@@ -327,14 +339,14 @@ function fnRecordDelete(postId: string = '0') {
}
Modal.confirm({
title: t('common.tipTitle'),
content: `确认删除岗位编号为 【${postId}】 的数据项?`,
content: t('views.system.post.delSure', { postId: postId }),
onOk() {
const key = 'delPost';
message.loading({ content: t('common.loading'), key });
delPost(postId).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
content: t('common.msgSuccess', { msg: t('common.deleteText ') }),
key,
duration: 2,
});
@@ -355,14 +367,16 @@ function fnRecordDelete(postId: string = '0') {
function fnExportList() {
Modal.confirm({
title: t('common.tipTitle'),
content: `确认根据搜索条件导出xlsx表格文件吗?`,
content: t('views.system.user.exportSure'),
onOk() {
const key = 'exportPost';
message.loading({ content: t('common.loading'), key });
exportPost(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,
});
@@ -383,7 +397,7 @@ function fnExportList() {
function fnGetList(pageNum?: number) {
if (tableState.loading) return;
tableState.loading = true;
if(pageNum){
if (pageNum) {
queryParams.pageNum = pageNum;
}
listPost(toRaw(queryParams)).then(res => {
@@ -422,29 +436,35 @@ 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="postCode">
<a-form-item
:label="t('views.system.post. positionId')"
name="postCode"
>
<a-input
v-model:value="queryParams.postCode"
allow-clear
placeholder="请输入岗位编码"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="岗位名称" name="postName">
<a-form-item
:label="t('views.system.post. positionName')"
name="postName"
>
<a-input
v-model:value="queryParams.postName"
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.post. positionStatus')"
name="status"
>
<a-select
v-model:value="queryParams.status"
allow-clear
placeholder="请选择"
:options="dict.sysNormalDisable"
>
</a-select>
@@ -455,11 +475,11 @@ onMounted(() => {
<a-space :size="8">
<a-button type="primary" @click.prevent="fnGetList(1)">
<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>
@@ -478,7 +498,7 @@ onMounted(() => {
v-perms:has="['system:post:add']"
>
<template #icon><PlusOutlined /></template>
新建
{{ t('common.addText') }}
</a-button>
<a-button
type="default"
@@ -488,7 +508,7 @@ onMounted(() => {
v-perms:has="['system:post:remove']"
>
<template #icon><DeleteOutlined /></template>
删除
{{ t('common.deleteText') }}
</a-button>
<a-button
type="dashed"
@@ -496,7 +516,7 @@ onMounted(() => {
v-perms:has="['system:post:export']"
>
<template #icon><ExportOutlined /></template>
导出
{{ t('common.export') }}
</a-button>
</a-space>
</template>
@@ -505,31 +525,31 @@ onMounted(() => {
<template #extra>
<a-space :size="8" align="center">
<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>
@@ -539,9 +559,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>
@@ -573,7 +599,7 @@ onMounted(() => {
<template v-if="column.key === 'postId'">
<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.postId)"
@@ -583,7 +609,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.postId)"
@@ -593,7 +619,7 @@ onMounted(() => {
</a-button>
</a-tooltip>
<a-tooltip>
<template #title>删除</template>
<template #title>{{ t('common.deleteText') }}</template>
<a-button
type="link"
@click.prevent="fnRecordDelete(record.postId)"
@@ -618,12 +644,18 @@ onMounted(() => {
<a-form layout="horizontal">
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="岗位编号" name="postId">
<a-form-item
:label="t('views.system.post.positionId')"
name="postId"
>
{{ modalState.from.postId }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="创建时间" name="createTime">
<a-form-item
:label="t('views.system.post.createTime')"
name="createTime"
>
<span v-if="+modalState.from.createTime > 0">
{{ parseDateToStr(+modalState.from.createTime) }}
</span>
@@ -632,12 +664,18 @@ onMounted(() => {
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="岗位顺序" name="postSort">
<a-form-item
:label="t('views.system.post.positionSort')"
name="postSort"
>
{{ modalState.from.postSort }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="岗位状态" name="status">
<a-form-item
:label="t('views.system.post.positionStatus')"
name="status"
>
<DictTag
:options="dict.sysNormalDisable"
:value="modalState.from.status"
@@ -647,22 +685,30 @@ onMounted(() => {
</a-row>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="岗位编码" name="postCode">
<a-form-item
:label="t('views.system.post.positionCode')"
name="postCode"
>
{{ modalState.from.postCode }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="岗位名称" name="postName">
<a-form-item
:label="t('views.system.post.positionName')"
name="postName"
>
{{ modalState.from.postName }}
</a-form-item>
</a-col>
</a-row>
<a-form-item label="岗位说明" name="remark">
<a-form-item :label="t('views.system.post.positionMark')" name="remark">
{{ modalState.from.remark }}
</a-form-item>
</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,23 +727,24 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="岗位编码"
:label="t('views.system.post.positionCode')"
name="postCode"
v-bind="modalStateFrom.validateInfos.postCode"
>
<a-input
v-model:value="modalState.from.postCode"
allow-clear
placeholder="请输入岗位编码"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="岗位状态" name="status">
<a-form-item
:label="t('views.system.post.positionStatus')"
name="status"
>
<a-select
v-model:value="modalState.from.status"
default-value="0"
placeholder="岗位状态"
:options="dict.sysNormalDisable"
>
</a-select>
@@ -708,37 +755,37 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
label="岗位名称"
:label="t('views.system.post.positionName')"
name="postName"
v-bind="modalStateFrom.validateInfos.postName"
>
<a-input
v-model:value="modalState.from.postName"
allow-clear
placeholder="请输入岗位名称"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item label="岗位顺序" name="postSort">
<a-form-item
:label="t('views.system.post.positionSort')"
name="postSort"
>
<a-input-number
v-model:value="modalState.from.postSort"
:min="0"
:max="9999"
:step="1"
placeholder="排序值"
></a-input-number>
</a-form-item>
</a-col>
</a-row>
<a-form-item label="岗位说明" name="remark">
<a-form-item :label="t('views.system.post.positionMark')" name="remark">
<a-textarea
v-model:value="modalState.from.remark"
:auto-size="{ minRows: 4, maxRows: 6 }"
:maxlength="450"
:show-count="true"
placeholder="请输入岗位说明"
/>
</a-form-item>
</a-form>