style: 快速开站多语言翻译

This commit is contained in:
TsMask
2024-05-24 09:41:20 +08:00
parent 7c78eab431
commit f94b1ef44a
8 changed files with 335 additions and 255 deletions

View File

@@ -1,6 +1,11 @@
<script setup lang="ts">
import { Modal, TableColumnsType, message } from 'ant-design-vue/lib';
import { defineAsyncComponent, onMounted, reactive, ref, toRaw } from 'vue';
import {
Modal,
TableColumnsType,
message,
notification,
} from 'ant-design-vue/lib';
import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
import { fnToStepName } from '../hooks/useStep';
import useI18n from '@/hooks/useI18n';
import useDictStore from '@/store/modules/dict';
@@ -19,19 +24,19 @@ let dictStatus = ref<DictType[]>([]);
/**表格字段列 */
let tableColumns = ref<TableColumnsType>([
{
title: 'neType',
title: t('views.ne.common.neType'),
dataIndex: 'neType',
align: 'left',
width: 100,
},
{
title: 'neId',
title: t('views.ne.common.neId'),
dataIndex: 'neId',
align: 'left',
width: 100,
},
{
title: 'version',
title: t('views.ne.neVersion.version'),
dataIndex: 'version',
align: 'left',
width: 100,
@@ -40,7 +45,7 @@ let tableColumns = ref<TableColumnsType>([
maxWidth: 200,
},
{
title: 'New Version',
title: t('views.ne.neVersion.newVersion'),
dataIndex: 'newVersion',
align: 'left',
width: 100,
@@ -49,7 +54,7 @@ let tableColumns = ref<TableColumnsType>([
maxWidth: 200,
},
{
title: 'status',
title: t('views.ne.neVersion.status'),
dataIndex: 'status',
key: 'status',
align: 'left',
@@ -67,8 +72,8 @@ type StateType = {
selectedRowKeys: (string | number)[];
/**多文件上传 */
visibleByMoreFile: boolean;
/**勾选升级情况 */
visibleByUpgrade: boolean;
/**勾选安装弹窗 */
visibleByInstall: boolean;
/**操作数据进行版本升级 */
operateDataUpgrade: any[];
/**确定按钮 loading */
@@ -81,7 +86,7 @@ let state: StateType = reactive({
data: [],
selectedRowKeys: [],
visibleByMoreFile: false,
visibleByUpgrade: false,
visibleByInstall: false,
operateDataUpgrade: [],
confirmLoading: false,
});
@@ -94,7 +99,7 @@ function fnTableSelectedRowKeys(keys: (string | number)[]) {
/**对话框弹出确认执行函数*/
function fnModalOk() {
fnGetList();
if (state.visibleByUpgrade) {
if (state.visibleByInstall) {
fnModalCancel();
}
}
@@ -102,7 +107,7 @@ function fnModalOk() {
/**对话框弹出关闭执行函数*/
function fnModalCancel() {
state.visibleByMoreFile = false;
state.visibleByUpgrade = false;
state.visibleByInstall = false;
state.operateDataUpgrade = [];
}
@@ -110,11 +115,16 @@ function fnModalCancel() {
function fnRecordInstall() {
Modal.confirm({
title: t('common.tipTitle'),
content: `check install version?`,
content: t('views.system.quickStart.stepInstallTip'),
onOk() {
if (state.confirmLoading) return;
state.confirmLoading = true;
const hide = message.loading(t('common.loading'), 0);
const notificationKey = 'NE_Select_Install';
notification.info({
key: notificationKey,
duration: 0,
message: t('common.loading'),
});
// 操作升级的网元数据
const selectRows = state.data.filter(item =>
state.selectedRowKeys.includes(item.id)
@@ -145,7 +155,7 @@ function fnRecordInstall() {
}
// 发请求信息
state.visibleByUpgrade = true;
state.visibleByInstall = true;
Promise.allSettled(
state.operateDataUpgrade
.filter(s => s.status !== 'fail')
@@ -169,7 +179,7 @@ function fnRecordInstall() {
});
})
.finally(() => {
hide();
notification.close(notificationKey);
state.confirmLoading = false;
});
},
@@ -201,7 +211,7 @@ function fnGetList() {
function fnStepPrev() {
Modal.confirm({
title: t('common.tipTitle'),
content: '确认要放弃当前变更返回上一步吗?',
content: t('views.system.quickStart.stepInstallStepPrev'),
onOk() {
fnToStepName('NeInfoConfigPara5G');
},
@@ -213,7 +223,7 @@ function fnStepNext(stepName: 'NeInfoSoftwareLicense') {
if (stepName === 'NeInfoSoftwareLicense') {
Modal.confirm({
title: t('common.tipTitle'),
content: '确认要下一步进行网元授权吗?',
content: t('views.system.quickStart.stepInstallStepNext'),
onOk() {
fnToStepName('NeInfoSoftwareLicense');
},
@@ -267,16 +277,16 @@ onMounted(() => {
@cancel="fnModalCancel"
></UploadMoreFile>
<!-- 勾选版本升级 -->
<!-- 勾选网元版本进行安装框 -->
<a-modal
width="800px"
:keyboard="false"
:mask-closable="false"
:visible="state.visibleByUpgrade"
title="Upgrade Version"
:visible="state.visibleByInstall"
:title="t('views.system.quickStart.stepInstallModal')"
:confirm-loading="state.confirmLoading"
:closable="false"
:cancelButtonProps="{ disabled: state.visibleByUpgrade }"
:cancelButtonProps="{ disabled: state.visibleByInstall }"
@ok="fnModalOk"
@cancel="fnModalCancel"
>
@@ -288,31 +298,34 @@ onMounted(() => {
<div class="ne-oper">
<a-space direction="horizontal" :size="18">
<a-button @click="fnStepPrev()"> 上一步 </a-button>
<a-button @click="fnStepPrev()">
{{ t('views.system.quickStart.stepPrev') }}
</a-button>
<a-button
type="primary"
type="dashed"
@click.prevent="
() => (state.visibleByMoreFile = !state.visibleByMoreFile)
"
>
<template #icon><PlusOutlined /></template>
Upload More Software
<template #icon><UploadOutlined /></template>
{{ t('views.ne.neSoftware.uploadBatch') }}
</a-button>
<a-button
type="default"
danger
type="primary"
ghost
:disabled="state.selectedRowKeys.length <= 0"
:loading="state.confirmLoading"
@click.prevent="fnRecordInstall()"
>
<template #icon><ThunderboltOutlined /></template>
Check Install
{{ t('views.system.quickStart.stepInstallText') }}
{{ state.selectedRowKeys.length || '' }}
</a-button>
<a-button type="dashed" @click="fnStepNext('NeInfoSoftwareLicense')">
下一步
<a-button type="primary" @click="fnStepNext('NeInfoSoftwareLicense')">
{{ t('views.system.quickStart.stepNext') }}
</a-button>
</a-space>
</div>