diff --git a/src/views/system/dict/editDict.vue b/src/views/system/dict/editDict.vue index bde4039..5856613 100644 --- a/src/views/system/dict/editDict.vue +++ b/src/views/system/dict/editDict.vue @@ -18,8 +18,8 @@ - - + + @@ -125,6 +125,11 @@ let detailArray = '' const details = this.details let passFlag = true + if(details.length==0){ + passFlag = false + this.$message.warning('至少有一个字典值') + return passFlag + } details.forEach((detail, index) => { if (detail.value === '' || detail.name === '') { passFlag = false @@ -134,6 +139,9 @@ detailArray += ';' } }) + if(!passFlag){ + this.$message.warning('请将字典值和名称都填全后再进行保存') + } this.dictForm.dictValues = detailArray return passFlag }, @@ -151,9 +159,7 @@ // 保存数据 saveData: function() { const flag = this.arrayToString() - if (!flag) { - this.$message.warning('请将字典值和名称都填全后再进行保存') - } else { + if(flag){ if (this.dialogStatus === 'update') { this.updateData() } else if (this.dialogStatus === 'create') { diff --git a/src/views/system/dict/editDict.vue b/src/views/system/dict/editDict.vue index bde4039..5856613 100644 --- a/src/views/system/dict/editDict.vue +++ b/src/views/system/dict/editDict.vue @@ -18,8 +18,8 @@ - - + + @@ -125,6 +125,11 @@ let detailArray = '' const details = this.details let passFlag = true + if(details.length==0){ + passFlag = false + this.$message.warning('至少有一个字典值') + return passFlag + } details.forEach((detail, index) => { if (detail.value === '' || detail.name === '') { passFlag = false @@ -134,6 +139,9 @@ detailArray += ';' } }) + if(!passFlag){ + this.$message.warning('请将字典值和名称都填全后再进行保存') + } this.dictForm.dictValues = detailArray return passFlag }, @@ -151,9 +159,7 @@ // 保存数据 saveData: function() { const flag = this.arrayToString() - if (!flag) { - this.$message.warning('请将字典值和名称都填全后再进行保存') - } else { + if(flag){ if (this.dialogStatus === 'update') { this.updateData() } else if (this.dialogStatus === 'create') { diff --git a/src/views/system/dict/listDict.vue b/src/views/system/dict/listDict.vue index fa9211b..1e0950e 100644 --- a/src/views/system/dict/listDict.vue +++ b/src/views/system/dict/listDict.vue @@ -15,7 +15,7 @@
- +