feat(sj_1.0.0): 优化通知人列表和查询
This commit is contained in:
parent
e83f20d14e
commit
19201310c9
@ -13,8 +13,8 @@ export const enableStatusRecord: Record<Api.Common.EnableStatus, App.I18n.I18nKe
|
|||||||
export const enableStatusOptions = transformRecordToOption(enableStatusRecord);
|
export const enableStatusOptions = transformRecordToOption(enableStatusRecord);
|
||||||
|
|
||||||
export const enableStatus01Record: Record<Api.Common.EnableStatus01, App.I18n.I18nKey> = {
|
export const enableStatus01Record: Record<Api.Common.EnableStatus01, App.I18n.I18nKey> = {
|
||||||
'0': 'page.manage.common.status.enable',
|
0: 'page.manage.common.status.enable',
|
||||||
'1': 'page.manage.common.status.disable'
|
1: 'page.manage.common.status.disable'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const enableStatus01Options = transformRecordToOption(enableStatus01Record);
|
export const enableStatus01Options = transformRecordToOption(enableStatus01Record);
|
||||||
|
@ -549,7 +549,9 @@ const local: App.I18n.Schema = {
|
|||||||
groupName: 'Please select Group name',
|
groupName: 'Please select Group name',
|
||||||
notifyThreshold: 'Please enter Notification threshold',
|
notifyThreshold: 'Please enter Notification threshold',
|
||||||
notifyStatus: 'Please select State',
|
notifyStatus: 'Please select State',
|
||||||
systemTaskType: '请选择任务类型'
|
systemTaskType: '请选择任务类型',
|
||||||
|
notifyRecipient: '请选择通知人',
|
||||||
|
rateLimiterThreshold: '请选择阈值'
|
||||||
},
|
},
|
||||||
addNotifyConfig: 'Add Alarm notification',
|
addNotifyConfig: 'Add Alarm notification',
|
||||||
editNotifyConfig: 'Add Alarm notification',
|
editNotifyConfig: 'Add Alarm notification',
|
||||||
@ -564,7 +566,10 @@ const local: App.I18n.Schema = {
|
|||||||
},
|
},
|
||||||
jobNotifyScene: {
|
jobNotifyScene: {
|
||||||
jobTaskError: '任务执行失败'
|
jobTaskError: '任务执行失败'
|
||||||
}
|
},
|
||||||
|
notifyRecipient: '通知人信息',
|
||||||
|
rateLimiterStatus: '限流开关',
|
||||||
|
rateLimiterThreshold: '每秒限流阈值'
|
||||||
},
|
},
|
||||||
notifyRecipient: {
|
notifyRecipient: {
|
||||||
title: 'Notify Recipient List',
|
title: 'Notify Recipient List',
|
||||||
|
@ -545,7 +545,9 @@ const local: App.I18n.Schema = {
|
|||||||
groupName: '请选择组名称',
|
groupName: '请选择组名称',
|
||||||
notifyThreshold: '请输入通知阈值',
|
notifyThreshold: '请输入通知阈值',
|
||||||
notifyStatus: '请选择状态',
|
notifyStatus: '请选择状态',
|
||||||
systemTaskType: '请选择任务类型'
|
systemTaskType: '请选择任务类型',
|
||||||
|
notifyRecipient: '请选择通知人',
|
||||||
|
rateLimiterThreshold: '请选择阈值'
|
||||||
},
|
},
|
||||||
addNotifyConfig: '新增告警通知',
|
addNotifyConfig: '新增告警通知',
|
||||||
editNotifyConfig: '编辑告警通知',
|
editNotifyConfig: '编辑告警通知',
|
||||||
@ -560,7 +562,10 @@ const local: App.I18n.Schema = {
|
|||||||
},
|
},
|
||||||
jobNotifyScene: {
|
jobNotifyScene: {
|
||||||
jobTaskError: '任务执行失败'
|
jobTaskError: '任务执行失败'
|
||||||
}
|
},
|
||||||
|
notifyRecipient: '通知人信息',
|
||||||
|
rateLimiterStatus: '限流开关',
|
||||||
|
rateLimiterThreshold: '每秒限流阈值'
|
||||||
},
|
},
|
||||||
notifyRecipient: {
|
notifyRecipient: {
|
||||||
title: '通知人列表',
|
title: '通知人列表',
|
||||||
|
@ -28,7 +28,7 @@ export function fetchEditNotify(data: Api.NotifyConfig.NotifyConfig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** get notify recipient list */
|
/** get notify recipient list */
|
||||||
export function fetchGetNotifyRecipientList(params?: Api.NotifyRecipient.NotifyRecipientParams) {
|
export function fetchGetNotifyRecipientPageList(params?: Api.NotifyRecipient.NotifyRecipientParams) {
|
||||||
return request<Api.NotifyRecipient.NotifyRecipientList>({
|
return request<Api.NotifyRecipient.NotifyRecipientList>({
|
||||||
url: '/notify-recipient/page/list',
|
url: '/notify-recipient/page/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@ -36,6 +36,14 @@ export function fetchGetNotifyRecipientList(params?: Api.NotifyRecipient.NotifyR
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** get notify recipient list */
|
||||||
|
export function fetchGetNotifyRecipientList() {
|
||||||
|
return request<CommonType.Option<number>[]>({
|
||||||
|
url: '/notify-recipient/list',
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** add notify recipient */
|
/** add notify recipient */
|
||||||
export function fetchAddNotifyRecipient(data: Api.NotifyRecipient.NotifyRecipient) {
|
export function fetchAddNotifyRecipient(data: Api.NotifyRecipient.NotifyRecipient) {
|
||||||
return request<boolean>({
|
return request<boolean>({
|
||||||
|
8
src/typings/api.d.ts
vendored
8
src/typings/api.d.ts
vendored
@ -44,7 +44,7 @@ declare namespace Api {
|
|||||||
* - "0": enabled
|
* - "0": enabled
|
||||||
* - "1": disabled
|
* - "1": disabled
|
||||||
*/
|
*/
|
||||||
type EnableStatus01 = '0' | '1';
|
type EnableStatus01 = 0 | 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* yes/no status
|
* yes/no status
|
||||||
@ -516,6 +516,8 @@ declare namespace Api {
|
|||||||
groupName: string;
|
groupName: string;
|
||||||
/** 业务ID */
|
/** 业务ID */
|
||||||
businessId: string;
|
businessId: string;
|
||||||
|
/** 通知人id */
|
||||||
|
notifyRecipientIds: number;
|
||||||
/** 任务类型 1、重试任务 2、回调任务、3、JOB任务 4、WORKFLOW任务 */
|
/** 任务类型 1、重试任务 2、回调任务、3、JOB任务 4、WORKFLOW任务 */
|
||||||
systemTaskType: SystemTaskType;
|
systemTaskType: SystemTaskType;
|
||||||
/** 业务名称 */
|
/** 业务名称 */
|
||||||
@ -526,6 +528,10 @@ declare namespace Api {
|
|||||||
notifyScene: string;
|
notifyScene: string;
|
||||||
/** 通知阈值 */
|
/** 通知阈值 */
|
||||||
notifyThreshold: number;
|
notifyThreshold: number;
|
||||||
|
/** 限流开关 */
|
||||||
|
rateLimiterStatus: number;
|
||||||
|
/** 每秒限流阈值 */
|
||||||
|
rateLimiterThreshold: number;
|
||||||
/** 描述 */
|
/** 描述 */
|
||||||
description: string;
|
description: string;
|
||||||
}>;
|
}>;
|
||||||
|
5
src/typings/app.d.ts
vendored
5
src/typings/app.d.ts
vendored
@ -721,6 +721,8 @@ declare namespace App {
|
|||||||
notifyThreshold: string;
|
notifyThreshold: string;
|
||||||
notifyStatus: string;
|
notifyStatus: string;
|
||||||
systemTaskType: string;
|
systemTaskType: string;
|
||||||
|
notifyRecipient: string;
|
||||||
|
rateLimiterThreshold: string;
|
||||||
};
|
};
|
||||||
addNotifyConfig: string;
|
addNotifyConfig: string;
|
||||||
editNotifyConfig: string;
|
editNotifyConfig: string;
|
||||||
@ -736,6 +738,9 @@ declare namespace App {
|
|||||||
jobNotifyScene: {
|
jobNotifyScene: {
|
||||||
jobTaskError: string;
|
jobTaskError: string;
|
||||||
};
|
};
|
||||||
|
notifyRecipient: string;
|
||||||
|
rateLimiterStatus: string;
|
||||||
|
rateLimiterThreshold: string;
|
||||||
};
|
};
|
||||||
notifyRecipient: {
|
notifyRecipient: {
|
||||||
title: string;
|
title: string;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script setup lang="tsx">
|
<script setup lang="tsx">
|
||||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||||
import { fetchGetNotifyRecipientList } from '@/service/api';
|
import { fetchGetNotifyRecipientPageList } from '@/service/api';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { useAppStore } from '@/store/modules/app';
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||||
@ -11,7 +11,7 @@ import NotifyRecipientSearch from './modules/notify-recipient-search.vue';
|
|||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
|
||||||
const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
|
const { columns, columnChecks, data, getData, loading, mobilePagination, searchParams, resetSearchParams } = useTable({
|
||||||
apiFn: fetchGetNotifyRecipientList,
|
apiFn: fetchGetNotifyRecipientPageList,
|
||||||
apiParams: {
|
apiParams: {
|
||||||
page: 1,
|
page: 1,
|
||||||
size: 10,
|
size: 10,
|
||||||
|
@ -3,7 +3,7 @@ import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
|||||||
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
||||||
import OperateDrawer from '@/components/common/operate-drawer.vue';
|
import OperateDrawer from '@/components/common/operate-drawer.vue';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { fetchAddNotify, fetchEditNotify, fetchGetAllGroupNameList } from '@/service/api';
|
import { fetchAddNotify, fetchEditNotify, fetchGetAllGroupNameList, fetchGetNotifyRecipientList } from '@/service/api';
|
||||||
import {
|
import {
|
||||||
enableStatus01Options,
|
enableStatus01Options,
|
||||||
jobNotifySceneOptions,
|
jobNotifySceneOptions,
|
||||||
@ -24,7 +24,9 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const groupNameList = ref<string[]>([]);
|
const groupNameList = ref<string[]>([]);
|
||||||
|
const notifyRecipientList = ref<CommonType.Option<number>[]>([]);
|
||||||
const props = defineProps<Props>();
|
const props = defineProps<Props>();
|
||||||
|
const defaultChecked = ref<number>(0);
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
(e: 'submitted'): void;
|
(e: 'submitted'): void;
|
||||||
@ -56,46 +58,69 @@ type Model = Pick<
|
|||||||
| 'id'
|
| 'id'
|
||||||
| 'groupName'
|
| 'groupName'
|
||||||
| 'businessId'
|
| 'businessId'
|
||||||
|
| 'notifyRecipientIds'
|
||||||
| 'systemTaskType'
|
| 'systemTaskType'
|
||||||
| 'notifyStatus'
|
| 'notifyStatus'
|
||||||
| 'notifyScene'
|
| 'notifyScene'
|
||||||
| 'notifyThreshold'
|
| 'notifyThreshold'
|
||||||
|
| 'rateLimiterStatus'
|
||||||
|
| 'rateLimiterThreshold'
|
||||||
| 'description'
|
| 'description'
|
||||||
>;
|
>;
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
getGroupNameList();
|
getGroupNameList();
|
||||||
|
getNotifyRecipientList();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
async function getGroupNameList() {
|
async function getGroupNameList() {
|
||||||
const res = await fetchGetAllGroupNameList();
|
const res = await fetchGetAllGroupNameList();
|
||||||
console.log(res.data);
|
|
||||||
groupNameList.value = res.data as string[];
|
groupNameList.value = res.data as string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getNotifyRecipientList() {
|
||||||
|
const res = await fetchGetNotifyRecipientList();
|
||||||
|
notifyRecipientList.value = res.data as CommonType.Option<number>[];
|
||||||
|
}
|
||||||
|
|
||||||
const model: Model = reactive(createDefaultModel());
|
const model: Model = reactive(createDefaultModel());
|
||||||
|
|
||||||
function createDefaultModel(): Model {
|
function createDefaultModel(): Model {
|
||||||
return {
|
return {
|
||||||
groupName: '',
|
groupName: '',
|
||||||
businessId: '',
|
businessId: '',
|
||||||
|
notifyRecipientIds: 0,
|
||||||
systemTaskType: '1',
|
systemTaskType: '1',
|
||||||
notifyStatus: '',
|
notifyStatus: '',
|
||||||
notifyScene: '',
|
notifyScene: '',
|
||||||
notifyThreshold: 0,
|
notifyThreshold: 0,
|
||||||
|
rateLimiterStatus: 0,
|
||||||
|
rateLimiterThreshold: 0,
|
||||||
description: ''
|
description: ''
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
type RuleKey = Extract<keyof Model, 'groupName' | 'businessId' | 'notifyStatus' | 'notifyScene'>;
|
type RuleKey = Extract<
|
||||||
|
keyof Model,
|
||||||
|
| 'groupName'
|
||||||
|
| 'businessId'
|
||||||
|
| 'notifyRecipientIds'
|
||||||
|
| 'notifyStatus'
|
||||||
|
| 'notifyScene'
|
||||||
|
| 'rateLimiterStatus'
|
||||||
|
| 'notifyThreshold'
|
||||||
|
>;
|
||||||
|
|
||||||
const rules: Record<RuleKey, App.Global.FormRule> = {
|
const rules: Record<RuleKey, App.Global.FormRule> = {
|
||||||
groupName: defaultRequiredRule,
|
groupName: defaultRequiredRule,
|
||||||
businessId: defaultRequiredRule,
|
businessId: defaultRequiredRule,
|
||||||
notifyStatus: defaultRequiredRule,
|
notifyStatus: defaultRequiredRule,
|
||||||
notifyScene: defaultRequiredRule
|
notifyScene: defaultRequiredRule,
|
||||||
|
notifyRecipientIds: defaultRequiredRule,
|
||||||
|
rateLimiterStatus: defaultRequiredRule,
|
||||||
|
notifyThreshold: defaultRequiredRule
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleUpdateModelWhenEdit() {
|
function handleUpdateModelWhenEdit() {
|
||||||
@ -117,30 +142,58 @@ async function handleSubmit() {
|
|||||||
await validate();
|
await validate();
|
||||||
// request
|
// request
|
||||||
if (props.operateType === 'add') {
|
if (props.operateType === 'add') {
|
||||||
const { groupName, businessId, systemTaskType, notifyStatus, notifyScene, notifyThreshold, description } = model;
|
const {
|
||||||
const { error } = await fetchAddNotify({
|
|
||||||
groupName,
|
groupName,
|
||||||
businessId,
|
businessId,
|
||||||
|
notifyRecipientIds,
|
||||||
systemTaskType,
|
systemTaskType,
|
||||||
notifyStatus,
|
notifyStatus,
|
||||||
notifyScene,
|
notifyScene,
|
||||||
notifyThreshold,
|
notifyThreshold,
|
||||||
|
rateLimiterStatus,
|
||||||
|
rateLimiterThreshold,
|
||||||
|
description
|
||||||
|
} = model;
|
||||||
|
const { error } = await fetchAddNotify({
|
||||||
|
groupName,
|
||||||
|
businessId,
|
||||||
|
notifyRecipientIds,
|
||||||
|
systemTaskType,
|
||||||
|
notifyStatus,
|
||||||
|
notifyScene,
|
||||||
|
notifyThreshold,
|
||||||
|
rateLimiterStatus,
|
||||||
|
rateLimiterThreshold,
|
||||||
description
|
description
|
||||||
});
|
});
|
||||||
if (error) return;
|
if (error) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.operateType === 'edit') {
|
if (props.operateType === 'edit') {
|
||||||
const { id, groupName, businessId, notifyStatus, systemTaskType, notifyScene, notifyThreshold, description } =
|
const {
|
||||||
model;
|
id,
|
||||||
|
groupName,
|
||||||
|
businessId,
|
||||||
|
notifyRecipientIds,
|
||||||
|
notifyStatus,
|
||||||
|
systemTaskType,
|
||||||
|
notifyScene,
|
||||||
|
notifyThreshold,
|
||||||
|
rateLimiterStatus,
|
||||||
|
rateLimiterThreshold,
|
||||||
|
description
|
||||||
|
} = model;
|
||||||
const { error } = await fetchEditNotify({
|
const { error } = await fetchEditNotify({
|
||||||
id,
|
id,
|
||||||
groupName,
|
groupName,
|
||||||
businessId,
|
businessId,
|
||||||
|
notifyRecipientIds,
|
||||||
systemTaskType,
|
systemTaskType,
|
||||||
notifyStatus,
|
notifyStatus,
|
||||||
notifyScene,
|
notifyScene,
|
||||||
notifyThreshold,
|
notifyThreshold,
|
||||||
|
rateLimiterStatus,
|
||||||
|
rateLimiterThreshold,
|
||||||
description
|
description
|
||||||
});
|
});
|
||||||
if (error) return;
|
if (error) return;
|
||||||
@ -208,17 +261,39 @@ watch(visible, () => {
|
|||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
<NGrid x-gap="12" :cols="6" item-responsive responsive="screen">
|
<NFormItem :label="$t('page.notifyConfig.notifyRecipient')" path="notifyRecipientIds">
|
||||||
<NGi span="m:6 l:6"></NGi>
|
<NSelect
|
||||||
<NGi span="m:6 l:2">
|
v-model:value="model.notifyRecipientIds"
|
||||||
<NFormItem :label="$t('page.notifyConfig.notifyThreshold')" path="notifyThreshold">
|
:placeholder="$t('page.notifyConfig.form.notifyRecipient')"
|
||||||
<NInputNumber
|
:options="notifyRecipientList"
|
||||||
v-model:value="model.notifyThreshold"
|
clearable
|
||||||
:placeholder="$t('page.notifyConfig.form.notifyThreshold')"
|
multiple
|
||||||
|
/>
|
||||||
|
</NFormItem>
|
||||||
|
<NFormItem :label="$t('page.notifyConfig.rateLimiterStatus')" path="rateLimiterStatus">
|
||||||
|
<NRadioGroup v-model:value="model.rateLimiterStatus" :default-value="defaultChecked" name="rateLimiterStatus">
|
||||||
|
<NSpace>
|
||||||
|
<NRadio
|
||||||
|
v-for="item in enableStatus01Options"
|
||||||
|
:key="item.value"
|
||||||
|
:value="item.value"
|
||||||
|
:label="$t(item.label)"
|
||||||
/>
|
/>
|
||||||
</NFormItem>
|
</NSpace>
|
||||||
</NGi>
|
</NRadioGroup>
|
||||||
</NGrid>
|
</NFormItem>
|
||||||
|
<NFormItem :label="$t('page.notifyConfig.rateLimiterThreshold')" path="rateLimiterThreshold">
|
||||||
|
<NInputNumber
|
||||||
|
v-model:value="model.rateLimiterThreshold"
|
||||||
|
:placeholder="$t('page.notifyConfig.form.rateLimiterThreshold')"
|
||||||
|
/>
|
||||||
|
</NFormItem>
|
||||||
|
<NFormItem :label="$t('page.notifyConfig.notifyThreshold')" path="notifyThreshold">
|
||||||
|
<NInputNumber
|
||||||
|
v-model:value="model.notifyThreshold"
|
||||||
|
:placeholder="$t('page.notifyConfig.form.notifyThreshold')"
|
||||||
|
/>
|
||||||
|
</NFormItem>
|
||||||
<NFormItem :label="$t('page.notifyConfig.description')" path="description">
|
<NFormItem :label="$t('page.notifyConfig.description')" path="description">
|
||||||
<NInput
|
<NInput
|
||||||
v-model:value="model.description"
|
v-model:value="model.description"
|
||||||
|
Loading…
Reference in New Issue
Block a user