From 913d60d785413b5416ede5016c3022864de53cdc Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Tue, 9 Jan 2024 18:25:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8B=93=E6=89=91=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E5=9B=BE=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/configManage/neManage.ts | 15 +- src/views/logManage/neFile/index.vue | 10 +- .../monitor/topologyArchitecture/index.vue | 500 ++++++++++++++++++ .../topologyArchitecture/useNeOptions.ts | 90 ++++ 4 files changed, 608 insertions(+), 7 deletions(-) create mode 100644 src/views/monitor/topologyArchitecture/index.vue create mode 100644 src/views/monitor/topologyArchitecture/useNeOptions.ts diff --git a/src/api/configManage/neManage.ts b/src/api/configManage/neManage.ts index bf3875ea..63f17166 100644 --- a/src/api/configManage/neManage.ts +++ b/src/api/configManage/neManage.ts @@ -8,7 +8,8 @@ import { parseObjLineToHump } from '@/utils/parse-utils'; * @returns object */ export async function listNeInfo(query: Record) { - let totalSQL = 'select count(*) as total from ne_info where (status=0 or status=3)'; + let totalSQL = + 'select count(*) as total from ne_info where (status=0 or status=3)'; let rowsSQL = 'select * from ne_info where (status=0 or status=3) '; // 系统特定顺序 @@ -112,7 +113,9 @@ export async function getNeInfo(id: string | number) { export function addNeInfo(data: Record) { data.port = `${data.port}`; return request({ - url: `/api/rest/systemManagement/v1/elementType/${data.neType.toLowerCase()}/objectType/neInfo?sync2ne=${data.sync}`, + url: `/api/rest/systemManagement/v1/elementType/${data.neType.toLowerCase()}/objectType/neInfo?sync2ne=${ + data.sync + }`, method: 'post', data: data, }); @@ -141,7 +144,7 @@ export async function delNeInfo(data: Record) { return request({ url: `/api/rest/systemManagement/v1/elementType/${data.neType}/objectType/neInfo?ne_id=${data.neId}`, method: 'delete', - timeout:60*1000, + timeout: 60 * 1000, }); } @@ -260,7 +263,7 @@ export async function listServerFile(data: Record) { /** * 启动网元 - * @param + * @data {neType,neId} * @returns bolb */ export function startNf(data: Record) { @@ -273,7 +276,7 @@ export function startNf(data: Record) { /** * 重启网元 - * @param + * @data {neType,neId} * @returns bolb */ export function restartNf(data: Record) { @@ -286,7 +289,7 @@ export function restartNf(data: Record) { /** * 停止网元 - * @param + * @data {neType,neId} * @returns bolb */ export function stopNf(data: Record) { diff --git a/src/views/logManage/neFile/index.vue b/src/views/logManage/neFile/index.vue index d10fc0f9..f5cb9b12 100644 --- a/src/views/logManage/neFile/index.vue +++ b/src/views/logManage/neFile/index.vue @@ -10,11 +10,16 @@ import useNeInfoStore from '@/store/modules/neinfo'; import useI18n from '@/hooks/useI18n'; import { Modal, message } from 'ant-design-vue/lib'; import saveAs from 'file-saver'; +import { useRoute } from 'vue-router'; const neInfoStore = useNeInfoStore(); const { t } = useI18n(); +const route = useRoute(); + +// 获取地址栏参数 +const routeParams = route.query as Record; /**网元参数 */ -let neType = ref([]); +let neType = ref([]); /**下载触发等待 */ let loading = ref(false); /**访问路径 */ @@ -244,6 +249,9 @@ onMounted(() => { content: t('common.noData'), duration: 2, }); + } else if (routeParams.neType) { + neType.value = [routeParams.neType, routeParams.neId] + fnNeChange(neType.value, undefined); } } }); diff --git a/src/views/monitor/topologyArchitecture/index.vue b/src/views/monitor/topologyArchitecture/index.vue new file mode 100644 index 00000000..e39f6a71 --- /dev/null +++ b/src/views/monitor/topologyArchitecture/index.vue @@ -0,0 +1,500 @@ + + + + + diff --git a/src/views/monitor/topologyArchitecture/useNeOptions.ts b/src/views/monitor/topologyArchitecture/useNeOptions.ts new file mode 100644 index 00000000..3df03b7c --- /dev/null +++ b/src/views/monitor/topologyArchitecture/useNeOptions.ts @@ -0,0 +1,90 @@ +import { restartNf, stopNf } from '@/api/configManage/neManage'; +import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; +import { Modal, message } from 'ant-design-vue/lib'; +import useI18n from '@/hooks/useI18n'; +import { useRouter } from 'vue-router'; + +export default function useNeOptions() { + const router = useRouter(); + const { t } = useI18n(); + + /** + * 网元重启 + * @param row {neName,neType,neId} + */ + function fnNeRestart(row: Record) { + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.configManage.neManage.totalSure', { + msg: row.neName, + oper: t('views.configManage.neManage.restart'), + }), + onOk() { + const key = 'restartNf'; + message.loading({ content: t('common.loading'), key }); + restartNf(row).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.msgSuccess', { + msg: t('views.configManage.neManage.restart'), + }), + key, + duration: 3, + }); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 3, + }); + } + }); + }, + }); + } + + /** + * 网元停止 + * @param row {neName,neType,neId} + */ + function fnNeStop(row: Record) { + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.configManage.neManage.totalSure', { + msg: row.neName, + oper: t('views.configManage.neManage.stop'), + }), + onOk() { + const key = 'restartNf'; + message.loading({ content: t('common.loading'), key }); + stopNf(row).then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.msgSuccess', { + msg: t('views.configManage.neManage.stop'), + }), + key: key, + duration: 3, + }); + } else { + message.error({ + content: `${res.msg}`, + key: key, + duration: 3, + }); + } + }); + }, + }); + } + + /** + * 跳转网元日志文件页面 + * @param row {neType,neId} + */ + function fnNeLogFile(row: Record) { + router.push(`/logManage/neFile?neType=${row.neType}&neId=${row.neId}`); + } + + return { fnNeRestart, fnNeStop, fnNeLogFile }; +}