From 182b6a17b6f07da22c845777cf070527b6c78bd0 Mon Sep 17 00:00:00 2001 From: zhoulingpo Date: Sat, 6 May 2023 13:53:52 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E5=AD=97=E5=85=B8=E7=9A=84=E6=A0=A1=E9=AA=8C=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/System/dataDictionary.vue | 18 ++++++++++++------ src/views/System/dictionaryDetail.vue | 27 ++++++++++++++++++--------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/views/System/dataDictionary.vue b/src/views/System/dataDictionary.vue index b1d41cc..2ce7d25 100644 --- a/src/views/System/dataDictionary.vue +++ b/src/views/System/dataDictionary.vue @@ -163,6 +163,16 @@ export default { this.q.pageNo = val this.sysUserList() }, + checkUserForm () { + if (!this.form.dicCode) { + return this.$message.warning('请检查数据字典编码') && false + } + if (!this.form.dicName) { + return this.$message.warning('请检查数据字典名称') && false + } + + return true + }, // 新增 add () { @@ -200,8 +210,8 @@ export default { }, // 新增用户 sysUserAddUser () { - this.$refs.dicRef.validate(v=>{ - if(v){ + if(this.checkUserForm()){ + if(this.mode=='add'){ this.$api.dictionary.addDic(this.form).then((res)=>{ this.$message.success("新增成功") @@ -213,12 +223,8 @@ export default { this.sysUserList() }) } - this.dialogUser = false - }else{ - this.$message.warning("请检查表单") } - }) }, // 编辑查看用户 diff --git a/src/views/System/dictionaryDetail.vue b/src/views/System/dictionaryDetail.vue index 1c9b4b3..374ed4b 100644 --- a/src/views/System/dictionaryDetail.vue +++ b/src/views/System/dictionaryDetail.vue @@ -73,19 +73,19 @@
- + - + - + - + @@ -163,8 +163,8 @@ export default { this.dialogUser = true }, sysUserAddUser(){ - this.$refs.addForm.validate(v=>{ - if(v){ + + if( this.checkUserForm()){ if(this.mode=='add'){ this.$api.dictionary.addItemDic(this.form).then((res)=>{ this.$message.success("新增成功") @@ -178,13 +178,22 @@ export default { } this.dialogUser = false - }else{ - this.$message.warning("请检查表单") } - }) + }, + checkUserForm () { + if (!this.form.itemName) { + return this.$message.warning('请检查选项') && false + } + if (!this.form.itemValue) { + return this.$message.warning('请检查选项值') && false + } + if (this.form.itemOrder && !(/^[0-9]*$/.test(this.form.itemOrder))) { + return this.$message.warning('请检查排序') && false + } + return true }, // 新增 add () {