@zgfe/modules-settings 1.0.1-a.0

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.
Files changed (97) hide show
  1. package/README.md +33 -0
  2. package/dist/esm/components/pageLoading/index.d.ts +3 -0
  3. package/dist/esm/components/pageLoading/index.js +11 -0
  4. package/dist/esm/components/pageLoading/index.less +11 -0
  5. package/dist/esm/constants/api.d.ts +30 -0
  6. package/dist/esm/constants/api.js +32 -0
  7. package/dist/esm/constants/icons/demo.css +539 -0
  8. package/dist/esm/constants/icons/demo_index.html +8537 -0
  9. package/dist/esm/constants/icons/iconfont.css +1467 -0
  10. package/dist/esm/constants/icons/iconfont.js +43 -0
  11. package/dist/esm/constants/icons/iconfont.json +2550 -0
  12. package/dist/esm/constants/icons/iconfont.ttf +0 -0
  13. package/dist/esm/constants/icons/iconfont.woff +0 -0
  14. package/dist/esm/constants/icons/iconfont.woff2 +0 -0
  15. package/dist/esm/constants/styles/base.sass +9 -0
  16. package/dist/esm/constants/styles/cleverUI.css +7 -0
  17. package/dist/esm/constants/styles/constants.sass +60 -0
  18. package/dist/esm/constants/styles/customUITheme.sass +54 -0
  19. package/dist/esm/constants/styles/reset.sass +61 -0
  20. package/dist/esm/global.d.ts +4 -0
  21. package/dist/esm/index.d.ts +3 -0
  22. package/dist/esm/index.js +3 -0
  23. package/dist/esm/modules/appSettings/appInfo/index.d.ts +3 -0
  24. package/dist/esm/modules/appSettings/appInfo/index.js +45 -0
  25. package/dist/esm/modules/appSettings/dataAccessFilter/index.d.ts +3 -0
  26. package/dist/esm/modules/appSettings/dataAccessFilter/index.js +37 -0
  27. package/dist/esm/modules/appSettings/index.d.ts +3 -0
  28. package/dist/esm/modules/appSettings/index.js +24 -0
  29. package/dist/esm/modules/appSettings/member/index.d.ts +3 -0
  30. package/dist/esm/modules/appSettings/member/index.js +29 -0
  31. package/dist/esm/modules/appSettings/secretKey/index.d.ts +3 -0
  32. package/dist/esm/modules/appSettings/secretKey/index.js +8 -0
  33. package/dist/esm/modules/companySetting/appList/index.d.ts +21 -0
  34. package/dist/esm/modules/companySetting/appList/index.js +386 -0
  35. package/dist/esm/modules/companySetting/appList/index.less +72 -0
  36. package/dist/esm/modules/companySetting/cost/index.d.ts +6 -0
  37. package/dist/esm/modules/companySetting/cost/index.js +79 -0
  38. package/dist/esm/modules/companySetting/cost/index.less +31 -0
  39. package/dist/esm/modules/companySetting/edit/authConfig.d.ts +9 -0
  40. package/dist/esm/modules/companySetting/edit/authConfig.js +333 -0
  41. package/dist/esm/modules/companySetting/edit/authConfigCEP.d.ts +10 -0
  42. package/dist/esm/modules/companySetting/edit/authConfigCEP.js +309 -0
  43. package/dist/esm/modules/companySetting/edit/authGroup.d.ts +7 -0
  44. package/dist/esm/modules/companySetting/edit/authGroup.js +89 -0
  45. package/dist/esm/modules/companySetting/edit/authModule.d.ts +7 -0
  46. package/dist/esm/modules/companySetting/edit/authModule.js +217 -0
  47. package/dist/esm/modules/companySetting/edit/multiAuthModule.d.ts +7 -0
  48. package/dist/esm/modules/companySetting/edit/multiAuthModule.js +150 -0
  49. package/dist/esm/modules/companySetting/edit/styles/authConfig.less +3 -0
  50. package/dist/esm/modules/companySetting/edit/styles/authGroup.less +10 -0
  51. package/dist/esm/modules/companySetting/edit/styles/authModule.less +82 -0
  52. package/dist/esm/modules/companySetting/edit/styles/user.less +32 -0
  53. package/dist/esm/modules/companySetting/edit/styles/userGroup.less +44 -0
  54. package/dist/esm/modules/companySetting/edit/user.d.ts +12 -0
  55. package/dist/esm/modules/companySetting/edit/user.js +222 -0
  56. package/dist/esm/modules/companySetting/edit/userGroup.d.ts +14 -0
  57. package/dist/esm/modules/companySetting/edit/userGroup.js +321 -0
  58. package/dist/esm/modules/companySetting/index.d.ts +18 -0
  59. package/dist/esm/modules/companySetting/index.js +492 -0
  60. package/dist/esm/modules/companySetting/index.less +24 -0
  61. package/dist/esm/modules/companySetting/info/index.d.ts +6 -0
  62. package/dist/esm/modules/companySetting/info/index.js +105 -0
  63. package/dist/esm/modules/companySetting/info/index.less +35 -0
  64. package/dist/esm/modules/companySetting/style/common.less +68 -0
  65. package/dist/esm/modules/companySetting/user/index.d.ts +29 -0
  66. package/dist/esm/modules/companySetting/user/index.js +548 -0
  67. package/dist/esm/modules/companySetting/user/index.less +161 -0
  68. package/dist/esm/modules/companySetting/user/invite.d.ts +8 -0
  69. package/dist/esm/modules/companySetting/user/invite.js +171 -0
  70. package/dist/esm/modules/companySetting/userGroup/authConfigDetail.d.ts +16 -0
  71. package/dist/esm/modules/companySetting/userGroup/authConfigDetail.js +379 -0
  72. package/dist/esm/modules/companySetting/userGroup/groupItem.d.ts +11 -0
  73. package/dist/esm/modules/companySetting/userGroup/groupItem.js +140 -0
  74. package/dist/esm/modules/companySetting/userGroup/index.d.ts +13 -0
  75. package/dist/esm/modules/companySetting/userGroup/index.js +142 -0
  76. package/dist/esm/modules/companySetting/userGroup/index.less +6 -0
  77. package/dist/esm/modules/companySetting/userGroup/style/authConfigDetail.less +44 -0
  78. package/dist/esm/modules/companySetting/userGroup/style/index.less +79 -0
  79. package/dist/esm/modules/dsfdsf +0 -0
  80. package/dist/esm/modules/personalSetting/index.d.ts +4 -0
  81. package/dist/esm/modules/personalSetting/index.js +17 -0
  82. package/dist/esm/modules/personalSetting/index.less +1 -0
  83. package/dist/esm/modules/personalSetting/info/index.d.ts +3 -0
  84. package/dist/esm/modules/personalSetting/info/index.js +83 -0
  85. package/dist/esm/modules/personalSetting/reset/index.d.ts +3 -0
  86. package/dist/esm/modules/personalSetting/reset/index.js +93 -0
  87. package/dist/esm/utils/ajax.d.ts +3 -0
  88. package/dist/esm/utils/ajax.js +5 -0
  89. package/dist/esm/utils/base64.d.ts +11 -0
  90. package/dist/esm/utils/base64.js +128 -0
  91. package/dist/esm/utils/constants.d.ts +160 -0
  92. package/dist/esm/utils/constants.js +282 -0
  93. package/dist/esm/utils/functionalPermissions.d.ts +385 -0
  94. package/dist/esm/utils/functionalPermissions.js +407 -0
  95. package/dist/esm/utils/util.d.ts +209 -0
  96. package/dist/esm/utils/util.js +649 -0
  97. package/package.json +56 -0
