From d7eae7182751042940ab360bfd77a2e9ab0dcb15 Mon Sep 17 00:00:00 2001 From: opensnail <598092184@qq.com> Date: Fri, 19 Apr 2024 18:26:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(sj=5F1.0.0):=20=E4=BC=98=E5=8C=96=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E4=BA=BA=E5=88=97=E8=A1=A8=E5=92=8C=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/business.ts | 30 +++++ src/locales/langs/en-us.ts | 23 +++- src/locales/langs/zh-cn.ts | 23 +++- src/typings/api.d.ts | 32 +++-- src/typings/app.d.ts | 19 +++ src/views/notify/scene/index.vue | 10 +- .../modules/notify-config-operate-drawer.vue | 115 ++++++++---------- 7 files changed, 160 insertions(+), 92 deletions(-) diff --git a/src/constants/business.ts b/src/constants/business.ts index 27c8353..a3f960b 100644 --- a/src/constants/business.ts +++ b/src/constants/business.ts @@ -12,6 +12,13 @@ export const enableStatusRecord: Record = { + '0': 'page.manage.common.status.enable', + '1': 'page.manage.common.status.disable' +}; + +export const enableStatus01Options = transformRecordToOption(enableStatus01Record); + export const userGenderRecord: Record = { '1': 'page.manage.user.gender.male', '2': 'page.manage.user.gender.female' @@ -50,3 +57,26 @@ export const alarmTypeRecord: Record = { + '1': 'common.systemTaskType.retry', + // '2': 'common.systemTaskType.callback', + '3': 'common.systemTaskType.job', + '4': 'common.systemTaskType.workflow' +}; +export const systemTaskTypeOptions = transformRecordToOption(systemTaskType); + +export const retryNotifyScene: Record = { + '1': 'page.notifyConfig.retryNotifyScene.maxRetry', + '2': 'page.notifyConfig.retryNotifyScene.maxRetryError', + '3': 'page.notifyConfig.retryNotifyScene.clientReportError', + '4': 'page.notifyConfig.retryNotifyScene.clientComponentError', + '5': 'page.notifyConfig.retryNotifyScene.retryTaskReachThreshold', + '6': 'page.notifyConfig.retryNotifyScene.retryTaskEnterDeadLetter' +}; +export const retryNotifySceneOptions = transformRecordToOption(retryNotifyScene); + +export const jobNotifyScene: Record = { + '1': 'page.notifyConfig.jobNotifyScene.jobTaskError' +}; +export const jobNotifySceneOptions = transformRecordToOption(jobNotifyScene); diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index d5302b4..77cba0a 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -46,6 +46,12 @@ const local: App.I18n.Schema = { yesOrNo: { yes: 'Yes', no: 'No' + }, + systemTaskType: { + retry: '重试任务', + callback: '回调任务', + job: '定时任务', + workflow: '工作流' } }, request: { @@ -542,10 +548,23 @@ const local: App.I18n.Schema = { notifyScene: 'Please select Notification scene', groupName: 'Please select Group name', notifyThreshold: 'Please enter Notification threshold', - notifyStatus: 'Please select State' + notifyStatus: 'Please select State', + systemTaskType: '请选择任务类型' }, addNotifyConfig: 'Add Alarm notification', - editNotifyConfig: 'Add Alarm notification' + editNotifyConfig: 'Add Alarm notification', + systemTaskType: '任务类型', + retryNotifyScene: { + maxRetry: '场景重试数量超过阈值', + maxRetryError: '场景重试失败数量超过阈值', + clientReportError: '客户端上报失败', + clientComponentError: '客户端组件异常', + retryTaskReachThreshold: '任务重试失败数量超过阈值', + retryTaskEnterDeadLetter: '任务重试失败进入死信队列' + }, + jobNotifyScene: { + jobTaskError: '任务执行失败' + } }, notifyRecipient: { title: 'Notify Recipient List', diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 64490cc..b115b0b 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -46,6 +46,12 @@ const local: App.I18n.Schema = { yesOrNo: { yes: '是', no: '否' + }, + systemTaskType: { + retry: '重试任务', + callback: '回调任务', + job: '定时任务', + workflow: '工作流' } }, request: { @@ -538,10 +544,23 @@ const local: App.I18n.Schema = { notifyScene: '请选择通知场景', groupName: '请选择组名称', notifyThreshold: '请输入通知阈值', - notifyStatus: '请选择状态' + notifyStatus: '请选择状态', + systemTaskType: '请选择任务类型' }, addNotifyConfig: '新增告警通知', - editNotifyConfig: '编辑告警通知' + editNotifyConfig: '编辑告警通知', + systemTaskType: '任务类型', + retryNotifyScene: { + maxRetry: '场景重试数量超过阈值', + maxRetryError: '场景重试失败数量超过阈值', + clientReportError: '客户端上报失败', + clientComponentError: '客户端组件异常', + retryTaskReachThreshold: '任务重试失败数量超过阈值', + retryTaskEnterDeadLetter: '任务重试失败进入死信队列' + }, + jobNotifyScene: { + jobTaskError: '任务执行失败' + } }, notifyRecipient: { title: '通知人列表', diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index 4abe5ee..db7f19a 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -38,6 +38,14 @@ declare namespace Api { */ type EnableStatus = '1' | '2'; + /** + * enable status + * + * - "0": enabled + * - "1": disabled + */ + type EnableStatus01 = '0' | '1'; + /** * yes/no status * @@ -508,14 +516,12 @@ declare namespace Api { groupName: string; /** 业务ID */ businessId: string; + /** 任务类型 1、重试任务 2、回调任务、3、JOB任务 4、WORKFLOW任务 */ + systemTaskType: SystemTaskType; /** 业务名称 */ businessName?: string; /** 状态 */ notifyStatus: string; - /** 通知类型 */ - notifyType: string; - /** 通知属性 */ - notifyAttribute: string; /** 通知场景 */ notifyScene: string; /** 通知阈值 */ @@ -528,20 +534,22 @@ declare namespace Api { type NotifySearchParams = CommonType.RecordNullable< Pick< Api.NotifyConfig.NotifyConfig, - | 'groupName' - | 'businessId' - | 'notifyStatus' - | 'notifyType' - | 'notifyAttribute' - | 'notifyScene' - | 'notifyThreshold' - | 'description' + 'groupName' | 'businessId' | 'systemTaskType' | 'notifyStatus' | 'notifyScene' > & CommonSearchParams >; /** notify-config list */ type NotifyConfigList = Common.PaginatingQueryRecord; + + /** 任务类型 1、重试任务 2、回调任务、 3、JOB任务 4、WORKFLOW任务 */ + type SystemTaskType = '1' | '3' | '4'; + + /** 1、场景重试数量超过阈值 2、场景重试失败数量超过阈值 3、客户端上报失败 4、客户端组件异常 5、任务重试失败数量超过阈值 6、任务重试失败进入死信队列 */ + type RetryNotifyScene = '1' | '2' | '3' | '4' | '5' | '6'; + + /** 1、任务执行失败 */ + type JobNotifyScene = '1'; } /** diff --git a/src/typings/app.d.ts b/src/typings/app.d.ts index 10389d9..0c8c776 100644 --- a/src/typings/app.d.ts +++ b/src/typings/app.d.ts @@ -293,6 +293,12 @@ declare namespace App { yes: string; no: string; }; + systemTaskType: { + retry: string; + callback: string; + job: string; + workflow: string; + }; }; request: { logout: string; @@ -714,9 +720,22 @@ declare namespace App { groupName: string; notifyThreshold: string; notifyStatus: string; + systemTaskType: string; }; addNotifyConfig: string; editNotifyConfig: string; + systemTaskType: string; + retryNotifyScene: { + maxRetry: string; + maxRetryError: string; + clientReportError: string; + clientComponentError: string; + retryTaskReachThreshold: string; + retryTaskEnterDeadLetter: string; + }; + jobNotifyScene: { + jobTaskError: string; + }; }; notifyRecipient: { title: string; diff --git a/src/views/notify/scene/index.vue b/src/views/notify/scene/index.vue index dc0d964..2dba9e9 100644 --- a/src/views/notify/scene/index.vue +++ b/src/views/notify/scene/index.vue @@ -18,9 +18,7 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP // the value can not be undefined, otherwise the property in Form will not be reactive groupName: null, notifyStatus: null, - notifyScene: null, - notifyThreshold: null, - description: null + notifyScene: null }, columns: () => [ { @@ -52,12 +50,6 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP align: 'left', width: 120 }, - { - key: 'notifyType', - title: $t('page.notifyConfig.notifyType'), - align: 'left', - width: 120 - }, { key: 'notifyScene', title: $t('page.notifyConfig.notifyScene'), diff --git a/src/views/notify/scene/modules/notify-config-operate-drawer.vue b/src/views/notify/scene/modules/notify-config-operate-drawer.vue index 083c8dd..e8cf3e6 100644 --- a/src/views/notify/scene/modules/notify-config-operate-drawer.vue +++ b/src/views/notify/scene/modules/notify-config-operate-drawer.vue @@ -4,6 +4,8 @@ import { useFormRules, useNaiveForm } from '@/hooks/common/form'; import OperateDrawer from '@/components/common/operate-drawer.vue'; import { $t } from '@/locales'; import { fetchAddNotify, fetchEditNotify } from '@/service/api'; +import { enableStatus01Options, retryNotifySceneOptions, systemTaskTypeOptions } from '@/constants/business'; +import { translateOptions } from '@/utils/common'; defineOptions({ name: 'NotifyConfigOperateDrawer' @@ -44,9 +46,8 @@ type Model = Pick< | 'id' | 'groupName' | 'businessId' + | 'systemTaskType' | 'notifyStatus' - | 'notifyType' - | 'notifyAttribute' | 'notifyScene' | 'notifyThreshold' | 'description' @@ -58,28 +59,21 @@ function createDefaultModel(): Model { return { groupName: '', businessId: '', + systemTaskType: '1', notifyStatus: '', - notifyType: '', notifyScene: '', notifyThreshold: 0, - notifyAttribute: '', description: '' }; } -type RuleKey = Extract< - keyof Model, - 'groupName' | 'businessId' | 'notifyStatus' | 'notifyType' | 'notifyScene' | 'notifyThreshold' | 'description' ->; +type RuleKey = Extract; const rules: Record = { groupName: defaultRequiredRule, businessId: defaultRequiredRule, notifyStatus: defaultRequiredRule, - notifyType: defaultRequiredRule, - notifyScene: defaultRequiredRule, - notifyThreshold: defaultRequiredRule, - description: defaultRequiredRule + notifyScene: defaultRequiredRule }; function handleUpdateModelWhenEdit() { @@ -104,9 +98,8 @@ async function handleSubmit() { const { groupName, businessId, + systemTaskType, notifyStatus, - notifyType, - notifyAttribute, notifyScene, notifyThreshold, description @@ -114,9 +107,8 @@ async function handleSubmit() { const { error } = await fetchAddNotify({ groupName, businessId, + systemTaskType, notifyStatus, - notifyType, - notifyAttribute, notifyScene, notifyThreshold, description @@ -130,8 +122,7 @@ async function handleSubmit() { groupName, businessId, notifyStatus, - notifyType, - notifyAttribute, + systemTaskType, notifyScene, notifyThreshold, description @@ -140,9 +131,8 @@ async function handleSubmit() { id, groupName, businessId, + systemTaskType, notifyStatus, - notifyType, - notifyAttribute, notifyScene, notifyThreshold, description @@ -165,18 +155,41 @@ watch(visible, () => {