@zgfe/business-lib 1.1.87-auth.0 → 1.1.87-auth.12

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.
@@ -62,9 +62,6 @@ export interface GlobalContextProps {
62
62
  eventIdMap?: Record<number, AnalysisEvent>;
63
63
  userPropList?: UserProp[];
64
64
  eventEnvList?: EnvProp[];
65
- menuNameMap?: {
66
- [name: string]: Menu;
67
- };
68
65
  currentApp?: AppInfoProps;
69
66
  currentUser?: UserInfo;
70
67
  isDemo?: boolean;
@@ -77,7 +74,7 @@ export interface GlobalContextProps {
77
74
  funPermissions?: any;
78
75
  menusName?: any;
79
76
  getMenuRouterByName?: (name: string) => string;
80
- authorityList?: any;
77
+ authority?: any;
81
78
  }
82
79
  declare const BizGlobalDataContext: import("react").Context<GlobalContextProps>;
83
80
  export default BizGlobalDataContext;
@@ -64,27 +64,29 @@ var DemoContent = function DemoContent(_ref3) {
64
64
  _useState6 = _slicedToArray(_useState5, 2),
65
65
  envList = _useState6[0],
66
66
  setEnvList = _useState6[1];
67
- var _useState7 = useState(true),
67
+ var _useState7 = useState({}),
68
68
  _useState8 = _slicedToArray(_useState7, 2),
69
- loadEvent = _useState8[0],
70
- setLoadEvent = _useState8[1];
69
+ authority = _useState8[0],
70
+ setAuthorityList = _useState8[1];
71
71
  var _useState9 = useState(true),
72
72
  _useState10 = _slicedToArray(_useState9, 2),
73
- loadEnv = _useState10[0],
74
- setLoadEnv = _useState10[1];
73
+ loadEvent = _useState10[0],
74
+ setLoadEvent = _useState10[1];
75
75
  var _useState11 = useState(true),
76
76
  _useState12 = _slicedToArray(_useState11, 2),
77
- loadUsers = _useState12[0],
78
- setLoadUsers = _useState12[1];
79
- var _useState13 = useState(),
77
+ loadEnv = _useState12[0],
78
+ setLoadEnv = _useState12[1];
79
+ var _useState13 = useState(true),
80
80
  _useState14 = _slicedToArray(_useState13, 2),
81
- store = _useState14[0],
82
- setStore = _useState14[1];
81
+ loadUsers = _useState14[0],
82
+ setLoadUsers = _useState14[1];
83
+ var _useState15 = useState(),
84
+ _useState16 = _slicedToArray(_useState15, 2),
85
+ store = _useState16[0],
86
+ setStore = _useState16[1];
83
87
  var _useBizStore = useBizStore({
84
88
  currentApp: currentApp,
85
- menuNameMap: {
86
- userTags: {}
87
- }
89
+ authority: authority
88
90
  }),
89
91
  userGroupList = _useBizStore.userGroupList,
90
92
  groupLoading = _useBizStore.groupLoading,
@@ -114,6 +116,35 @@ var DemoContent = function DemoContent(_ref3) {
114
116
  envPropList: envList
115
117
  }));
116
118
  }, [loadEvent, loadEnv, loadUsers, groupLoading]);
