diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 772a2f9..4a7dabd 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -703,7 +703,7 @@ const local: App.I18n.Schema = { title: '告警通知列表', groupName: '组名称', businessName: '业务ID', - notifyStatus: '状态', + notifyStatus: '通知状态', notifyType: '通知类型', notifyScene: '通知场景', notifyThreshold: '通知阈值', @@ -748,7 +748,7 @@ const local: App.I18n.Schema = { workflowClientError: '客户端执行失败' }, notifyRecipient: '通知人信息', - rateLimiterStatus: '限流开关', + rateLimiterStatus: '限流状态', rateLimiterThreshold: '每秒限流阈值' }, notifyRecipient: { diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index c43ae2d..fa8e6e3 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -547,7 +547,7 @@ declare namespace Api { /** 通知人id */ recipientIds: number[]; /** 任务类型 1、重试任务 2、回调任务、3、JOB任务 4、WORKFLOW任务 */ - systemTaskType: SystemTaskType; + systemTaskType: SystemTaskType | null; /** 业务名称 */ businessName?: string; /** 状态 */ 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 2245451..2c83c76 100644 --- a/src/views/notify/scene/modules/notify-config-operate-drawer.vue +++ b/src/views/notify/scene/modules/notify-config-operate-drawer.vue @@ -39,6 +39,10 @@ const workflows = ref([]); const props = defineProps(); +interface Emits { + (e: 'update:value', value: Api.NotifyConfig.RetryNotifyScene): void; +} + interface Emits { (e: 'submitted'): void; } @@ -49,6 +53,10 @@ const visible = defineModel('visible', { default: false }); +const retrySceneDisable = defineModel('retrySceneDisable', { + default: true +}); + const notifySceneOptions = ref[]>(translateOptions(retryNotifySceneOptions)); const { formRef, validate, restoreValidation } = useNaiveForm(); @@ -95,12 +103,12 @@ function createDefaultModel(): Model { groupName: '', businessId: '', recipientIds: [], - systemTaskType: 1, + systemTaskType: null, notifyStatus: 1, - notifyScene: 1, + notifyScene: null, notifyThreshold: 16, rateLimiterStatus: 0, - rateLimiterThreshold: null, + rateLimiterThreshold: 100, description: '' }; } @@ -129,6 +137,7 @@ function handleUpdateModelWhenEdit() { if (props.operateType === 'edit' && props.rowData) { Object.assign(model, props.rowData); systemTaskTypeChange(model.systemTaskType); + retrySceneChange(model.notifyScene); } } @@ -201,7 +210,7 @@ async function handleSubmit() { emit('submitted'); } -async function systemTaskTypeChange(value: number) { +async function systemTaskTypeChange(value: number | null) { if (value === 1) { const res = await fetchGetRetrySceneList({ groupName: model.groupName }); retryScenes.value = res.data as Api.RetryScene.Scene[]; @@ -231,10 +240,21 @@ async function systemTaskTypeChange(value: number) { } } +async function retrySceneChange( + value: + | Api.NotifyConfig.JobNotifyScene + | Api.NotifyConfig.RetryNotifyScene + | Api.NotifyConfig.WorkflowNotifyScene + | null +) { + retrySceneDisable.value = !(value === 5 || value === 6); +} + function groupNameUpdate(groupName: string) { handleUpdateModelWhenEdit(); model.groupName = groupName; systemTaskTypeChange(1); + retrySceneChange(1); } watch(visible, () => { @@ -306,8 +326,9 @@ watch(visible, () => { @@ -320,7 +341,27 @@ watch(visible, () => { /> - + + + + + + + + + + + { v-model:value="model.notifyThreshold" :min="1" :placeholder="$t('page.notifyConfig.form.notifyThreshold')" - disabled + :disabled="retrySceneDisable" />