From a2a28d5ceface332b02559a0b7ec46a4516b9504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AD=A5=E5=B1=A5=E4=B8=8D=E5=81=9C?= <1873501479@qq.com> Date: Thu, 28 Jul 2022 15:18:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E9=86=92=E8=AE=BE=E7=BD=AE=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E6=B7=BB=E5=8A=A0=E9=82=AE=E7=AE=B1=E9=99=90=E5=88=B6?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/DataManagement/ReminderSettings.vue | 66 +++++++++++++------ 1 file changed, 45 insertions(+), 21 deletions(-) diff --git a/src/views/DataManagement/ReminderSettings.vue b/src/views/DataManagement/ReminderSettings.vue index 519b0d9..44a8dcf 100644 --- a/src/views/DataManagement/ReminderSettings.vue +++ b/src/views/DataManagement/ReminderSettings.vue @@ -299,40 +299,64 @@ export default { }, methods: { removeDailyNewspaperFormEmail(item) { - var index = this.dailyNewspaperForm.emails.indexOf(item) - if (index !== -1) { - this.dailyNewspaperForm.emails.splice(index, 1) + if (this.dailyNewspaperForm.emails.length > 1) { + var index = this.dailyNewspaperForm.emails.indexOf(item) + if (index !== -1) { + this.dailyNewspaperForm.emails.splice(index, 1) + } + } else { + alert('最少为一个邮箱!') } }, removePoliceFormEmail(item) { - var index = this.policeForm.emails.indexOf(item) - if (index !== -1) { - this.policeForm.emails.splice(index, 1) + if (this.policeForm.emails.length > 1) { + var index = this.policeForm.emails.indexOf(item) + if (index !== -1) { + this.policeForm.emails.splice(index, 1) + } + } else { + alert('最少为一个邮箱!') } }, removeUtilizationRatioFormEmail(item) { - var index = this.utilizationRatioForm.emails.indexOf(item) - if (index !== -1) { - this.utilizationRatioForm.emails.splice(index, 1) + if (this.utilizationRatioForm.emails.length > 1) { + var index = this.utilizationRatioForm.emails.indexOf(item) + if (index !== -1) { + this.utilizationRatioForm.emails.splice(index, 1) + } + } else { + alert('最少为一个邮箱!') } }, addDailyNewspaperFormEmail() { - this.dailyNewspaperForm.emails.push({ - value: '', - key: Date.now() - }) + if (this.dailyNewspaperForm.emails.length < 2) { + this.dailyNewspaperForm.emails.push({ + value: '', + key: Date.now() + }) + } else { + alert('最多添加两个邮箱!') + } }, addPoliceFormEmail() { - this.policeForm.emails.push({ - value: '', - key: Date.now() - }) + if (this.policeForm.emails.length < 2) { + this.policeForm.emails.push({ + value: '', + key: Date.now() + }) + } else { + alert('最多添加两个邮箱!') + } }, addUtilizationRatioFormEmail() { - this.utilizationRatioForm.emails.push({ - value: '', - key: Date.now() - }) + if (this.utilizationRatioForm.emails.length < 2) { + this.utilizationRatioForm.emails.push({ + value: '', + key: Date.now() + }) + } else { + alert('最多添加两个邮箱!') + } }, submitForm(formName) { this.$refs[formName].validate((valid) => { -- Gitee