feat(sj_1.0.0): 完成场景的新增和列表查询
This commit is contained in:
parent
62b5152d86
commit
82ec1b2296
@ -12,12 +12,12 @@ export const enableStatusRecord: Record<Api.Common.EnableStatus, App.I18n.I18nKe
|
||||
|
||||
export const enableStatusOptions = transformRecordToOption(enableStatusRecord);
|
||||
|
||||
export const enableStatus01Record: Record<Api.Common.EnableStatusNumber, App.I18n.I18nKey> = {
|
||||
export const enableStatusNumberRecord: Record<Api.Common.EnableStatusNumber, App.I18n.I18nKey> = {
|
||||
0: 'page.manage.common.status.disable',
|
||||
1: 'page.manage.common.status.enable'
|
||||
};
|
||||
|
||||
export const enableStatus01Options = transformRecordToNumberOption(enableStatus01Record, true);
|
||||
export const enableStatusNumberOptions = transformRecordToNumberOption(enableStatusNumberRecord, true);
|
||||
|
||||
export const userGenderRecord: Record<Api.SystemManage.UserGender, App.I18n.I18nKey> = {
|
||||
'1': 'page.manage.user.gender.male',
|
||||
@ -101,3 +101,11 @@ export const backOffRecord: Record<Api.RetryScene.BackOff, App.I18n.I18nKey> = {
|
||||
4: 'page.retryScene.backOffItem.random'
|
||||
};
|
||||
export const backOffRecordOptions = transformRecordToNumberOption(backOffRecord, true);
|
||||
|
||||
export const routeKeyRecord: Record<Api.RetryScene.RouteKey, App.I18n.I18nKey> = {
|
||||
1: 'page.retryScene.routeKeyItem.consistentHash',
|
||||
2: 'page.retryScene.routeKeyItem.random',
|
||||
3: 'page.retryScene.routeKeyItem.lru',
|
||||
4: 'page.retryScene.routeKeyItem.round'
|
||||
};
|
||||
export const routeKeyRecordOptions = transformRecordToNumberOption(routeKeyRecord, true);
|
||||
|
@ -638,6 +638,12 @@ const local: App.I18n.Schema = {
|
||||
fixed: '固定时间',
|
||||
cron: 'CRON表达式',
|
||||
random: '随机等待'
|
||||
},
|
||||
routeKeyItem: {
|
||||
consistentHash: '一致性哈希',
|
||||
random: '随机',
|
||||
lru: 'LRU',
|
||||
round: '轮询'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -602,7 +602,7 @@ const local: App.I18n.Schema = {
|
||||
lark: '飞书'
|
||||
},
|
||||
retryScene: {
|
||||
title: 'Scene 列表',
|
||||
title: '场景列表',
|
||||
groupName: '组名',
|
||||
sceneName: '场景名',
|
||||
sceneStatus: '状态',
|
||||
@ -634,6 +634,12 @@ const local: App.I18n.Schema = {
|
||||
fixed: '固定时间',
|
||||
cron: 'CRON表达式',
|
||||
random: '随机等待'
|
||||
},
|
||||
routeKeyItem: {
|
||||
consistentHash: '一致性哈希',
|
||||
random: '随机',
|
||||
lru: 'LRU',
|
||||
round: '轮询'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
6
src/typings/app.d.ts
vendored
6
src/typings/app.d.ts
vendored
@ -808,6 +808,12 @@ declare namespace App {
|
||||
cron: string;
|
||||
random: string;
|
||||
};
|
||||
routeKeyItem: {
|
||||
consistentHash: string;
|
||||
random: string;
|
||||
lru: string;
|
||||
round: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
form: {
|
||||
|
@ -5,7 +5,7 @@ import OperateDrawer from '@/components/common/operate-drawer.vue';
|
||||
import { $t } from '@/locales';
|
||||
import { fetchAddNotify, fetchEditNotify, fetchGetAllGroupNameList, fetchGetNotifyRecipientList } from '@/service/api';
|
||||
import {
|
||||
enableStatus01Options,
|
||||
enableStatusNumberOptions,
|
||||
jobNotifySceneOptions,
|
||||
retryNotifySceneOptions,
|
||||
systemTaskTypeOptions
|
||||
@ -235,7 +235,7 @@ watch(visible, () => {
|
||||
<NRadioGroup v-model:value="model.notifyStatus" name="notifyStatus">
|
||||
<NSpace>
|
||||
<NRadio
|
||||
v-for="item in enableStatus01Options"
|
||||
v-for="item in enableStatusNumberOptions"
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
:label="$t(item.label)"
|
||||
@ -273,7 +273,7 @@ watch(visible, () => {
|
||||
<NRadioGroup v-model:value="model.rateLimiterStatus" name="rateLimiterStatus">
|
||||
<NSpace>
|
||||
<NRadio
|
||||
v-for="item in enableStatus01Options"
|
||||
v-for="item in enableStatusNumberOptions"
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
:label="$t(item.label)"
|
||||
|
@ -1,9 +1,10 @@
|
||||
<script setup lang="tsx">
|
||||
import { NButton, NPopconfirm } from 'naive-ui';
|
||||
import { NButton, NPopconfirm, NTag } from 'naive-ui';
|
||||
import { fetchGetRetryScenePageList } from '@/service/api';
|
||||
import { $t } from '@/locales';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
import { useTable, useTableOperate } from '@/hooks/common/table';
|
||||
import { backOffRecord, enableStatusNumberRecord, routeKeyRecord } from '@/constants/business';
|
||||
import SceneOperateDrawer from './modules/scene-operate-drawer.vue';
|
||||
import SceneSearch from './modules/scene-search.vue';
|
||||
|
||||
@ -48,13 +49,31 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
key: 'sceneStatus',
|
||||
title: $t('page.retryScene.sceneStatus'),
|
||||
align: 'left',
|
||||
minWidth: 120
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
const label = $t(enableStatusNumberRecord[row.sceneStatus!]);
|
||||
return <NTag type="primary">{label}</NTag>;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'backOff',
|
||||
title: $t('page.retryScene.backOff'),
|
||||
align: 'left',
|
||||
minWidth: 120
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
const label = $t(backOffRecord[row.backOff!]);
|
||||
return <NTag type="primary">{label}</NTag>;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'routeKey',
|
||||
title: $t('page.retryScene.routeKey'),
|
||||
align: 'left',
|
||||
minWidth: 120,
|
||||
render: row => {
|
||||
const label = $t(routeKeyRecord[row.routeKey!]);
|
||||
return <NTag type="primary">{label}</NTag>;
|
||||
}
|
||||
},
|
||||
{
|
||||
key: 'maxRetryCount',
|
||||
@ -98,12 +117,6 @@ const { columns, columnChecks, data, getData, loading, mobilePagination, searchP
|
||||
align: 'left',
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
key: 'routeKey',
|
||||
title: $t('page.retryScene.routeKey'),
|
||||
align: 'left',
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
key: 'operate',
|
||||
title: $t('common.operate'),
|
||||
|
@ -1,11 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
||||
import CronInput from '@sa/cron-input';
|
||||
import { useFormRules, useNaiveForm } from '@/hooks/common/form';
|
||||
import OperateDrawer from '@/components/common/operate-drawer.vue';
|
||||
import { $t } from '@/locales';
|
||||
import { fetchAddRetryScene, fetchEditRetryScene, fetchGetAllGroupNameList } from '@/service/api';
|
||||
import { backOffRecordOptions, enableStatus01Options } from '@/constants/business';
|
||||
import { backOffRecordOptions, enableStatusNumberOptions, routeKeyRecordOptions } from '@/constants/business';
|
||||
import { translateOptions, translateOptions2 } from '@/utils/common';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
|
||||
defineOptions({
|
||||
name: 'SceneOperateDrawer'
|
||||
@ -18,6 +20,7 @@ interface Props {
|
||||
rowData?: Api.RetryScene.Scene | null;
|
||||
}
|
||||
|
||||
const app = useAppStore();
|
||||
const groupNameList = ref<string[]>([]);
|
||||
|
||||
const props = defineProps<Props>();
|
||||
@ -65,13 +68,13 @@ function createDefaultModel(): Model {
|
||||
groupName: '',
|
||||
sceneName: '',
|
||||
sceneStatus: 1,
|
||||
backOff: 1,
|
||||
maxRetryCount: 0,
|
||||
triggerInterval: '',
|
||||
deadlineRequest: 0,
|
||||
executorTimeout: 0,
|
||||
backOff: 2,
|
||||
maxRetryCount: 1,
|
||||
triggerInterval: '60',
|
||||
deadlineRequest: 60000,
|
||||
executorTimeout: 60,
|
||||
description: '',
|
||||
routeKey: 1
|
||||
routeKey: 4
|
||||
};
|
||||
}
|
||||
|
||||
@ -207,7 +210,7 @@ watch(visible, () => {
|
||||
<NRadioGroup v-model:value="model.sceneStatus" name="sceneStatus">
|
||||
<NSpace>
|
||||
<NRadio
|
||||
v-for="item in enableStatus01Options"
|
||||
v-for="item in enableStatusNumberOptions"
|
||||
:key="item.value"
|
||||
:value="item.value"
|
||||
:label="$t(item.label)"
|
||||
@ -223,7 +226,15 @@ watch(visible, () => {
|
||||
clearable
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem :label="$t('page.retryScene.backOff')" path="systemTaskType">
|
||||
<NFormItem :label="$t('page.retryScene.routeKey')" path="routeKey">
|
||||
<NSelect
|
||||
v-model:value="model.routeKey"
|
||||
:placeholder="$t('page.retryScene.form.routeKey')"
|
||||
:options="translateOptions(routeKeyRecordOptions)"
|
||||
clearable
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem :label="$t('page.retryScene.backOff')" path="backOff">
|
||||
<NSelect
|
||||
v-model:value="model.backOff"
|
||||
:placeholder="$t('page.retryScene.form.backOff')"
|
||||
@ -231,6 +242,46 @@ watch(visible, () => {
|
||||
clearable
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem :label="$t('page.retryScene.triggerInterval')" path="triggerInterval">
|
||||
<NInputNumber
|
||||
v-if="model.backOff === 2 || model.backOff === 4"
|
||||
v-model:value="model.triggerInterval as any"
|
||||
:placeholder="$t('page.retryScene.form.triggerInterval')"
|
||||
/>
|
||||
|
||||
<CronInput v-if="model.backOff === 3" v-model:value="model.triggerInterval as any" :lang="app.locale" />
|
||||
</NFormItem>
|
||||
<NFormItem :label="$t('page.retryScene.maxRetryCount')" path="maxRetryCount">
|
||||
<NInputNumber
|
||||
v-model:value="model.maxRetryCount"
|
||||
:min="1"
|
||||
:max="model.backOff === 1 ? 26 : 9999999"
|
||||
:placeholder="$t('page.retryScene.form.maxRetryCount')"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem :label="$t('page.retryScene.executorTimeout')" path="executorTimeout">
|
||||
<NInputNumber
|
||||
v-model:value="model.executorTimeout"
|
||||
:min="1"
|
||||
:max="3600"
|
||||
:placeholder="$t('page.retryScene.form.executorTimeout')"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem :label="$t('page.retryScene.deadlineRequest')" path="deadlineRequest">
|
||||
<NInputNumber
|
||||
v-model:value="model.deadlineRequest"
|
||||
:min="100"
|
||||
:max="60000"
|
||||
:placeholder="$t('page.retryScene.form.deadlineRequest')"
|
||||
/>
|
||||
</NFormItem>
|
||||
<NFormItem :label="$t('page.retryScene.description')" path="description">
|
||||
<NInput
|
||||
v-model:value="model.description"
|
||||
type="textarea"
|
||||
:placeholder="$t('page.retryScene.form.description')"
|
||||
/>
|
||||
</NFormItem>
|
||||
</NForm>
|
||||
<template #footer>
|
||||
<NSpace :size="16">
|
||||
|
Loading…
Reference in New Issue
Block a user