From c518ebd921d1ba13366a77faf2f0cb58d8c7306b Mon Sep 17 00:00:00 2001 From: zhongzm Date: Tue, 10 Jun 2025 19:09:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=91=8A=E8=AD=A6=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/langs/zh-cn.ts | 2 +- src/service/api/auth.ts | 109 ++++++++++++ src/typings/auto-imports.d.ts | 9 + src/views/device/alerts/index.vue | 267 ++++++++++++++++++++++++++++++ 4 files changed, 386 insertions(+), 1 deletion(-) create mode 100644 src/views/device/alerts/index.vue diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index f9c5015..0fef2cd 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -670,7 +670,7 @@ const local:any = { alert:'警告', gateway:'网关', switches:'交换机', - clients:'装置', + clients:'终端', search:'输入站点名称', total:'共', addsite:'添加站点', diff --git a/src/service/api/auth.ts b/src/service/api/auth.ts index d892d7f..c88efef 100644 --- a/src/service/api/auth.ts +++ b/src/service/api/auth.ts @@ -514,6 +514,115 @@ export function getPaymentConfig() { }); } +// 获取告警数据 +export function fetchAlertList(siteId: string, params: { + pageNum: number; + pageSize: number; + filters: { + timeStart?: string; + timeEnd?: string; + module?: string; + resolved?: boolean; + } +}) { + return request({ + url: `/system/log/alerts/${siteId}`, + method: 'get', + params: { + pageNum: params.pageNum, + pageSize: params.pageSize, + 'filters.timeStart': params.filters.timeStart, + 'filters.timeEnd': params.filters.timeEnd, + 'filters.module': params.filters.module, + 'filters.resolved': params.filters.resolved, + } + }) +} +// 删除告警 +export function deleteAlerts(siteId: string, data: { + selectType: 'unresolved' | 'resolved' | 'all'; + startTime: number; + endTime: number; + logs: number[]; +}) { + return request({ + url: `/system/log/alerts/${siteId}`, + method: 'delete', + data + }); +} +// 标记告警为已解决 +export function markAlertsResolved(siteId: string, data: { + selectType: 'unresolved' | 'resolved' | 'all'; + startTime: number; + endTime: number; + logs: string[]; +}) { + return request({ + url: `/system/log/alerts/${siteId}`, + method: 'post', + data + }) +} + +// 获取白名单配置 +export function fetchAccessControl(siteId: string) { + return request({ + url: `/system/access-control/${siteId}`, + method: 'get' + }) +} +// 更新白名单配置 +export function updateAccessControl(siteId: string, data: { + preAuthAccessEnable: boolean; + freeAuthClientEnable: boolean; + preAuthAccessPolicies: Array<{ + type: number; + ip?: string; + url?: string; + }>; + freeAuthClientPolicies: Array<{ + type: number; + clientIp?: string; + clientMac?: string; + }>; +}) { + return request({ + url: `/system/access-control/${siteId}`, + method: 'post', + data + }); +} +// 获取 Mesh 配置 +export function getMeshConfig(siteId: string) { + return request({ + url: `/system/site/${siteId}/mesh`, + method: 'get' + }) +} +// 更新 Mesh 配置 +export function updateMeshConfig(siteId: string, data: { meshEnable: boolean; autoFailoverEnable?: boolean }) { + return request({ + url: `/system/site/${siteId}/mesh`, + method: 'post', + data + }) +} +// 获取 Roaming 配置 +export function getRoamingConfig(siteId: string) { + return request({ + url: `/system/site/${siteId}/roaming`, + method: 'get' + }) +} +// 更新 Roaming 配置 +export function updateRoamingConfig(siteId: string, data: { fastRoamingEnable: boolean; noStickRoamingEnable?: boolean; aiRoamingEnable?: boolean }) { + return request({ + url: `/system/site/${siteId}/roaming`, + method: 'post', + data + }) +} diff --git a/src/typings/auto-imports.d.ts b/src/typings/auto-imports.d.ts index 77dbf2c..ea86774 100644 --- a/src/typings/auto-imports.d.ts +++ b/src/typings/auto-imports.d.ts @@ -66,6 +66,7 @@ declare global { const defineStore: typeof import('pinia')['defineStore'] const delData: typeof import('../service/api/dictData')['delData'] const delJobLog: typeof import('../service/api/job')['delJobLog'] + const deleteAlerts: typeof import('../service/api/auth')['deleteAlerts'] const deleteApDevices: typeof import('../service/api/auth')['deleteApDevices'] const deletePackage: typeof import('../service/api/auth')['deletePackage'] const deletePortal: typeof import('../service/api/auth')['deletePortal'] @@ -133,6 +134,8 @@ declare global { const exportJobLog: typeof import('../service/api/jobLog')['exportJobLog'] const extendRef: typeof import('@vueuse/core')['extendRef'] const extractTabsByAllRoutes: typeof import('../store/modules/tab/shared')['extractTabsByAllRoutes'] + const fetchAccessControl: typeof import('../service/api/auth')['fetchAccessControl'] + const fetchAlertList: typeof import('../service/api/auth')['fetchAlertList'] const fetchApDeviceList: typeof import('../service/api/auth')['fetchApDeviceList'] const fetchBillList: typeof import('../service/api/auth')['fetchBillList'] const fetchBillRuleList: typeof import('../service/api/auth')['fetchBillRuleList'] @@ -183,8 +186,10 @@ declare global { const getFixedTabs: typeof import('../store/modules/tab/shared')['getFixedTabs'] const getGlobalMenusByAuthRoutes: typeof import('../store/modules/route/shared')['getGlobalMenusByAuthRoutes'] const getLocalizedTimeUnit: typeof import('../utils/units')['getLocalizedTimeUnit'] + const getMeshConfig: typeof import('../service/api/auth')['getMeshConfig'] const getPaymentConfig: typeof import('../service/api/auth')['getPaymentConfig'] const getPortalConfig: typeof import('../service/api/auth')['getPortalConfig'] + const getRoamingConfig: typeof import('../service/api/auth')['getRoamingConfig'] const getRouteIcons: typeof import('../store/modules/tab/shared')['getRouteIcons'] const getSelectedMenuKeyPathByKey: typeof import('../store/modules/route/shared')['getSelectedMenuKeyPathByKey'] const getServiceBaseURL: typeof import('../utils/service')['getServiceBaseURL'] @@ -216,6 +221,7 @@ declare global { const mapState: typeof import('pinia')['mapState'] const mapStores: typeof import('pinia')['mapStores'] const mapWritableState: typeof import('pinia')['mapWritableState'] + const markAlertsResolved: typeof import('../service/api/auth')['markAlertsResolved'] const markRaw: typeof import('vue')['markRaw'] const nextTick: typeof import('vue')['nextTick'] const omit: typeof import('lodash-es')['omit'] @@ -307,15 +313,18 @@ declare global { const unref: typeof import('vue')['unref'] const unrefElement: typeof import('@vueuse/core')['unrefElement'] const until: typeof import('@vueuse/core')['until'] + const updateAccessControl: typeof import('../service/api/auth')['updateAccessControl'] const updateApDeviceConfig: typeof import('../service/api/auth')['updateApDeviceConfig'] const updateBillRule: typeof import('../service/api/auth')['updateBillRule'] const updateData: typeof import('../service/api/dictData')['updateData'] const updateJob: typeof import('../service/api/job')['updateJob'] const updateLocaleOfGlobalMenus: typeof import('../store/modules/route/shared')['updateLocaleOfGlobalMenus'] + const updateMeshConfig: typeof import('../service/api/auth')['updateMeshConfig'] const updatePackage: typeof import('../service/api/auth')['updatePackage'] const updatePasswordByOld: typeof import('../service/api/auth')['updatePasswordByOld'] const updatePaymentConfig: typeof import('../service/api/auth')['updatePaymentConfig'] const updatePortalConfig: typeof import('../service/api/auth')['updatePortalConfig'] + const updateRoamingConfig: typeof import('../service/api/auth')['updateRoamingConfig'] const updateSite: typeof import('../service/api/auth')['updateSite'] const updateTabByI18nKey: typeof import('../store/modules/tab/shared')['updateTabByI18nKey'] const updateTabsByI18nKey: typeof import('../store/modules/tab/shared')['updateTabsByI18nKey'] diff --git a/src/views/device/alerts/index.vue b/src/views/device/alerts/index.vue new file mode 100644 index 0000000..8b37f49 --- /dev/null +++ b/src/views/device/alerts/index.vue @@ -0,0 +1,267 @@ + + + + +