提交 62841a5e authored 作者: 龙菲's avatar 龙菲

更新角色权限

上级 6923c081
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<script> <script>
import { import {
addRole, addRole,
editRole, upadateRole,
getPermissionTreeAll, getPermissionTreeAll,
getPermissionById, getPermissionById,
} from "@/api/user"; } from "@/api/user";
...@@ -86,7 +86,7 @@ export default { ...@@ -86,7 +86,7 @@ export default {
watch: { watch: {
form: { form: {
handler: function (value) { handler: function (value) {
// debugger debugger
let that = this; let that = this;
that.dialogForm = JSON.parse(JSON.stringify(value)); that.dialogForm = JSON.parse(JSON.stringify(value));
// 编辑状态 // 编辑状态
...@@ -141,41 +141,33 @@ export default { ...@@ -141,41 +141,33 @@ export default {
// 取消编辑 // 取消编辑
cancelForm() { cancelForm() {
this.$emit("handleClose"); this.$emit("handleClose");
this.faceImage = [];
}, },
async handleSubmit() { async handleSubmit() {
let params = JSON.parse(JSON.stringify(this.dialogForm)); const { name, remark } = this.dialogForm;
// 修改状态 let status = this.status ? 1 : 0;
params.status = this.status ? 1 : 0; let permissions = this.$refs.tree.getCheckedKeys();
let checkedIds = this.$refs.tree.getCheckedKeys(true); //true代表只获取叶子结点 const params = {
return; name,
console.log(checkedIds); status,
console.log(params); permissions,
travesePer(params.permissionRespNodes); remark,
function travesePer(arr) { };
// debugger
arr.map((item) => {
item.checked = checkedIds.indexOf(item.id) !== -1;
if (item.children && item.children.length > 0) {
travesePer(item.children);
}
});
}
console.log(params); console.log(params);
if (params.literatureId) { if (this.dialogForm.id) {
// let res = await editRole(params); params.id = this.dialogForm.id;
// if (res.code == 0) { let res = await upadateRole(params);
// this.$message.success("修改成功!"); if (res.code == 0) {
// this.reload(); this.$message.success("修改成功!");
// } this.reload();
}
} else { } else {
// let res = await addRole(params); let res = await addRole(params);
// if (res.code == 0) { if (res.code == 0) {
// this.$message.success("添加成功!"); this.$message.success("添加成功!");
// this.reload(); this.reload();
// } }
} }
}, },
reload() { reload() {
......
...@@ -109,7 +109,7 @@ export default { ...@@ -109,7 +109,7 @@ export default {
name:'', name:'',
remark:'', remark:'',
status: 0, status: 0,
permissionRespNodes:[] permissionRespNodes:[]
}, },
}; };
}, },
...@@ -174,14 +174,15 @@ export default { ...@@ -174,14 +174,15 @@ export default {
this.drawerVisible = true; this.drawerVisible = true;
this.form = { this.form = {
status: 0, status: 0,
permissionRespNodes:[]
}; };
break; break;
case "edit": case "edit":
const { id } = row; const { id } = row;
let res = await getRoleById(id); let res = await getRoleById(id);
this.form = res.data; this.form = res.data;
console.log('this.form.permissionRespNodes',this.form.permissionRespNodes);
this.drawerVisible = true; this.drawerVisible = true;
break; break;
case "delete": case "delete":
break; break;
...@@ -219,7 +220,7 @@ export default { ...@@ -219,7 +220,7 @@ export default {
handleClose() { handleClose() {
this.drawerVisible = false; this.drawerVisible = false;
this.form = { this.form = {
status: true, status: 0,
permissionRespNodes:[] permissionRespNodes:[]
}; };
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论