From 04d2472a919c5eff895b479b0644334f2b19355d Mon Sep 17 00:00:00 2001 From: opensnail <598092184@qq.com> Date: Fri, 19 Apr 2024 23:06:48 +0800 Subject: [PATCH] =?UTF-8?q?feat(sj=5F1.0.0):=20=E4=BC=98=E5=8C=96=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E7=B1=BB=E5=9E=8B=E4=B8=8E=E9=80=9A=E7=9F=A5=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E8=81=94=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/notify-config-operate-drawer.vue | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) 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" />