ref: v3变更,,表结构对应相关接口功能
This commit is contained in:
@@ -20,10 +20,6 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
coreUid: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
neUid: {
|
||||
type: String,
|
||||
default: '',
|
||||
@@ -45,11 +41,10 @@ const importState = reactive({
|
||||
|
||||
/**查询网元远程服务器备份文件 */
|
||||
function backupSearch(name?: string) {
|
||||
const { neType, neUid, coreUid } = props;
|
||||
const { neType, neUid } = props;
|
||||
listNeConfigBackup({
|
||||
neType,
|
||||
neUid,
|
||||
coreUid,
|
||||
name,
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
@@ -91,7 +86,6 @@ type ModalStateType = {
|
||||
from: {
|
||||
neType: string;
|
||||
neUid: string;
|
||||
coreUid: string;
|
||||
type: 'upload' | 'backup';
|
||||
path: string | undefined;
|
||||
};
|
||||
@@ -108,7 +102,6 @@ let modalState: ModalStateType = reactive({
|
||||
from: {
|
||||
neType: '',
|
||||
neUid: '',
|
||||
coreUid: '',
|
||||
type: 'upload',
|
||||
path: undefined,
|
||||
},
|
||||
@@ -233,10 +226,9 @@ watch(
|
||||
() => props.open,
|
||||
val => {
|
||||
if (val) {
|
||||
if (props.neType && props.neUid && props.coreUid) {
|
||||
if (props.neType && props.neUid) {
|
||||
modalState.from.neType = props.neType;
|
||||
modalState.from.neUid = props.neUid;
|
||||
modalState.from.coreUid = props.coreUid;
|
||||
modalState.title = t('views.ne.neInfo.backConf.title');
|
||||
modalState.openByEdit = true;
|
||||
}
|
||||
@@ -248,13 +240,13 @@ watch(
|
||||
* 网元导出配置
|
||||
* @param row 网元编号ID
|
||||
*/
|
||||
function fnExportConf(coreUid: string, neUid: string, neType: string) {
|
||||
function fnExportConf(neUid: string, neType: string) {
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: t('views.ne.neInfo.backConf.exportTip'),
|
||||
onOk() {
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
exportNeConfigBackup({ neType, coreUid, neUid })
|
||||
exportNeConfigBackup({ neType, neUid })
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
notification.success({
|
||||
|
||||
@@ -9,7 +9,6 @@ import { addNeInfo, updateNeInfo, getNeInfo } from '@/api/ne/neInfo';
|
||||
import { neHostAuthorizedRSA, testNeHost } from '@/api/ne/neHost';
|
||||
import useDictStore from '@/store/modules/dict';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import { currentCoreUid } from '@/hooks/useCoreUid';
|
||||
const { getDict } = useDictStore();
|
||||
const { t } = useI18n();
|
||||
const emit = defineEmits(['ok', 'cancel', 'update:open']);
|
||||
@@ -22,10 +21,6 @@ const props = defineProps({
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
coreUid: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
/**字典数据 */
|
||||
@@ -113,7 +108,6 @@ let modalState: ModalStateType = reactive({
|
||||
ipAddr: '',
|
||||
port: 33030,
|
||||
pvFlag: 'PNF',
|
||||
coreUid: currentCoreUid(),
|
||||
neUid: '',
|
||||
macAddr: '',
|
||||
dn: '',
|
||||
@@ -202,11 +196,10 @@ function modalStateFromEqualIPV4AndIPV6(
|
||||
|
||||
/**
|
||||
* 对话框弹出显示为 新增或者修改
|
||||
* @param coreUid 核心网ID
|
||||
* @param neUid 网元ID
|
||||
* @param id 网元ID
|
||||
*/
|
||||
function fnModalVisibleByEdit(coreUid: string, id: number) {
|
||||
if (!coreUid || !id) {
|
||||
function fnModalVisibleByEdit(id: number) {
|
||||
if (!id) {
|
||||
modalStateFrom.resetFields();
|
||||
modalState.title = t('views.ne.neInfo.addTitle');
|
||||
modalState.openByEdit = true;
|
||||
@@ -214,7 +207,7 @@ function fnModalVisibleByEdit(coreUid: string, id: number) {
|
||||
if (modalState.confirmLoading) return;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
modalState.confirmLoading = true;
|
||||
getNeInfo(coreUid, id).then(res => {
|
||||
getNeInfo(id).then(res => {
|
||||
modalState.confirmLoading = false;
|
||||
hide();
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
@@ -329,7 +322,7 @@ function fnNeIPChange(e: any) {
|
||||
watch(
|
||||
() => props.open,
|
||||
val => {
|
||||
if (val) fnModalVisibleByEdit(props.coreUid, props.id);
|
||||
if (val) fnModalVisibleByEdit(props.id);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
357
src/views/ne/neInfo/components/LicenseEditModal.vue
Normal file
357
src/views/ne/neInfo/components/LicenseEditModal.vue
Normal file
@@ -0,0 +1,357 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, onMounted, toRaw, watch } from 'vue';
|
||||
import { ProModal } from 'antdv-pro-modal';
|
||||
import { Form, Modal, Upload, message } from 'ant-design-vue/es';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { UploadRequestOption } from 'ant-design-vue/es/vc-upload/interface';
|
||||
import { FileType } from 'ant-design-vue/es/upload/interface';
|
||||
import { uploadFile } from '@/api/tool/file';
|
||||
import { useClipboard } from '@vueuse/core';
|
||||
import saveAs from 'file-saver';
|
||||
import { getNeInfo, codeNeLicense, updateNeLicense } from '@/api/ne/neInfo';
|
||||
const { copy } = useClipboard({ legacy: true });
|
||||
const { t } = useI18n();
|
||||
const emit = defineEmits(['ok', 'cancel', 'update:open']);
|
||||
const props = defineProps({
|
||||
open: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
/**网元ID */
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
required: true,
|
||||
},
|
||||
neUid: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
/**是否重启服务 */
|
||||
reload: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
/**对话框对象信息状态类型 */
|
||||
type ModalStateType = {
|
||||
/**新增框或修改框是否显示 */
|
||||
openByEdit: boolean;
|
||||
/**标题 */
|
||||
title: string;
|
||||
/**表单数据 */
|
||||
from: {
|
||||
id: number | undefined;
|
||||
neType: string;
|
||||
neName: string;
|
||||
neId: string;
|
||||
activationRequestCode: string;
|
||||
licensePath: string;
|
||||
reload: boolean;
|
||||
};
|
||||
/**确定按钮 loading */
|
||||
confirmLoading: boolean;
|
||||
/**上传文件 */
|
||||
uploadFiles: any[];
|
||||
};
|
||||
|
||||
/**对话框对象信息状态 */
|
||||
let modalState: ModalStateType = reactive({
|
||||
openByEdit: false,
|
||||
title: '授权文件',
|
||||
from: {
|
||||
id: undefined,
|
||||
neType: '',
|
||||
neId: '',
|
||||
neName: '',
|
||||
activationRequestCode: '',
|
||||
licensePath: '',
|
||||
reload: false,
|
||||
},
|
||||
confirmLoading: false,
|
||||
uploadFiles: [],
|
||||
});
|
||||
|
||||
/**对话框内表单属性和校验规则 */
|
||||
const modalStateFrom = Form.useForm(
|
||||
modalState.from,
|
||||
reactive({
|
||||
licensePath: [
|
||||
{
|
||||
required: true,
|
||||
message: t('views.ne.neLicense.licensePathTip'),
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* 对话框弹出确认执行函数
|
||||
* 进行表达规则校验
|
||||
*/
|
||||
function fnModalOk() {
|
||||
if (modalState.confirmLoading || !modalState.from.id) return;
|
||||
|
||||
modalStateFrom
|
||||
.validate()
|
||||
.then(e => {
|
||||
modalState.confirmLoading = true;
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
const from = toRaw(modalState.from);
|
||||
updateNeLicense(from).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.operateOk'),
|
||||
duration: 3,
|
||||
});
|
||||
// 返回无引用信息
|
||||
emit('ok', JSON.parse(JSON.stringify(from)));
|
||||
fnModalCancel();
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
hide();
|
||||
modalState.confirmLoading = false;
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
message.error(t('common.errorFields', { num: e.errorFields.length }), 3);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 对话框弹出关闭执行函数
|
||||
* 进行表达规则校验
|
||||
*/
|
||||
function fnModalCancel() {
|
||||
modalState.openByEdit = false;
|
||||
modalState.confirmLoading = false;
|
||||
modalStateFrom.resetFields();
|
||||
modalState.uploadFiles = [];
|
||||
emit('cancel');
|
||||
emit('update:open', false);
|
||||
}
|
||||
|
||||
/**表单上传前检查或转换压缩 */
|
||||
function fnBeforeUploadFile(file: FileType) {
|
||||
if (modalState.confirmLoading) return false;
|
||||
if (!file.name.endsWith('.ini')) {
|
||||
const msg = `${t('components.UploadModal.onlyAllow')} .ini`;
|
||||
message.error(msg, 3);
|
||||
return Upload.LIST_IGNORE;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/**表单上传文件 */
|
||||
function fnUploadFile(up: UploadRequestOption) {
|
||||
// 发送请求
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
modalState.confirmLoading = true;
|
||||
let formData = new FormData();
|
||||
formData.append('file', up.file);
|
||||
formData.append('subPath', 'license');
|
||||
uploadFile(formData)
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
// 改为完成状态
|
||||
const file = modalState.uploadFiles[0];
|
||||
file.percent = 100;
|
||||
file.status = 'done';
|
||||
// 预置到表单
|
||||
modalState.from.licensePath = res.data.filePath;
|
||||
} else {
|
||||
message.error(res.msg, 3);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
modalState.confirmLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
/**复制授权申请码 */
|
||||
function fnCopyCode() {
|
||||
const code = modalState.from.activationRequestCode;
|
||||
if (!code) return;
|
||||
copy(code).then(() => {
|
||||
message.success(t('common.copyOk'), 3);
|
||||
});
|
||||
}
|
||||
|
||||
/**下载授权申请码文件 */
|
||||
function fnDownCode() {
|
||||
const { activationRequestCode, neType, neName } = modalState.from;
|
||||
if (!activationRequestCode) return;
|
||||
Modal.confirm({
|
||||
title: t('common.tipTitle'),
|
||||
content: t('views.ne.neLicense.downCodeTop'),
|
||||
onOk() {
|
||||
const blob = new Blob([activationRequestCode], {
|
||||
type: 'text/plain',
|
||||
});
|
||||
saveAs(blob, `${neType}_${neName}_code.txt`);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 对话框弹出显示为 ID编辑
|
||||
* @param id id
|
||||
*/
|
||||
function fnModalVisibleById(id: number) {
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
codeNeLicense(props.neUid)
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
return getNeInfo(id);
|
||||
} else {
|
||||
message.error(res.msg, 3);
|
||||
return undefined;
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
if (!res) return;
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
Object.assign(modalState.from, res.data);
|
||||
modalState.from.licensePath = '';
|
||||
modalState.from.reload = props.reload;
|
||||
modalState.title = t('views.ne.neLicense.updateTtile');
|
||||
modalState.openByEdit = true;
|
||||
} else {
|
||||
message.error(res.msg, 3);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
modalState.confirmLoading = false;
|
||||
hide();
|
||||
});
|
||||
}
|
||||
|
||||
/**监听是否显示,初始数据 */
|
||||
watch(
|
||||
() => props.open,
|
||||
val => {
|
||||
if (val && props.id && props.neUid) {
|
||||
fnModalVisibleById(props.id);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ProModal
|
||||
:drag="true"
|
||||
:width="800"
|
||||
:destroyOnClose="true"
|
||||
:keyboard="false"
|
||||
:mask-closable="false"
|
||||
:open="modalState.openByEdit"
|
||||
:title="modalState.title"
|
||||
:confirm-loading="modalState.confirmLoading"
|
||||
@ok="fnModalOk"
|
||||
@cancel="fnModalCancel"
|
||||
>
|
||||
<a-form
|
||||
name="modalStateFrom"
|
||||
layout="horizontal"
|
||||
:wrapper-col="{ span: 18 }"
|
||||
:label-col="{ span: 6 }"
|
||||
:labelWrap="true"
|
||||
>
|
||||
<a-row>
|
||||
<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.neName')"
|
||||
name="neName"
|
||||
>
|
||||
{{ modalState.from.neName }}
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-form-item
|
||||
:label="t('views.ne.neLicense.activationRequestCode')"
|
||||
name="activationRequestCode"
|
||||
v-bind="modalStateFrom.validateInfos.activationRequestCode"
|
||||
>
|
||||
<a-input-group compact>
|
||||
<a-input
|
||||
v-model:value="modalState.from.activationRequestCode"
|
||||
:disabled="true"
|
||||
style="width: calc(100% - 64px)"
|
||||
/>
|
||||
<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="t('common.downloadText')" placement="topRight">
|
||||
<a-button type="primary" @click="fnDownCode()">
|
||||
<template #icon><DownloadOutlined /></template>
|
||||
</a-button>
|
||||
</a-tooltip>
|
||||
</a-input-group>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
:label="t('views.ne.neLicense.licensePath')"
|
||||
name="file"
|
||||
v-bind="modalStateFrom.validateInfos.licensePath"
|
||||
>
|
||||
<a-upload
|
||||
name="file"
|
||||
v-model:file-list="modalState.uploadFiles"
|
||||
accept=".ini"
|
||||
list-type="text"
|
||||
: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>
|
||||
{{ t('views.ne.neLicense.upload') }}
|
||||
</a-button>
|
||||
</a-upload>
|
||||
</a-form-item>
|
||||
|
||||
<!-- 网元授权不允许操作重启,上传后根据情况去网元信息操作重启 -->
|
||||
<a-form-item label="NE Reload" name="reload" v-if="false">
|
||||
<a-switch v-model:checked="modalState.from.reload"> </a-switch>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ProModal>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
249
src/views/ne/neInfo/components/LicenseUpdateMore.vue
Normal file
249
src/views/ne/neInfo/components/LicenseUpdateMore.vue
Normal file
@@ -0,0 +1,249 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, onMounted, watch, PropType, h } from 'vue';
|
||||
import { message, notification, Upload } from 'ant-design-vue/es';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { UploadRequestOption } from 'ant-design-vue/es/vc-upload/interface';
|
||||
import { FileType } from 'ant-design-vue/es/upload/interface';
|
||||
import { ProModal } from 'antdv-pro-modal';
|
||||
import { uploadFile } from '@/api/tool/file';
|
||||
import { changeNeLicense } from '@/api/ne/neLicense';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
const { t } = useI18n();
|
||||
const emit = defineEmits(['ok', 'cancel', 'update:open']);
|
||||
const props = defineProps({
|
||||
open: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
/**指定网元类型 */
|
||||
licenseList: {
|
||||
type: Array as PropType<Record<string, any>[]>,
|
||||
default: [],
|
||||
},
|
||||
});
|
||||
|
||||
/**对话框对象信息状态类型 */
|
||||
type ModalStateType = {
|
||||
/**新增框或修改框是否显示 */
|
||||
openByUploadFile: boolean;
|
||||
/**标题 */
|
||||
title: string;
|
||||
/**授权文件路径 */
|
||||
licensePath: string;
|
||||
/**上传文件 */
|
||||
uploadFiles: any[];
|
||||
/**确定按钮 loading */
|
||||
confirmLoading: boolean;
|
||||
};
|
||||
|
||||
/**对话框对象信息状态 */
|
||||
let modalState: ModalStateType = reactive({
|
||||
openByUploadFile: false,
|
||||
licensePath: '',
|
||||
uploadFiles: [],
|
||||
title: '授权文件',
|
||||
confirmLoading: false,
|
||||
});
|
||||
|
||||
/**
|
||||
* 对话框弹出确认执行函数
|
||||
* 进行表达规则校验
|
||||
*/
|
||||
async function fnModalOk() {
|
||||
if (!modalState.licensePath) {
|
||||
message.warning(t('views.ne.neLicense.licensePathTip'), 3);
|
||||
return;
|
||||
}
|
||||
if (modalState.confirmLoading) return;
|
||||
modalState.confirmLoading = true;
|
||||
|
||||
const notificationKey = 'NE_LICENSE_MORE';
|
||||
notification.info({
|
||||
key: notificationKey,
|
||||
message: modalState.title,
|
||||
description: t('common.loading'),
|
||||
duration: 0,
|
||||
});
|
||||
|
||||
if (props.licenseList.length === 0) {
|
||||
notification.close(notificationKey);
|
||||
modalState.confirmLoading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const hasFailNeType: string[] = [];
|
||||
for (const item of props.licenseList) {
|
||||
try {
|
||||
const res = await changeNeLicense({
|
||||
neType: item.neType,
|
||||
neId: item.neId,
|
||||
licensePath: modalState.licensePath,
|
||||
reload: true, // 重启网元
|
||||
});
|
||||
if (res.code !== RESULT_CODE_SUCCESS) {
|
||||
hasFailNeType.push(item.neType);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 存在错误网元提示
|
||||
if (hasFailNeType.length > 0) {
|
||||
notification.warning({
|
||||
message: modalState.title,
|
||||
description: h('div', {}, [
|
||||
h('p', t('views.ne.neLicense.uploadChangeFail')),
|
||||
h('div', { style: { color: '#f5222d' } }, hasFailNeType.join('、')),
|
||||
]),
|
||||
duration: 4.5,
|
||||
});
|
||||
} else {
|
||||
notification.success({
|
||||
message: modalState.title,
|
||||
description: t('views.ne.neLicense.uploadChangeOk'),
|
||||
duration: 4.5,
|
||||
});
|
||||
}
|
||||
|
||||
// 结束
|
||||
emit('ok', hasFailNeType);
|
||||
fnModalCancel();
|
||||
notification.close(notificationKey);
|
||||
modalState.confirmLoading = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对话框弹出关闭执行函数
|
||||
* 进行表达规则校验
|
||||
*/
|
||||
function fnModalCancel() {
|
||||
modalState.openByUploadFile = false;
|
||||
modalState.confirmLoading = false;
|
||||
modalState.licensePath = '';
|
||||
modalState.uploadFiles = [];
|
||||
emit('cancel');
|
||||
emit('update:open', false);
|
||||
}
|
||||
|
||||
/**表单上传前检查或转换压缩 */
|
||||
function fnBeforeUploadFile(file: FileType) {
|
||||
if (modalState.confirmLoading) return false;
|
||||
if (!file.name.endsWith('.ini')) {
|
||||
const msg = `${t('components.UploadModal.onlyAllow')} .ini`;
|
||||
message.error(msg, 3);
|
||||
return Upload.LIST_IGNORE;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/**表单上传文件 */
|
||||
function fnUploadFile(up: UploadRequestOption) {
|
||||
// 发送请求
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
modalState.confirmLoading = true;
|
||||
let formData = new FormData();
|
||||
formData.append('file', up.file);
|
||||
formData.append('subPath', 'license');
|
||||
uploadFile(formData)
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
// 改为完成状态
|
||||
const file = modalState.uploadFiles[0];
|
||||
file.percent = 100;
|
||||
file.status = 'done';
|
||||
// 预置到表单
|
||||
modalState.licensePath = res.data.filePath;
|
||||
} else {
|
||||
message.error(res.msg, 3);
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
hide();
|
||||
modalState.confirmLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
/**监听是否显示,初始数据 */
|
||||
watch(
|
||||
() => props.open,
|
||||
val => {
|
||||
if (val) {
|
||||
modalState.title = t('views.ne.neLicense.updateTtile');
|
||||
modalState.openByUploadFile = true;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(() => {});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ProModal
|
||||
:drag="true"
|
||||
:destroyOnClose="true"
|
||||
:keyboard="false"
|
||||
:mask-closable="false"
|
||||
:open="modalState.openByUploadFile"
|
||||
:title="modalState.title"
|
||||
:confirm-loading="modalState.confirmLoading"
|
||||
:cancel-button-props="{ disabled: modalState.confirmLoading }"
|
||||
:closable="false"
|
||||
@ok="fnModalOk"
|
||||
@cancel="fnModalCancel"
|
||||
>
|
||||
<a-form
|
||||
name="modalStateFrom"
|
||||
layout="horizontal"
|
||||
:wrapper-col="{ span: 18 }"
|
||||
:label-col="{ span: 6 }"
|
||||
:labelWrap="true"
|
||||
>
|
||||
<a-form-item :label="t('views.ne.common.neType')">
|
||||
<a-tag color="processing" v-for="s in props.licenseList">
|
||||
{{ s.neType }}
|
||||
</a-tag>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item
|
||||
:label="t('views.ne.neLicense.licensePath')"
|
||||
name="file"
|
||||
:required="true"
|
||||
:validate-on-rule-change="false"
|
||||
:validateTrigger="[]"
|
||||
>
|
||||
<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>
|
||||
{{ t('views.ne.neLicense.upload') }}
|
||||
</a-button>
|
||||
</a-upload>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ProModal>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -12,10 +12,6 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
coreUid: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
neUid: {
|
||||
type: String,
|
||||
default: '',
|
||||
@@ -75,9 +71,9 @@ const modalStateFrom = Form.useForm(
|
||||
* @param neType 网元类型
|
||||
* @param neId 网元ID
|
||||
*/
|
||||
function fnModalVisibleByTypeAndId(coreUid: string, neUid: string) {
|
||||
function fnModalVisibleByTypeAndId(neUid: string) {
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
getOAMFile(coreUid, neUid)
|
||||
getOAMFile(neUid)
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
const data = res.data;
|
||||
@@ -119,7 +115,6 @@ function fnModalOk() {
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
const from = toRaw(modalState.from);
|
||||
saveOAMFile({
|
||||
coreUid: props.coreUid,
|
||||
neUid: props.neUid,
|
||||
content: from,
|
||||
sync: true,
|
||||
@@ -132,7 +127,6 @@ function fnModalOk() {
|
||||
serviceNeAction({
|
||||
neType: props.neType,
|
||||
neUid: props.neUid,
|
||||
coreUid: props.coreUid,
|
||||
action: 'restart',
|
||||
});
|
||||
}
|
||||
@@ -172,8 +166,8 @@ watch(
|
||||
() => props.open,
|
||||
val => {
|
||||
if (val) {
|
||||
if (props.coreUid && props.neUid) {
|
||||
fnModalVisibleByTypeAndId(props.coreUid, props.neUid);
|
||||
if (props.neUid) {
|
||||
fnModalVisibleByTypeAndId(props.neUid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ export default function useNeOptions() {
|
||||
serviceNeAction({
|
||||
neType: row.neType,
|
||||
neUid: row.neUid,
|
||||
coreUid: row.coreUid,
|
||||
action: 'start',
|
||||
})
|
||||
.then(res => {
|
||||
@@ -62,7 +61,6 @@ export default function useNeOptions() {
|
||||
serviceNeAction({
|
||||
neType: row.neType,
|
||||
neUid: row.neUid,
|
||||
coreUid: row.coreUid,
|
||||
action: 'restart',
|
||||
})
|
||||
.then(res => {
|
||||
@@ -111,7 +109,6 @@ export default function useNeOptions() {
|
||||
serviceNeAction({
|
||||
neType: row.neType,
|
||||
neUid: row.neUid,
|
||||
coreUid: row.coreUid,
|
||||
action: 'stop',
|
||||
})
|
||||
.then(res => {
|
||||
@@ -144,7 +141,7 @@ export default function useNeOptions() {
|
||||
content: t('views.ne.common.reloadTip'),
|
||||
onOk() {
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
updateNeConfigReload(row.coreUid, row.neUid)
|
||||
updateNeConfigReload(row.neUid)
|
||||
.then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success(t('common.operateOk'), 3);
|
||||
@@ -169,7 +166,6 @@ export default function useNeOptions() {
|
||||
query: {
|
||||
neType: row.neType,
|
||||
neUid: row.neUid,
|
||||
coreUid: row.coreUid,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import { listNeInfo, delNeInfo } from '@/api/ne/neInfo';
|
||||
import { stateNeInfo } from '@/api/ne/neAction';
|
||||
import useDictStore from '@/store/modules/dict';
|
||||
import useNeOptions from './hooks/useNeOptions';
|
||||
import { currentCoreUid } from '@/hooks/useCoreUid';
|
||||
const { getDict } = useDictStore();
|
||||
const neStore = useNeStore();
|
||||
const { t } = useI18n();
|
||||
@@ -31,6 +30,10 @@ const EditModal = defineAsyncComponent(
|
||||
const OAMModal = defineAsyncComponent(
|
||||
() => import('./components/OAMModal.vue')
|
||||
);
|
||||
// 软件授权上传
|
||||
const LicenseEditModal = defineAsyncComponent(
|
||||
() => import('./components/LicenseEditModal.vue')
|
||||
);
|
||||
// 配置备份文件导入
|
||||
const BackConfModal = defineAsyncComponent(
|
||||
() => import('./components/BackConfModal.vue')
|
||||
@@ -47,8 +50,6 @@ let dict: {
|
||||
|
||||
/**查询参数 */
|
||||
let queryParams = reactive({
|
||||
/**核心网标识 */
|
||||
coreUid: currentCoreUid(),
|
||||
/**网元类型 */
|
||||
neType: '',
|
||||
/**带状态信息 */
|
||||
@@ -129,6 +130,42 @@ let tableColumns: ColumnsType = [
|
||||
align: 'left',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: t('views.ne.common.serialNum'),
|
||||
dataIndex: 'serialNum',
|
||||
align: 'left',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: t('views.ne.common.expiryDate'),
|
||||
dataIndex: 'expiryDate',
|
||||
align: 'left',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: t('views.ne.common.ueNumber'),
|
||||
dataIndex: 'ueNumber',
|
||||
align: 'left',
|
||||
customRender(opt) {
|
||||
if (['UDM', 'AMF', 'MME'].includes(opt.record.neType)) {
|
||||
return opt.value;
|
||||
}
|
||||
return '';
|
||||
},
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: t('views.ne.common.nbNumber'),
|
||||
dataIndex: 'nbNumber',
|
||||
align: 'left',
|
||||
customRender(opt) {
|
||||
if (['AMF', 'MME'].includes(opt.record.neType)) {
|
||||
return opt.value;
|
||||
}
|
||||
return '';
|
||||
},
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
title: t('views.ne.neInfo.state'),
|
||||
dataIndex: 'status',
|
||||
@@ -182,7 +219,6 @@ function fnTableSelectedRowKeys(keys: (string | number)[], rows: any[]) {
|
||||
tableState.selectedRows = rows.map(item => {
|
||||
return {
|
||||
id: item.id,
|
||||
coreUid: item.coreUid,
|
||||
neUid: item.neUid,
|
||||
neType: item.neType,
|
||||
};
|
||||
@@ -191,6 +227,8 @@ function fnTableSelectedRowKeys(keys: (string | number)[], rows: any[]) {
|
||||
|
||||
/**对话框对象信息状态类型 */
|
||||
type ModalStateType = {
|
||||
/**软件授权上传框是否显示 */
|
||||
openByLicense: boolean;
|
||||
/**配置备份框是否显示 */
|
||||
openByBackConf: boolean;
|
||||
/**OAM文件配置框是否显示 */
|
||||
@@ -199,7 +237,6 @@ type ModalStateType = {
|
||||
openByEdit: boolean;
|
||||
/**新增框或修改框ID */
|
||||
id: number;
|
||||
coreUid: string;
|
||||
neUid: string;
|
||||
neType: string;
|
||||
/**确定按钮 loading */
|
||||
@@ -208,11 +245,11 @@ type ModalStateType = {
|
||||
|
||||
/**对话框对象信息状态 */
|
||||
let modalState: ModalStateType = reactive({
|
||||
openByLicense: false,
|
||||
openByBackConf: false,
|
||||
openByOAM: false,
|
||||
openByEdit: false,
|
||||
id: 0,
|
||||
coreUid: '',
|
||||
neUid: '',
|
||||
neType: '',
|
||||
confirmLoading: false,
|
||||
@@ -225,12 +262,10 @@ let modalState: ModalStateType = reactive({
|
||||
function fnModalVisibleByEdit(row?: Record<string, any>) {
|
||||
if (!row) {
|
||||
modalState.id = 0;
|
||||
modalState.coreUid = '';
|
||||
modalState.neUid = '';
|
||||
modalState.neType = '';
|
||||
} else {
|
||||
modalState.id = row.id;
|
||||
modalState.coreUid = row.coreUid;
|
||||
modalState.neUid = row.neUid;
|
||||
modalState.neType = row.neType;
|
||||
}
|
||||
@@ -253,14 +288,13 @@ function fnModalEditOk(from: Record<string, any>) {
|
||||
|
||||
/**局部更新信息 */
|
||||
function reloadRowInfo(row: Record<string, any>) {
|
||||
stateNeInfo(row.coreUid, row.neUid)
|
||||
stateNeInfo(row.neUid)
|
||||
.then(res => {
|
||||
// 找到编辑更新的网元
|
||||
const item = tableState.data.find(s => s.id === row.id);
|
||||
if (item && res.code === RESULT_CODE_SUCCESS) {
|
||||
item.neType = row.neType;
|
||||
item.neUid = row.neUid;
|
||||
item.coreUid = row.coreUid;
|
||||
item.neName = row.neName;
|
||||
item.ipAddr = row.ipAddr;
|
||||
item.port = row.port;
|
||||
@@ -287,7 +321,6 @@ function reloadRowInfo(row: Record<string, any>) {
|
||||
* 进行表达规则校验
|
||||
*/
|
||||
function fnModalEditCancel() {
|
||||
modalState.coreUid = '';
|
||||
modalState.neUid = '';
|
||||
modalState.neType = '';
|
||||
modalState.openByEdit = false;
|
||||
@@ -314,18 +347,13 @@ function fnRecordDelete(id: string) {
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
let reqArr: any = [];
|
||||
if (id === '0') {
|
||||
tableState.selectedRows.forEach(item => {
|
||||
reqArr.push(
|
||||
delNeInfo({ coreUid: item.coreUid, neUid: item.neUid, id: item.id })
|
||||
);
|
||||
});
|
||||
const ids = tableState.selectedRowKeys.join(',');
|
||||
delNeInfo({ id: ids });
|
||||
} else {
|
||||
tableState.data.forEach(item => {
|
||||
if (item.id === id) {
|
||||
reqArr.push(
|
||||
delNeInfo({
|
||||
coreUid: item.coreUid,
|
||||
neUid: item.neUid,
|
||||
id: item.id,
|
||||
})
|
||||
);
|
||||
@@ -385,16 +413,20 @@ function fnRecordMore(type: string | number, row: Record<string, any>) {
|
||||
fnNeLogFile(row);
|
||||
break;
|
||||
case 'oam':
|
||||
modalState.coreUid = row.coreUid;
|
||||
modalState.neUid = row.neUid;
|
||||
modalState.neType = row.neType;
|
||||
modalState.openByOAM = !modalState.openByOAM;
|
||||
break;
|
||||
case 'license':
|
||||
modalState.id = row.id;
|
||||
modalState.neUid = row.neUid;
|
||||
modalState.neType = row.neType;
|
||||
modalState.openByLicense = !modalState.openByLicense;
|
||||
break;
|
||||
case 'backConfExport':
|
||||
backConf.value.exportConf(row.coreUid, row.neUid, row.neType);
|
||||
backConf.value.exportConf(row.neUid, row.neType);
|
||||
break;
|
||||
case 'backConfImport':
|
||||
modalState.coreUid = row.coreUid;
|
||||
modalState.neUid = row.neUid;
|
||||
modalState.neType = row.neType;
|
||||
modalState.openByBackConf = !modalState.openByBackConf;
|
||||
@@ -642,6 +674,13 @@ onMounted(() => {
|
||||
<FileTextOutlined />
|
||||
{{ t('views.ne.common.oam') }}
|
||||
</a-menu-item>
|
||||
<a-menu-item
|
||||
key="license"
|
||||
v-if="!['OMC'].includes(record.neType)"
|
||||
>
|
||||
<FileTextOutlined />
|
||||
{{ t('views.ne.common.license') }}
|
||||
</a-menu-item>
|
||||
<!-- 配置备份 -->
|
||||
<a-menu-item key="backConfExport">
|
||||
<ExportOutlined />
|
||||
@@ -680,6 +719,21 @@ onMounted(() => {
|
||||
<span>{{ t('views.ne.common.expiryDate') }}:</span>
|
||||
<span>{{ record.serverState.expire }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>{{ t('views.ne.common.ueNumber') }}:</span>
|
||||
<span
|
||||
v-if="
|
||||
['UDM', 'AMF', 'MME'].includes(record.serverState.neType)
|
||||
"
|
||||
>
|
||||
{{ record.serverState.ueNumber }}
|
||||
</span>
|
||||
<span v-else> - </span>
|
||||
</div>
|
||||
<div v-if="['AMF', 'MME'].includes(record.serverState.neType)">
|
||||
<span>{{ t('views.ne.common.nbNumber') }}:</span>
|
||||
<span> {{ record.serverState.nbNumber }} </span>
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col :offset="2" :lg="8" :md="8" :xs="8">
|
||||
<a-divider orientation="left">
|
||||
@@ -750,7 +804,6 @@ onMounted(() => {
|
||||
<!-- 新增框或修改框 -->
|
||||
<EditModal
|
||||
v-model:open="modalState.openByEdit"
|
||||
:core-uid="modalState.coreUid"
|
||||
:id="modalState.id"
|
||||
@ok="fnModalEditOk"
|
||||
@cancel="fnModalEditCancel"
|
||||
@@ -759,7 +812,6 @@ onMounted(() => {
|
||||
<!-- OAM编辑框 -->
|
||||
<OAMModal
|
||||
v-model:open="modalState.openByOAM"
|
||||
:core-uid="modalState.coreUid"
|
||||
:ne-uid="modalState.neUid"
|
||||
:ne-type="modalState.neType"
|
||||
@cancel="fnModalEditCancel"
|
||||
@@ -769,11 +821,20 @@ onMounted(() => {
|
||||
<BackConfModal
|
||||
ref="backConf"
|
||||
v-model:open="modalState.openByBackConf"
|
||||
:core-uid="modalState.coreUid"
|
||||
:ne-uid="modalState.neUid"
|
||||
:ne-type="modalState.neType"
|
||||
@cancel="fnModalEditCancel"
|
||||
></BackConfModal>
|
||||
|
||||
<!-- 文件上传框 -->
|
||||
<LicenseEditModal
|
||||
v-model:open="modalState.openByLicense"
|
||||
:id="modalState.id"
|
||||
:ne-uid="modalState.neUid"
|
||||
:ne-type="modalState.neType"
|
||||
@ok="fnModalEditOk"
|
||||
@cancel="fnModalEditCancel"
|
||||
></LicenseEditModal>
|
||||
</PageContainer>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user