@@ -0,0 +1,222 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React, { useContext, useEffect, useRef, useState } from 'react';
8
+ import "./styles/user.less";
9
+ import { BizGlobalDataContext } from '@zgfe/business-lib';
10
+ import { Button, Input, notification, Tabs } from 'antd';
11
+ import request from "./../../../utils/ajax";
12
+ import AuthConfig from "./authConfig";
13
+ import AuthConfigCEP from "./authConfigCEP";
14
+ import { BizSelect } from '@zgfe/business-lib';
15
+ import apis from "./../../../constants/api";
16
+ var TextArea = Input.TextArea;
17
+ var Info = function Info(props) {
18
+ var data = props.data,
19
+ allGroupInfos = props.allGroupInfos,
20
+ companyAppList = props.companyAppList,
21
+ isMarsUi = props.isMarsUi,
22
+ leftMenus = props.leftMenus,
23
+ onCancel = props.onCancel,
24
+ changeUserAuthCallback = props.changeUserAuthCallback;
25
+ var _useContext = useContext(BizGlobalDataContext),
26
+ currentApp = _useContext.currentApp,
27
+ currentUser = _useContext.currentUser,
28
+ isDemo = _useContext.isDemo;
29
+ var _useState = useState([]),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ groups = _useState2[0],
32
+ setGroups = _useState2[1];
33
+ var _useState3 = useState({}),
34
+ _useState4 = _slicedToArray(_useState3, 2),
35
+ CEPData = _useState4[0],
36
+ setCEPData = _useState4[1];
37
+ var _useState5 = useState('io'),
38
+ _useState6 = _slicedToArray(_useState5, 2),
39
+ currentTab = _useState6[0],
40
+ setCurrentTab = _useState6[1];
41
+ var _useState7 = useState(false),
42
+ _useState8 = _slicedToArray(_useState7, 2),
43
+ btnLoading = _useState8[0],
44
+ setBtnLoading = _useState8[1];
45
+ var refAuthConfig = useRef();
46
+ var refAuthCEPConfig = useRef();
47
+ useEffect(function () {
48
+ Promise.all([request(apis.setting.queryFunConfigList, {
49
+ method: 'post'
50
+ }).then(function (res) {
51
+ if (res && res.code === 200) {
52
+ return res.data;
53
+ }
54
+ throw new Error('接口返回错误');
55
+ }), request(apis.setting.queryAppList, {
56
+ method: 'post'
57
+ }).then(function (res) {
58
+ if (res && res.code === 200) {
59
+ return res.data;
60
+ }
61
+ throw new Error('接口返回错误');
62
+ }), request(apis.setting.queryFunConfigByUserId, {
63
+ method: 'post',
64
+ data: {
65
+ userId: data.id,
66
+ type: 1
67
+ }
68
+ }).then(function (res) {
69
+ if (res && res.code === 200) {
70
+ return res.data;
71
+ }
72
+ throw new Error('接口返回错误');
73
+ })]).then(function (posts) {
74
+ setCEPData(posts || []);
75
+ }).catch(function () {
76
+ notification.error({
77
+ message: '接口返回错误'
78
+ });
79
+ });
80
+ }, []);
81
+ useEffect(function () {
82
+ var authConfig = data.authConfig || {};
83
+ var groupIds = authConfig.groupIds || [];
84
+ setGroups(allGroupInfos.filter(function (item) {
85
+ return groupIds.includes(item.id);
86
+ }));
87
+ }, []);
88
+ var onChangeGroups = function onChangeGroups(value) {
89
+ setGroups(value);
90
+ };
91
+ var onCancelCallback = function onCancelCallback() {
92
+ onCancel && onCancel();
93
+ };
94
+ var onSaveCallback = function onSaveCallback() {
95
+ // if (currentTab === 'io'){
96
+ var authConfig = refAuthConfig.current.getFormData();
97
+ var groupIdArr = groups.map(function (item) {
98
+ return item.id;
99
+ });
100
+ var formData = {
101
+ userId: data.id,
102
+ authConfig: JSON.stringify(authConfig),
103
+ groupIds: groupIdArr.join(',')
104
+ };
105
+ setBtnLoading(true);
106
+ request(apis.setting.updateUserAuth, {
107
+ method: 'post',
108
+ data: formData
109
+ }).then(function () {
110
+ changeUserAuthCallback && changeUserAuthCallback(data && data.id);
111
+ notification.success({
112
+ message: '保存成功'
113
+ });
114
+ setBtnLoading(false);
115
+ onCancel();
116
+ }).catch(function (error) {
117
+ console.log(error);
118
+ setBtnLoading(false);
119
+ notification.error({
120
+ message: '权限修改失败'
121
+ });
122
+ });
123
+ if (currentTab === 'cep') {
124
+ var _authConfig = refAuthCEPConfig.current.getFormData();
125
+ console.log(_authConfig);
126
+ var _groupIdArr = groups.map(function (item) {
127
+ return item.id;
128
+ });
129
+ var _formData = {
130
+ userId: 1,
131
+ appIds: _authConfig.dataAuth.map(function (item) {
132
+ return item.appId;
133
+ }),
134
+ menuIds: _authConfig.cepFunAuth.map(function (item) {
135
+ return item.resource;
136
+ })
137
+ };
138
+ setBtnLoading(true);
139
+ request(apis.setting.updateUserAuthCEP, {
140
+ method: 'post',
141
+ data: _formData
142
+ }).then(function () {
143
+ changeUserAuthCallback && changeUserAuthCallback(data && data.id);
144
+ notification.success({
145
+ message: '保存成功'
146
+ });
147
+ setBtnLoading(false);
148
+ onCancel();
149
+ }).catch(function (error) {
150
+ console.log(error);
151
+ setBtnLoading(false);
152
+ notification.error({
153
+ message: '权限修改失败'
154
+ });
155
+ });
156
+ }
157
+ };
158
+ return /*#__PURE__*/React.createElement("div", {
159
+ className: "company-setting-user"
160
+ }, /*#__PURE__*/React.createElement("div", {
161
+ className: "company-setting-user-title"
162
+ }, /*#__PURE__*/React.createElement("span", null, "\u7F16\u8F91\u7528\u6237")), /*#__PURE__*/React.createElement("div", {
163
+ className: "company-setting-user-name"
164
+ }, /*#__PURE__*/React.createElement("span", {
165
+ className: "item-label"
166
+ }, "\u8D26\u53F7\uFF1A"), /*#__PURE__*/React.createElement("span", null, data.username || data.email)), /*#__PURE__*/React.createElement("div", {
167
+ className: "company-setting-user-groups"
168
+ }, /*#__PURE__*/React.createElement("span", {
169
+ className: "item-label"
170
+ }, "\u6240\u5C5E\u7528\u6237\u7EC4\uFF1A"), /*#__PURE__*/React.createElement("div", {
171
+ style: {
172
+ display: 'inline-block',
173
+ width: 500
174
+ }
175
+ }, /*#__PURE__*/React.createElement(BizSelect, {
176
+ overlayWidth: 284,
177
+ options: allGroupInfos,
178
+ value: groups,
179
+ labelField: "groupName",
180
+ keyField: "id",
181
+ popupContainer: true,
182
+ enableCreate: true,
183
+ multiple: true,
184
+ onChange: onChangeGroups
185
+ }))), /*#__PURE__*/React.createElement(Tabs, {
186
+ activeKey: currentTab,
187
+ onChange: function onChange(e) {
188
+ return setCurrentTab(e);
189
+ }
190
+ }, /*#__PURE__*/React.createElement(Tabs.TabPane, {
191
+ tab: "\u8BF8\u845Bio",
192
+ key: "io"
193
+ }, /*#__PURE__*/React.createElement(AuthConfig, {
194
+ ref: refAuthConfig,
195
+ config: data.authConfig.defaultAuth,
196
+ appList: companyAppList,
197
+ isMarsUi: isMarsUi,
198
+ leftMenus: leftMenus
199
+ })), /*#__PURE__*/React.createElement(Tabs.TabPane, {
200
+ tab: "CEP",
201
+ key: "cep"
202
+ }, /*#__PURE__*/React.createElement(AuthConfigCEP, {
203
+ ref: refAuthCEPConfig,
204
+ CEPData: CEPData,
205
+ config: data.authConfig.defaultAuth,
206
+ appList: companyAppList,
207
+ isMarsUi: isMarsUi,
208
+ leftMenus: leftMenus
209
+ }))), /*#__PURE__*/React.createElement("div", {
210
+ className: "company-setting-footer"
211
+ }, /*#__PURE__*/React.createElement(Button, {
212
+ onClick: onCancelCallback
213
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
214
+ style: {
215
+ marginLeft: 10
216
+ },
217
+ loading: btnLoading,
218
+ type: "primary",
219
+ onClick: onSaveCallback
220
+ }, "\u786E\u5B9A")));
221
+ };
222
+ export default Info;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import './styles/userGroup.less';
3
+ declare const CompanySettingUserGroup: React.FC<{
4
+ id: Number;
5
+ data?: {};
6
+ allGroupInfos: [];
7
+ companyAppList: [];
8
+ isMarsUi: Boolean;
9
+ leftMenus: [];
10
+ isAdmin: Boolean;
11
+ onCancel: Function;
12
+ updateGroupAuthCallback: Function;
13
+ }>;
14
+ export default CompanySettingUserGroup;
@@ -0,0 +1,321 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import React, { useContext, useEffect, useRef, useState } from 'react';
14
+ import "./styles/userGroup.less";
15
+ import { BizGlobalDataContext } from '@zgfe/business-lib';
16
+ import constants from "./../../../utils/constants";
17
+ import { Button, Input, notification, Tabs, Radio } from 'antd';
18
+ import request from "./../../../utils/ajax";
19
+ import AuthConfig from "./authConfig";
20
+ import AuthConfigCEP from "./authConfigCEP";
21
+ import { BizSelect } from '@zgfe/business-lib';
22
+ import apis from "./../../../constants/api";
23
+ var TextArea = Input.TextArea;
24
+ var CompanySettingUserGroup = function CompanySettingUserGroup(props) {
25
+ var id = props.id,
26
+ data = props.data,
27
+ allGroupInfos = props.allGroupInfos,
28
+ companyAppList = props.companyAppList,
29
+ isMarsUi = props.isMarsUi,
30
+ leftMenus = props.leftMenus,
31
+ isAdmin = props.isAdmin,
32
+ onCancel = props.onCancel,
33
+ updateGroupAuthCallback = props.updateGroupAuthCallback;
34
+ var _useContext = useContext(BizGlobalDataContext),
35
+ currentApp = _useContext.currentApp,
36
+ currentUser = _useContext.currentUser,
37
+ isDemo = _useContext.isDemo;
38
+ var _useState = useState(''),
39
+ _useState2 = _slicedToArray(_useState, 2),
40
+ name = _useState2[0],
41
+ setName = _useState2[1];
42
+ var _useState3 = useState([]),
43
+ _useState4 = _slicedToArray(_useState3, 2),
44
+ user = _useState4[0],
45
+ setUser = _useState4[1];
46
+ var _useState5 = useState([]),
47
+ _useState6 = _slicedToArray(_useState5, 2),
48
+ oldUser = _useState6[0],
49
+ setOldUser = _useState6[1];
50
+ var _useState7 = useState(0),
51
+ _useState8 = _slicedToArray(_useState7, 2),
52
+ isEncryption = _useState8[0],
53
+ setIsEncryption = _useState8[1];
54
+ var _useState9 = useState([]),
55
+ _useState10 = _slicedToArray(_useState9, 2),
56
+ allMembers = _useState10[0],
57
+ setAllMembers = _useState10[1];
58
+ var _useState11 = useState({}),
59
+ _useState12 = _slicedToArray(_useState11, 2),
60
+ CEPData = _useState12[0],
61
+ setCEPData = _useState12[1];
62
+ var _useState13 = useState('io'),
63
+ _useState14 = _slicedToArray(_useState13, 2),
64
+ currentTab = _useState14[0],
65
+ setCurrentTab = _useState14[1];
66
+ var _useState15 = useState(false),
67
+ _useState16 = _slicedToArray(_useState15, 2),
68
+ btnLoading = _useState16[0],
69
+ setBtnLoading = _useState16[1];
70
+ var refAuthConfig = useRef();
71
+ var refAuthCEPConfig = useRef();
72
+ useEffect(function () {
73
+ Promise.all([request(apis.setting.queryFunConfigList, {
74
+ method: 'post'
75
+ }).then(function (res) {
76
+ if (res && res.code === 200) {
77
+ return res.data;
78
+ }
79
+ throw new Error('接口返回错误');
80
+ }), request(apis.setting.queryAppList, {
81
+ method: 'post'
82
+ }).then(function (res) {
83
+ if (res && res.code === 200) {
84
+ return res.data;
85
+ }
86
+ throw new Error('接口返回错误');
87
+ }), request(apis.setting.queryFunConfigByUserId, {
88
+ method: 'post',
89
+ data: {
90
+ groupId: data.id,
91
+ type: 2
92
+ }
93
+ }).then(function (res) {
94
+ if (res && res.code === 200) {
95
+ return res.data;
96
+ }
97
+ throw new Error('接口返回错误');
98
+ })]).then(function (posts) {
99
+ setCEPData(posts || []);
100
+ }).catch(function () {
101
+ notification.error({
102
+ message: '接口返回错误'
103
+ });
104
+ });
105
+ }, []);
106
+ useEffect(function () {
107
+ setName(data.groupName || '');
108
+ var result = [];
109
+ if (data && data.members) {
110
+ data.members.forEach(function (item) {
111
+ result.push({
112
+ id: item.userId,
113
+ username: item.username || item.email
114
+ });
115
+ });
116
+ }
117
+ setUser(result);
118
+ setOldUser(result);
119
+ setIsEncryption(data.isEncryption || 0);
120
+ }, [props.data]);
121
+ useEffect(function () {
122
+ setName(data.groupName || '');
123
+ }, [props.allGroupInfos]);
124
+ useEffect(function () {
125
+ request(apis.setting.getGroupMembers, {
126
+ method: 'get'
127
+ }).then(function (res) {
128
+ if (res.flag === 101) {
129
+ setAllMembers(res.company_members.map(function (item) {
130
+ return _objectSpread(_objectSpread({}, item), {}, {
131
+ username: item.username || item.email
132
+ });
133
+ }));
134
+ }
135
+ }).catch(function (err) {});
136
+ }, []);
137
+ var onCancelCallback = function onCancelCallback() {
138
+ onCancel && onCancel();
139
+ };
140
+ var onSave = function onSave() {
141
+ if (!constants.regExp.teamAndAppName.test(name)) {
142
+ notification.error({
143
+ message: '请输入1-20个字符'
144
+ });
145
+ return;
146
+ }
147
+ var groupNameArr = allGroupInfos.map(function (item) {
148
+ return item.groupName;
149
+ });
150
+ if (!data.id && groupNameArr.includes(name)) {
151
+ // 如果props data没有传值 就是新建组 新建的时候不检查组名重复
152
+ notification.error({
153
+ message: '用户组名称重复'
154
+ });
155
+ return;
156
+ }
157
+ setBtnLoading(true);
158
+ var authConfig = refAuthConfig.current.getFormData();
159
+ var userIdArr = user.map(function (item) {
160
+ return item.id;
161
+ });
162
+ var formData = {
163
+ groupId: data.id || 0,
164
+ groupName: name,
165
+ authConfig: JSON.stringify(authConfig),
166
+ userIds: userIdArr.join(','),
167
+ isEncryption: isEncryption
168
+ };
169
+ request(apis.setting.updateGroupAuth, {
170
+ method: 'post',
171
+ data: formData
172
+ }).then(function () {
173
+ // let arr = []
174
+ var hasCurrentUser = user.concat(oldUser).map(function (item) {
175
+ return item.id;
176
+ }).includes(id);
177
+ updateGroupAuthCallback && updateGroupAuthCallback(hasCurrentUser);
178
+ notification.success({
179
+ message: '保存成功'
180
+ });
181
+ setBtnLoading(false);
182
+ onCancel();
183
+ }).catch(function (error) {
184
+ console.log(error);
185
+ setBtnLoading(false);
186
+ notification.error({
187
+ message: '权限修改失败'
188
+ });
189
+ });
190
+ if (currentTab === 'cep') {
191
+ var _authConfig = refAuthCEPConfig.current.getFormData();
192
+ console.log(_authConfig);
193
+ var groupIdArr = groups.map(function (item) {
194
+ return item.id;
195
+ });
196
+ var _formData = {
197
+ groupId: data.id,
198
+ appIds: _authConfig.dataAuth.map(function (item) {
199
+ return item.appId;
200
+ }),
201
+ menuIds: _authConfig.cepFunAuth.map(function (item) {
202
+ return item.resource;
203
+ })
204
+ };
205
+ setBtnLoading(true);
206
+ request(apis.setting.updateUserAuthCEP, {
207
+ method: 'post',
208
+ data: _formData
209
+ }).then(function () {
210
+ changeUserAuthCallback && changeUserAuthCallback(data && data.id);
211
+ notification.success({
212
+ message: '保存成功'
213
+ });
214
+ setBtnLoading(false);
215
+ onCancel();
216
+ }).catch(function (error) {
217
+ console.log(error);
218
+ setBtnLoading(false);
219
+ notification.error({
220
+ message: '权限修改失败'
221
+ });
222
+ });
223
+ }
224
+ };
225
+ return /*#__PURE__*/React.createElement("div", {
226
+ className: "company-setting-user-group"
227
+ }, /*#__PURE__*/React.createElement("div", {
228
+ className: "company-setting-group-title"
229
+ }, data.id ? /*#__PURE__*/React.createElement("span", null, "\u7F16\u8F91\u7528\u6237\u7EC4") : /*#__PURE__*/React.createElement("span", null, "\u521B\u5EFA\u7528\u6237\u7EC4")), /*#__PURE__*/React.createElement("div", {
230
+ className: "company-setting-user-name"
231
+ }, /*#__PURE__*/React.createElement("span", null, "\u540D\u79F0\uFF1A"), /*#__PURE__*/React.createElement(Input, {
232
+ placeholder: "\u8BF7\u8F93\u5165\u7528\u6237\u7EC4\u540D\u79F0",
233
+ style: {
234
+ width: 261
235
+ },
236
+ allowClear: true,
237
+ value: name,
238
+ onChange: function onChange(e) {
239
+ setName(e.target.value);
240
+ }
241
+ })), /*#__PURE__*/React.createElement("div", {
242
+ className: "company-setting-users"
243
+ }, /*#__PURE__*/React.createElement("span", null, "\u6210\u5458\uFF1A"), /*#__PURE__*/React.createElement("div", {
244
+ style: {
245
+ display: 'inline-block',
246
+ width: 'calc(100% - 100px)'
247
+ }
248
+ }, /*#__PURE__*/React.createElement(BizSelect, {
249
+ placeholder: "\u9009\u62E9\u7528\u6237",
250
+ overlayWidth: 261,
251
+ options: allMembers,
252
+ value: user,
253
+ labelField: "username",
254
+ keyField: "id",
255
+ popupContainer: true,
256
+ enableCreate: true,
257
+ multiple: true,
258
+ filterOption: true,
259
+ useChosenAll: true,
260
+ onChange: function onChange(e) {
261
+ setUser(e);
262
+ }
263
+ }))), !isAdmin ? /*#__PURE__*/React.createElement("div", {
264
+ className: "encryption-wrap"
265
+ }, /*#__PURE__*/React.createElement("div", {
266
+ className: "encryption-name"
267
+ }, "\u6570\u636E\u52A0\u5BC6\uFF1A"), /*#__PURE__*/React.createElement(Radio.Group, {
268
+ onChange: function onChange(e) {
269
+ return setIsEncryption(e.target.value);
270
+ },
271
+ value: isEncryption
272
+ }, /*#__PURE__*/React.createElement(Radio, {
273
+ style: {
274
+ display: 'inline-block'
275
+ },
276
+ value: 0,
277
+ className: "encryption-item"
278
+ }, "\u5BC6\u6587"), /*#__PURE__*/React.createElement(Radio, {
279
+ style: {
280
+ display: 'inline-block'
281
+ },
282
+ value: 1,
283
+ className: "encryption-item"
284
+ }, "\u660E\u6587"))) : null, /*#__PURE__*/React.createElement(Tabs, {
285
+ activeKey: currentTab,
286
+ onChange: function onChange(e) {
287
+ return setCurrentTab(e);
288
+ }
289
+ }, /*#__PURE__*/React.createElement(Tabs.TabPane, {
290
+ tab: "\u8BF8\u845Bio",
291
+ key: "io"
292
+ }, /*#__PURE__*/React.createElement(AuthConfig, {
293
+ ref: refAuthConfig,
294
+ config: data.authConfig,
295
+ appList: companyAppList,
296
+ isMarsUi: isMarsUi,
297
+ leftMenus: leftMenus
298
+ })), /*#__PURE__*/React.createElement(Tabs.TabPane, {
299
+ tab: "CEP",
300
+ key: "cep"
301
+ }, /*#__PURE__*/React.createElement(AuthConfigCEP, {
302
+ ref: refAuthCEPConfig,
303
+ CEPData: CEPData,
304
+ config: data.authConfig,
305
+ appList: companyAppList,
306
+ isMarsUi: isMarsUi,
307
+ leftMenus: leftMenus
308
+ }))), /*#__PURE__*/React.createElement("div", {
309
+ className: "company-setting-footer"
310
+ }, /*#__PURE__*/React.createElement(Button, {
311
+ onClick: onCancelCallback
312
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
313
+ style: {
314
+ marginLeft: 10
315
+ },
316
+ loading: btnLoading,
317
+ type: "primary",
318
+ onClick: onSave
319
+ }, "\u786E\u5B9A")));
320
+ };
321
+ export default CompanySettingUserGroup;
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import './index.less';
3
+ declare const _default: ({ zgText, isMarsUi, updateCurrentUser, settingDelAppCallback, settingCreateAppCallback, settingGotoAppSetting, settingGotoAppPanel, settingRemoveUserCallback, settingChangeUserAuthCallback, settingCreateMembersCallback, settingChangeAdminCallback, settingDelGroupCallback, settingUpdateGroupAuthCallback, }: {
4
+ zgText: String;
5
+ isMarsUi: Boolean;
6
+ updateCurrentUser?: (() => void) | undefined;
7
+ settingDelAppCallback?: ((formData: {}, id: Number) => void) | undefined;
8
+ settingCreateAppCallback?: ((formDat: {}, id: Number) => void) | undefined;
9
+ settingGotoAppSetting?: ((id: Number) => void) | undefined;
10
+ settingGotoAppPanel?: ((id: Number) => void) | undefined;
11
+ settingRemoveUserCallback?: ((id: Number) => void) | undefined;
12
+ settingChangeUserAuthCallback?: ((id: Number) => void) | undefined;
13
+ settingCreateMembersCallback?: (({}: {}) => void) | undefined;
14
+ settingChangeAdminCallback?: (({}: {}) => void) | undefined;
15
+ settingDelGroupCallback?: ((id: Number) => void) | undefined;
16
+ settingUpdateGroupAuthCallback?: ((isUser: Boolean) => void) | undefined;
17
+ }) => JSX.Element;
18
+ export default _default;