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 e8cf3e6..3320743 100644 --- a/src/views/notify/scene/modules/notify-config-operate-drawer.vue +++ b/src/views/notify/scene/modules/notify-config-operate-drawer.vue @@ -4,7 +4,12 @@ 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 { + enableStatus01Options, + jobNotifySceneOptions, + retryNotifySceneOptions, + systemTaskTypeOptions +} from '@/constants/business'; import { translateOptions } from '@/utils/common'; defineOptions({ @@ -30,6 +35,10 @@ const visible = defineModel('visible', { default: false }); +const options = defineModel[]>('options', { + default: translateOptions(retryNotifySceneOptions) +}); + const { formRef, validate, restoreValidation } = useNaiveForm(); const { defaultRequiredRule } = useFormRules(); @@ -95,15 +104,7 @@ async function handleSubmit() { await validate(); // request if (props.operateType === 'add') { - const { - groupName, - businessId, - systemTaskType, - notifyStatus, - notifyScene, - notifyThreshold, - description - } = model; + const { groupName, businessId, systemTaskType, notifyStatus, notifyScene, notifyThreshold, description } = model; const { error } = await fetchAddNotify({ groupName, businessId, @@ -117,16 +118,8 @@ async function handleSubmit() { } if (props.operateType === 'edit') { - const { - id, - groupName, - businessId, - notifyStatus, - systemTaskType, - notifyScene, - notifyThreshold, - description - } = model; + const { id, groupName, businessId, notifyStatus, systemTaskType, notifyScene, notifyThreshold, description } = + model; const { error } = await fetchEditNotify({ id, groupName, @@ -144,6 +137,16 @@ async function handleSubmit() { emit('submitted'); } +function systemTaskTypeChange(value: string) { + if (value === '1') { + options.value = translateOptions(retryNotifySceneOptions); + } else if (value === '3') { + options.value = translateOptions(jobNotifySceneOptions); + } + + model.notifyScene = ''; +} + watch(visible, () => { if (visible.value) { handleUpdateModelWhenEdit(); @@ -176,13 +179,14 @@ watch(visible, () => { :placeholder="$t('page.notifyConfig.form.systemTaskType')" :options="translateOptions(systemTaskTypeOptions)" clearable + @update:value="systemTaskTypeChange" />