提交 e558ce66 authored 作者: 龙菲's avatar 龙菲

修复角色新增和编辑的数据冲突

上级 729c5f86
......@@ -12,7 +12,12 @@
<div class="label">{{ title }}</div>
</div>
<div class="dialog-content">
<el-form :model="dialogForm" class="basic-info" :rules="rules">
<el-form
:model="dialogForm"
class="basic-info"
:rules="rules"
ref="dialogForm"
>
<el-form-item
label="角色名称"
:label-width="formLabelWidth"
......@@ -138,9 +143,7 @@ export default {
dialogForm: {},
formLabelWidth: "100px",
status: true,
files: [], //文献文件
dialogVisible: false,
// permissionTree: [],
props: {
value: "id",
label: "title",
......@@ -171,9 +174,12 @@ export default {
// 取消编辑
cancelForm() {
this.$emit("handleClose");
this.reload();
},
async handleSubmit() {
handleSubmit() {
this.$refs.dialogForm.validate(async (valid) => {
if (valid) {
const { name, remark } = this.dialogForm;
let status = this.status ? 1 : 0;
let permissions = this.$refs.tree.getCheckedKeys();
......@@ -205,21 +211,29 @@ export default {
this.reload();
}
}
}
});
},
reload() {
this.$emit("refresh");
this.$emit("handleClose");
this.$refs.dialogForm.resetFields();
this.$emit("refresh");
this.$nextTick(() => {
this.$refs.tree.setCheckedKeys([]);
});
this.allRole = [];
},
handleClose(done) {
this.$confirm("确认关闭?")
.then((_) => {
done();
this.$emit("handleClose");
this.reload();
})
.catch((_) => {});
},
setPer() {
let checkedIds = [];
getCheckedIds(this.dialogForm.permissionRespNodes);
......@@ -236,7 +250,7 @@ export default {
}
setTimeout(() => {
if (checkedIds.length > 0) {
this.$refs["tree"].setCheckedKeys(checkedIds);
this.$refs.tree.setCheckedKeys(checkedIds);
}
}, 100);
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论