Commit f3c1fa70 by caoyanzhi

编辑角色

parent e493dacb
......@@ -139,16 +139,17 @@ export default {
// 获取角色详情
getRoleDetail(roleId) {
roleDetail({ roleId }).then(res => {
const { roleId, roleName, menuIds } = res.result;
Object.assign(this.roleData, { roleId, roleName, menuIds: JSON.parse(menuIds || '[]') });
let { roleId, roleName, menuIds } = res.result;
menuIds = typeof menuIds == 'string' ? menuIds.split(',') : [];
Object.assign(this.roleData, { roleId, roleName });
// 将menuIds分配到相应同的tab下的checkedId中
this.roleData.menuIds.forEach(el => {
this.tabList.some(item => {
item.menuList.forEach(menu => {
item.checkedId[menu.menuId] = getAllMenuId([ menu ], el.menuIds || []);
})
return item.appType == el.appType;
this.tabList.forEach(el => {
let checkedId = [];
el.menuList.forEach(item => {
el.checkedId[item.menuId] = getAllMenuId([ item ], menuIds);
checkedId = checkedId.concat(el.checkedId[item.menuId]);
})
this.roleData.menuIds.push({ appType: el.appType, menuIds: checkedId });
})
})
function getAllMenuId(menuList, allMenuIds) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment