isdata-customer-sdk 0.2.29 → 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 = [];
@@ -30090,7 +30108,16 @@ const getPlatformBortherMenusByMenuID = async menu_id => {
30090
30108
  menuDatas.push(item);
30091
30109
  }
30092
30110
  }
30093
- // console.log("getPlatformBortherMenusByMenuID",menuDatas);
30111
+ //如果没有数据,说明只有一级节点父亲
30112
+ if (menuDatas.length == 0) {
30113
+ for (const key in menuMaps) {
30114
+ let item = menuMaps[key];
30115
+ if (item) {
30116
+ menuDatas.push(item);
30117
+ }
30118
+ }
30119
+ }
30120
+ console.log("getPlatformBortherMenusByMenuID", menuDatas);
30094
30121
  //获取菜单数据
30095
30122
  return menuDatas;
30096
30123
  };
@@ -32412,12 +32439,12 @@ const logoutAccount = async endside_type => {
32412
32439
  window.sessionStorage.clear();
32413
32440
  return {
32414
32441
  code: resultCode,
32415
- message: response.message
32442
+ message: `$L{${response.message}}`
32416
32443
  };
32417
32444
  } else {
32418
32445
  return {
32419
32446
  code: resultCode,
32420
- message: response.message
32447
+ message: `$L{${response.message}}`
32421
32448
  };
32422
32449
  }
32423
32450
  };
@@ -32457,7 +32484,7 @@ const switchPortalLogin = async (data, appid, endside_type) => {
32457
32484
  } else {
32458
32485
  return {
32459
32486
  code: resultCode,
32460
- message: message
32487
+ message: `$L{${message}}`
32461
32488
  };
32462
32489
  }
32463
32490
  };
@@ -32528,7 +32555,7 @@ const loginAccount = async (data, appid) => {
32528
32555
  } else {
32529
32556
  return {
32530
32557
  code: code,
32531
- message: response.message
32558
+ message: `$L{${response.message}}`
32532
32559
  };
32533
32560
  }
32534
32561
  } else {
@@ -32540,7 +32567,7 @@ const loginAccount = async (data, appid) => {
32540
32567
  }
32541
32568
  return {
32542
32569
  code: code,
32543
- message: result.data.message
32570
+ message: `$L{${result.data.message}}`
32544
32571
  };
32545
32572
  };
32546
32573