--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

@@ -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>