File tree Expand file tree Collapse file tree
frontend/src/views/admin/ops/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -131,15 +131,7 @@ const validation = computed(() => {
131131 }
132132 }
133133
134- // 验证邮件配置
135- if (emailConfig .value ) {
136- if (emailConfig .value .alert .enabled && emailConfig .value .alert .recipients .length === 0 ) {
137- errors .push (t (' admin.ops.email.validation.alertRecipientsRequired' ))
138- }
139- if (emailConfig .value .report .enabled && emailConfig .value .report .recipients .length === 0 ) {
140- errors .push (t (' admin.ops.email.validation.reportRecipientsRequired' ))
141- }
142- }
134+ // 邮件配置: 启用但无收件人时不阻断保存, 保存时会自动禁用
143135
144136 // 验证高级设置
145137 if (advancedSettings .value ) {
@@ -181,6 +173,15 @@ async function saveAllSettings() {
181173
182174 saving .value = true
183175 try {
176+ // 无收件人时自动禁用邮件通知
177+ if (emailConfig .value ) {
178+ if (emailConfig .value .alert .enabled && emailConfig .value .alert .recipients .length === 0 ) {
179+ emailConfig .value .alert .enabled = false
180+ }
181+ if (emailConfig .value .report .enabled && emailConfig .value .report .recipients .length === 0 ) {
182+ emailConfig .value .report .enabled = false
183+ }
184+ }
184185 await Promise .all ([
185186 runtimeSettings .value ? opsAPI .updateAlertRuntimeSettings (runtimeSettings .value ) : Promise .resolve (),
186187 emailConfig .value ? opsAPI .updateEmailNotificationConfig (emailConfig .value ) : Promise .resolve (),
You can’t perform that action at this time.
0 commit comments