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; }); } }