From fef1305e41340815b917aa1d0ea6ffb91049f75b Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Mon, 9 Dec 2024 21:44:37 +0800 Subject: [PATCH] chore: --- .../notification/notification-selector/index.vue | 5 ++--- .../src/views/certd/pipeline/certd-form/crud.tsx | 11 ++++++++--- .../ui/certd-client/src/views/certd/pipeline/crud.tsx | 6 +++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue b/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue index 782255dc..2d6ca839 100644 --- a/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue +++ b/packages/ui/certd-client/src/views/certd/notification/notification-selector/index.vue @@ -126,14 +126,12 @@ function clear() { } async function emitValue(value: any) { - const target = optionsDictRef.dataMap[value]; - if (value !== 0 && pipeline?.value && target && pipeline.value.userId !== target.userId) { + if (value !== 0 && pipeline?.value && target && pipeline.value.userId !== target.value.userId) { message.error("对不起,您不能修改他人流水线的通知"); return; } emit("change", value); emit("update:modelValue", value); - emit("selectedChange", target); } watch( @@ -143,6 +141,7 @@ watch( async (value) => { await optionsDictRef.loadDict(); target.value = optionsDictRef.dataMap[value]; + emit("selectedChange", target.value); }, { immediate: true diff --git a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx index 15768239..3fe9e5f0 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx @@ -107,10 +107,15 @@ export default function (certPlugins: any[], formWrapperRef: any): CreateCrudOpt title: "失败通知", type: "text", form: { - value: true, + value: 0, component: { - name: "a-switch", - vModel: "checked" + name: NotificationSelector, + vModel: "modelValue", + on: { + selectedChange({ $event, form }) { + form.notificationTarget = $event; + } + } }, order: 101, helper: "任务执行失败实时提醒" diff --git a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx index ac1d06fa..13e62eb6 100644 --- a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx +++ b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx @@ -102,12 +102,12 @@ export default function ({ crudExpose, context: { certdFormRef, groupDictRef, se triggers.push({ title: "定时触发", type: "timer", props: { cron: form.triggerCron } }); } const notifications = []; - if (form.notification) { + if (form.notification != null) { notifications.push({ type: "custom", when: ["error", "turnToSuccess"], - notificationId: 0, - title: "使用默认通知" + notificationId: form.notification, + title: form.notificationTarget?.name || "自定义通知" }); } let pipeline = {