refactor:职位国际化
This commit is contained in:
parent
f39f565932
commit
1c00248143
@ -10,39 +10,39 @@
|
|||||||
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto">
|
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto">
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||||
<el-form-item label="职位名称" prop="name" :rules="[{ required: true, message: '职位名称不能为空', trigger: 'blur' }]">
|
<el-form-item :label="$t('message.list.jobTitle')" prop="name" :rules="[{ required: true, message: $t('message.list.jobTitleRequired'), trigger: 'blur' }]">
|
||||||
<el-input v-model="state.ruleForm.name" placeholder="职位名称" clearable />
|
<el-input v-model="state.ruleForm.name" :placeholder="$t('message.list.jobTitle')" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||||
<el-form-item label="职位编码" prop="code" :rules="[{ required: true, message: '职位编码不能为空', trigger: 'blur' }]">
|
<el-form-item :label="$t('message.list.positionCode')" prop="code" :rules="[{ required: true, message: $t('message.list.positionCodeRequired'), trigger: 'blur' }]">
|
||||||
<el-input v-model="state.ruleForm.code" placeholder="职位编码" clearable />
|
<el-input v-model="state.ruleForm.code" :placeholder="$t('message.list.positionCode')" clearable />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
<el-form-item label="排序">
|
<el-form-item :label="$t('message.list.orderNo')">
|
||||||
<el-input-number v-model="state.ruleForm.orderNo" placeholder="排序" class="w100" />
|
<el-input-number v-model="state.ruleForm.orderNo" :placeholder="$t('message.list.orderNo')" class="w100" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
<el-form-item label="状态">
|
<el-form-item :label="$t('message.list.status')">
|
||||||
<el-radio-group v-model="state.ruleForm.status">
|
<el-radio-group v-model="state.ruleForm.status">
|
||||||
<el-radio :value="1">启用</el-radio>
|
<el-radio :value="1">{{ $t('message.list.enable') }}</el-radio>
|
||||||
<el-radio :value="2">禁用</el-radio>
|
<el-radio :value="2">{{ $t('message.list.disable') }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||||
<el-form-item label="备注">
|
<el-form-item :label="$t('message.list.remark')">
|
||||||
<el-input v-model="state.ruleForm.remark" placeholder="请输入备注内容" clearable type="textarea" />
|
<el-input v-model="state.ruleForm.remark" :placeholder="$t('message.list.needInputRemark')" clearable type="textarea" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button icon="ele-CircleCloseFilled" @click="cancel">取 消</el-button>
|
<el-button icon="ele-CircleCloseFilled" @click="cancel">{{ $t('message.list.cancelButtonText') }}</el-button>
|
||||||
<el-button type="primary" icon="ele-CircleCheckFilled" @click="submit">确 定</el-button>
|
<el-button type="primary" icon="ele-CircleCheckFilled" @click="submit">{{ $t('message.list.confirmButtonText') }}</el-button>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|||||||
@ -5,12 +5,12 @@
|
|||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
|
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
|
||||||
<el-form-item label="职位名称" prop="name">
|
<el-form-item label="职位名称" prop="name">
|
||||||
<el-input v-model="state.queryParams.name" placeholder="职位名称" clearable @keyup.enter.native="handleQuery(true)" />
|
<el-input v-model="state.queryParams.name" :placeholder="$t('message.list.jobTitle')" clearable @keyup.enter.native="handleQuery(true)" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
|
<el-col class="mb5" :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
|
||||||
<el-form-item label="职位编码" prop="code">
|
<el-form-item label="职位编码" prop="code">
|
||||||
<el-input v-model="state.queryParams.code" placeholder="职位编码" clearable @keyup.enter.native="handleQuery(true)" />
|
<el-input v-model="state.queryParams.code" :placeholder="$t('message.list.positionCode')" clearable @keyup.enter.native="handleQuery(true)" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -21,8 +21,8 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col>
|
<el-col>
|
||||||
<el-button-group>
|
<el-button-group>
|
||||||
<el-button type="primary" icon="ele-Search" @click="handleQuery(true)" v-auth="'sysPos/page'"> 查询 </el-button>
|
<el-button type="primary" icon="ele-Search" @click="handleQuery(true)" v-auth="'sysPos/page'"> {{ $t('message.list.query') }} </el-button>
|
||||||
<el-button icon="ele-Refresh" @click="resetQuery"> 重置 </el-button>
|
<el-button icon="ele-Refresh" @click="resetQuery"> {{ $t('message.list.reset') }} </el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -31,15 +31,15 @@
|
|||||||
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
|
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
|
||||||
<vxe-grid ref="xGrid" class="xGrid-style" v-bind="options" v-on="gridEvents">
|
<vxe-grid ref="xGrid" class="xGrid-style" v-bind="options" v-on="gridEvents">
|
||||||
<template #toolbar_buttons>
|
<template #toolbar_buttons>
|
||||||
<el-button type="primary" icon="ele-Plus" @click="handleAdd" v-auth="'sysPos/add'"> 新增 </el-button>
|
<el-button type="primary" icon="ele-Plus" @click="handleAdd" v-auth="'sysPos/add'"> {{ $t('message.list.add') }} </el-button>
|
||||||
</template>
|
</template>
|
||||||
<template #toolbar_tools> </template>
|
<template #toolbar_tools> </template>
|
||||||
<template #empty>
|
<template #empty>
|
||||||
<el-empty :image-size="200" />
|
<el-empty :image-size="200" />
|
||||||
</template>
|
</template>
|
||||||
<template #row_status="{ row }">
|
<template #row_status="{ row }">
|
||||||
<el-tag v-if="row.status === 1" type="success">启用</el-tag>
|
<el-tag v-if="row.status === 1" type="success">{{ $t('message.list.enable') }}</el-tag>
|
||||||
<el-tag v-else type="danger">禁用</el-tag>
|
<el-tag v-else type="danger">{{ $t('message.list.disable') }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
<template #row_userCount="{ row }">
|
<template #row_userCount="{ row }">
|
||||||
{{ row.userList?.length }}
|
{{ row.userList?.length }}
|
||||||
@ -62,9 +62,9 @@
|
|||||||
<ModifyRecord :data="row" />
|
<ModifyRecord :data="row" />
|
||||||
</template>
|
</template>
|
||||||
<template #row_buttons="{ row }">
|
<template #row_buttons="{ row }">
|
||||||
<el-button icon="ele-Edit" text type="primary" v-auth="'sysPos/update'" @click="handleEdit(row)"> 编辑 </el-button>
|
<el-button icon="ele-Edit" text type="primary" v-auth="'sysPos/update'" @click="handleEdit(row)"> {{ $t('message.list.edit') }} </el-button>
|
||||||
<el-button icon="ele-Delete" text type="danger" v-auth="'sysPos/delete'" @click="handleDelete(row)"> 删除 </el-button>
|
<el-button icon="ele-Delete" text type="danger" v-auth="'sysPos/delete'" @click="handleDelete(row)"> {{ $t('message.list.delete') }} </el-button>
|
||||||
<el-button icon="ele-CopyDocument" text type="primary" v-auth="'sysPos/add'" @click="openCopyMenu(row)"> 复制 </el-button>
|
<el-button icon="ele-CopyDocument" text type="primary" v-auth="'sysPos/add'" @click="openCopyMenu(row)"> {{ $t('message.list.copy') }} </el-button>
|
||||||
</template>
|
</template>
|
||||||
</vxe-grid>
|
</vxe-grid>
|
||||||
</el-card>
|
</el-card>
|
||||||
@ -86,6 +86,9 @@ import ModifyRecord from '/@/components/table/modifyRecord.vue';
|
|||||||
import { getAPI } from '/@/utils/axios-utils';
|
import { getAPI } from '/@/utils/axios-utils';
|
||||||
import { SysPosApi } from '/@/api-services/api';
|
import { SysPosApi } from '/@/api-services/api';
|
||||||
import { PagePosOutput, PagePosInput, UpdatePosInput } from '/@/api-services/models';
|
import { PagePosOutput, PagePosInput, UpdatePosInput } from '/@/api-services/models';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
|
const i18n = useI18n();
|
||||||
|
|
||||||
const xGrid = ref<VxeGridInstance>();
|
const xGrid = ref<VxeGridInstance>();
|
||||||
const editPosRef = ref<InstanceType<typeof EditPos>>();
|
const editPosRef = ref<InstanceType<typeof EditPos>>();
|
||||||
@ -108,18 +111,18 @@ const localPageParamKey = 'localPageParam:sysPos';
|
|||||||
const options = useVxeTable<PagePosOutput>(
|
const options = useVxeTable<PagePosOutput>(
|
||||||
{
|
{
|
||||||
id: 'sysPos',
|
id: 'sysPos',
|
||||||
name: '职位',
|
name: i18n.t('message.list.jobTitle'),
|
||||||
columns: [
|
columns: [
|
||||||
// { type: 'checkbox', width: 40, fixed: 'left' },
|
// { type: 'checkbox', width: 40, fixed: 'left' },
|
||||||
{ field: 'seq', type: 'seq', title: '序号', width: 60, fixed: 'left' },
|
{ field: 'seq', type: 'seq', title: i18n.t('message.list.seq'), width: 60, fixed: 'left' },
|
||||||
{ field: 'name', title: '职位名称', minWidth: 200, showOverflow: 'tooltip' },
|
{ field: 'name', title: i18n.t('message.list.jobTitle'), minWidth: 200, showOverflow: 'tooltip' },
|
||||||
{ field: 'code', title: '职位编码', minWidth: 200, showOverflow: 'tooltip' },
|
{ field: 'code', title: i18n.t('message.list.positionCode'), minWidth: 200, showOverflow: 'tooltip' },
|
||||||
{ field: 'userCount', title: '在职人数', width: 100, showOverflow: 'tooltip', slots: { default: 'row_userCount' } },
|
{ field: 'userCount', title: i18n.t('message.list.staffCount'), width: 100, showOverflow: 'tooltip', slots: { default: 'row_userCount' } },
|
||||||
{ field: 'userList', title: '人员明细', width: 100, showOverflow: 'tooltip', slots: { default: 'row_userList' } },
|
{ field: 'userList', title: i18n.t('message.list.staffDetails'), width: 100, showOverflow: 'tooltip', slots: { default: 'row_userList' } },
|
||||||
{ field: 'orderNo', title: '排序', width: 80, showOverflow: 'tooltip' },
|
{ field: 'orderNo', title: i18n.t('message.list.orderNo'), width: 80, showOverflow: 'tooltip' },
|
||||||
{ field: 'status', title: '状态', width: 80, showOverflow: 'tooltip', slots: { default: 'row_status' } },
|
{ field: 'status', title: i18n.t('message.list.status'), width: 80, showOverflow: 'tooltip', slots: { default: 'row_status' } },
|
||||||
{ field: 'record', title: '修改记录', width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
|
{ field: 'record', title: i18n.t('message.list.record'), width: 100, showOverflow: 'tooltip', slots: { default: 'row_record' } },
|
||||||
{ field: 'buttons', title: '操作', fixed: 'right', width: 210, showOverflow: true, slots: { default: 'row_buttons' } },
|
{ field: 'buttons', title: i18n.t('message.list.operation'), fixed: 'right', width: 210, showOverflow: true, slots: { default: 'row_buttons' } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// vxeGrid配置参数(此处可覆写任何参数),参考vxe-table官方文档
|
// vxeGrid配置参数(此处可覆写任何参数),参考vxe-table官方文档
|
||||||
@ -162,19 +165,19 @@ const resetQuery = async () => {
|
|||||||
|
|
||||||
// 打开新增页面
|
// 打开新增页面
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
state.title = '添加职位';
|
state.title = i18n.t('message.list.addPosition');
|
||||||
editPosRef.value?.openDialog({ status: 1, orderNo: 100 });
|
editPosRef.value?.openDialog({ status: 1, orderNo: 100 });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开编辑页面
|
// 打开编辑页面
|
||||||
const handleEdit = (row: any) => {
|
const handleEdit = (row: any) => {
|
||||||
state.title = '编辑职位';
|
state.title = i18n.t('message.list.editPosition');
|
||||||
editPosRef.value?.openDialog(row);
|
editPosRef.value?.openDialog(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 打开复制页面
|
// 打开复制页面
|
||||||
const openCopyMenu = (row: any) => {
|
const openCopyMenu = (row: any) => {
|
||||||
state.title = '复制职位';
|
state.title = i18n.t('message.list.copyPosition');
|
||||||
var copyRow = JSON.parse(JSON.stringify(row)) as UpdatePosInput;
|
var copyRow = JSON.parse(JSON.stringify(row)) as UpdatePosInput;
|
||||||
copyRow.id = 0;
|
copyRow.id = 0;
|
||||||
copyRow.name = '';
|
copyRow.name = '';
|
||||||
@ -183,15 +186,15 @@ const openCopyMenu = (row: any) => {
|
|||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
const handleDelete = (row: any) => {
|
const handleDelete = (row: any) => {
|
||||||
ElMessageBox.confirm(`确定删除职位:【${row.name}】?`, '提示', {
|
ElMessageBox.confirm(i18n.t('message.list.confirmDeletePosition', { name: row.name }), i18n.t('message.list.hint'), {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: i18n.t('message.list.confirmButtonText'),
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: i18n.t('message.list.cancelButtonText'),
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await getAPI(SysPosApi).apiSysPosDeletePost({ id: row.id });
|
await getAPI(SysPosApi).apiSysPosDeletePost({ id: row.id });
|
||||||
handleQuery();
|
handleQuery();
|
||||||
ElMessage.success('删除成功');
|
ElMessage.success(i18n.t('message.list.successDelete'));
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user