feat(sj_1.0.0): 优化通知人列表和查询
This commit is contained in:
parent
75a12598ae
commit
d7eae71827
@ -12,6 +12,13 @@ export const enableStatusRecord: Record<Api.Common.EnableStatus, App.I18n.I18nKe
|
||||
|
||||
export const enableStatusOptions = transformRecordToOption(enableStatusRecord);
|
||||
|
||||
export const enableStatus01Record: Record<Api.Common.EnableStatus01, App.I18n.I18nKey> = {
|
||||
'0': 'page.manage.common.status.enable',
|
||||
'1': 'page.manage.common.status.disable'
|
||||
};
|
||||
|
||||
export const enableStatus01Options = transformRecordToOption(enableStatus01Record);
|
||||
|
||||
export const userGenderRecord: Record<Api.SystemManage.UserGender, App.I18n.I18nKey> = {
|
||||
'1': 'page.manage.user.gender.male',
|
||||
'2': 'page.manage.user.gender.female'
|
||||
@ -50,3 +57,26 @@ export const alarmTypeRecord: Record<Api.NotifyRecipient.AlarmType, App.I18n.I18
|
||||
4: 'page.notifyRecipient.lark'
|
||||
};
|
||||
export const alarmTypeRecordOptions = transformRecordToOption(alarmTypeRecord);
|
||||
|
||||
export const systemTaskType: Record<Api.NotifyConfig.SystemTaskType, App.I18n.I18nKey> = {
|
||||
'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<Api.NotifyConfig.RetryNotifyScene, App.I18n.I18nKey> = {
|
||||
'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<Api.NotifyConfig.JobNotifyScene, App.I18n.I18nKey> = {
|
||||
'1': 'page.notifyConfig.jobNotifyScene.jobTaskError'
|
||||
};
|
||||
export const jobNotifySceneOptions = transformRecordToOption(jobNotifyScene);
|
||||
|
@ -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',
|
||||
|
@ -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: '通知人列表',
|
||||
|
32
src/typings/api.d.ts
vendored
32
src/typings/api.d.ts
vendored
@ -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<NotifyConfig>;
|
||||
|
||||
/** 任务类型 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';
|
||||
}
|
||||
|
||||
/**
|
||||
|
19
src/typings/app.d.ts
vendored
19
src/typings/app.d.ts
vendored
@ -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;
|
||||
|
@ -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'),
|
||||
|
@ -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<keyof Model, 'groupName' | 'businessId' | 'notifyStatus' | 'notifyScene'>;
|
||||
|
||||
const rules: Record<RuleKey, App.Global.FormRule> = {
|
||||
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, () => {
|
||||
<template>
|
||||
<OperateDrawer v-model="visible" :title="title" @handle-submit="handleSubmit">
|
||||
<NForm ref="formRef" :model="model" :rules="rules">
|
||||
<NGrid x-gap="12" :cols="6" item-responsive responsive="screen">
|
||||
<NGi span="m:6 l:4">
|
||||
<NFormItem :label="$t('page.notifyConfig.notifyScene')" path="name">
|
||||
<NFormItem :label="$t('page.notifyConfig.groupName')" path="name">
|
||||
<NSelect v-model:value="model.groupName" :placeholder="$t('page.notifyConfig.form.groupName')" clearable />
|
||||
</NFormItem>
|
||||
<NFormItem :label="$t('page.notifyConfig.notifyStatus')" path="notifyStatus">
|
||||
<NRadioGroup v-model:value="model.notifyStatus" name="notifyStatus">
|
||||
<NSpace>
|
||||
<NRadio
|
||||
v-for="item in enableStatus01Options"
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
:label="$t(item.label)"
|
||||
/>
|
||||
</NSpace>
|
||||
</NRadioGroup>
|
||||
</NFormItem>
|
||||
<NFormItem :label="$t('page.notifyConfig.systemTaskType')" path="systemTaskType">
|
||||
<NSelect
|
||||
v-model:value="model.notifyScene"
|
||||
:placeholder="$t('page.notifyConfig.page.notifyScene')"
|
||||
v-model:value="model.systemTaskType"
|
||||
:placeholder="$t('page.notifyConfig.form.systemTaskType')"
|
||||
:options="translateOptions(systemTaskTypeOptions)"
|
||||
clearable
|
||||
/>
|
||||
</NFormItem>
|
||||
</NGi>
|
||||
<NFormItem :label="$t('page.notifyConfig.notifyScene')" path="notifyScene">
|
||||
<NSelect
|
||||
v-model:value="model.notifyScene"
|
||||
:placeholder="$t('page.notifyConfig.form.notifyScene')"
|
||||
:options="translateOptions(retryNotifySceneOptions)"
|
||||
clearable
|
||||
/>
|
||||
</NFormItem>
|
||||
<NGrid x-gap="12" :cols="6" item-responsive responsive="screen">
|
||||
<NGi span="m:6 l:6"></NGi>
|
||||
<NGi span="m:6 l:2">
|
||||
<NFormItem :label="$t('page.notifyConfig.notifyThreshold')" path="name">
|
||||
<NFormItem :label="$t('page.notifyConfig.notifyThreshold')" path="notifyThreshold">
|
||||
<NInputNumber
|
||||
v-model:value="model.notifyThreshold"
|
||||
:placeholder="$t('page.notifyConfig.form.notifyThreshold')"
|
||||
@ -184,44 +197,12 @@ watch(visible, () => {
|
||||
</NFormItem>
|
||||
</NGi>
|
||||
</NGrid>
|
||||
<NGrid x-gap="12" :cols="6" item-responsive responsive="screen">
|
||||
<NGi span="m:6 l:4">
|
||||
<NFormItem :label="$t('page.notifyConfig.groupName')" path="name">
|
||||
<NSelect v-model:value="model.groupName" :placeholder="$t('page.notifyConfig.form.groupName')" clearable />
|
||||
</NFormItem>
|
||||
</NGi>
|
||||
<NGi span="m:6 l:2">
|
||||
<NFormItem :label="$t('page.notifyConfig.notifyStatus')" path="name">
|
||||
<NSelect
|
||||
v-model:value="model.notifyStatus"
|
||||
:placeholder="$t('page.notifyConfig.form.notifyStatus')"
|
||||
clearable
|
||||
/>
|
||||
</NFormItem>
|
||||
</NGi>
|
||||
</NGrid>
|
||||
<NGrid x-gap="12" :cols="6" item-responsive responsive="screen">
|
||||
<NGi span="m:6 l:4">
|
||||
<NFormItem :label="$t('page.notifyConfig.notifyType')" path="name">
|
||||
<NSelect
|
||||
v-model:value="model.notifyType"
|
||||
:placeholder="$t('page.notifyConfig.form.notifyType')"
|
||||
clearable
|
||||
/>
|
||||
</NFormItem>
|
||||
</NGi>
|
||||
<NGi span="m:6 l:2">
|
||||
<NFormItem :label="$t('page.notifyConfig.notifyAttribute')" path="name">
|
||||
<NSelect
|
||||
v-model:value="model.notifyAttribute"
|
||||
:placeholder="$t('page.notifyConfig.form.notifyAttribute')"
|
||||
clearable
|
||||
/>
|
||||
</NFormItem>
|
||||
</NGi>
|
||||
</NGrid>
|
||||
<NFormItem :label="$t('page.notifyConfig.description')" path="description">
|
||||
<NInput v-model:value="model.description" :placeholder="$t('page.notifyConfig.form.description')" />
|
||||
<NInput
|
||||
v-model:value="model.description"
|
||||
type="textarea"
|
||||
:placeholder="$t('page.notifyConfig.form.description')"
|
||||
/>
|
||||
</NFormItem>
|
||||
</NForm>
|
||||
<template #footer>
|
||||
|
Loading…
Reference in New Issue
Block a user