fix: 网元授权多语言翻译

This commit is contained in:
TsMask
2024-05-17 15:18:01 +08:00
parent 531cd6d03d
commit 85ae7dc5ea
5 changed files with 120 additions and 73 deletions

View File

@@ -80,22 +80,10 @@ let modalState: ModalStateType = reactive({
const modalStateFrom = Form.useForm(
modalState.from,
reactive({
neType: [
{
required: true,
message: 'Please input NE Type',
},
],
neId: [
{
required: true,
message: 'Please input NE ID',
},
],
licensePath: [
{
required: true,
message: 'Please upload file',
message: t('views.ne.neLicense.licensePathTip'),
},
],
})
@@ -155,12 +143,14 @@ function fnModalCancel() {
function fnBeforeUploadFile(file: FileType) {
if (modalState.confirmLoading) return false;
if (!file.name.endsWith('.ini')) {
message.error('只支持上传文件格式 .ini', 3);
const msg = `${t('components.UploadModal.onlyAllow')} .ini`;
message.error(msg, 3);
return Upload.LIST_IGNORE;
}
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
message.error('文件必须小于2MB', 3);
const isLt3M = file.size / 1024 / 1024 < 3;
if (!isLt3M) {
const msg = `${t('components.UploadModal.allowFilter')} 3MB`;
message.error(msg, 3);
return Upload.LIST_IGNORE;
}
return true;
@@ -200,7 +190,7 @@ function fnCopyCode() {
const code = modalState.from.activationRequestCode;
if (!code) return;
copy(code).then(() => {
message.success('copy success', 3);
message.success(t('common.copyOk'), 3);
});
}
@@ -210,7 +200,7 @@ function fnDownCode() {
if (!activationRequestCode) return;
Modal.confirm({
title: t('common.tipTitle'),
content: 'Confirm to download the Code as a file for saving?',
content: t('views.ne.neLicense.downCodeTop'),
onOk() {
const blob = new Blob([activationRequestCode], {
type: 'text/plain',
@@ -231,7 +221,7 @@ function fnModalVisibleById(id: string) {
if (res.code === RESULT_CODE_SUCCESS) {
Object.assign(modalState.from, res.data);
modalState.from.licensePath = '';
modalState.title = 'Update License';
modalState.title = t('views.ne.neLicense.updateTtile');
modalState.visibleByEdit = true;
} else {
message.error(res.msg, 3);
@@ -255,7 +245,7 @@ function fnModalVisibleByTypeAndId(neType: string, neId: string) {
if (res.code === RESULT_CODE_SUCCESS) {
Object.assign(modalState.from, res.data);
modalState.from.licensePath = '';
modalState.title = 'Update License';
modalState.title = t('views.ne.neLicense.updateTtile');
modalState.visibleByEdit = true;
} else {
message.error(res.msg, 3);
@@ -303,23 +293,29 @@ onMounted(() => {});
:label-col="{ span: 6 }"
:labelWrap="true"
>
<a-form-item
:label="t('views.configManage.license.neType')"
name="neType"
v-bind="modalStateFrom.validateInfos.neType"
>
<a-input v-model:value="modalState.from.neType" :disabled="true" />
</a-form-item>
<a-form-item
:label="t('views.configManage.license.neId')"
name="neId"
v-bind="modalStateFrom.validateInfos.neId"
>
<a-input v-model:value="modalState.from.neId" :disabled="true" />
</a-form-item>
<a-row :gutter="16">
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
:label-col="{ span: 12 }"
:label="t('views.ne.common.neType')"
name="neType"
>
{{ modalState.from.neType }}
</a-form-item>
</a-col>
<a-col :lg="12" :md="12" :xs="24">
<a-form-item
:label-col="{ span: 12 }"
:label="t('views.ne.common.neId')"
name="neId"
>
{{ modalState.from.neId }}
</a-form-item>
</a-col>
</a-row>
<a-form-item
label="ActivationRequestCode"
:label="t('views.ne.neLicense.activationRequestCode')"
name="activationRequestCode"
v-bind="modalStateFrom.validateInfos.activationRequestCode"
>
@@ -329,12 +325,12 @@ onMounted(() => {});
:disabled="true"
style="width: calc(100% - 64px)"
/>
<a-tooltip title="Copy">
<a-tooltip :title="t('common.copyText')" placement="topRight">
<a-button type="default" @click="fnCopyCode()">
<template #icon><CopyOutlined /></template>
</a-button>
</a-tooltip>
<a-tooltip title="Download">
<a-tooltip :title="t('common.downloadText')" placement="topRight">
<a-button type="primary" @click="fnDownCode()">
<template #icon><DownloadOutlined /></template>
</a-button>
@@ -343,7 +339,7 @@ onMounted(() => {});
</a-form-item>
<a-form-item
:label="t('views.configManage.license.updateFile')"
:label="t('views.ne.neLicense.licensePath')"
name="file"
v-bind="modalStateFrom.validateInfos.licensePath"
>
@@ -376,7 +372,7 @@ onMounted(() => {});
<a-switch v-model:checked="modalState.from.reload"> </a-switch>
</a-form-item>
<a-form-item label="Remark" name="remark">
<a-form-item :label="t('views.ne.common.remark')" name="remark">
<a-textarea
v-model:value="modalState.from.remark"
:maxlength="200"