fix: 网元软件包类型支持adb,mf,rtproxy

This commit is contained in:
TsMask
2024-05-27 17:08:56 +08:00
parent 38cb406687
commit 9f2b80718e
6 changed files with 75 additions and 59 deletions

View File

@@ -694,6 +694,8 @@ export default {
uploadBatch: "Update Softwares",
uploadBatchMax: "Multiple packages can be uploaded, with up to {txt} selected at the same time.",
uploadFileName: "Parses file names in the format of: amf-r2.240x.xx-xxx",
type: 'Software Type',
typePlease: 'Please select the software type',
name: "File Name",
path: "Software File",
pathPlease: "Please upload the software package file",
@@ -769,7 +771,7 @@ export default {
configAddTip: 'Is it added as new network element information and continue?',
configUpdateTitle: 'Update Tips',
configUpdateTip: 'Does it update to the already existing network element information and continue?',
configStepNext: 'Confirm that you want to proceed to the next step for the Net Element software installation?',
configStepNext: 'Confirm that you want to proceed to the next step for the Network Element software installation?',
installTitle: "Network Element Installation",
installDesc: "Installation to Service Terminal",
installConfirmTip: 'Are you sure you want to install package [{name}]?',
@@ -786,6 +788,7 @@ export default {
licenseResultTitleOk: 'Successful Activation',
licenseUpload: 'License',
licenseEnd: 'Finish',
licenseEndTip: "Confirmed to end the installation?",
licenseCheack: 'Waiting for network element validation',
licenseTip1: '1. Click [License] to get the license activation code, and then contact the network element vendor for activation.',
licenseTip2: '2. Clicking [Finish] will end the installation process.',

View File

@@ -694,6 +694,8 @@ export default {
uploadBatch: "上传软件包",
uploadBatchMax: "可上传多个软件包,最多同时选择{txt}个。",
uploadFileName: "解析文件名称格式如: amf-r2.240x.xx-xxx",
type: '软件类型',
typePlease: '请选择软件包类型',
name: "文件名",
path: "软件文件",
pathPlease: "请上传软件包文件",
@@ -786,6 +788,7 @@ export default {
licenseResultTitleOk: '成功激活',
licenseUpload: '许可证',
licenseEnd: '结束',
licenseEndTip: "确认要结束安装吗?",
licenseCheack: '等待网元验证',
licenseTip1: '1. 点击【许可证】可获取许可激活码,随后联系网元厂商进行激活',
licenseTip2: '2. 点击【结束】将结束安装过程',

View File

@@ -29,10 +29,10 @@ let tableColumns: ColumnsType = [
width: 50,
},
{
title: t('views.ne.common.neType'),
dataIndex: 'neType',
title: t('views.ne.neSoftware.type'),
dataIndex: 'type',
align: 'left',
width: 100,
width: 120,
},
{
title: t('views.ne.neSoftware.version'),
@@ -275,7 +275,7 @@ function fnStepPrev() {
function fnStepNext() {
Modal.confirm({
title: t('common.tipTitle'),
content: t('views.ne.neQuickSetup.neInfoSoftwareInstallStepNext'),
content: t('views.ne.neQuickSetup.installStepNext'),
onOk() {
fnToStepName('NeInfoSoftwareLicense');
},
@@ -285,7 +285,7 @@ function fnStepNext() {
onMounted(() => {
const { neType, neId } = stepState.neInfo;
if (neId) {
tableState.queryParams.neType = neType;
tableState.queryParams.type = neType;
state.from.neType = neType;
state.from.neId = neId;
fnGetList(1);

View File

@@ -34,7 +34,7 @@ type ModalStateType = {
/**表单数据 */
from: {
id: string;
neType: string;
type: string;
name: string;
path: string;
version: string;
@@ -52,7 +52,7 @@ let modalState: ModalStateType = reactive({
title: '软件包文件',
from: {
id: '',
neType: '',
type: '',
name: '',
path: '',
version: '',
@@ -66,12 +66,12 @@ let modalState: ModalStateType = reactive({
const modalStateFrom = Form.useForm(
modalState.from,
reactive({
neType: [
type: [
{
required: true,
min: 1,
max: 32,
message: t('views.ne.common.neTypePlease'),
message: t('views.ne.neSoftware.typePlease'),
},
],
version: [
@@ -160,9 +160,9 @@ function fnBeforeUploadFile(file: FileType) {
if (matches) {
modalState.from.version = matches[0];
}
const neTypeIndex = fileName.indexOf('-');
if (neTypeIndex !== -1) {
modalState.from.neType = fileName.substring(0, neTypeIndex).toUpperCase();
const typeIndex = fileName.indexOf('-');
if (typeIndex !== -1) {
modalState.from.type = fileName.substring(0, typeIndex).toUpperCase();
}
return true;
}
@@ -235,7 +235,7 @@ onMounted(() => {});
<template>
<a-modal
width="500px"
width="550px"
:keyboard="false"
:mask-closable="false"
:visible="modalState.visibleByEdit"
@@ -253,6 +253,7 @@ onMounted(() => {});
>
<a-form-item
:label="t('views.ne.neSoftware.path')"
:help="t('views.ne.neSoftware.uploadFileName')"
name="file"
v-bind="modalStateFrom.validateInfos.path"
v-if="modalState.from.id === ''"
@@ -282,13 +283,17 @@ onMounted(() => {});
</a-form-item>
<a-form-item
:label="t('views.ne.common.neType')"
name="neType"
v-bind="modalStateFrom.validateInfos.neType"
:label="t('views.ne.neSoftware.type')"
name="type"
v-bind="modalStateFrom.validateInfos.type"
>
<a-auto-complete
v-model:value="modalState.from.neType"
:options="NE_TYPE_LIST.map(v => ({ value: v }))"
v-model:value="modalState.from.type"
:options="
['MF', 'RTPROXY', 'ADB']
.concat(NE_TYPE_LIST)
.map(v => ({ value: v }))
"
:disabled="modalState.from.id !== ''"
>
<a-input

View File

@@ -15,8 +15,8 @@ const props = defineProps({
type: Boolean,
default: false,
},
/**网元类型,指定上传 */
neType: {
/**软件类型,指定上传 */
type: {
type: String,
},
});
@@ -29,7 +29,7 @@ type ModalStateType = {
title: string;
/**表单数据 */
from: {
neType: string;
type: string;
name: string;
path: string;
status: 'done' | 'uploading' | 'error';
@@ -88,7 +88,7 @@ function fnModalOk() {
rows.push(info);
} else {
message.error({
content: `${info.neType} ${res.msg}`,
content: `${info.type} ${res.msg}`,
duration: 3,
});
}
@@ -131,13 +131,13 @@ function fnBeforeUploadFile(file: FileType) {
return Upload.LIST_IGNORE;
}
// 取网元类型判断是否支持
let neType = '';
const neTypeIndex = fileName.indexOf('-');
if (neTypeIndex !== -1) {
neType = fileName.substring(0, neTypeIndex).toUpperCase();
// 取文件包类型判断是否支持
let softwareType = '';
const typeIndex = fileName.indexOf('-');
if (typeIndex !== -1) {
softwareType = fileName.substring(0, typeIndex).toUpperCase();
}
if (!NE_TYPE_LIST.includes(neType)) {
if (!['MF', 'RTPROXY', 'ADB'].concat(NE_TYPE_LIST).includes(softwareType)) {
notification.warning({
message: fileName,
description: t('views.ne.neSoftware.fileCheckType'),
@@ -157,10 +157,18 @@ function fnBeforeUploadFile(file: FileType) {
return Upload.LIST_IGNORE;
}
// 单网元上传
if (!props.neType) {
// 单网元上传
if (props.type && props.type !== softwareType) {
notification.warning({
message: fileName,
description: t('views.ne.neSoftware.fileTypeNotEq', {
txt: props.type,
}),
});
return Upload.LIST_IGNORE;
} else {
// 多文件上传时检查是否有同类型网元包
const hasItem = modalState.from.find(item => item.neType === neType);
const hasItem = modalState.from.find(item => item.type === softwareType);
if (hasItem) {
notification.warning({
message: fileName,
@@ -168,21 +176,11 @@ function fnBeforeUploadFile(file: FileType) {
});
return Upload.LIST_IGNORE;
}
} else {
if (props.neType !== neType) {
notification.warning({
message: fileName,
description: t('views.ne.neSoftware.fileTypeNotEq', {
txt: props.neType,
}),
});
return Upload.LIST_IGNORE;
}
}
modalState.from.push({
name: fileName,
neType: neType,
type: softwareType,
version: version,
uid: file.uid,
status: 'uploading',
@@ -251,10 +249,10 @@ onMounted(() => {});
:label-col="{ span: 6 }"
:labelWrap="true"
>
<template v-if="props.neType">
<a-form-item :label="t('views.ne.common.neType')" name="neType">
<template v-if="props.type">
<a-form-item :label="t('views.ne.neSoftware.type')" name="type">
<a-tag color="processing">
{{ props.neType }}
{{ props.type }}
</a-tag>
</a-form-item>
@@ -324,21 +322,21 @@ onMounted(() => {});
<p :key="item.uid" v-for="item in modalState.from">
<template v-if="item.status === 'done'">
<a-alert
:message="`${item.neType}-${item.version}`"
:message="`${item.type}-${item.version}`"
type="success"
show-icon
/>
</template>
<template v-if="item.status === 'uploading'">
<a-alert
:message="`${item.neType}-${item.version}`"
:message="`${item.type}-${item.version}`"
type="info"
show-icon
/>
</template>
<template v-if="item.status === 'error'">
<a-alert
:message="`${item.neType}-${item.version}`"
:message="`${item.type}-${item.version}`"
type="error"
show-icon
/>

View File

@@ -28,7 +28,7 @@ let neOtions = ref<Record<string, any>[]>([]);
/**查询参数 */
let queryParams = reactive({
/**网元类型 */
neType: undefined,
type: undefined,
/**包名称 */
name: '',
/**包版本 */
@@ -42,7 +42,7 @@ let queryParams = reactive({
/**查询参数重置 */
function fnQueryReset() {
queryParams = Object.assign(queryParams, {
neType: undefined,
type: undefined,
name: '',
version: '',
pageNum: 1,
@@ -85,10 +85,10 @@ let tableColumns = ref<TableColumnsType>([
width: 100,
},
{
title: t('views.ne.common.neType'),
dataIndex: 'neType',
title: t('views.ne.neSoftware.type'),
dataIndex: 'type',
align: 'left',
width: 100,
width: 120,
},
{
title: t('views.ne.neSoftware.version'),
@@ -285,7 +285,7 @@ function fnRecordDelete(id: string) {
function fnDownloadFile(row: Record<string, any>) {
Modal.confirm({
title: t('common.tipTitle'),
content: t('views.ne.neSoftware.downTip', {txt: row.name}),
content: t('views.ne.neSoftware.downTip', { txt: row.name }),
onOk() {
const hide = message.loading(t('common.loading'), 0);
downloadFile(row.path)
@@ -356,10 +356,14 @@ onMounted(() => {
<a-form :model="queryParams" name="queryParams" layout="horizontal">
<a-row :gutter="16">
<a-col :lg="6" :md="12" :xs="24">
<a-form-item :label="t('views.ne.common.neType')" name="neType ">
<a-form-item :label="t('views.ne.neSoftware.type')" name="type ">
<a-auto-complete
v-model:value="queryParams.neType"
:options="NE_TYPE_LIST.map(v => ({ value: v }))"
v-model:value="queryParams.type"
:options="
['MF', 'RTPROXY', 'ADB']
.concat(NE_TYPE_LIST)
.map(v => ({ value: v }))
"
allow-clear
:placeholder="t('common.inputPlease')"
/>
@@ -375,7 +379,10 @@ onMounted(() => {
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :xs="24">
<a-form-item :label="t('views.ne.neSoftware.version')" name="version">
<a-form-item
:label="t('views.ne.neSoftware.version')"
name="version"
>
<a-input
v-model:value="queryParams.version"
allow-clear