Commit a4b4a9b9 by caoyanzhi

接口联调

parent c1de60f7
......@@ -102,29 +102,7 @@ export default {
initData() {
const params = { wxEnterpriseId: this.wxEnterpriseId }
const prom = [];
// eslint-disable-next-line
function setMenu(label, parentId, level) {
let result = [];
let menu = [];
while(menu.length < 3) {
const item = {
menuId: `${parentId}-${menu.length}`, // 菜单id
menuName: `${label}${parentId}-${menu.length}`, // 菜单名称
level, // 层级
parentId,
}
menu.push(item);
if (level < 2) {
result = result.concat(setMenu(label, item.menuId, level + 1));
}
}
return menu.concat(result);
}
this.tabList.forEach(el => {
// el.menuList = this.flatDataToTree(setMenu(el.label, 0, 0));
// el.menuList.forEach(item => {
// this.$set(el.checkedId, item.menuId, []);
// });
// appType 1好办后台2应用后台3好办小程序4小程序应用
// roleType 1管理员角色 2门店角色
prom.push(menuList(Object.assign({}, params, { appType: el.appType, roleType: 2 })).then(res => {
......@@ -145,16 +123,17 @@ export default {
},
getRoleDetail(roleId) {
roleDetail({ roleId }).then(res => {
const { roleId, roleName, menuIds, resourceCode } = res.result || {};
Object.assign(this.roleData, { roleId, roleName, menuIds: JSON.parse(menuIds || '[]') });
let { roleId, roleName, menuIds, resourceCode } = 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 });
})
if (typeof resourceCode == 'string' && resourceCode.length > 0) {
resourceCode.split(',').forEach(el => {
......
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