119
+ function loadAuthorityList() {
120
+ ajax('/zg/web/v2/company/setting/queryRoleMenuTree', {
121
+ method: 'post',
122
+ data: {
123
+ systemVersion: 1
124
+ }
125
+ }).then(function (res) {
126
+ if (res && res.data) {
127
+ console.log('权限列表:', res.data.children);
128
+ var _data = res.data.children;
129
+ var _authority = {};
130
+ var loop = function loop(data, name) {
131
+ data.forEach(function (item) {
132
+ var _name = name ? "".concat(name, "-").concat(item.name) : item.name;
133
+ _authority[item.menuCode] = _name;
134
+ if (item.children) {
135
+ loop(item.children, _name);
136
+ }
137
+ });
138
+ };
139
+ loop(_data);
140
+ sessionStorage.setItem('authorityList', JSON.stringify(_authority));
141
+ setAuthorityList(_authority);
142
+ }
143
+ }).catch(function () {});
144
+ }
145
+ useEffect(function () {
146
+ loadAuthorityList();
147
+ }, []);
117
148
  function loadUserProps() {
118
149
  setLoadUsers(true);
119
150
  ajax('/zg/web/v2/appusergroup/getUserPropMeta', {
@@ -167,6 +198,7 @@ var DemoContent = function DemoContent(_ref3) {
167
198
  eventGroupList: store === null || store === void 0 ? void 0 : store.eventGroupList,
168
199
  userPropList: store === null || store === void 0 ? void 0 : store.userPropList,
169
200
  eventEnvList: store === null || store === void 0 ? void 0 : store.envPropList,
201
+ authority: authority,
170
202
  eventIdMap: store === null || store === void 0 ? void 0 : store.eventIdMap,
171
203
  eventNameMap: store === null || store === void 0 ? void 0 : store.eventNameMap,
172
204
  userGroupList: userGroupList,
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { UserTagsSelectorTypes } from '../userTagsSelector/types';
3
3
  import { UserGroupTypes } from '../userGroup/types';
4
- import { AppInfoProps, GlobalContextProps } from '../context';
5
- declare function useBizStore({ currentApp, menuNameMap, }: {
4
+ import { AppInfoProps } from '../context';
5
+ declare function useBizStore({ currentApp, authority }: {
6
6
  currentApp: AppInfoProps;
7
- menuNameMap: GlobalContextProps['menuNameMap'];
7
+ authority: any;
8
8
  }): {
9
9
  groupLoading: boolean;
10
10
  userGroupList: UserGroupTypes.Group[];
@@ -9,7 +9,7 @@ import { ajax } from '../utils';
9
9
  import Apis from '../constants/apis';
10
10
  function useBizStore(_ref) {
11
11
  var currentApp = _ref.currentApp,
12
- menuNameMap = _ref.menuNameMap;
12
+ authority = _ref.authority;
13
13
  var _React$useState = React.useState([]),
14
14
  _React$useState2 = _slicedToArray(_React$useState, 2),
15
15
  userGroupList = _React$useState2[0],
@@ -81,7 +81,7 @@ function useBizStore(_ref) {
81
81
  }
82
82
  return setTimeout(function () {
83
83
  queryGroups();
84
- if (menuNameMap === null || menuNameMap === void 0 ? void 0 : menuNameMap.userTags) queryTags();
84
+ if (authority[10038]) queryTags();
85
85
  }, 300);
86
86
  });
87
87
  }, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.id, currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform]);
@@ -18,9 +18,9 @@ var ConditionTypeList = function ConditionTypeList(props) {
18
18
  openCondition = _useContext.openCondition,
19
19
  cdpTip = _useContext.cdpTip;
20
20
  var _useContext2 = useContext(BizGlobalDataContext),
21
- menuNameMap = _useContext2.menuNameMap,
22
21
  currentUser = _useContext2.currentUser,
23
- currentApp = _useContext2.currentApp;
22
+ currentApp = _useContext2.currentApp,
23
+ authority = _useContext2.authority;
24
24
  if (!show || textMode) return null;
25
25
  return /*#__PURE__*/React.createElement("div", {
26
26
  className: "biz-user-condition-type-list"
@@ -60,7 +60,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
60
60
  }
61
61
  }, /*#__PURE__*/React.createElement(Space, {
62
62
  key: "prop"
63
- }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u5C5E\u6027\u6EE1\u8DB3"))) : null, openTagCondition && (!menuNameMap || menuNameMap['userTags']) ? /*#__PURE__*/React.createElement("li", {
63
+ }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u5C5E\u6027\u6EE1\u8DB3"))) : null, openTagCondition && authority[10038] ? /*#__PURE__*/React.createElement("li", {
64
64
  className: "condition-type",
65
65
  onClick: function onClick() {
66
66
  return onAdd('tag');
@@ -74,7 +74,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
74
74
  title: cdpTip
75
75
  }, /*#__PURE__*/React.createElement(IconFont, {
76
76
  type: "tishiicon"
77
- })) : null)) : null, (currentApp === null || currentApp === void 0 ? void 0 : currentApp.appVersion) !== 2 && openCdpCondition && (!menuNameMap || menuNameMap['dataset']) ? /*#__PURE__*/React.createElement("li", {
77
+ })) : null)) : null, (currentApp === null || currentApp === void 0 ? void 0 : currentApp.appVersion) !== 2 && openCdpCondition && authority[1006] ? /*#__PURE__*/React.createElement("li", {
78
78
  className: "condition-type",
79
79
  onClick: function onClick() {
80
80
  return onAdd('cdp');
@@ -63,9 +63,6 @@ export default (function () {
63
63
  currentApp: {
64
64
  appId: 204,
65
65
  platform: 0
66
- },
67
- menuNameMap: {
68
- userTags: true
69
66
  }
70
67
  }
71
68
  }, /*#__PURE__*/React.createElement("div", {
@@ -39,8 +39,8 @@ var BizUserCondition = function BizUserCondition(props) {
39
39
  var _useContext = useContext(BizGlobalDataContext),
40
40
  eventEnvList = _useContext.eventEnvList,
41
41
  userPropList = _useContext.userPropList,
42
- menuNameMap = _useContext.menuNameMap,
43
- currentApp = _useContext.currentApp;
42
+ currentApp = _useContext.currentApp,
43
+ authority = _useContext.authority;
44
44
  var andConditionNum = props.andConditionNum,
45
45
  defaultValue = props.defaultValue,
46
46
  openTagCondition = props.openTagCondition,
@@ -61,8 +61,8 @@ var BizUserCondition = function BizUserCondition(props) {
61
61
  var _useState5 = useState(function () {
62
62
  var list = [];
63
63
  if (defaultValue) {
64
- var showTag = openTagCondition && (!menuNameMap || menuNameMap['userTags']);
65
- var showCdp = openCdpCondition && (!menuNameMap || menuNameMap['dataset']);
64
+ var showTag = openTagCondition && authority[10038];
65
+ var showCdp = openCdpCondition && authority[1006];
66
66
  var flag = false;
67
67
  defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.forEach(function (item) {
68
68
  var showItem = _toConsumableArray(item);
@@ -116,7 +116,7 @@ var BizUserCondition = function BizUserCondition(props) {
116
116
  }, [userPropList]);
117
117
  useEffect(function () {
118
118
  initShowList();
119
- if (props.openCdpCondition && (!menuNameMap || menuNameMap['dataset'])) {
119
+ if (props.openCdpCondition && authority[1006]) {
120
120
  getDatasetList();
121
121
  } else {
122
122
  setLoading(false);
@@ -260,7 +260,7 @@ var BizUserCondition = function BizUserCondition(props) {
260
260
  show: value.length < andConditionNum,
261
261
  label: "\u4E14",
262
262
  onAdd: onAdd
263
- }), openCdpCondition && (!menuNameMap || menuNameMap['dataset']) && !props.textMode && haveCdpValues ? /*#__PURE__*/React.createElement("div", {
263
+ }), openCdpCondition && authority[1006] && !props.textMode && haveCdpValues ? /*#__PURE__*/React.createElement("div", {
264
264
  className: "".concat(classPrefix, "-tip")
265
265
  }, ' ', /*#__PURE__*/React.createElement(IconFont, {
266
266
  type: "tishiicon"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.87-auth.0",
3
+ "version": "1.1.87-auth.12",
4
4
  "module": "es/index.js",
5
5
  "typings": "es/index.d.ts",
6
6
  "files": [
@@ -55,7 +55,7 @@
55
55
  "react": "^16.12.0 || ^17.0.0",
56
56
  "yorkie": "^2.0.0"
57
57
  },
58
- "gitHead": "b1a87ab05528d67eb501dca0de3d526f5071a103",
58
+ "gitHead": "20170a5942de7ebc061b451bfa649ec3708166fc",
59
59
  "gitHooks": {
60
60
  "pre-commit": "lint-staged"
61
61
  }