isdata-customer-sdk 0.1.16 → 0.1.18

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.
package/dist/index.js CHANGED
@@ -4879,6 +4879,7 @@ __webpack_require__.r(__webpack_exports__);
4879
4879
 
4880
4880
  // EXPORTS
4881
4881
  __webpack_require__.d(__webpack_exports__, {
4882
+ fireEvent: function() { return /* reexport */ fireEvent; },
4882
4883
  getAppPortalMenuDatas: function() { return /* reexport */ getAppPortalMenuDatas; },
4883
4884
  getMenuDatasByGroupID: function() { return /* reexport */ getMenuDatasByGroupID; },
4884
4885
  getMenuDatasByRoleIDs: function() { return /* reexport */ getMenuDatasByRoleIDs; },
@@ -4886,6 +4887,8 @@ __webpack_require__.d(__webpack_exports__, {
4886
4887
  getRoleIDsByUserAndGroupID: function() { return /* reexport */ getRoleIDsByUserAndGroupID; },
4887
4888
  queryAssetById: function() { return /* reexport */ queryAssetById; },
4888
4889
  queryGroupIDByOfficeId: function() { return /* reexport */ queryGroupIDByOfficeId; },
4890
+ registerEventListener: function() { return /* reexport */ registerEventListener; },
4891
+ removeEventListener: function() { return /* reexport */ removeEventListener; },
4889
4892
  transformPortalData: function() { return /* reexport */ transformPortalData; }
4890
4893
  });
4891
4894
 
@@ -4988,6 +4991,36 @@ const queryAssetById = (id, count = 200) => request.post(`/asset/getAssetData?as
4988
4991
  filters: []
4989
4992
  });
4990
4993
 
4994
+ /**
4995
+ * 注册事件监听器
4996
+ * @param {} eventName
4997
+ * @param {*} actionFun
4998
+ */
4999
+ const registerEventListener = (eventName, actionFun) => {
5000
+ let eventBus = window.rjEventCenter;
5001
+ if (eventBus && eventBus.register) {
5002
+ eventBus.register(eventName, actionFun);
5003
+ }
5004
+ };
5005
+
5006
+ /**
5007
+ * 移除事件监听器
5008
+ * @param {*} eventName
5009
+ * @param {*} actionFun
5010
+ */
5011
+ const removeEventListener = (eventName, actionFun) => {
5012
+ let eventBus = window.rjEventCenter;
5013
+ if (eventBus && eventBus.unregister) {
5014
+ eventBus.unregister(eventName, actionFun);
5015
+ }
5016
+ };
5017
+ const fireEvent = (eventName, eventData) => {
5018
+ let eventBus = window.rjEventCenter;
5019
+ if (eventBus && eventBus.fireEvent) {
5020
+ eventBus.fireEvent(eventName, eventData);
5021
+ }
5022
+ };
5023
+
4991
5024
  /**
4992
5025
  * 获取门户应用ID
4993
5026
  * @param {*} isPortalAction 是否是门户操作
@@ -4996,7 +5029,7 @@ const queryAssetById = (id, count = 200) => request.post(`/asset/getAssetData?as
4996
5029
  * @param {*} isPortalAction
4997
5030
  * @returns
4998
5031
  */
4999
- const getPoratlAppID = isPortalAction => {
5032
+ const getPoratlAppID = (isPortalAction, appVariables) => {
5000
5033
  let portal_app_id = "";
5001
5034
  if (isPortalAction) {
5002
5035
  portal_app_id = window.appSdk.getAppId();
@@ -5004,7 +5037,7 @@ const getPoratlAppID = isPortalAction => {
5004
5037
  portal_app_id = window.sessionStorage.getItem("iportal_app_id");
5005
5038
  // 如果缓存中没有iportal_app_id,则从appVariables中获取
5006
5039
  if (!portal_app_id) {
5007
- undefined.vueProps.appVariables.forEach(item => {
5040
+ appVariables.forEach(item => {
5008
5041
  if (item.name == "iPortal_app_id") {
5009
5042
  portal_app_id = item.default_value;
5010
5043
  }
@@ -5021,8 +5054,8 @@ const getPoratlAppID = isPortalAction => {
5021
5054
  * @param {*} isPortalAction
5022
5055
  * @returns
5023
5056
  */
5024
- const getAppPortalMenuDatas = async (user_id, group_id, isPortalAction) => {
5025
- let portal_app_id = getPoratlAppID(isPortalAction);
5057
+ const getAppPortalMenuDatas = async (user_id, group_id, isPortalAction, appVariables) => {
5058
+ let portal_app_id = getPoratlAppID(isPortalAction, appVariables);
5026
5059
  let roleList = await getRoleIDsByUserAndGroupID(user_id, portal_app_id, group_id);
5027
5060
  let portalMenuDatas = await getMenuDatasByGroupID(group_id, roleList);
5028
5061
  let app_id = window.appSdk.getAppId();
@@ -5118,12 +5151,13 @@ const transformPortalData = (datas, menuTypes, filterObjectMap) => {
5118
5151
  let id = data.id;
5119
5152
  let tempMenuData = {
5120
5153
  id: id,
5154
+ index: data.menu_id,
5121
5155
  name: data.title,
5122
5156
  sort: data.sort,
5123
5157
  actionType: data.actionType,
5124
5158
  url: data.url,
5125
5159
  iconClass: data.image,
5126
- types: [],
5160
+ children: [],
5127
5161
  app_id: data.app_id,
5128
5162
  menu_id: data.menu_id,
5129
5163
  beyond_type: data.menu_type ? data.menu_type : "RJVIEW-OTHERS",
@@ -5153,7 +5187,7 @@ const transformPortalData = (datas, menuTypes, filterObjectMap) => {
5153
5187
  let tempType = tempMenuData.beyond_type;
5154
5188
  // let tempType_sort =tempMenuData.beyond_type_sort;
5155
5189
  let tempParentMenu = menuMaps[parent_id];
5156
- let parentTypes = tempParentMenu.types;
5190
+ let parentTypes = tempParentMenu.children;
5157
5191
  let parentType = parentTypes.find(tempTypeItem => {
5158
5192
  return tempTypeItem.id == tempType;
5159
5193
  });
@@ -5164,11 +5198,13 @@ const transformPortalData = (datas, menuTypes, filterObjectMap) => {
5164
5198
  let menuTypeObj = menuTypeMaps[tempType];
5165
5199
  let parentType = menuTypeObj ? {
5166
5200
  id: tempType,
5201
+ index: tempType,
5167
5202
  name: menuTypeObj.title,
5168
5203
  children: [],
5169
5204
  sort: menuTypeObj.value
5170
5205
  } : {
5171
5206
  id: tempType,
5207
+ index: tempType,
5172
5208
  name: "其他",
5173
5209
  children: [],
5174
5210
  sort: 999
@@ -5187,7 +5223,7 @@ const transformPortalData = (datas, menuTypes, filterObjectMap) => {
5187
5223
  let tempMenuData = menuMaps[data.id];
5188
5224
  //如果没有对应的菜单数据,则跳过
5189
5225
  if (!tempMenuData) continue;
5190
- let menuTypes = tempMenuData.types;
5226
+ let menuTypes = tempMenuData.children;
5191
5227
  let count = 0;
5192
5228
  for (const menuType of menuTypes) {
5193
5229
  let type_childens = menuType.children;
@@ -5201,7 +5237,7 @@ const transformPortalData = (datas, menuTypes, filterObjectMap) => {
5201
5237
  continue;
5202
5238
  }
5203
5239
  menuList.push(tempMenuData);
5204
- let types = tempMenuData.types;
5240
+ let types = tempMenuData.children;
5205
5241
  types.sort((data1, data2) => {
5206
5242
  if (Number.isNaN(data1.sort)) return 1;
5207
5243
  if (Number.isNaN(data2.sort)) return -1;