--新增岗位管理国际化

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