分配用户国际化

This commit is contained in:
lai
2023-11-10 16:37:51 +08:00
parent 1d4db90b1e
commit b8190bd640
4 changed files with 110 additions and 62 deletions

View File

@@ -697,6 +697,18 @@ export default {
stop:'Pause',
preScope:'Scope of authority',
dataPer:'Data permission',
userId:'User number',
account:'Login account',
userName:'User nickname',
phone:'Phone',
email:'Email',
userStaus:'User status',
selectPls:'Please select the user to be assigned',
suss:'{oper}success',
giveUser:'Authorized user',
cancelGive:'Cancel authorization',
cancelSure:'Confirm to cancel the authorization of the data item with user number [{userId}]?',
batchCancel:'Batch cancellation of authorization',
},
dept:{
classInfo:' Department information',

View File

@@ -132,7 +132,7 @@ export default {
ttile: '没有访问权限',
subTitle:'请不要进行非法操作,您可以返回主页面或返回',
backHome: '返回首页',
back: '返回',
back: '返回',
},
err404: {
ttile: '找不到匹配页面',
@@ -440,7 +440,7 @@ export default {
},
},
faultManage: {
activeAlarm: {
activeAlarm: {
all:'所有',
neType: '告警设备类型',
neName: '告警网元名称',
@@ -697,6 +697,18 @@ export default {
stop:'暂停',
preScope:'权限范围',
dataPer:'数据权限',
userId:'用户编号',
account:'登录账号',
userName:'用户昵称',
phone:'手机号码',
email:'电子邮箱',
userStaus:'用户状态',
selectPls:'请选择要分配的用户',
suss:'{oper}成功',
giveUser:'授权用户',
cancelGive:'取消授权',
cancelSure:'确认取消用户编号为 【{userId}】 的数据项授权?',
batchCancel:'批量取消授权',
},
dept:{
classInfo:'部门信息',

View File

@@ -92,38 +92,38 @@ let tableState: TabeStateType = reactive({
/**表格字段列 */
let tableColumns: ColumnsType = [
{
title: '用户编号',
title: t('views.system.role.userId'),
dataIndex: 'userId',
align: 'center',
},
{
title: '登录账号',
title: t('views.system.role.account'),
dataIndex: 'userName',
align: 'center',
},
{
title: '用户昵称',
title: t('views.system.role.userName'),
dataIndex: 'nickName',
align: 'center',
},
{
title: '手机号码',
title: t('views.system.role.phone'),
dataIndex: 'phonenumber',
align: 'center',
},
{
title: '电子邮箱',
title: t('views.system.role.email'),
dataIndex: 'email',
align: 'center',
},
{
title: '用户状态',
title: t('views.system.role.userStaus'),
dataIndex: 'status',
key: 'status',
align: 'center',
},
{
title: '创建时间',
title: t('views.system.role.createTime'),
dataIndex: 'createTime',
align: 'center',
customRender(opt) {
@@ -132,7 +132,7 @@ let tableColumns: ColumnsType = [
},
},
{
title: '操作',
title: t('common.operate'),
key: 'userId',
align: 'center',
},
@@ -156,7 +156,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;
@@ -208,7 +208,7 @@ function fnModalVisibleBySelectUser() {
*/
function fnModalOk(userIds: string[] | number[]) {
if (userIds.length <= 0) {
message.error(`请选择要分配的用户`, 2);
message.error(t('views.system.role.selectPls'), 2);
return;
}
const key = 'authUserChecked';
@@ -221,7 +221,9 @@ function fnModalOk(userIds: string[] | number[]) {
if (res.code === RESULT_CODE_SUCCESS) {
modalState.visibleBySelectUser = false;
message.success({
content: `授权用户添加成功`,
content: t('views.system.role.suss', {
oper: t('views.system.role.giveUser'),
}),
key,
duration: 3,
});
@@ -246,7 +248,7 @@ function fnRecordDelete(userId: string | number) {
}
Modal.confirm({
title: t('common.tipTitle'),
content: `确认取消用户编号为 【${userId}】 的数据项授权?`,
content: t('views.system.role.cancelSure', { userId: userId }),
onOk() {
const key = 'authUserChecked';
message.loading({ content: t('common.loading'), key });
@@ -254,7 +256,9 @@ function fnRecordDelete(userId: string | number) {
res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `取消授权成功`,
content: t('views.system.role.suss', {
oper: t('views.system.role.cancelGive'),
}),
key,
duration: 3,
});
@@ -286,7 +290,7 @@ function fnClose() {
function fnGetList(pageNum?: number) {
if (tableState.loading) return;
tableState.loading = true;
if(pageNum){
if (pageNum) {
queryParams.pageNum = pageNum;
}
authUserAllocatedList(toRaw(queryParams)).then(res => {
@@ -325,40 +329,45 @@ 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="roleName">
<a-input
:value="roleName"
disabled
placeholder="请输入角色名称"
></a-input>
<a-form-item
:label="t('views.system.role.roleName')"
name="roleName"
>
<a-input :value="roleName" disabled></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="登录账号" name="userName">
<a-form-item
:label="t('views.system.role.account')"
name="userName"
>
<a-input
v-model:value="queryParams.userName"
allow-clear
:maxlength="30"
placeholder="请输入登录账号"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item label="手机号码" name="phonenumber">
<a-form-item
:label="t('views.system.role.phone')"
name="phonenumber"
>
<a-input
v-model:value="queryParams.phonenumber"
allow-clear
:maxlength="11"
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.role.userStaus')"
name="status"
>
<a-select
v-model:value="queryParams.status"
allow-clear
placeholder="请选择用户状态"
:options="dict.sysNormalDisable"
>
</a-select>
@@ -369,11 +378,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>
@@ -388,7 +397,7 @@ onMounted(() => {
<a-space :size="8" align="center">
<a-button type="default" @click.prevent="fnClose()">
<template #icon><CloseOutlined /></template>
关闭
{{ t('common.cancel') }}
</a-button>
<a-button
type="primary"
@@ -396,7 +405,7 @@ onMounted(() => {
v-perms:has="['system:role:add']"
>
<template #icon><UsergroupAddOutlined /></template>
分配用户
{{ t('views.system.role.distributeUser') }}
</a-button>
<a-button
type="default"
@@ -406,7 +415,7 @@ onMounted(() => {
v-perms:has="['system:role:remove']"
>
<template #icon><UsergroupDeleteOutlined /></template>
批量取消授权
{{ t('views.system.role.batchCancel') }}
</a-button>
</a-space>
</template>
@@ -415,31 +424,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>
@@ -449,9 +458,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>
@@ -483,7 +498,7 @@ onMounted(() => {
<template v-if="column.key === 'userId'">
<a-space :size="8" align="center">
<a-tooltip>
<template #title>取消授权</template>
<template #title>{{t('views.system.role.cancelGive')}}</template>
<a-button
type="link"
@click.prevent="fnRecordDelete(record.userId)"

View File

@@ -7,6 +7,8 @@ import { authUserAllocatedList } from '@/api/system/role';
import { parseDateToStr } from '@/utils/date-utils';
import useDictStore from '@/store/modules/dict';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import useI18n from '@/hooks/useI18n';
const { t } = useI18n();
const { getDict } = useDictStore();
const emit = defineEmits(['ok', 'cancel', 'update:visible']);
const props = defineProps({
@@ -87,33 +89,38 @@ let tableState: TabeStateType = reactive({
/**表格字段列 */
let tableColumns: ColumnsType = [
{
title: '用户编号',
title: t('views.system.role.userId'),
dataIndex: 'userId',
align: 'center',
},
{
title: '登录账号',
title: t('views.system.role.account'),
dataIndex: 'userName',
align: 'center',
},
{
title: '用户昵称',
title: t('views.system.role.userName'),
dataIndex: 'nickName',
align: 'center',
},
{
title: '手机号码',
title: t('views.system.role.phone'),
dataIndex: 'phonenumber',
align: 'center',
},
{
title: '用户状态',
title: t('views.system.role.email'),
dataIndex: 'email',
align: 'center',
},
{
title: t('views.system.role.userStaus'),
dataIndex: 'status',
key: 'status',
align: 'center',
},
{
title: '创建时间',
title: t('views.system.role.createTime'),
dataIndex: 'createTime',
align: 'center',
customRender(opt) {
@@ -121,6 +128,11 @@ let tableColumns: ColumnsType = [
return parseDateToStr(+opt.value);
},
},
{
title: t('common.operate'),
key: 'userId',
align: 'center',
},
];
/**表格分页器参数 */
@@ -141,7 +153,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;
@@ -180,7 +192,7 @@ function fnGetList(pageNum?: number) {
function fnModalOk() {
const userIds = tableState.selectedRowKeys;
if (userIds.length <= 0) {
message.error(`请选择要分配的用户`, 2);
message.error(t('views.system.role.selectPls'), 2);
return;
}
emit('update:visible', false);
@@ -228,31 +240,28 @@ watch(
<a-form :model="queryParams" name="queryParams" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="8" :md="12" :xs="24">
<a-form-item label="登录账号" name="userName">
<a-form-item :label="t('views.system.role.account')" name="userName">
<a-input
v-model:value="queryParams.userName"
allow-clear
:maxlength="30"
placeholder="请输入登录账号"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="8" :md="12" :xs="24">
<a-form-item label="手机号码" name="phonenumber">
<a-form-item :label="t('views.system.role.phone')" name="phonenumber">
<a-input
v-model:value="queryParams.phonenumber"
allow-clear
:maxlength="11"
placeholder="请输入手机号码"
></a-input>
</a-form-item>
</a-col>
<a-col :lg="8" :md="12" :xs="24">
<a-form-item label="用户状态" name="status">
<a-form-item :label="t('views.system.role.userStaus')" name="status">
<a-select
v-model:value="queryParams.status"
allow-clear
placeholder="请选择用户状态"
:options="dict.sysNormalDisable"
>
</a-select>
@@ -263,11 +272,11 @@ watch(
<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>
@@ -282,7 +291,7 @@ watch(
:loading="tableState.loading"
:data-source="tableState.data"
:size="tableState.size"
:scroll="{ scrollToFirstRowOnChange: true, y: 400, x: true }"
:scroll="{ scrollToFirstRowOnChange: true, y: 400, x: 600 }"
:pagination="tablePagination"
:row-selection="{
type: 'checkbox',