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;
}
@@ -143,18 +143,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':
@@ -167,7 +167,7 @@ function ruleVerification(
}
if (!Object.keys(filterJson).includes(`${value}`)) {
return [false, `${display} 不是合理的枚举值`];
return [false, t('views.mmlManage.requireEnum', { display })];
}
}
break;
@@ -181,7 +181,7 @@ function ruleVerification(
}
if (!Object.values(filterJson).includes(`${value}`)) {
return [false, `${display} 不是合理的布尔类型的值`];
return [false, t('views.mmlManage.requireBool', { display })];
}
}
break;
@@ -193,7 +193,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);
@@ -206,7 +206,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);
@@ -215,7 +215,7 @@ function ruleVerification(
break;
default:
return [false, `${display} 输入值是未知类型`];
return [false, t('views.mmlManage.requireUn', { display })];
}
return result;
}
@@ -275,7 +275,7 @@ function fnGetList() {
state.mmlTreeData = treeArr;
} else {
message.warning({
content: `${neType} 无可选命令操作`,
content: t('views.mmlManage.cmdNoTip', { num: neType }),
duration: 2,
});
}
@@ -305,7 +305,7 @@ onMounted(() => {
}
} else {
message.warning({
content: 'No Data',
content: t('common.noData'),
duration: 2,
});
}
@@ -318,7 +318,11 @@ onMounted(() => {
<a-row :gutter="16">
<a-col :span="6">
<!-- 命令导航 -->
<a-card size="small" :bordered="false" title="命令导航">
<a-card
size="small"
:bordered="false"
:title="t('views.mmlManage.cmdTitle')"
>
<a-form layout="vertical" autocomplete="off">
<a-form-item name="neType">
<a-cascader
@@ -326,7 +330,7 @@ onMounted(() => {
:options="neCascaderOtions"
@change="fnNeChange"
:allow-clear="false"
placeholder="请选择网元"
:placeholder="t('common.selectPlease')"
/>
</a-form-item>
<a-form-item name="listeningPort">
@@ -350,7 +354,7 @@ onMounted(() => {
{{ state.mmlSelect.title }}
</a-typography-text>
<a-typography-text type="danger" v-else>
左侧命令导航中选择要操作项
{{ t('views.mmlManage.cmdOpTip') }}
</a-typography-text>
</template>
<!-- 插槽-卡片右侧 -->
@@ -365,7 +369,7 @@ onMounted(() => {
<template #icon>
<ClearOutlined />
</template>
清除表单
{{ t('views.mmlManage.clearForm') }}
</a-button>
<a-button
type="primary"
@@ -377,7 +381,7 @@ onMounted(() => {
<template #icon>
<SendOutlined />
</template>
执行
{{ t('views.mmlManage.exec') }}
</a-button>
</a-space>
</template>
@@ -445,7 +449,7 @@ onMounted(() => {
<!-- 命令展示 -->
<a-card
title="控制台"
:title="t('views.mmlManage.cmdConsole')"
:bordered="false"
size="small"
:body-style="{ padding: 0 }"
@@ -463,7 +467,7 @@ onMounted(() => {
<template #icon>
<ClearOutlined />
</template>
清除日志
{{ t('views.mmlManage.clearLog') }}
</a-button>
</a-space>
</template>
@@ -472,7 +476,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>