功能优化

This commit is contained in:
hayu 2024-11-18 10:06:51 +08:00
parent e9f80e2b8c
commit 18927c3779
1 changed files with 22 additions and 1 deletions

View File

@ -54,6 +54,8 @@
type="primary" type="primary"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:user:edit']" v-hasPermi="['system:user:edit']"
ref="editButton"
:disabled="isEditing"
>编辑</el-button> >编辑</el-button>
<el-button <el-button
size="mini" size="mini"
@ -80,7 +82,7 @@
/> />
<!-- 添加或修改参数配置对话框 --> <!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @close="handleClose">
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
@ -191,6 +193,7 @@
components: { Treeselect }, components: { Treeselect },
data() { data() {
return { return {
isEditing: false,
// //
loading: false, loading: false,
// //
@ -313,6 +316,13 @@
// //
cancel() { cancel() {
this.open = false; this.open = false;
this.isEditing = false;
this.reset();
},
//
handleClose() {
this.open = false;
this.isEditing = false;
this.reset(); this.reset();
}, },
// //
@ -350,6 +360,7 @@
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
this.isEditing = true;
let param={ let param={
userId:row.userId userId:row.userId
} }
@ -360,6 +371,14 @@
this.open = true; this.open = true;
this.title = "编辑人员"; this.title = "编辑人员";
this.$forceUpdate() 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 => { updateUser(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.isEditing = false;
this.getList(); this.getList();
}); });
} else { } else {
addUser(this.form).then(response => { addUser(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.isEditing = false;
this.getList(); this.getList();
}); });
} }