From e1401777a1a71962d36b2c4815a7743cad84ac4a Mon Sep 17 00:00:00 2001 From: opensnail <598092184@qq.com> Date: Wed, 17 Apr 2024 16:37:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(sj=5F1.0.0):=20=E6=96=B0=E5=A2=9E=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=91=8A=E8=AD=A6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/langs/en-us.ts | 24 ++ src/locales/langs/zh-cn.ts | 24 ++ src/router/elegant/imports.ts | 1 + src/router/elegant/routes.ts | 9 + src/router/elegant/transform.ts | 5 +- src/service/api/index.ts | 1 + src/service/api/notify.ts | 28 +++ src/typings/api.d.ts | 53 ++++ src/typings/app.d.ts | 23 ++ src/typings/components.d.ts | 1 + src/typings/elegant-router.d.ts | 13 +- src/views/notify/index.vue | 178 ++++++++++++++ .../modules/notify-config-operate-drawer.vue | 228 ++++++++++++++++++ .../notify/modules/notify-config-search.vue | 71 ++++++ 14 files changed, 653 insertions(+), 6 deletions(-) create mode 100644 src/service/api/notify.ts create mode 100644 src/views/notify/index.vue create mode 100644 src/views/notify/modules/notify-config-operate-drawer.vue create mode 100644 src/views/notify/modules/notify-config-search.vue diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index e415fc0..6ca5f22 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -160,6 +160,7 @@ const local: App.I18n.Schema = { namepase: 'Namepase', manage: 'System Manage', manage_user: 'User Manage', + notify: 'notify', 'manage_user-detail': 'User Detail', manage_role: 'Role Manage', manage_menu: 'Menu Manage', @@ -496,6 +497,29 @@ const local: App.I18n.Schema = { local: 'Local Icon' } } + }, + notifyConfig: { + title: 'Alarm Notify List', + groupName: 'Group name', + businessName: 'Business ID', + notifyStatus: 'State', + notifyType: 'Notify type', + notifyScene: 'Notify scene', + notifyThreshold: 'Notify threshold', + description: 'Describe', + notifyAttribute: 'Notify Attribute', + form: { + businessId: 'Please select Business ID', + description: 'Please enter Describe', + notifyType: 'Please select Notification type', + notifyAttribute: 'Please enter notify attribute', + notifyScene: 'Please select Notification scene', + groupName: 'Please select Group name', + notifyThreshold: 'Please enter Notification threshold', + notifyStatus: 'Please select State' + }, + addNotifyConfig: 'Add Alarm notification', + editNotifyConfig: 'Add Alarm notification' } }, form: { diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 59e07d1..2e09ea6 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -160,6 +160,7 @@ const local: App.I18n.Schema = { namepase: '命名空间', manage: '系统管理', manage_user: '用户管理', + notify: '告警通知', 'manage_user-detail': '用户详情', manage_role: '角色管理', manage_menu: '菜单管理', @@ -492,6 +493,29 @@ const local: App.I18n.Schema = { local: '本地图标' } } + }, + notifyConfig: { + title: '告警通知列表', + groupName: '组名称', + businessName: '业务ID', + notifyStatus: '状态', + notifyType: '通知类型', + notifyScene: '通知场景', + notifyThreshold: '通知阈值', + description: '描述', + notifyAttribute: '通知属性', + form: { + businessId: '请选择业务ID', + description: '请输入描述', + notifyType: '请选择通知类型', + notifyAttribute: '请求输入通知属性', + notifyScene: '请选择通知场景', + groupName: '请选择组名称', + notifyThreshold: '请输入通知阈值', + notifyStatus: '请选择状态' + }, + addNotifyConfig: '新增告警通知', + editNotifyConfig: '编辑告警通知' } }, form: { diff --git a/src/router/elegant/imports.ts b/src/router/elegant/imports.ts index 5b8ae53..d288fb4 100644 --- a/src/router/elegant/imports.ts +++ b/src/router/elegant/imports.ts @@ -36,6 +36,7 @@ export const views: Record Promise import("@/views/multi-menu/first_child/index.vue"), "multi-menu_second_child_home": () => import("@/views/multi-menu/second_child_home/index.vue"), namepase: () => import("@/views/namepase/index.vue"), + notify: () => import("@/views/notify/index.vue"), pods: () => import("@/views/pods/index.vue"), "user-center": () => import("@/views/user-center/index.vue"), }; diff --git a/src/router/elegant/routes.ts b/src/router/elegant/routes.ts index 73d208a..b932774 100644 --- a/src/router/elegant/routes.ts +++ b/src/router/elegant/routes.ts @@ -332,6 +332,15 @@ export const generatedRoutes: GeneratedRoute[] = [ order: 2 } }, + { + name: 'notify', + path: '/notify', + component: 'layout.base$view.notify', + meta: { + title: 'notify', + i18nKey: 'route.notify' + } + }, { name: 'pods', path: '/pods', diff --git a/src/router/elegant/transform.ts b/src/router/elegant/transform.ts index 5dc6e98..f79982c 100644 --- a/src/router/elegant/transform.ts +++ b/src/router/elegant/transform.ts @@ -114,14 +114,14 @@ function transformElegantRouteToVueRoute( } } - + // add redirect to child if (children?.length && !vueRoute.redirect) { vueRoute.redirect = { name: children[0].name }; } - + if (children?.length) { const childRoutes = children.flatMap(child => transformElegantRouteToVueRoute(child, layouts, views)); @@ -175,6 +175,7 @@ const routeMap: RouteMap = { "multi-menu_second_child": "/multi-menu/second/child", "multi-menu_second_child_home": "/multi-menu/second/child/home", "namepase": "/namepase", + "notify": "/notify", "pods": "/pods", "user-center": "/user-center" }; diff --git a/src/service/api/index.ts b/src/service/api/index.ts index eeb1586..97411d7 100644 --- a/src/service/api/index.ts +++ b/src/service/api/index.ts @@ -4,3 +4,4 @@ export * from './system'; export * from './dashboard'; export * from './namespace'; export * from './system-manage'; +export * from './notify'; diff --git a/src/service/api/notify.ts b/src/service/api/notify.ts new file mode 100644 index 0000000..7f2e75e --- /dev/null +++ b/src/service/api/notify.ts @@ -0,0 +1,28 @@ +import { request } from '../request'; + +/** get notify list */ +export function fetchGetNotifyConfigList(params?: Api.NotifyConfig.NotifySearchParams) { + return request({ + url: '/notify-config/list', + method: 'get', + params + }); +} + +/** add notify */ +export function fetchAddNotify(data: Api.NotifyConfig.NotifyConfig) { + return request({ + url: '/notify-config', + method: 'post', + data + }); +} + +/** edit notify */ +export function fetchEditNotify(data: Api.NotifyConfig.NotifyConfig) { + return request({ + url: '/notify-config', + method: 'put', + data + }); +} diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index e13b5f8..43a1f0c 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -422,4 +422,57 @@ declare namespace Api { children?: MenuTree[]; }; } + + /** + * namespace NotifyConfig + * + * backend api module: "notifyConfig" + */ + namespace NotifyConfig { + type CommonSearchParams = Pick; + + /** notify-config */ + type NotifyConfig = Common.CommonRecord<{ + /** 组名称 */ + groupName: string; + /** 业务ID */ + businessId: string; + /** 状态 */ + notifyStatus: string; + /** 通知类型 */ + notifyType: string; + /** 通知属性 */ + notifyAttribute: string; + /** 通知场景 */ + notifyScene: string; + /** 通知阈值 */ + notifyThreshold: number; + /** 描述 */ + description: string; + }>; + + /** notify-config search params */ + type NotifySearchParams = CommonType.RecordNullable< + Pick< + Api.NotifyConfig.NotifyConfig, + | 'groupName' + | 'businessId' + | 'notifyStatus' + | 'notifyType' + | 'notifyAttribute' + | 'notifyScene' + | 'notifyThreshold' + | 'description' + > & + CommonSearchParams + >; + + /** notify-config list */ + type NotifyConfigList = Common.PaginatingQueryRecord< + { + /** 业务名称 */ + businessName: string; + } & NotifyConfig + >; + } } diff --git a/src/typings/app.d.ts b/src/typings/app.d.ts index af04920..395fcaa 100644 --- a/src/typings/app.d.ts +++ b/src/typings/app.d.ts @@ -671,6 +671,29 @@ declare namespace App { }; }; }; + notifyConfig: { + title: string; + groupName: string; + businessName: string; + notifyStatus: string; + notifyType: string; + notifyScene: string; + notifyThreshold: string; + description: string; + notifyAttribute: string; + form: { + businessId: string; + description: string; + notifyType: string; + notifyAttribute: string; + notifyScene: string; + groupName: string; + notifyThreshold: string; + notifyStatus: string; + }; + addNotifyConfig: string; + editNotifyConfig: string; + }; }; form: { required: string; diff --git a/src/typings/components.d.ts b/src/typings/components.d.ts index b31add1..c4e950e 100644 --- a/src/typings/components.d.ts +++ b/src/typings/components.d.ts @@ -52,6 +52,7 @@ declare module 'vue' { NDrawerContent: typeof import('naive-ui')['NDrawerContent'] NDropdown: typeof import('naive-ui')['NDropdown'] NEmpty: typeof import('naive-ui')['NEmpty'] + NFlex: typeof import('naive-ui')['NFlex'] NForm: typeof import('naive-ui')['NForm'] NFormItem: typeof import('naive-ui')['NFormItem'] NFormItemGi: typeof import('naive-ui')['NFormItemGi'] diff --git a/src/typings/elegant-router.d.ts b/src/typings/elegant-router.d.ts index 2203731..208d07e 100644 --- a/src/typings/elegant-router.d.ts +++ b/src/typings/elegant-router.d.ts @@ -49,6 +49,7 @@ declare module "@elegant-router/types" { "multi-menu_second_child": "/multi-menu/second/child"; "multi-menu_second_child_home": "/multi-menu/second/child/home"; "namepase": "/namepase"; + "notify": "/notify"; "pods": "/pods"; "user-center": "/user-center"; }; @@ -65,7 +66,7 @@ declare module "@elegant-router/types" { /** * custom route key - */ + */ export type CustomRouteKey = Extract< RouteKey, | "root" @@ -78,7 +79,7 @@ declare module "@elegant-router/types" { /** * the generated route key - */ + */ export type GeneratedRouteKey = Exclude; /** @@ -90,12 +91,14 @@ declare module "@elegant-router/types" { | "404" | "500" | "about" + | "demo-route" | "function" | "home" | "login" | "manage" | "multi-menu" | "namepase" + | "notify" | "pods" | "user-center" >; @@ -120,6 +123,7 @@ declare module "@elegant-router/types" { | "500" | "login" | "about" + | "demo-route_child" | "function_hide-child_one" | "function_hide-child_three" | "function_hide-child_two" @@ -136,6 +140,7 @@ declare module "@elegant-router/types" { | "multi-menu_first_child" | "multi-menu_second_child_home" | "namepase" + | "notify" | "pods" | "user-center" >; @@ -212,7 +217,7 @@ declare module "@elegant-router/types" { component: `view.${K}`; } : never; - + /** * the center level route */ @@ -235,7 +240,7 @@ declare module "@elegant-router/types" { children: (CenterLevelRoute> | LastLevelRoute>)[]; } : never; - + /** * the custom first level route */ diff --git a/src/views/notify/index.vue b/src/views/notify/index.vue new file mode 100644 index 0000000..c80cbfa --- /dev/null +++ b/src/views/notify/index.vue @@ -0,0 +1,178 @@ + + + + + diff --git a/src/views/notify/modules/notify-config-operate-drawer.vue b/src/views/notify/modules/notify-config-operate-drawer.vue new file mode 100644 index 0000000..1f54aac --- /dev/null +++ b/src/views/notify/modules/notify-config-operate-drawer.vue @@ -0,0 +1,228 @@ + + + + + diff --git a/src/views/notify/modules/notify-config-search.vue b/src/views/notify/modules/notify-config-search.vue new file mode 100644 index 0000000..a757ba7 --- /dev/null +++ b/src/views/notify/modules/notify-config-search.vue @@ -0,0 +1,71 @@ + + + + +