From 18927c37794ef6878055bb6336ed6352fe87cf4c Mon Sep 17 00:00:00 2001
From: hayu <1604366271@qq.com>
Date: Mon, 18 Nov 2024 10:06:51 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/system/userInfo/index.vue | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
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();
});
}