style: MML页面多语言

This commit is contained in:
TsMask
2023-11-10 16:52:08 +08:00
parent b8190bd640
commit 6a683f8754
6 changed files with 142 additions and 70 deletions

View File

@@ -76,7 +76,7 @@ function fnSendMML() {
// 是否必填项且有效值
const notV = value === null || value === undefined || value === '';
if (item.optional === 'false' && notV) {
message.warning(`必填参数:${item.display}`, 2);
message.warning(t('views.mmlManage.require', { num: item.display }), 2);
return;
}
@@ -142,18 +142,18 @@ function ruleVerification(
const maxInt = parseInt(filterArr[1]);
const valueInt = parseInt(value);
if (valueInt < minInt || valueInt > maxInt) {
return [false, `${display} 参数值不在合理范围 ${filter}`];
return [false, t('views.mmlManage.requireInt', { display, filter })];
}
}
break;
case 'ipv4':
if (!regExpIPv4.test(value)) {
return [false, `${display} 不是合法的IPV4地址`];
return [false, t('views.mmlManage.requireIpv4', { display })];
}
break;
case 'ipv6':
if (!regExpIPv6.test(value)) {
return [false, `${display} 不是合法的IPV6地址`];
return [false, t('views.mmlManage.requireIpv6', { display })];
}
break;
case 'enum':
@@ -166,7 +166,7 @@ function ruleVerification(
}
if (!Object.keys(filterJson).includes(`${value}`)) {
return [false, `${display} 不是合理的枚举值`];
return [false, t('views.mmlManage.requireEnum', { display })];
}
}
break;
@@ -180,7 +180,7 @@ function ruleVerification(
}
if (!Object.values(filterJson).includes(`${value}`)) {
return [false, `${display} 不是合理的布尔类型的值`];
return [false, t('views.mmlManage.requireBool', { display })];
}
}
break;
@@ -192,7 +192,7 @@ function ruleVerification(
'^\\S{' + filterArr[0] + ',' + filterArr[1] + '}$'
);
if (!rule.test(value)) {
return [false, `${display} 参数值不合理`];
return [false, t('views.mmlManage.requireString', { display })];
}
} catch (error) {
console.error(error);
@@ -205,7 +205,7 @@ function ruleVerification(
try {
let regex = new RegExp(filter);
if (!regex.test(value)) {
return [false, `${display} 参数值不合理`];
return [false, t('views.mmlManage.requireString', { display })];
}
} catch (error) {
console.error(error);
@@ -214,7 +214,7 @@ function ruleVerification(
break;
default:
return [false, `${display} 输入值是未知类型`];
return [false, t('views.mmlManage.requireUn', { display })];
}
return result;
}
@@ -286,13 +286,13 @@ onMounted(() => {
}
} else {
message.warning({
content: `暂无OMC网元`,
content: t('views.mmlManage.omcOperate.noOMC'),
duration: 5,
});
}
} else {
message.warning({
content: `暂无网元列表数据`,
content: t('common.noData'),
duration: 2,
});
}
@@ -308,7 +308,7 @@ onMounted(() => {
<a-card
size="small"
:bordered="false"
title="命令导航"
:title="t('views.mmlManage.cmdTitle')"
:loading="state.mmlLoading"
>
<a-form layout="vertical" autocomplete="off">
@@ -316,7 +316,7 @@ onMounted(() => {
<a-select
v-model:value="state.neId"
:options="neOtions"
placeholder="请选择OMC操作命令"
:placeholder="t('common.selectPlease')"
/>
</a-form-item>
<a-form-item name="listeningPort">
@@ -340,7 +340,7 @@ onMounted(() => {
{{ state.mmlSelect.title }}
</a-typography-text>
<a-typography-text type="danger" v-else>
左侧命令导航中选择要操作项
{{ t('views.mmlManage.cmdOpTip') }}
</a-typography-text>
</template>
<!-- 插槽-卡片右侧 -->
@@ -355,7 +355,7 @@ onMounted(() => {
<template #icon>
<ClearOutlined />
</template>
清除表单
{{ t('views.mmlManage.clearForm') }}
</a-button>
<a-button
type="primary"
@@ -367,7 +367,7 @@ onMounted(() => {
<template #icon>
<SendOutlined />
</template>
执行
{{ t('views.mmlManage.exec') }}
</a-button>
</a-space>
</template>
@@ -435,7 +435,7 @@ onMounted(() => {
<!-- 命令展示 -->
<a-card
title="控制台"
:title="t('views.mmlManage.cmdConsole')"
:bordered="false"
size="small"
:body-style="{ padding: 0 }"
@@ -453,7 +453,7 @@ onMounted(() => {
<template #icon>
<ClearOutlined />
</template>
清除日志
{{ t('views.mmlManage.clearLog') }}
</a-button>
</a-space>
</template>
@@ -462,7 +462,7 @@ onMounted(() => {
v-model:value="state.mmlCmdLog"
:disabled="true"
:editor-style="{ height: '500px !important' }"
placeholder="等待发送命令"
:placeholder="t('views.mmlManage.cmdAwait')"
></CodemirrorEdite>
</a-card>
</a-col>