--UDM鉴权用户国际化

This commit is contained in:
lai
2023-11-08 16:17:29 +08:00
parent d19d2c868c
commit d9940c7c0d
4 changed files with 99 additions and 77 deletions

View File

@@ -2,6 +2,8 @@
import { message } from 'ant-design-vue/lib';
import { FileType } from 'ant-design-vue/lib/upload/interface';
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
import useI18n from '@/hooks/useI18n';
const { t } = useI18n();
const emit = defineEmits(['upload', 'close', 'update:visible']);
const props = defineProps({
/**窗口标题 */
@@ -45,7 +47,7 @@ function fnBeforeUpload(file: FileType) {
const fileSize = file.size;
const isLtM = fileSize / 1024 / 1024 < props.size;
if (!isLtM) {
message.error(`上传文件大小必须小于 ${props.size}MB`, 3);
message.error(`${t('components.UploadModal.allowFilter')} ${props.size}MB`, 3);
return false;
}
}
@@ -54,7 +56,7 @@ function fnBeforeUpload(file: FileType) {
const fileName = file.name;
const isAllowType = props.ext.some(v => fileName.endsWith(v));
if (!isAllowType) {
message.error(`只支持上传文件格式 ${props.ext.join('、')}`, 3);
message.error(`${t('components.UploadModal.onlyAllow')} ${props.ext.join('、')}`, 3);
return false;
}
}
@@ -91,15 +93,14 @@ function fnUpload(up: UploadRequestOption) {
<p class="ant-upload-drag-icon">
<inbox-outlined></inbox-outlined>
</p>
<p class="ant-upload-text">点击选择或将文件拖入边框区域进行上传</p>
<p class="ant-upload-text">{{t('components.UploadModal.uploadTip')}}</p>
<p class="ant-upload-hint">
<div v-if="props.size > 0">
允许上传文件大小 {{ props.size }} MB
{{t('components.UploadModal.allowSize')}} {{ props.size }} MB
</div>
<div v-if="props.ext.length > 0">
允许导入
{{ props.ext.join('') }}
格式文件
{{t('components.UploadModal.allowFormat')}} {{ props.ext.join('') }}
</div>
</p>
</a-upload-dragger>

View File

@@ -18,11 +18,13 @@ export default {
search: 'Search',
reset: 'Reset',
viewText: 'View',
getInfoFail:'Failed to obtain information',
view: 'View',
addText: 'Add',
editText: 'Edit',
deleteText: 'Delete',
downloadText: 'Download',
export:'Export',
uploadText: 'Upload',
unableNull:' Cannot be empty',
moreText: 'More',
@@ -56,11 +58,16 @@ export default {
}
},
// 全局页脚
globalFooter: {
help: 'Help',
privacy: 'Privacy',
term: 'Term',
// 导入
components: {
UploadModal:{
uploadTitle:'Data Import',
uploadTip:'Click to select or drag the file into the border area to upload',
allowSize:'Allowed upload file size',
allowFormat:'The formats allowed to be imported are ',
allowFilter:'Upload file size must be less than ',
onlyAllow:'Only supports upload file formats',
}
},
// 校验
@@ -208,7 +215,7 @@ export default {
},
neUser: {
auth: {
authInfo:'Authentication Info',
authInfo:' Authentication Info',
neTypePlease: 'Query network element type',
neType: 'UDM Type',
export: 'Export',
@@ -217,9 +224,13 @@ export default {
loadDataConfirm: 'Are you sure you want to reload the data?',
loadData: 'LoadData',
loadDataTip: 'Successfully obtained updated data: {num} items. The system is updating the data internally. Please do not click repeatedly to obtain updates!!!',
num: 'Number allocation',
batchAddText: 'Batch Add',
batchDelText: 'Batch Del',
num: 'Number allocation ',
batchAddText: 'Batch Add ',
batchDelText: 'Batch Del ',
delNum:'Number of deletions ',
imsiTip:'SUPI=MCC+MNC+MSIN MCC=mobile country code, consisting of three digits MNC=Mobile Network Number, consisting of two digits MSIN=Mobile Customer Identification Number, composed of 10 digits of equal length',
delSure:'Are you sure to delete the user with IMSI number: {imsi}?',
noListData:'No network element list data yet',
},
sub: {
neTypePlease: 'Query network element type',
@@ -231,7 +242,7 @@ export default {
loadData: 'LoadData',
loadDataTip: 'Successfully obtained updated data: {num} items. The system is updating the data internally. Please do not click repeatedly to obtain updates!!!',
num: 'Number of deletions',
startIMSI: 'start IMSI',
startIMSI: 'Start IMSI',
},
base5G: {
neTypePlease: 'Query network element type',

View File

@@ -18,11 +18,13 @@ export default {
search: '搜索',
reset: '重置',
viewText: '查看详情',
getInfoFail:'获取信息失败',
view: '查看',
addText: '新增',
editText: '编辑',
deleteText: '删除',
downloadText: '下载',
export:'导出',
uploadText: '上传',
unableNull:'不能为空',
moreText: '更多',
@@ -56,11 +58,16 @@ export default {
}
},
// 全局页脚
globalFooter: {
help: '',
privacy: '',
term: '',
// 导入
components: {
UploadModal:{
uploadTitle:'数据导入',
uploadTip:'点击选择或将文件拖入边框区域进行上传',
allowSize:'允许上传文件大小',
allowFormat:'允许导入的格式为',
allowFilter:'上传文件大小必须小于',
onlyAllow:'只支持上传文件格式',
}
},
// 校验
@@ -220,6 +227,10 @@ export default {
num: '放号数',
batchAddText: '批量新增',
batchDelText: '批量删除',
delNum:'删除个数',
imsiTip:' SUPI=MCC+MNC+MSIN MCC=移动国家号码, 由三位数字组成 MNC=移动网络号,由两位数字组成 MSIN=移动客户识别码,采用等长10位数字构成',
delSure:'确认删除IMSI编号为: {imsi} 的用户嘛?',
noListData:'暂无网元列表数据',
},
sub: {
neTypePlease: '查询网元类型',

View File

@@ -230,10 +230,10 @@ let modalState: ModalStateType = reactive({
const modalStateFrom = Form.useForm(
modalState.from,
reactive({
imsi: [{ required: true, message: 'IMSI不能为空' }],
amf: [{ required: true, message: 'AMF不能为空' }],
ki: [{ required: true, message: 'KI不能为空' }],
algo: [{ required: true, message: 'algoIndex不能为空' }],
imsi: [{ required: true, message: 'IMSI'+t('common.unableNull') }],
amf: [{ required: true, message: 'AMF'+t('common.unableNull') }],
ki: [{ required: true, message: 'KI'+t('common.unableNull') }],
algoIndex: [{ required: true, message: 'algoIndex'+t('common.unableNull') }],
})
);
@@ -241,11 +241,11 @@ const modalStateFrom = Form.useForm(
const modalStateBatchFrom = Form.useForm(
modalState.BatchForm,
reactive({
num: [{ required: true, message: '放号数不能为空' }],
imsi: [{ required: true, message: 'IMSI不能为空' }],
amf: [{ required: true, message: 'AMF不能为空' }],
ki: [{ required: true, message: 'KI不能为空' }],
algo: [{ required: true, message: 'algoIndex不能为空' }],
num: [{ required: true, message: t('views.neUser.auth.num')+t('common.unableNull') }],
imsi: [{ required: true, message: 'IMSI'+t('common.unableNull') }],
amf: [{ required: true, message: 'AMF'+t('common.unableNull') }],
ki: [{ required: true, message: 'KI'+t('common.unableNull') }],
algoIndex: [{ required: true, message: 'algoIndex'+t('common.unableNull') }],
})
);
@@ -253,8 +253,8 @@ const modalStateBatchFrom = Form.useForm(
const modalStateBatchDelFrom = Form.useForm(
modalState.BatchDelForm,
reactive({
num: [{ required: true, message: '删除个数不能为空' }],
imsi: [{ required: true, message: '起始IMSI不能为空' }],
num: [{ required: true, message: t('views.neUser.auth.delNum')+t('common.unableNull') }],
imsi: [{ required: true, message: 'IMSI'+t('common.unableNull') }],
})
);
@@ -267,17 +267,20 @@ function fnModalVisibleByVive(imsi: string) {
const hide = message.loading('Waiting...', 0);
modalState.confirmLoading = true;
const neID = queryParams.neId || '-';
getAuth(neID, imsi).then(res => {
modalState.confirmLoading = false;
hide();
if (res.code === RESULT_CODE_SUCCESS) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = t("common.view")+t("views.neUser.authInfo");
modalState.visibleByView = true;
} else {
message.error(`获取鉴权信息失败`, 2);
}
});
getAuth(neID, imsi)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = t('common.viewText') + t('views.neUser.auth.authInfo');
modalState.visibleByView = true;
} else {
message.error(`获取鉴权信息失败`, 2);
}
})
.finally(() => {
hide();
modalState.confirmLoading = false;
});
}
/**
@@ -287,24 +290,27 @@ function fnModalVisibleByVive(imsi: string) {
function fnModalVisibleByEdit(row?: Record<string, any>) {
if (!row) {
modalStateFrom.resetFields(); //重置表单
modalState.title = '添加鉴权信息';
modalState.title = t('common.addText')+t('views.neUser.auth.authInfo');
modalState.visibleByEdit = true;
} else {
if (modalState.confirmLoading) return;
const hide = message.loading(t('common.loading'), 0);
modalState.confirmLoading = true;
const neID = queryParams.neId || '-';
getAuth(neID, row?.imsi).then(res => {
modalState.confirmLoading = false;
hide();
if (res.code === RESULT_CODE_SUCCESS) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '修改鉴权信息';
modalState.visibleByEdit = true;
} else {
message.error(`获取鉴权信息失败`, 2);
}
});
getAuth(neID, row?.imsi)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = t('common.editText')+t('views.neUser.auth.authInfo');
modalState.visibleByEdit = true;
} else {
message.error(`获取鉴权信息失败`, 2);
}
})
.finally(() => {
hide();
modalState.confirmLoading = false;
});
}
}
@@ -315,11 +321,11 @@ function fnModalVisibleByEdit(row?: Record<string, any>) {
function fnModalVisibleByBatch(batchFlag?: number) {
if (batchFlag) {
modalStateBatchFrom.resetFields(); //重置表单
modalState.title = '批量添加鉴权信息';
modalState.title = t('views.neUser.auth.batchAddText')+t('views.neUser.auth.authInfo');
modalState.visibleByBatch = true;
} else {
modalStateBatchFrom.resetFields(); //重置表单
modalState.title = '批量删除鉴权信息';
modalState.title = t('views.neUser.auth.batchDelText')+t('views.neUser.auth.authInfo');
modalState.visibleByBatchDel = true;
}
}
@@ -488,7 +494,7 @@ function fnModalCancel() {
function fnRecordDelete(row: Record<string, any>) {
Modal.confirm({
title: t('common.tipTitle'),
content: `确认删除IMSI编号为: ${row.imsi} 的用户嘛?`,
content: t('views.neUser.auth.delSure',{imsi:row.imsi}),
onOk() {
const key = 'delNotice';
message.loading({ content: t('common.loading'), key });
@@ -496,7 +502,7 @@ function fnRecordDelete(row: Record<string, any>) {
delAuth(neID, row).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `删除成功`,
content: t('common.msgSuccess', { msg: t('common.deleteText') }),
key,
duration: 2,
});
@@ -525,7 +531,7 @@ function fnExportList(type: string) {
}).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `已完成导出`,
content: t('common.msgSuccess', { msg: t('common.export') }),
key,
duration: 2,
});
@@ -563,7 +569,7 @@ function fnLoadData() {
}, 3000);
} else {
message.error({
content: `获取数据失败`,
content: t('common.getInfoFail'),
duration: 3,
});
}
@@ -601,7 +607,7 @@ type ModalUploadImportStateType = {
/**对话框表格信息导入对象信息状态 */
let uploadImportState: ModalUploadImportStateType = reactive({
visible: false,
title: '数据导入',
title: t('components.UploadModal.uploadTitle'),
loading: false,
msg: '',
});
@@ -625,16 +631,16 @@ function fnModalUploadImportUpload(file: File) {
formData.append('file', file);
const neID = queryParams.neId;
if (!neID) {
return Promise.reject('未知网元');
return Promise.reject('Unknown network element');
}
const hide = message.loading('正在上传...', 0);
const hide = message.loading(t('common.loading'), 0);
uploadImportState.loading = true;
importAuthData(neID, formData)
.then(res => {
uploadImportState.msg = res.msg;
})
.catch((err: { code: number; msg: string }) => {
message.error(`上传失败 ${err.msg}`);
message.error(` ${err.msg}`);
})
.finally(() => {
hide();
@@ -662,7 +668,7 @@ onMounted(() => {
}
} else {
message.warning({
content: `暂无网元列表数据`,
content:t('views.neUser.auth.noListData'),
duration: 2,
});
}
@@ -690,7 +696,6 @@ onMounted(() => {
v-model:value="queryParams.neId"
:options="neOtions"
allow-clear
:placeholder="t('views.neUser.auth.neTypePlease')"
/>
</a-form-item>
</a-col>
@@ -699,7 +704,6 @@ onMounted(() => {
<a-input
v-model:value="queryParams.imsi"
allow-clear
placeholder="查询IMSI"
></a-input>
</a-form-item>
</a-col>
@@ -991,7 +995,7 @@ onMounted(() => {
<a-form-item
label="Algo Index"
name="algo"
v-bind="modalStateFrom.validateInfos.algo"
v-bind="modalStateFrom.validateInfos.algoIndex"
>
<a-input
v-model:value="modalState.from.algoIndex"
@@ -1051,7 +1055,6 @@ onMounted(() => {
<a-form
name="modalStateBatchFrom"
layout="horizontal"
:label-col="{ span: 7 }"
>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
@@ -1101,7 +1104,7 @@ onMounted(() => {
<a-form-item
label="Algo Index"
name="algo"
v-bind="modalStateBatchFrom.validateInfos.algo"
v-bind="modalStateBatchFrom.validateInfos.algoIndex"
>
<a-input
v-model:value="modalState.BatchForm.algoIndex"
@@ -1172,14 +1175,11 @@ onMounted(() => {
<a-input
v-model:value="modalState.BatchDelForm.imsi"
allow-clear
placeholder="请输入起始IMSI"
>
<template #prefix>
<a-tooltip placement="topLeft">
<template #title>
SUPI=MCC+MNC+MSIN MCC=移动国家号码, 由三位数字组成
MNC=移动网络号由两位数字组成
MSIN=移动客户识别码,采用等长10位数字构成
{{t('views.neUser.auth.imsiTip')}}
</template>
<InfoCircleOutlined style="color: rgba(0, 0, 0, 0.45)" />
</a-tooltip>
@@ -1195,7 +1195,6 @@ onMounted(() => {
>
<a-input-number
v-model:value="modalState.BatchDelForm.num"
placeholder="请输入删号个数"
style="width: 100%"
></a-input-number>
</a-form-item>