feat: 网元快速安装多语言翻译

This commit is contained in:
TsMask
2024-05-20 20:18:00 +08:00
parent 624f67ecca
commit 814b7b0058
10 changed files with 285 additions and 340 deletions

View File

@@ -29,33 +29,33 @@ let tableColumns: ColumnsType = [
width: 50,
},
{
title: 'neType',
title: t('views.ne.common.neType'),
dataIndex: 'neType',
align: 'left',
width: 100,
},
{
title: 'name',
title: t('views.ne.neSoftware.version'),
dataIndex: 'version',
align: 'left',
width: 150,
},
{
title: t('views.ne.neSoftware.name'),
dataIndex: 'name',
key: 'name',
align: 'left',
width: 300,
},
{
title: 'version',
dataIndex: 'version',
align: 'left',
width: 100,
},
{
title: 'description',
title: t('common.description'),
dataIndex: 'description',
key: 'description',
align: 'left',
ellipsis: true,
},
{
title: 'createTime',
title: t('common.createTime'),
dataIndex: 'createTime',
align: 'left',
width: 150,
@@ -214,7 +214,9 @@ function fnRecordInstall() {
const from = toRaw(state.from);
Modal.confirm({
title: t('common.tipTitle'),
content: `install software package [${from.name}] ?`,
content: t('views.ne.neQuickSetup.installConfirmTip', {
name: from.name,
}),
onOk: async () => {
if (state.confirmLoading) return;
state.confirmLoading = true;
@@ -224,7 +226,7 @@ function fnRecordInstall() {
if (state.optionType === 'option') {
const res = await newNeVersion(from);
if (res.code === RESULT_CODE_ERROR) {
message.error(`软件信息错误 ${res.msg}`, 3);
message.error(res.msg, 3);
hide();
state.confirmLoading = false;
return;
@@ -243,10 +245,10 @@ function fnRecordInstall() {
preinput: preinput,
});
if (res.code === RESULT_CODE_SUCCESS) {
message.success(`安装成功 ${res.msg}`, 3);
message.success(t('common.operateOk'), 3);
state.stepNext = true;
} else {
message.error(`安装失败 ${res.msg}`, 3);
message.error(res.msg, 3);
}
// 非选择的重置
@@ -262,7 +264,7 @@ function fnRecordInstall() {
function fnStepPrev() {
Modal.confirm({
title: t('common.tipTitle'),
content: '确认要放弃当前变更返回上一步吗?',
content: t('views.ne.neQuickSetup.stepPrevTip'),
onOk() {
fnToStepName('NeInfoConfig');
},
@@ -273,7 +275,7 @@ function fnStepPrev() {
function fnStepNext() {
Modal.confirm({
title: t('common.tipTitle'),
content: '确认要下一步进行网元授权吗?',
content: t('views.ne.neQuickSetup.neInfoSoftwareInstallStepNext'),
onOk() {
fnToStepName('NeInfoSoftwareLicense');
},
@@ -296,24 +298,34 @@ onMounted(() => {
<a-form
name="installStateFrom"
layout="horizontal"
:label-col="{ span: 3 }"
:wrapper-col="{ span: 8 }"
:label-col="{ span: 4 }"
:wrapper-col="{ span: 16 }"
:label-wrap="true"
>
<a-form-item label="软件来源" name="optionType">
<a-form-item
:label="t('views.ne.neQuickSetup.installSource')"
name="optionType"
>
<a-radio-group
v-model:value="state.optionType"
button-style="solid"
:disabled="state.confirmLoading"
@change="fnOptionTypeChange"
>
<a-radio-button value="option">已上传</a-radio-button>
<a-radio-button value="upload">新上传</a-radio-button>
<a-radio-button value="option">
{{ t('views.ne.neQuickSetup.installSourceOption') }}
</a-radio-button>
<a-radio-button value="upload">
{{ t('views.ne.neQuickSetup.installSourceUpload') }}
</a-radio-button>
</a-radio-group>
</a-form-item>
<!-- 选择已上传 -->
<template v-if="state.optionType === 'option'">
<a-form-item label="选择记录" name="option" :wrapper-col="{ span: 24 }">
<a-form-item
:label="t('views.ne.neQuickSetup.installSelect')"
name="option"
>
<a-table
class="table"
row-key="id"
@@ -350,7 +362,11 @@ onMounted(() => {
<!-- 重新上传 -->
<template v-if="state.optionType === 'upload'">
<a-form-item label="上传文件" name="upload" :help="state.from.name">
<a-form-item
:label="t('views.ne.neQuickSetup.installUpload')"
name="upload"
:help="state.from.name"
>
<a-button
type="primary"
@click.prevent="() => (state.visibleByFile = !state.visibleByFile)"
@@ -371,25 +387,27 @@ onMounted(() => {
<div class="ne-oper">
<a-space direction="horizontal" :size="18">
<a-button @click="fnStepPrev()"> 上一步 </a-button>
<a-button @click="fnStepPrev()">
{{ t('views.ne.neQuickSetup.stepPrev') }}
</a-button>
<a-button
type="default"
danger
type="primary"
ghost
:disabled="!state.from.version"
:loading="state.confirmLoading"
@click.prevent="fnRecordInstall()"
>
<template #icon><ThunderboltOutlined /></template>
Install
{{ t('views.ne.neQuickSetup.installText') }}
</a-button>
<a-button
type="dashed"
type="primary"
@click="fnStepNext()"
:disabled="!state.stepNext"
>
下一步
{{ t('views.ne.neQuickSetup.stepNext') }}
</a-button>
</a-space>
</div>
@@ -398,10 +416,15 @@ onMounted(() => {
<style lang="less" scoped>
.ne {
padding-top: 12px;
min-height: 400px;
display: flex;
flex-direction: column;
& .ant-form {
flex: 1;
}
&-oper {
padding-top: 24px;
text-align: end;
}
}