diff --git a/src/views/system/userInfo/index.vue b/src/views/system/userInfo/index.vue index 91a3f40..8fb5df5 100644 --- a/src/views/system/userInfo/index.vue +++ b/src/views/system/userInfo/index.vue @@ -54,6 +54,8 @@ type="primary" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']" + ref="editButton" + :disabled="isEditing" >编辑 - + @@ -191,6 +193,7 @@ components: { Treeselect }, data() { return { + isEditing: false, // 遮罩层 loading: false, // 选中数组 @@ -313,6 +316,13 @@ // 取消按钮 cancel() { this.open = false; + this.isEditing = false; + this.reset(); + }, + // 处理对话框关闭 + handleClose() { + this.open = false; + this.isEditing = false; this.reset(); }, // 表单重置 @@ -350,6 +360,7 @@ /** 修改按钮操作 */ handleUpdate(row) { this.reset(); + this.isEditing = true; let param={ userId:row.userId } @@ -360,6 +371,14 @@ this.open = true; this.title = "编辑人员"; this.$forceUpdate() + + // 使用 $nextTick 确保 DOM 已经更新 + // 在下一个 tick 中取消按钮焦点 + this.$nextTick(() => { + if (this.$refs.editButton) { + this.$refs.editButton.$el.blur(); + } + }); }); }, /** 提交按钮 */ @@ -370,12 +389,14 @@ updateUser(this.form).then(response => { this.$modal.msgSuccess("修改成功"); this.open = false; + this.isEditing = false; this.getList(); }); } else { addUser(this.form).then(response => { this.$modal.msgSuccess("新增成功"); this.open = false; + this.isEditing = false; this.getList(); }); }