isdata-customer-sdk 0.2.30 → 0.2.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30040,18 +30040,32 @@ const getLoginPortalAccountKey = async (loginName, groupID) => {
30040
30040
  * @param {*} menu_id
30041
30041
  * @returns
30042
30042
  */
30043
- const getPlatformBortherMenusByMenuID = async menu_id => {
30043
+ const getPlatformBortherMenusByMenuID = async (menu_id, role_ids, group_id) => {
30044
30044
  let queryData_groupData = {
30045
30045
  "param": {
30046
30046
  "menu_id": menu_id
30047
30047
  }
30048
30048
  };
30049
30049
  let result = await request.post(`/dataservice/rest/orchestration/getPlatformBortherMenusByMenuID`, queryData_groupData);
30050
- let mappingDatas = result.data.menuDatas;
30050
+ let sysMenuDatas = result.data.menuDatas;
30051
+
30052
+ //获取当前角色下对应的角色菜单权限的映射信息
30053
+ let roleMenuMappingDatas = await getPlatformMenuMappingsByRoleIDs(role_ids, group_id);
30054
+ let roleMenuMappingMap = {};
30055
+ for (const mappingData of roleMenuMappingDatas) {
30056
+ let menu_mapping_id = mappingData.menu_id;
30057
+ roleMenuMappingMap[menu_mapping_id] = mappingData;
30058
+ }
30051
30059
  let menuMaps = {};
30052
30060
  //缓存所有菜单信息
30053
- for (const item of mappingDatas) {
30061
+ for (const item of sysMenuDatas) {
30054
30062
  let id = item.id;
30063
+ let leaf_flag = item.leaf_flag;
30064
+ //如果是叶子节点 并且当前菜单ID在角色菜单映射信息中不存在,则跳过
30065
+ if (leaf_flag === 1 && !roleMenuMappingMap[id]) {
30066
+ continue;
30067
+ }
30068
+ // 如果当前菜单ID在角色菜单映射信息中存在,则表示该角色有权限访问该菜单
30055
30069
  if (!menuMaps[id]) {
30056
30070
  let icon = item.icon;
30057
30071
  let iconClass = "el-icon-menu";
@@ -30075,12 +30089,16 @@ const getPlatformBortherMenusByMenuID = async menu_id => {
30075
30089
  menuMaps[id] = tempItem;
30076
30090
  }
30077
30091
  }
30078
- for (const item of mappingDatas) {
30092
+ for (const item of sysMenuDatas) {
30079
30093
  let parent_id = item.parent_id;
30080
30094
  if (!parent_id) continue;
30081
30095
  let parentItem = menuMaps[parent_id];
30082
30096
  if (parentItem) {
30083
- parentItem.children.push(menuMaps[item.id]);
30097
+ let menuItem = menuMaps[item.id];
30098
+ if (!menuItem) {
30099
+ continue;
30100
+ }
30101
+ parentItem.children.push(menuItem);
30084
30102
  }
30085
30103
  }
30086
30104
  let menuDatas = [];
@@ -30099,7 +30117,7 @@ const getPlatformBortherMenusByMenuID = async menu_id => {
30099
30117
  }
30100
30118
  }
30101
30119
  }
30102
- // console.log("getPlatformBortherMenusByMenuID",menuDatas);
30120
+ console.log("getPlatformBortherMenusByMenuID", menuDatas);
30103
30121
  //获取菜单数据
30104
30122
  return menuDatas;
30105
30123
  };
@@ -32421,12 +32439,12 @@ const logoutAccount = async endside_type => {
32421
32439
  window.sessionStorage.clear();
32422
32440
  return {
32423
32441
  code: resultCode,
32424
- message: response.message
32442
+ message: `$L{${response.message}}`
32425
32443
  };
32426
32444
  } else {
32427
32445
  return {
32428
32446
  code: resultCode,
32429
- message: response.message
32447
+ message: `$L{${response.message}}`
32430
32448
  };
32431
32449
  }
32432
32450
  };
@@ -32466,7 +32484,7 @@ const switchPortalLogin = async (data, appid, endside_type) => {
32466
32484
  } else {
32467
32485
  return {
32468
32486
  code: resultCode,
32469
- message: message
32487
+ message: `$L{${message}}`
32470
32488
  };
32471
32489
  }
32472
32490
  };
@@ -32537,7 +32555,7 @@ const loginAccount = async (data, appid) => {
32537
32555
  } else {
32538
32556
  return {
32539
32557
  code: code,
32540
- message: response.message
32558
+ message: `$L{${response.message}}`
32541
32559
  };
32542
32560
  }
32543
32561
  } else {
@@ -32549,7 +32567,7 @@ const loginAccount = async (data, appid) => {
32549
32567
  }
32550
32568
  return {
32551
32569
  code: code,
32552
- message: result.data.message
32570
+ message: `$L{${result.data.message}}`
32553
32571
  };
32554
32572
  };
32555
32573