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.umd.js CHANGED
@@ -4889,6 +4889,7 @@ __webpack_require__.r(__webpack_exports__);
4889
4889
 
4890
4890
  // EXPORTS
4891
4891
  __webpack_require__.d(__webpack_exports__, {
4892
+ fireEvent: function() { return /* reexport */ fireEvent; },
4892
4893
  getAppPortalMenuDatas: function() { return /* reexport */ getAppPortalMenuDatas; },
4893
4894
  getMenuDatasByGroupID: function() { return /* reexport */ getMenuDatasByGroupID; },
4894
4895
  getMenuDatasByRoleIDs: function() { return /* reexport */ getMenuDatasByRoleIDs; },
@@ -4896,6 +4897,8 @@ __webpack_require__.d(__webpack_exports__, {
4896
4897
  getRoleIDsByUserAndGroupID: function() { return /* reexport */ getRoleIDsByUserAndGroupID; },
4897
4898
  queryAssetById: function() { return /* reexport */ queryAssetById; },
4898
4899
  queryGroupIDByOfficeId: function() { return /* reexport */ queryGroupIDByOfficeId; },
4900
+ registerEventListener: function() { return /* reexport */ registerEventListener; },
4901
+ removeEventListener: function() { return /* reexport */ removeEventListener; },
4899
4902
  transformPortalData: function() { return /* reexport */ transformPortalData; }
4900
4903
  });
4901
4904
 
@@ -4998,6 +5001,36 @@ const queryAssetById = (id, count = 200) => request.post(`/asset/getAssetData?as
4998
5001
  filters: []
4999
5002
  });
5000
5003
 
5004
+ /**
5005
+ * 注册事件监听器
5006
+ * @param {} eventName
5007
+ * @param {*} actionFun
5008
+ */
5009
+ const registerEventListener = (eventName, actionFun) => {
5010
+ let eventBus = window.rjEventCenter;
5011
+ if (eventBus && eventBus.register) {
5012
+ eventBus.register(eventName, actionFun);
5013
+ }
5014
+ };
5015
+
5016
+ /**
5017
+ * 移除事件监听器
5018
+ * @param {*} eventName
5019
+ * @param {*} actionFun
5020
+ */
5021
+ const removeEventListener = (eventName, actionFun) => {
5022
+ let eventBus = window.rjEventCenter;
5023
+ if (eventBus && eventBus.unregister) {
5024
+ eventBus.unregister(eventName, actionFun);
5025
+ }
5026
+ };
5027
+ const fireEvent = (eventName, eventData) => {
5028
+ let eventBus = window.rjEventCenter;
5029
+ if (eventBus && eventBus.fireEvent) {
5030
+ eventBus.fireEvent(eventName, eventData);
5031
+ }
5032
+ };
5033
+
5001
5034
  /**
5002
5035
  * 获取门户应用ID
5003
5036
  * @param {*} isPortalAction 是否是门户操作
@@ -5006,7 +5039,7 @@ const queryAssetById = (id, count = 200) => request.post(`/asset/getAssetData?as
5006
5039
  * @param {*} isPortalAction
5007
5040
  * @returns
5008
5041
  */
5009
- const getPoratlAppID = isPortalAction => {
5042
+ const getPoratlAppID = (isPortalAction, appVariables) => {
5010
5043
  let portal_app_id = "";
5011
5044
  if (isPortalAction) {
5012
5045
  portal_app_id = window.appSdk.getAppId();
@@ -5014,7 +5047,7 @@ const getPoratlAppID = isPortalAction => {
5014
5047
  portal_app_id = window.sessionStorage.getItem("iportal_app_id");
5015
5048
  // 如果缓存中没有iportal_app_id,则从appVariables中获取
5016
5049
  if (!portal_app_id) {
5017
- undefined.vueProps.appVariables.forEach(item => {
5050
+ appVariables.forEach(item => {
5018
5051
  if (item.name == "iPortal_app_id") {
5019
5052
  portal_app_id = item.default_value;
5020
5053
  }
@@ -5031,8 +5064,8 @@ const getPoratlAppID = isPortalAction => {
5031
5064
  * @param {*} isPortalAction
5032
5065
  * @returns
5033
5066
  */
5034
- const getAppPortalMenuDatas = async (user_id, group_id, isPortalAction) => {
5035
- let portal_app_id = getPoratlAppID(isPortalAction);
5067
+ const getAppPortalMenuDatas = async (user_id, group_id, isPortalAction, appVariables) => {
5068
+ let portal_app_id = getPoratlAppID(isPortalAction, appVariables);
5036
5069
  let roleList = await getRoleIDsByUserAndGroupID(user_id, portal_app_id, group_id);
5037
5070
  let portalMenuDatas = await getMenuDatasByGroupID(group_id, roleList);
5038
5071
  let app_id = window.appSdk.getAppId();
@@ -5128,12 +5161,13 @@ const transformPortalData = (datas, menuTypes, filterObjectMap) => {
5128
5161
  let id = data.id;
5129
5162
  let tempMenuData = {
5130
5163
  id: id,
5164
+ index: data.menu_id,
5131
5165
  name: data.title,
5132
5166
  sort: data.sort,
5133
5167
  actionType: data.actionType,
5134
5168
  url: data.url,
5135
5169
  iconClass: data.image,
5136
- types: [],
5170
+ children: [],
5137
5171
  app_id: data.app_id,
5138
5172
  menu_id: data.menu_id,
5139
5173
  beyond_type: data.menu_type ? data.menu_type : "RJVIEW-OTHERS",
@@ -5163,7 +5197,7 @@ const transformPortalData = (datas, menuTypes, filterObjectMap) => {
5163
5197
  let tempType = tempMenuData.beyond_type;
5164
5198
  // let tempType_sort =tempMenuData.beyond_type_sort;
5165
5199
  let tempParentMenu = menuMaps[parent_id];
5166
- let parentTypes = tempParentMenu.types;
5200
+ let parentTypes = tempParentMenu.children;
5167
5201
  let parentType = parentTypes.find(tempTypeItem => {
5168
5202
  return tempTypeItem.id == tempType;
5169
5203
  });
@@ -5174,11 +5208,13 @@ const transformPortalData = (datas, menuTypes, filterObjectMap) => {
5174
5208
  let menuTypeObj = menuTypeMaps[tempType];
5175
5209
  let parentType = menuTypeObj ? {
5176
5210
  id: tempType,
5211
+ index: tempType,
5177
5212
  name: menuTypeObj.title,
5178
5213
  children: [],
5179
5214
  sort: menuTypeObj.value
5180
5215
  } : {
5181
5216
  id: tempType,
5217
+ index: tempType,
5182
5218
  name: "其他",
5183
5219
  children: [],
5184
5220
  sort: 999
@@ -5197,7 +5233,7 @@ const transformPortalData = (datas, menuTypes, filterObjectMap) => {
5197
5233
  let tempMenuData = menuMaps[data.id];
5198
5234
  //如果没有对应的菜单数据,则跳过
5199
5235
  if (!tempMenuData) continue;
5200
- let menuTypes = tempMenuData.types;
5236
+ let menuTypes = tempMenuData.children;
5201
5237
  let count = 0;
5202
5238
  for (const menuType of menuTypes) {
5203
5239
  let type_childens = menuType.children;
@@ -5211,7 +5247,7 @@ const transformPortalData = (datas, menuTypes, filterObjectMap) => {
5211
5247
  continue;
5212
5248
  }
5213
5249
  menuList.push(tempMenuData);
5214
- let types = tempMenuData.types;
5250
+ let types = tempMenuData.children;
5215
5251
  types.sort((data1, data2) => {
5216
5252
  if (Number.isNaN(data1.sort)) return 1;
5217
5253
  if (Number.isNaN(data2.sort)) return -1;