feat: 网元信息表单多语言翻译

This commit is contained in:
TsMask
2024-05-20 15:14:23 +08:00
parent 48f278997f
commit 1ad2ed2d26
7 changed files with 56 additions and 46 deletions

View File

@@ -172,6 +172,9 @@ export default {
codeHit: 'Verification code', codeHit: 'Verification code',
codeText: 'Obtain verification code', codeText: 'Obtain verification code',
codeSmsSend: 'Successfully sent, please pay attention to checking the SMS', codeSmsSend: 'Successfully sent, please pay attention to checking the SMS',
ipPlease: 'Please enter a valid IP address',
ipv4Reg: 'Not a valid IPv4 address',
ipv6Reg: 'Not a valid IPv6 address',
}, },
// 布局 // 布局
@@ -586,9 +589,13 @@ export default {
neType: 'NE Type', neType: 'NE Type',
neTypePlease: "Please select network element type", neTypePlease: "Please select network element type",
neId: 'NE ID', neId: 'NE ID',
neIdPlease: 'Please enter the network element identification',
rmUid: 'Resource Unique ID', rmUid: 'Resource Unique ID',
rmUidPlease: 'Please enter a resource unique ID',
neName: 'NE Name', neName: 'NE Name',
neNamePlease: 'Please enter the name of the network element',
ipAddr: 'IP Addr', ipAddr: 'IP Addr',
ipAddrPlease: 'Please enter the IP address of the network element',
port: 'Port', port: 'Port',
serialNum: 'Serial Number', serialNum: 'Serial Number',
expiryDate: 'Expiry Date', expiryDate: 'Expiry Date',
@@ -618,6 +625,8 @@ export default {
hostConfig: "Connection Configuration", hostConfig: "Connection Configuration",
rmUID: "Data resource location identifiers are used for data tagging such as logging, alarm reporting, etc.", rmUID: "Data resource location identifiers are used for data tagging such as logging, alarm reporting, etc.",
ipAddr: "Support IPV4/IPV6, synchronize the change of the configuration address of the following configuration", ipAddr: "Support IPV4/IPV6, synchronize the change of the configuration address of the following configuration",
addTitle: 'New network element information',
editTitle: 'Editing network element information',
delTip: 'Confirm deletion of network element information data items?', delTip: 'Confirm deletion of network element information data items?',
oam: { oam: {
title: 'OAM Configuration', title: 'OAM Configuration',
@@ -628,6 +637,7 @@ export default {
snmpPort: 'Port', snmpPort: 'Port',
kpiEnable: 'Report', kpiEnable: 'Report',
kpiTimer: 'Reporting Cycle', kpiTimer: 'Reporting Cycle',
kpiTimerPlease: 'Please enter the reporting period (in seconds)',
}, },
}, },
neHost: { neHost: {
@@ -654,6 +664,7 @@ export default {
editTitle: "Edit Host Connection", editTitle: "Edit Host Connection",
test: "Test Connection To Host", test: "Test Connection To Host",
testOk: "Test Connection Successful", testOk: "Test Connection Successful",
authorizedRSA: "Do I have to configure authorization for a password-free direct connection?",
}, },
neHostCmd: { neHostCmd: {
cmdType: "Type", cmdType: "Type",

View File

@@ -172,6 +172,9 @@ export default {
codeHit: '验证码', codeHit: '验证码',
codeText: '获取验证码', codeText: '获取验证码',
codeSmsSend: '发送成功,请注意查看短信', codeSmsSend: '发送成功,请注意查看短信',
ipPlease: '请输入有效的IP地址',
ipv4Reg: '不是有效IPv4地址',
ipv6Reg: '不是有效IPv6地址',
}, },
// 布局 // 布局
@@ -585,10 +588,14 @@ export default {
common: { common: {
neType: '网元类型', neType: '网元类型',
neTypePlease: "请选择网元类型", neTypePlease: "请选择网元类型",
neId: '网元内部标识', neId: '网元标识',
neIdPlease: '请输入网元标识',
rmUid: '资源唯一标识', rmUid: '资源唯一标识',
rmUidPlease: '请输入资源唯一标识',
neName: '网元名称', neName: '网元名称',
neNamePlease: '请输入网元名称',
ipAddr: '网元服务IP', ipAddr: '网元服务IP',
ipAddrPlease: '请输入网元IP地址',
port: '网元服务端口', port: '网元服务端口',
serialNum: '序列号', serialNum: '序列号',
expiryDate: '许可证到期日期', expiryDate: '许可证到期日期',
@@ -618,6 +625,8 @@ export default {
hostConfig: "终端连接配置", hostConfig: "终端连接配置",
rmUID: "数据资源定位标识符用于日志、告警上报等数据标记", rmUID: "数据资源定位标识符用于日志、告警上报等数据标记",
ipAddr: "支持IPV4/IPV6,同步变更下方配置的配置地址", ipAddr: "支持IPV4/IPV6,同步变更下方配置的配置地址",
addTitle: '新增网元信息',
editTitle: '编辑网元信息',
delTip: '确认删除网元信息数据项吗?', delTip: '确认删除网元信息数据项吗?',
oam: { oam: {
title: 'OAM配置', title: 'OAM配置',
@@ -628,6 +637,7 @@ export default {
snmpPort: '端口', snmpPort: '端口',
kpiEnable: '上报', kpiEnable: '上报',
kpiTimer: '上报周期', kpiTimer: '上报周期',
kpiTimerPlease: '请输入上报周期(单位秒)',
}, },
}, },
neHost: { neHost: {
@@ -654,6 +664,7 @@ export default {
editTitle: "编辑主机连接", editTitle: "编辑主机连接",
test: "测试连接", test: "测试连接",
testOk: "测试连接成功", testOk: "测试连接成功",
authorizedRSA: "是否要配置授权免密直连?",
}, },
neHostCmd: { neHostCmd: {
cmdType: "命令类型", cmdType: "命令类型",

View File

@@ -69,22 +69,16 @@ function fnHostAuthorized(row: Record<string, any>) {
if (modalState.confirmLoading) return; if (modalState.confirmLoading) return;
Modal.confirm({ Modal.confirm({
title: '提示', title: t('common.tipTitle'),
content: '是否要配置免密直连?', content: t('views.ne.neHost.authorizedRSA'),
onOk: () => { onOk: () => {
modalState.confirmLoading = true; modalState.confirmLoading = true;
neHostAuthorizedRSA(row).then(res => { neHostAuthorizedRSA(row).then(res => {
modalState.confirmLoading = false; modalState.confirmLoading = false;
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
message.success({ message.success(t('common.operateOk'), 3);
content: `操作成功`,
duration: 2,
});
} else { } else {
message.error({ message.error(t('common.operateErr'), 3);
content: `操作失败`,
duration: 2,
});
} }
}); });
}, },
@@ -161,19 +155,19 @@ const modalStateFrom = Form.useForm(
neType: [ neType: [
{ {
required: true, required: true,
message: '请输入网元类型', message: t('views.ne.common.neTypePlease'),
}, },
], ],
neId: [ neId: [
{ {
required: true, required: true,
message: '请输入网元标识', message: t('views.ne.common.neIdPlease'),
}, },
], ],
rmUid: [ rmUid: [
{ {
required: true, required: true,
message: '请输入资源唯一标识', message: t('views.ne.common.rmUidPlease'),
}, },
], ],
ip: [ ip: [
@@ -185,7 +179,7 @@ const modalStateFrom = Form.useForm(
neName: [ neName: [
{ {
required: true, required: true,
message: '请输入网元名称', message: t('views.ne.common.neNamePlease'),
}, },
], ],
}) })
@@ -198,17 +192,17 @@ function modalStateFromEqualIPV4AndIPV6(
callback: (error?: string) => void callback: (error?: string) => void
) { ) {
if (!value) { if (!value) {
return Promise.reject('请输入网元IP地址'); return Promise.reject(t('views.ne.common.ipAddrPlease'));
} }
if (value.indexOf('.') === -1 && value.indexOf(':') === -1) { if (value.indexOf('.') === -1 && value.indexOf(':') === -1) {
return Promise.reject('请输入有效的IP地址'); return Promise.reject(t('valid.ipPlease'));
} }
if (value.indexOf('.') !== -1 && !regExpIPv4.test(value)) { if (value.indexOf('.') !== -1 && !regExpIPv4.test(value)) {
return Promise.reject('不是有效IPv4地址'); return Promise.reject(t('valid.ipv4Reg'));
} }
if (value.indexOf(':') !== -1 && !regExpIPv6.test(value)) { if (value.indexOf(':') !== -1 && !regExpIPv6.test(value)) {
return Promise.reject('不是有效IPv6地址'); return Promise.reject(t('valid.ipv6Reg'));
} }
return Promise.resolve(); return Promise.resolve();
} }
@@ -220,7 +214,7 @@ function modalStateFromEqualIPV4AndIPV6(
function fnModalVisibleByEdit(editId: string) { function fnModalVisibleByEdit(editId: string) {
if (!editId) { if (!editId) {
modalStateFrom.resetFields(); modalStateFrom.resetFields();
modalState.title = t('views.configManage.neManage.addNe'); modalState.title = t('views.ne.neInfo.addTitle');
modalState.visibleByEdit = true; modalState.visibleByEdit = true;
} else { } else {
if (modalState.confirmLoading) return; if (modalState.confirmLoading) return;
@@ -231,7 +225,7 @@ function fnModalVisibleByEdit(editId: string) {
hide(); hide();
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
Object.assign(modalState.from, res.data); Object.assign(modalState.from, res.data);
modalState.title = '编辑网元信息'; modalState.title = t('views.ne.neInfo.editTitle');
modalState.visibleByEdit = true; modalState.visibleByEdit = true;
} else { } else {
message.error(t('common.getInfoFail'), 2); message.error(t('common.getInfoFail'), 2);
@@ -255,10 +249,7 @@ function fnModalOk() {
result result
.then(res => { .then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
message.success({ message.success(t('common.operateOk'), 3);
content: '操作成功',
duration: 3,
});
// 刷新缓存的网元信息 // 刷新缓存的网元信息
useNeInfoStore().fnRefreshNelist(); useNeInfoStore().fnRefreshNelist();
emit('ok'); emit('ok');

View File

@@ -59,7 +59,7 @@ const modalStateFrom = Form.useForm(
kpiTimer: [ kpiTimer: [
{ {
required: true, required: true,
message: '请输入KPI上报周期单位秒', message: t('views.ne.neInfo.oam.kpiTimerPlease'),
}, },
], ],
}) })
@@ -115,10 +115,7 @@ function fnModalOk() {
}) })
.then(res => { .then(res => {
if (res.code === RESULT_CODE_SUCCESS) { if (res.code === RESULT_CODE_SUCCESS) {
message.success({ message.success(t('common.operateOk'), 3);
content: '操作成功',
duration: 3,
});
emit('ok'); emit('ok');
fnModalCancel(); fnModalCancel();
} else { } else {

View File

@@ -127,17 +127,17 @@ function modalStateFromEqualIPV4AndIPV6(
callback: (error?: string) => void callback: (error?: string) => void
) { ) {
if (!value) { if (!value) {
return Promise.reject('请输入网元IP地址'); return Promise.reject(t('views.ne.common.ipAddrPlease'));
} }
if(value.indexOf('.') === -1 && value.indexOf(':') === -1) { if (value.indexOf('.') === -1 && value.indexOf(':') === -1) {
return Promise.reject('请输入有效的IP地址'); return Promise.reject(t('valid.ipPlease'));
} }
if (value.indexOf('.') !== -1 && !regExpIPv4.test(value)) { if (value.indexOf('.') !== -1 && !regExpIPv4.test(value)) {
return Promise.reject('不是有效IPv4地址'); return Promise.reject(t('valid.ipv4Reg'));
} }
if (value.indexOf(':') !== -1 && !regExpIPv6.test(value)) { if (value.indexOf(':') !== -1 && !regExpIPv6.test(value)) {
return Promise.reject('不是有效IPv6地址'); return Promise.reject(t('valid.ipv6Reg'));
} }
return Promise.resolve(); return Promise.resolve();
} }

View File

@@ -112,17 +112,17 @@ function modalStateFromEqualIPV4AndIPV6(
callback: (error?: string) => void callback: (error?: string) => void
) { ) {
if (!value) { if (!value) {
return Promise.reject('请输入网元IP地址'); return Promise.reject(t('views.ne.common.ipAddrPlease'));
} }
if(value.indexOf('.') === -1 && value.indexOf(':') === -1) { if (value.indexOf('.') === -1 && value.indexOf(':') === -1) {
return Promise.reject('请输入有效的IP地址'); return Promise.reject(t('valid.ipPlease'));
} }
if (value.indexOf('.') !== -1 && !regExpIPv4.test(value)) { if (value.indexOf('.') !== -1 && !regExpIPv4.test(value)) {
return Promise.reject('不是有效IPv4地址'); return Promise.reject(t('valid.ipv4Reg'));
} }
if (value.indexOf(':') !== -1 && !regExpIPv6.test(value)) { if (value.indexOf(':') !== -1 && !regExpIPv6.test(value)) {
return Promise.reject('不是有效IPv6地址'); return Promise.reject(t('valid.ipv6Reg'));
} }
return Promise.resolve(); return Promise.resolve();
} }

View File

@@ -222,17 +222,17 @@ function modalStateFromEqualIPV4AndIPV6(
callback: (error?: string) => void callback: (error?: string) => void
) { ) {
if (!value) { if (!value) {
return Promise.reject('请输入网元IP地址'); return Promise.reject(t('views.ne.common.ipAddrPlease'));
} }
if (value.indexOf('.') === -1 && value.indexOf(':') === -1) { if (value.indexOf('.') === -1 && value.indexOf(':') === -1) {
return Promise.reject('请输入有效的IP地址'); return Promise.reject(t('valid.ipPlease'));
} }
if (value.indexOf('.') !== -1 && !regExpIPv4.test(value)) { if (value.indexOf('.') !== -1 && !regExpIPv4.test(value)) {
return Promise.reject('不是有效IPv4地址'); return Promise.reject(t('valid.ipv4Reg'));
} }
if (value.indexOf(':') !== -1 && !regExpIPv6.test(value)) { if (value.indexOf(':') !== -1 && !regExpIPv6.test(value)) {
return Promise.reject('不是有效IPv6地址'); return Promise.reject(t('valid.ipv6Reg'));
} }
return Promise.resolve(); return Promise.resolve();
} }