From cac5f720b642c7cd09038f5824f7a6dbaffea157 Mon Sep 17 00:00:00 2001 From: yaojn Date: Fri, 10 Oct 2025 12:11:03 +0800 Subject: [PATCH] =?UTF-8?q?-=20[=E5=8A=9F=E8=83=BD]=E6=8C=89=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E6=8A=BD=E7=A6=BB=E5=8A=A8=E6=80=81=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=20=20=20=20-=20[=E5=85=B3=E8=81=94]#[1501469071605760]?= =?UTF-8?q?=E6=8C=89=E6=A8=A1=E5=9D=97=E6=8A=BD=E7=A6=BB=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=20http://192.168.0.96:8090/demo/rdm.html#/st?= =?UTF-8?q?ory-detail/939050947543040/939050947543042/1501469071605760?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/alert/alert.js | 4 ++++ store/modules/topMenu.js | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 store/modules/topMenu.js diff --git a/api/alert/alert.js b/api/alert/alert.js index bad4ece..0c93296 100644 --- a/api/alert/alert.js +++ b/api/alert/alert.js @@ -1,6 +1,10 @@ import axios from '@/resources/api/http.js'; const alert = { + //获取ALERT的视图列表 + updateAlertMenu() { + return axios.post('/api/rest/alert/view/list', {}); + }, getAlertViewById(id) { return axios.post('/api/rest/alert/view/get', { id: id }); }, diff --git a/store/modules/topMenu.js b/store/modules/topMenu.js new file mode 100644 index 0000000..1f8ac3b --- /dev/null +++ b/store/modules/topMenu.js @@ -0,0 +1,25 @@ +import alertApi from '@/community-module/alert/api/alert/alert.js'; +async function updateAlertMenu({ commit, state, rootState, forceUpdate = true, hasCustomMenuAuthority } = {}) { + await state.gettingModuleList; + const alertModule = state.moduleList.find(item => item.moduleId === 'alert'); + if (!alertModule || (!forceUpdate && state.dynamicMenu.hasOwnProperty('alert')) || !hasCustomMenuAuthority('alert', 'alert-manage')) { + return; + } + const res = await alertApi.updateAlertMenu(); + if (!res.Return || res.Return.length === 0) return; + const alertViewList = res.Return.map(view => ({ + name: view.label, + path: `/alert-manage/${view.name}`, + url: `/alert-manage/${view.name}`, + icon: 'tsfont-dot' + })); + const newMenuGroup = [ + { + menuTypeName: '告警视图', + menuList: alertViewList + } + ]; + commit('updateMenu', { module: alertModule, startIndex: 0, newMenuGroup }); + return res; +} +export default updateAlertMenu; -- Gitee