From a97ec1bd9ad2ec513031c8faa23c3460e915cf6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Sun, 26 Sep 2021 10:20:34 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=96=B0=E5=A2=9E=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=20=E6=94=B9=E4=B8=BA=20buttonLoading=20?= =?UTF-8?q?=E6=9C=89=E6=95=88=E9=98=B2=E6=AD=A2=E9=87=8D=E5=A4=8D=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=20=E5=87=8F=E5=B0=91=E5=85=A8=E5=B1=80loading?= =?UTF-8?q?=E9=97=AA=E5=B1=8F=20=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C?= =?UTF-8?q?=E6=9E=81=E4=BD=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/vm/vue/index-tree.vue.vm | 11 ++++++++++- .../src/main/resources/vm/vue/index.vue.vm | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 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 19802cee8..1eedeae11 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 @@ -251,7 +251,7 @@ #end </el-form> <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">确 定</el-button> + <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> <el-button @click="cancel">取 消</el-button> </div> </el-dialog> @@ -273,6 +273,8 @@ export default { }, data() { return { + // 按钮loading + buttonLoading: false, // 遮罩层 loading: true, // 显示搜索条件 @@ -441,6 +443,7 @@ export default { submitForm() { this.#[[$]]#refs["form"].validate(valid => { if (valid) { + this.buttonLoading = true; #foreach ($column in $columns) #if($column.htmlType == "checkbox") this.form.$column.javaField = this.form.${column.javaField}.join(","); @@ -451,12 +454,18 @@ export default { this.#[[$modal]]#.msgSuccess("修改成功"); this.open = false; this.getList(); + }).finally(() => { + // 防止异常loading不关闭 + this.buttonLoading = false; }); } else { add${BusinessName}(this.form).then(response => { this.#[[$modal]]#.msgSuccess("新增成功"); this.open = false; this.getList(); + }).finally(() => { + // 防止异常loading不关闭 + this.buttonLoading = 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 a55550373..f48e9d5b3 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -305,7 +305,7 @@ #end </el-form> <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">确 定</el-button> + <el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button> <el-button @click="cancel">取 消</el-button> </div> </el-dialog> @@ -322,6 +322,8 @@ export default { #end data() { return { + // 按钮loading + buttonLoading: false, // 遮罩层 loading: true, // 导出遮罩层 @@ -493,6 +495,7 @@ export default { submitForm() { this.#[[$]]#refs["form"].validate(valid => { if (valid) { + this.buttonLoading = true; #foreach ($column in $columns) #if($column.htmlType == "checkbox") this.form.$column.javaField = this.form.${column.javaField}.join(","); @@ -506,12 +509,18 @@ export default { this.#[[$modal]]#.msgSuccess("修改成功"); this.open = false; this.getList(); + }).finally(() => { + // 防止异常loading不关闭 + this.buttonLoading = false; }); } else { add${BusinessName}(this.form).then(response => { this.#[[$modal]]#.msgSuccess("新增成功"); this.open = false; this.getList(); + }).finally(() => { + // 防止异常loading不关闭 + this.buttonLoading = false; }); } }