feat: 网元授权文件支持勾选指定网元类型替换
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, onMounted, watch } from 'vue';
|
import { reactive, onMounted, watch, PropType, computed } from 'vue';
|
||||||
import { message, Upload } from 'ant-design-vue/lib';
|
import { message, Upload } from 'ant-design-vue/lib';
|
||||||
import useI18n from '@/hooks/useI18n';
|
import useI18n from '@/hooks/useI18n';
|
||||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
@@ -14,6 +14,11 @@ const props = defineProps({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
/**指定网元类型 */
|
||||||
|
licenseList: {
|
||||||
|
type: Array as PropType<Record<string, any>[]>,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
/**对话框对象信息状态类型 */
|
/**对话框对象信息状态类型 */
|
||||||
@@ -23,7 +28,9 @@ type ModalStateType = {
|
|||||||
/**标题 */
|
/**标题 */
|
||||||
title: string;
|
title: string;
|
||||||
/**模式 */
|
/**模式 */
|
||||||
mode: '5GC' | 'AUSF-UDM-IMS';
|
mode: 'Universal' | 'AUSF-UDM-IMS';
|
||||||
|
/**指定网元 */
|
||||||
|
selectNe: any[];
|
||||||
/**授权文件路径 */
|
/**授权文件路径 */
|
||||||
licensePath: string;
|
licensePath: string;
|
||||||
/**上传文件 */
|
/**上传文件 */
|
||||||
@@ -35,7 +42,8 @@ type ModalStateType = {
|
|||||||
/**对话框对象信息状态 */
|
/**对话框对象信息状态 */
|
||||||
let modalState: ModalStateType = reactive({
|
let modalState: ModalStateType = reactive({
|
||||||
visibleByUploadFile: false,
|
visibleByUploadFile: false,
|
||||||
mode: '5GC',
|
mode: 'Universal',
|
||||||
|
selectNe: [],
|
||||||
licensePath: '',
|
licensePath: '',
|
||||||
uploadFiles: [],
|
uploadFiles: [],
|
||||||
title: '授权文件',
|
title: '授权文件',
|
||||||
@@ -46,40 +54,28 @@ let modalState: ModalStateType = reactive({
|
|||||||
* 对话框弹出确认执行函数
|
* 对话框弹出确认执行函数
|
||||||
* 进行表达规则校验
|
* 进行表达规则校验
|
||||||
*/
|
*/
|
||||||
function fnModalOk() {
|
async function fnModalOk() {
|
||||||
if (modalState.confirmLoading || !modalState.licensePath) return;
|
if (!modalState.licensePath) {
|
||||||
|
message.warning('请上传授权文件', 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (modalState.confirmLoading) return;
|
||||||
modalState.confirmLoading = true;
|
modalState.confirmLoading = true;
|
||||||
const hide = message.loading(t('common.loading'), 0);
|
const hide = message.loading(t('common.loading'), 0);
|
||||||
listNeLicense({
|
|
||||||
neType: undefined,
|
let reqArr: any = calcSelectNe.value.map(s => {
|
||||||
neId: '',
|
s.reload = true; // 重启网元
|
||||||
version: '',
|
|
||||||
pageNum: 1,
|
|
||||||
pageSize: 20,
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
|
|
||||||
if (modalState.mode === '5GC') {
|
|
||||||
return res.rows.filter(
|
|
||||||
s => !['OMC', 'AUSF', 'UDM', 'IMS'].includes(s.neType)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (modalState.mode === 'AUSF-UDM-IMS') {
|
|
||||||
return res.rows.filter(s =>
|
|
||||||
['AUSF', 'UDM', 'IMS'].includes(s.neType)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
})
|
|
||||||
.then(arr => {
|
|
||||||
return Promise.all(
|
|
||||||
arr.map(s => {
|
|
||||||
s.licensePath = modalState.licensePath;
|
s.licensePath = modalState.licensePath;
|
||||||
return changeNeLicense(s);
|
return changeNeLicense(s);
|
||||||
})
|
});
|
||||||
);
|
if (reqArr.length === 0) {
|
||||||
})
|
message.warning('没有对应的网元对象', 3);
|
||||||
|
hide();
|
||||||
|
modalState.confirmLoading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Promise.all(reqArr)
|
||||||
.then(resArr => {
|
.then(resArr => {
|
||||||
message.success(t('common.operateOk'), 3);
|
message.success(t('common.operateOk'), 3);
|
||||||
emit('ok', resArr);
|
emit('ok', resArr);
|
||||||
@@ -98,7 +94,8 @@ function fnModalOk() {
|
|||||||
function fnModalCancel() {
|
function fnModalCancel() {
|
||||||
modalState.visibleByUploadFile = false;
|
modalState.visibleByUploadFile = false;
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
modalState.mode = '5GC';
|
modalState.mode = 'Universal';
|
||||||
|
modalState.selectNe = [];
|
||||||
modalState.licensePath = '';
|
modalState.licensePath = '';
|
||||||
modalState.uploadFiles = [];
|
modalState.uploadFiles = [];
|
||||||
emit('cancel');
|
emit('cancel');
|
||||||
@@ -155,12 +152,43 @@ watch(
|
|||||||
() => props.visible,
|
() => props.visible,
|
||||||
val => {
|
val => {
|
||||||
if (val) {
|
if (val) {
|
||||||
|
// 传入授权列表
|
||||||
|
if (props.licenseList.length === 0) {
|
||||||
|
listNeLicense({
|
||||||
|
neType: undefined,
|
||||||
|
neId: '',
|
||||||
|
version: '',
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 20,
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
|
||||||
|
modalState.selectNe = res.rows;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
modalState.selectNe = props.licenseList;
|
||||||
|
}
|
||||||
|
|
||||||
modalState.title = 'Upload License File';
|
modalState.title = 'Upload License File';
|
||||||
modalState.visibleByUploadFile = true;
|
modalState.visibleByUploadFile = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**授权模式选择 */
|
||||||
|
const calcSelectNe = computed(() => {
|
||||||
|
if (!Array.isArray(modalState.selectNe)) return [];
|
||||||
|
if (modalState.mode === 'AUSF-UDM-IMS') {
|
||||||
|
return modalState.selectNe.filter(s =>
|
||||||
|
['AUSF', 'UDM', 'IMS'].includes(s.neType)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return modalState.selectNe.filter(
|
||||||
|
s => !['OMC', 'AUSF', 'UDM', 'IMS'].includes(s.neType)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
onMounted(() => {});
|
onMounted(() => {});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -178,11 +206,50 @@ onMounted(() => {});
|
|||||||
<a-form
|
<a-form
|
||||||
name="modalStateFrom"
|
name="modalStateFrom"
|
||||||
layout="horizontal"
|
layout="horizontal"
|
||||||
|
:validate-on-rule-change="false"
|
||||||
|
:validateTrigger="[]"
|
||||||
:wrapper-col="{ span: 18 }"
|
:wrapper-col="{ span: 18 }"
|
||||||
:label-col="{ span: 6 }"
|
:label-col="{ span: 6 }"
|
||||||
:labelWrap="true"
|
:labelWrap="true"
|
||||||
>
|
>
|
||||||
<a-form-item label="License File" name="file">
|
<a-form-item label="NE Type" v-if="calcSelectNe.length > 0">
|
||||||
|
<a-tag color="default" v-for="s in calcSelectNe">
|
||||||
|
{{ s.neType }}
|
||||||
|
</a-tag>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="License Mode" name="mode">
|
||||||
|
<a-select v-model:value="modalState.mode">
|
||||||
|
<a-select-option value="Universal">Universal</a-select-option>
|
||||||
|
<a-select-option value="AUSF-UDM-IMS">AUSF-UDM-IMS</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="License File" name="file" :required="true">
|
||||||
|
<a-upload
|
||||||
|
name="file"
|
||||||
|
v-model:file-list="modalState.uploadFiles"
|
||||||
|
accept=".ini"
|
||||||
|
list-type="text"
|
||||||
|
:multiple="true"
|
||||||
|
:max-count="1"
|
||||||
|
:show-upload-list="{
|
||||||
|
showPreviewIcon: false,
|
||||||
|
showRemoveIcon: false,
|
||||||
|
showDownloadIcon: false,
|
||||||
|
}"
|
||||||
|
:before-upload="fnBeforeUploadFile"
|
||||||
|
:custom-request="fnUploadFile"
|
||||||
|
:disabled="modalState.confirmLoading"
|
||||||
|
>
|
||||||
|
<a-button type="primary">
|
||||||
|
<template #icon>
|
||||||
|
<UploadOutlined />
|
||||||
|
</template>
|
||||||
|
Upload
|
||||||
|
</a-button>
|
||||||
|
</a-upload>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item label="License File" name="file" v-if="false">
|
||||||
<a-input-group compact>
|
<a-input-group compact>
|
||||||
<a-upload
|
<a-upload
|
||||||
name="file"
|
name="file"
|
||||||
@@ -191,7 +258,11 @@ onMounted(() => {});
|
|||||||
list-type="text"
|
list-type="text"
|
||||||
:multiple="true"
|
:multiple="true"
|
||||||
:max-count="1"
|
:max-count="1"
|
||||||
:show-upload-list="false"
|
:show-upload-list="{
|
||||||
|
showPreviewIcon: false,
|
||||||
|
showRemoveIcon: false,
|
||||||
|
showDownloadIcon: false,
|
||||||
|
}"
|
||||||
:before-upload="fnBeforeUploadFile"
|
:before-upload="fnBeforeUploadFile"
|
||||||
:custom-request="fnUploadFile"
|
:custom-request="fnUploadFile"
|
||||||
:disabled="modalState.confirmLoading"
|
:disabled="modalState.confirmLoading"
|
||||||
@@ -204,7 +275,7 @@ onMounted(() => {});
|
|||||||
</a-button>
|
</a-button>
|
||||||
</a-upload>
|
</a-upload>
|
||||||
<a-select v-model:value="modalState.mode" style="width: 142px">
|
<a-select v-model:value="modalState.mode" style="width: 142px">
|
||||||
<a-select-option value="5GC">5GC</a-select-option>
|
<a-select-option value="Other">Other</a-select-option>
|
||||||
<a-select-option value="AUSF-UDM-IMS">AUSF-UDM-IMS</a-select-option>
|
<a-select-option value="AUSF-UDM-IMS">AUSF-UDM-IMS</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-input-group>
|
</a-input-group>
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ type StateType = {
|
|||||||
selectedRowKeys: (string | number)[];
|
selectedRowKeys: (string | number)[];
|
||||||
/**授权文件上传 */
|
/**授权文件上传 */
|
||||||
visibleByLicenseFile: boolean;
|
visibleByLicenseFile: boolean;
|
||||||
|
/**授权文件上传勾选指定到网元授权列表 */
|
||||||
|
neLicenseList: any[];
|
||||||
/**确定按钮 loading */
|
/**确定按钮 loading */
|
||||||
confirmLoading: boolean;
|
confirmLoading: boolean;
|
||||||
};
|
};
|
||||||
@@ -70,6 +72,7 @@ let state: StateType = reactive({
|
|||||||
data: [],
|
data: [],
|
||||||
selectedRowKeys: [],
|
selectedRowKeys: [],
|
||||||
visibleByLicenseFile: false,
|
visibleByLicenseFile: false,
|
||||||
|
neLicenseList: [],
|
||||||
confirmLoading: false,
|
confirmLoading: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -88,6 +91,21 @@ function fnModalCancel() {
|
|||||||
state.visibleByLicenseFile = false;
|
state.visibleByLicenseFile = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**对话框弹出打开执行函数 */
|
||||||
|
function fnModalOpen() {
|
||||||
|
if (state.selectedRowKeys.length > 0) {
|
||||||
|
// 勾选的网元数据的网元类型
|
||||||
|
let neTypeArr = state.data.filter(item =>
|
||||||
|
state.selectedRowKeys.includes(item.id)
|
||||||
|
);
|
||||||
|
state.neLicenseList = neTypeArr;
|
||||||
|
}else{
|
||||||
|
state.neLicenseList = []
|
||||||
|
}
|
||||||
|
|
||||||
|
state.visibleByLicenseFile = !state.visibleByLicenseFile;
|
||||||
|
}
|
||||||
|
|
||||||
/**勾选刷新网元状态 */
|
/**勾选刷新网元状态 */
|
||||||
function fnRecordState() {
|
function fnRecordState() {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
@@ -236,6 +254,7 @@ onMounted(() => {
|
|||||||
<!-- 授权文件上传框 -->
|
<!-- 授权文件上传框 -->
|
||||||
<UploadLicenseFile
|
<UploadLicenseFile
|
||||||
v-model:visible="state.visibleByLicenseFile"
|
v-model:visible="state.visibleByLicenseFile"
|
||||||
|
:licenseList="state.neLicenseList"
|
||||||
@ok="fnModalOk"
|
@ok="fnModalOk"
|
||||||
@cancel="fnModalCancel"
|
@cancel="fnModalCancel"
|
||||||
></UploadLicenseFile>
|
></UploadLicenseFile>
|
||||||
@@ -244,12 +263,7 @@ onMounted(() => {
|
|||||||
<a-space direction="horizontal" :size="18">
|
<a-space direction="horizontal" :size="18">
|
||||||
<a-button @click="fnStepPrev()"> 上一步 </a-button>
|
<a-button @click="fnStepPrev()"> 上一步 </a-button>
|
||||||
|
|
||||||
<a-button
|
<a-button type="primary" @click.prevent="fnModalOpen">
|
||||||
type="primary"
|
|
||||||
@click.prevent="
|
|
||||||
() => (state.visibleByLicenseFile = !state.visibleByLicenseFile)
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<template #icon><UploadOutlined /></template>
|
<template #icon><UploadOutlined /></template>
|
||||||
Upload License
|
Upload License
|
||||||
</a-button>
|
</a-button>
|
||||||
|
|||||||
Reference in New Issue
Block a user