diff --git a/src/views/DataManagement/ReminderSettings.vue b/src/views/DataManagement/ReminderSettings.vue index 519b0d99c151716a6b0f97b82c87a41a2bbc9969..44a8dcf9b0ec9744bc725f954048a4b7697d9671 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) => {