From febf86c5c7f6f9260c9d08aa03dc471e7064db3d Mon Sep 17 00:00:00 2001 From: lai <371757574@qq.com> Date: Wed, 18 Oct 2023 10:20:31 +0800 Subject: [PATCH 1/6] =?UTF-8?q?---=E8=AE=BE=E7=BD=AE=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E5=BF=83=E8=B7=B3=E5=88=97=E8=A1=A8=E8=B6=85=E6=97=B6=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api/index.ts b/src/api/index.ts index 482784c5..9cf4cea9 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -9,6 +9,7 @@ export async function listMain() { const result = await request({ url: 'systemManagement/v1/elementType/all/objectType/systemState', method: 'get', + timeout: 30 * 1000, }); // console.log(result); let realData = result.data.data; From caa0016626d763f56d0ed40698be0ef94cb1b85a Mon Sep 17 00:00:00 2001 From: lai <371757574@qq.com> Date: Wed, 18 Oct 2023 10:21:17 +0800 Subject: [PATCH 2/6] =?UTF-8?q?--=E6=96=B0=E5=A2=9E=E7=BD=91=E5=85=83?= =?UTF-8?q?=E7=AE=A1=E7=90=86=20=E5=AF=BC=E5=87=BA=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E9=87=8D=E5=90=AF=E5=90=AF=E5=8A=A8=E5=81=9C=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/configManage/neManage.ts | 66 +++++- src/views/configManage/neManage/index.vue | 263 +++++++++++++++++++++- 2 files changed, 327 insertions(+), 2 deletions(-) diff --git a/src/api/configManage/neManage.ts b/src/api/configManage/neManage.ts index 9e80709f..7e84d25e 100644 --- a/src/api/configManage/neManage.ts +++ b/src/api/configManage/neManage.ts @@ -157,6 +157,70 @@ export function exportSet(data: Record) { }); } +/** + * 导入网元配置文件 + * @param data 网元对象 + * @returns object + */ +export function importFile(data: Record) { + let dataType: 'json' | 'form-data' = 'json'; + let url = `/systemManagement/v1/elementType/${data.neType}/objectType/cm?ne_id=${data.neId}`; + let obj: any = { fileName: data.fileName }; + if (data.importType === 'local') { + let formData = new FormData(); + formData.append('nfType', data.neType); + formData.append('nfId', data.neId); + formData.append('file', data.file); + obj = formData; + dataType = 'form-data'; + } + + // 处理FormData类型的data + return request({ + url, + method: 'post', + data: obj, + dataType, + }); + if (data instanceof FormData) { + // 处理FormData类型的data + return request({ + url: `/systemManagement/v1/elementType/${data.get( + 'nfType' + )}/objectType/cm?ne_id=${data.get('nfId')}`, + method: 'post', + data, + dataType: 'form-data', + }); + } else { + // 处理普通对象类型的data + return request({ + url: `/systemManagement/v1/elementType/${data.nfType}/objectType/cm?ne_id=${data.nfId}`, + method: 'post', + data: { fileName: data.fileName }, + }); + } +} + +/** + * 查询远程服务器上网元配置文件 + * @param data 网元对象 + * @returns object + */ +export async function listServerFile(data: Record) { + const result = await request({ + url: `databaseManagement/v1/omc_db/ne_backup?SQL= select * from ne_backup where ne_type ='${data.neType}'`, + method: 'get', + }); + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) { + let data = result.data.data[0]; + return Object.assign(result, { + data: parseObjLineToHump(data['ne_backup']), + }); + } + return result; +} /** * 启动网元 @@ -192,4 +256,4 @@ export function stopNf(data: Record) { url: `/systemManagement/v1/elementType/${data.neType}/objectType/service/stop?ne_id=${data.neId}`, method: 'post', }); -} \ No newline at end of file +} diff --git a/src/views/configManage/neManage/index.vue b/src/views/configManage/neManage/index.vue index a463db14..3c9b8c49 100644 --- a/src/views/configManage/neManage/index.vue +++ b/src/views/configManage/neManage/index.vue @@ -16,9 +16,13 @@ import { startNf, restartNf, stopNf, + importFile, + listServerFile, } from '@/api/configManage/neManage'; import { parseDateToStr } from '@/utils/date-utils'; import useI18n from '@/hooks/useI18n'; +import { FileType } from 'ant-design-vue/lib/upload/interface'; +import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; const { t } = useI18n(); const route = useRoute(); @@ -26,6 +30,15 @@ const route = useRoute(); /**路由标题 */ let title = ref((route.meta.title as string) ?? '标题'); +/**表格所需option */ +const neManageOption = reactive({ + importType: [ + { label: t('views.configManage.neManage.server'), value: 'server' }, + { label: t('views.configManage.neManage.local'), value: 'local' }, + ], + serverFileName: [], +}); + /**查询参数 */ let queryParams = reactive({ /**网元类型 */ @@ -183,10 +196,14 @@ type ModalStateType = { visibleByView: boolean; /**新增框或修改框是否显示 */ visibleByEdit: boolean; + /**导入是否显示 */ + visibleByImport: boolean; /**标题 */ title: string; /**表单数据 */ from: Record; + /**导入表单数据 */ + importFrom: Record; /**确定按钮 loading */ confirmLoading: boolean; }; @@ -195,6 +212,7 @@ type ModalStateType = { let modalState: ModalStateType = reactive({ visibleByView: false, visibleByEdit: false, + visibleByImport: false, title: '网元', from: { dn: '', @@ -209,6 +227,14 @@ let modalState: ModalStateType = reactive({ rmUid: '', vendorName: '', }, + importFrom: { + neId: '', + neType: '', + importType: '', + file: undefined, + fileList: [], + fileName: '', + }, confirmLoading: false, }); @@ -226,6 +252,31 @@ const modalStateFrom = Form.useForm( }) ); +/**导入对话框内表单属性和校验规则 */ +const importStateFrom = Form.useForm( + modalState.importFrom, + reactive({ + file: [ + { + required: true, + message: t('views.configManage.softwareManage.updateFilePlease'), + }, + ], + importType: [ + { + required: true, + message: t('views.configManage.neManage.selectPlease'), + }, + ], + fileName: [ + { + required: true, + message: t('views.configManage.neManage.fileSelect'), + }, + ], + }) +); + /** * 对话框弹出显示为 新增或者修改 * @param noticeId 网元id, 不传为新增 @@ -292,6 +343,72 @@ function fnModalOk() { }); } +/** + * 导入对话框弹出确认执行函数 + * 进行表达规则校验 + */ +function fnImportModalOk() { + const from = toRaw(modalState.importFrom); + let validateName = ['importType']; + if (from.file) { + validateName.push('file'); + } else { + validateName.push('fileName'); + } + + importStateFrom + .validate(validateName) + .then(e => { + modalState.confirmLoading = true; + const hide = message.loading({ content: t('common.loading') }); + // let result = importFile(from); + // if (from.importType === 'local') { + // let formData = new FormData(); + // formData.append('nfType', from.neType); + // formData.append('nfId', from.neId); + // formData.append('file', from.file); + // result = importFile(formData); + // } + + importFile(from) + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.msgSuccess', { msg: modalState.title }), + duration: 3, + }); + modalState.visibleByEdit = false; + modalStateFrom.resetFields(); + } else { + message.error({ + content: `${res.msg}`, + duration: 3, + }); + } + }) + .finally(() => { + hide(); + modalState.confirmLoading = false; + // 获取列表数据 + fnGetList(); + }); + }) + .catch(e => { + console.error(e) + message.error(t('common.errorFields', { num: e.errorFields.length }), 3); + }); +} + +/** + * 导入对话框弹出关闭执行函数 + * 进行表达规则校验 + */ +function fnImportModalCancel() { + modalState.visibleByView = false; + modalState.visibleByImport = false; + importStateFrom.resetFields(); +} + /** * 对话框弹出关闭执行函数 * 进行表达规则校验 @@ -431,6 +548,12 @@ function fnFileModalVisible(type: string | number, row: Record) { tableState.loading = false; }); } + + if (type === 'import') { + modalState.importFrom = Object.assign(modalState.importFrom, row); + modalState.title = '导入'; + modalState.visibleByImport = true; + } } /**查询网元列表 */ @@ -450,6 +573,53 @@ function fnGetList() { }); } +/**查询网元远程服务器备份文件 */ +function typeChange(value: any) { + if (value === 'server') { + listServerFile(modalState.importFrom).then(res => { + if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { + neManageOption.serverFileName = []; + res.data.forEach((item: any) => { + neManageOption.serverFileName.push({ + label: item.fileName, + value: item.fileName, + }); + }); + } + // else if (res.code === RESULT_CODE_SUCCESS && !res.data) { + // message.error({ + // content: `当前网元没有远程服务器备份文件`, + // key: 'importServer', + // duration: 2, + // }); + // } + }); + } +} + +/**上传前检查或转换压缩 */ +function fnBeforeUploadFile(file: FileType) { + if (modalState.confirmLoading) return false; + const fileName = file.name; + const suff = fileName.substring(fileName.lastIndexOf('.')); + const isLt60M = file.size / 1024 / 1024 > 60; + if (isLt60M) { + message.error('有效软件文件大小应不小于 60MB', 3); + return false; + } + return true; +} + +/**上传文件 */ +function fnUploadFile(up: UploadRequestOption) { + // 改为完成状态 + const file = modalState.importFrom.fileList[0]; + file.percent = 100; + file.status = 'done'; + // 预置到表单 + modalState.importFrom.file = up.file; +} + onMounted(() => { // 获取列表数据 fnGetList(); @@ -604,7 +774,7 @@ onMounted(() => { {{ t('views.configManage.neManage.start') }} - + {{ t('views.configManage.neManage.restart') }} @@ -807,6 +977,97 @@ onMounted(() => { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ t('views.configManage.neManage.fileSelect') }} + + + + + From 0845751a760604dd560693942dee02570eb24f27 Mon Sep 17 00:00:00 2001 From: lai <371757574@qq.com> Date: Wed, 18 Oct 2023 10:21:58 +0800 Subject: [PATCH 3/6] =?UTF-8?q?--=E4=BF=AE=E6=AD=A3=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E5=91=8A=E8=AD=A6=E7=9A=84=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/faultManage/actAlarm.ts | 51 ++++++++++------ src/views/faultManage/active-alarm/index.vue | 61 +++++++------------ src/views/faultManage/history-alarm/index.vue | 2 +- 3 files changed, 55 insertions(+), 59 deletions(-) diff --git a/src/api/faultManage/actAlarm.ts b/src/api/faultManage/actAlarm.ts index f27636be..d223b729 100644 --- a/src/api/faultManage/actAlarm.ts +++ b/src/api/faultManage/actAlarm.ts @@ -4,7 +4,6 @@ import { toRaw } from 'vue'; import { parseObjLineToHump } from '@/utils/parse-utils'; import { parseDateToStr } from '@/utils/date-utils'; import useUserStore from '@/store/modules/user'; -import { ConsoleSqlOutlined } from '@ant-design/icons-vue'; /** * 查询列表 @@ -16,23 +15,38 @@ export async function listAct(query: Record, filterSQl: string) { let rowsSQL = `select * from alarm where alarm_status='1' ${filterSQl}`; // 查询 let querySQL = ''; - querySQL += query.alarm_code - ? ` and alarm_code = '${query.alarm_code}' ` - : ''; - querySQL += query.alarm_type - ? ` and alarm_type = '${query.alarm_type}' ` - : ''; - querySQL += query.pv_flag ? ` and pv_flag = '${query.pv_flag}' ` : ''; - querySQL += query.orig_severity - ? ` and orig_severity in('${query.orig_severity}' )` - : ''; - querySQL += query.ne_id ? ` and ne_id like '%${query.ne_id}%' ` : ''; - querySQL += query.ne_name ? ` and ne_name like '%${query.ne_name}%' ` : ''; - querySQL += query.ne_type ? ` and ne_type like '%${query.ne_type}%' ` : ''; - querySQL += - query.beginTime && query.endTime - ? ` and event_time BETWEEN '${query.beginTime}' and ' ${query.endTime}'` - : ''; + + if (query.alarmCode) { + querySQL += ` and alarm_code = '${query.alarmCode}' `; + } + + if (query.alarmType) { + querySQL += ` and alarm_type = '${query.alarmType}' `; + } + + if (query.pvFlag) { + querySQL += ` and pv_flag = '${query.pvFlag}' `; + } + + if (query.origSeverity) { + querySQL += ` and orig_severity in('${query.origSeverity}' )`; + } + + if (query.neId) { + querySQL += ` and ne_id like '%${query.neId}%' `; + } + + if (query.neName) { + querySQL += ` and ne_name like '%${query.neName}%' `; + } + + if (query.neType) { + querySQL += ` and ne_type like '%${query.neType}%' `; + } + + if (query.beginTime && query.endTime) { + querySQL += ` and event_time BETWEEN '${query.beginTime}' and ' ${query.endTime}'`; + } // 分页 const pageNum = (query.pageNum - 1) * query.pageSize; @@ -239,7 +253,6 @@ export async function exportAll(query: Record) { }, }); - if (result.code === RESULT_CODE_SUCCESS) { let v = result.data.data[0]; const vArr = parseObjLineToHump(v['alarm']); diff --git a/src/views/faultManage/active-alarm/index.vue b/src/views/faultManage/active-alarm/index.vue index 1f365428..b3c547aa 100644 --- a/src/views/faultManage/active-alarm/index.vue +++ b/src/views/faultManage/active-alarm/index.vue @@ -1,6 +1,5 @@ @@ -352,26 +608,15 @@ onMounted(() => { - - - - - - + @@ -394,12 +639,17 @@ onMounted(() => { - + @@ -511,26 +979,4 @@ onMounted(() => { .table :deep(.ant-pagination) { padding: 0 24px; } - -.raw { - &-title { - color: #000000d9; - font-size: 24px; - line-height: 1.8; - } - .num { - background-color: #e5e5e5; - } - .code { - background-color: #e7e6ff; - } - .txt { - background-color: #ffe3e5; - } - - &-html { - max-height: 300px; - overflow-y: scroll; - } -} From a13e65b39bcb814b58569501e4203731b76d602c Mon Sep 17 00:00:00 2001 From: lai <371757574@qq.com> Date: Wed, 18 Oct 2023 10:23:57 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E6=B5=8B=E9=87=8F=E9=9B=86=E7=9A=84=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/neinfo.ts | 16 ++++++++++++++++ src/store/modules/user.ts | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/store/modules/neinfo.ts b/src/store/modules/neinfo.ts index 1d02fa5f..30d67b3c 100644 --- a/src/store/modules/neinfo.ts +++ b/src/store/modules/neinfo.ts @@ -3,6 +3,7 @@ import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { getNelistAll } from '@/api/configManage/neManage'; import { parseDataToOptions } from '@/utils/parse-tree-utils'; import { getNeTraceInterfaceAll } from '@/api/traceManage/task'; +import { getNePerformanceList } from '@/api/perfManage/taskManage'; /**网元信息类型 */ type NeInfo = { @@ -14,6 +15,8 @@ type NeInfo = { neSelectOtions: Record[]; /**跟踪接口列表 */ traceInterfaceList: Record[]; + /**性能测量数据集 */ + perMeasurementList: Record[]; }; const useNeInfoStore = defineStore('neinfo', { @@ -22,6 +25,7 @@ const useNeInfoStore = defineStore('neinfo', { neCascaderOtions: [], neSelectOtions: [], traceInterfaceList: [], + perMeasurementList: [], }), getters: { /** @@ -91,6 +95,18 @@ const useNeInfoStore = defineStore('neinfo', { } return res; }, + // 获取性能测量数据集列表 + async fnNeTaskPerformance() { + // 有数据不请求 + if (this.perMeasurementList.length > 0) { + return { code: 1, data: this.perMeasurementList, msg: 'success' }; + } + const res = await getNePerformanceList(); + if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) { + this.perMeasurementList = res.data; + } + return res; + }, }, }); diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 8c03cb8e..a5b519f9 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -138,13 +138,13 @@ const useUserStore = defineStore('user', { } catch (error) { console.error(error); - this.profile = { + this.profile = {color:{ critical: '#FF5722', major: '#FFB800', minor: '#393D49', warning: '#009688', event: '#1E9FFF', - }; + }}; } // 验证返回的roles是否是一个非空数组