diff --git a/src/api/configManage/neManage.ts b/src/api/configManage/neManage.ts index da21cbff..765305b4 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: `/api/rest/systemManagement/v1/elementType/${data.neType}/objectType/service/stop?ne_id=${data.neId}`, method: 'post', }); -} \ No newline at end of file +} diff --git a/src/api/faultManage/actAlarm.ts b/src/api/faultManage/actAlarm.ts index 84a38663..d0329395 100644 --- a/src/api/faultManage/actAlarm.ts +++ b/src/api/faultManage/actAlarm.ts @@ -14,23 +14,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; @@ -237,7 +252,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/api/index.ts b/src/api/index.ts index afe7594a..9c9732e4 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -10,6 +10,7 @@ export async function listMain() { const result = await request({ url: '/api/rest/systemManagement/v1/elementType/all/objectType/systemState', method: 'get', + timeout: 30 * 1000, }); // console.log(result); let realData = result.data.data; diff --git a/src/api/perfManage/perfData.ts b/src/api/perfManage/perfData.ts new file mode 100644 index 00000000..8c87f618 --- /dev/null +++ b/src/api/perfManage/perfData.ts @@ -0,0 +1,69 @@ +import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; +import { request } from '@/plugins/http-fetch'; +import { parseObjLineToHump } from '@/utils/parse-utils'; + +/** + * 查询日志列表 + * @param query 查询参数 + * @returns object + */ +export async function listperfData(query: Record) { + let totalSQL = 'select count(*) as total from measure_data where 1=1 '; + let rowsSQL = 'select * from measure_data where 1=1 '; + + // 查询 + let querySQL = ''; + if (query.neType) { + querySQL += ` and ne_type like '%${query.neType}%' `; + } + if (query.beginTime) { + querySQL += ` and start_time >= '${query.beginTime}' `; + } + if (query.endTime) { + querySQL += ` and start_time <= '${query.endTime}' `; + } + + // 排序 + let sortSql = ' order by start_time '; + if (query.sortOrder === 'asc') { + sortSql += ' asc '; + } else { + sortSql += ' desc '; + } + + // 分页 + const pageNum = (query.pageNum - 1) * query.pageSize; + const limtSql = ` limit ${pageNum},${query.pageSize} `; + + // 发起请求 + const result = await request({ + url: `/databaseManagement/v1/select/omc_db/measure_data`, + method: 'get', + params: { + totalSQL: totalSQL + querySQL, + rowsSQL: rowsSQL + querySQL + sortSql + limtSql, + }, + }); + + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS) { + const data: DataList = { + total: 0, + rows: [], + code: result.code, + msg: result.msg, + }; + result.data.data.forEach((item: any) => { + const itemData = item['measure_data']; + if (Array.isArray(itemData)) { + if (itemData.length === 1 && itemData[0]['total'] >= 0) { + data.total = itemData[0]['total']; + } else { + data.rows = itemData.map(v => parseObjLineToHump(v)); + } + } + }); + return data; + } + return result; +} diff --git a/src/api/perfManage/taskManage.ts b/src/api/perfManage/taskManage.ts new file mode 100644 index 00000000..6b2820ed --- /dev/null +++ b/src/api/perfManage/taskManage.ts @@ -0,0 +1,140 @@ +import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; +import { request } from '@/plugins/http-fetch'; +import { parseObjLineToHump } from '@/utils/parse-utils'; + +/** + * 查询任务列表 + * @param query 查询参数 + * @returns object + */ +export async function listPerfTask(query: Record) { + let totalSQL = 'select count(*) as total from measure_task where 1=1 '; + let rowsSQL = 'select * from measure_task where 1=1 '; + + // 查询 + let querySQL = ''; + if (query.neType) { + querySQL += ` and ne_type like '%${query.neType}%' `; + } + + // 分页 + const pageNum = (query.pageNum - 1) * query.pageSize; + const limtSql = ` limit ${pageNum},${query.pageSize} `; + + // 发起请求 + const result = await request({ + url: `/databaseManagement/v1/select/omc_db/measure_task`, + method: 'get', + params: { + totalSQL: totalSQL + querySQL, + rowsSQL: rowsSQL + querySQL + limtSql, + }, + }); + + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS) { + const data: DataList = { + total: 0, + rows: [], + code: result.code, + msg: result.msg, + }; + result.data.data.forEach((item: any) => { + const itemData = item['measure_task']; + if (Array.isArray(itemData)) { + if (itemData.length === 1 && itemData[0]['total'] >= 0) { + data.total = itemData[0]['total']; + } else { + data.rows = itemData.map(v => parseObjLineToHump(v)); + } + } + }); + return data; + } + return result; +} + +/** + * 查询任务详细 + * @param id 网元ID + * @returns object + */ +export async function getTraceTask(id: string | number) { + // 发起请求 + const result = await request({ + url: `/databaseManagement/v1/select/omc_db/trace_task`, + method: 'get', + params: { + SQL: `select * from trace_task where id = ${id}`, + }, + }); + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) { + let data = result.data.data[0]; + return Object.assign(result, { + data: parseObjLineToHump(data['trace_task'][0]), + }); + } + return result; +} + +/** + * 新增任务 + * @param data 网元对象 + * @returns object + */ +export function addTraceTask(data: Record) { + return request({ + url: `/traceManagement/v1/subscriptions`, + method: 'post', + data: data, + }); +} + +/** + * 修改任务 + * @param data 网元对象 + * @returns object + */ +export function updateTraceTask(data: Record) { + return request({ + url: `/traceManagement/v1/subscriptions`, + method: 'put', + data: data, + }); +} + +/** + * 删除任务 + * @param noticeId 网元ID + * @returns object + */ +export async function delTraceTask(id: string) { + return request({ + url: `/traceManagement/v1/subscriptions?id=${id}`, + method: 'delete', + }); +} + +/** + * 获取网元跟踪接口列表 + * @returns object + */ +export async function getNePerformanceList() { + // 发起请求 + const result = await request({ + url: `/databaseManagement/v1/elementType/omc_db/objectType/measure_title`, + method: 'get', + params: { + SQL: `SELECT * FROM measure_title`, + }, + }); + // 解析数据 + if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) { + let data = result.data.data[0]; + return Object.assign(result, { + data: parseObjLineToHump(data['measure_title']), + }); + } + return result; +} diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 86f7c4cd..61a182d9 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -109,6 +109,10 @@ export default { start: 'Start', export: 'Export', import: 'Import', + selectPlease:'Please select the source of the import file', + server:'Server File', + local:'Local File', + fileSelect:'Please select the current import file', }, backupManage: { setBackupTask: 'Set automatic backup time', @@ -200,6 +204,17 @@ export default { neType: 'IMS Type', }, }, + perfManage: { + taskManage:{ + taskId: 'Task ID', + neType: 'Type', + size: 'Measurement Dimensionality', + taskStatus: 'Task Status', + addUser: 'Creator', + addTime: 'Creation time', + granulOption:'Particle', + }, + }, traceManage: { analysis: { imsi: 'IMSI', diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 86711ff1..ec0c5847 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -109,6 +109,10 @@ export default { start: '启动', export: '导出', import: '导入', + selectPlease:'请选择导入文件来源', + server:'服务器文件', + local:'本地文件', + fileSelect:'请选择当前导入文件', }, backupManage: { setBackupTask: '设置自动备份时间', @@ -200,6 +204,17 @@ export default { neType: 'IMS网元类型', }, }, + perfManage: { + taskManage:{ + taskId: '任务ID', + neType: '网元类型', + size: '测量粒度', + taskStatus: '任务状态', + addUser: '创建人', + addTime: '创建时间', + granulOption:'测量粒度', + }, + }, traceManage: { analysis: { imsi: 'IMSI', 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/views/configManage/neManage/index.vue b/src/views/configManage/neManage/index.vue index de397a19..3aee60bf 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(); +} + /** * 对话框弹出关闭执行函数 * 进行表达规则校验 @@ -472,6 +589,12 @@ function fnRecordMore(type: string | number, row: Record) { if (type === 'stop') { fnRecordStop(row); } + + if (type === 'import') { + modalState.importFrom = Object.assign(modalState.importFrom, row); + modalState.title = '导入'; + modalState.visibleByImport = true; + } } /**查询网元列表 */ @@ -491,6 +614,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(); @@ -846,6 +1016,97 @@ onMounted(() => { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ t('views.configManage.neManage.fileSelect') }} + + + + + 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; - } -}