From 3f49466c1d2efdfceb6d504763001fe7eb1f895b Mon Sep 17 00:00:00 2001 From: lingdeng <1024721228@qq.com> Date: Sun, 17 Apr 2022 12:49:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90=E4=BB=A3=E7=A0=81=20el-dialo?= =?UTF-8?q?g=20=E6=8F=90=E7=A4=BA=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/vm/vue/index-tree.vue.vm | 9 ++++++++- ruoyi-generator/src/main/resources/vm/vue/index.vue.vm | 9 ++++++++- .../src/main/resources/vm/vue/v3/index-tree.vue.vm | 9 ++++++++- .../src/main/resources/vm/vue/v3/index.vue.vm | 9 ++++++++- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm index 8126f8d95..753cd25e5 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index-tree.vue.vm @@ -467,7 +467,7 @@ export default { }, /** 提交按钮 */ submitForm() { - this.#[[$]]#refs["form"].validate(valid => { + this.#[[$]]#refs["form"].validate((valid, obj) => { if (valid) { this.buttonLoading = true; #foreach ($column in $columns) @@ -492,6 +492,13 @@ export default { this.buttonLoading = false; }); } + } else { + const a = []; + for (let key in obj) { + a.push(obj[key][0].message); + } + this.$modal.msgError(a[0]); + return false; } }); }, diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm index 29926da5f..d7eed7575 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -520,7 +520,7 @@ export default { }, /** 提交按钮 */ submitForm() { - this.#[[$]]#refs["form"].validate(valid => { + this.#[[$]]#refs["form"].validate((valid, obj) => { if (valid) { this.buttonLoading = true; #foreach ($column in $columns) @@ -548,6 +548,13 @@ export default { this.buttonLoading = false; }); } + } else { + const a = []; + for (let key in obj) { + a.push(obj[key][0].message); + } + this.$modal.msgError(a[0]); + return false; } }); }, diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm index d1664e733..2192f4be2 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/index-tree.vue.vm @@ -447,7 +447,7 @@ async function handleUpdate(row) { /** 提交按钮 */ function submitForm() { - proxy.#[[$]]#refs["${businessName}Ref"].validate(valid => { + proxy.#[[$]]#refs["${businessName}Ref"].validate((valid, obj) => { if (valid) { buttonLoading.value = true; #foreach ($column in $columns) @@ -472,6 +472,13 @@ function submitForm() { buttonLoading.value = false; }); } + } else { + const a = []; + for (let key in obj) { + a.push(obj[key][0].message); + } + this.$modal.msgError(a[0]); + return false; } }); } diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm index 643d61f2a..6615b376c 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm @@ -511,7 +511,7 @@ function handleUpdate(row) { /** 提交按钮 */ function submitForm() { - proxy.#[[$]]#refs["${businessName}Ref"].validate(valid => { + proxy.#[[$]]#refs["${businessName}Ref"].validate((valid, obj) => { if (valid) { buttonLoading.value = true; #foreach ($column in $columns) @@ -539,6 +539,13 @@ function submitForm() { buttonLoading.value = false; }); } + } else { + const a = []; + for (let key in obj) { + a.push(obj[key][0].message); + } + this.$modal.msgError(a[0]); + return false; } }); }