@zgfe/modules-settings 1.0.1-a.7 → 1.0.1-a.9

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 (28) hide show
  1. package/dist/esm/components/settingTabs/index.d.ts +12 -0
  2. package/dist/esm/components/settingTabs/index.js +52 -0
  3. package/dist/esm/components/settingTabs/index.less +31 -0
  4. package/dist/esm/constants/api.d.ts +3 -0
  5. package/dist/esm/constants/api.js +7 -2
  6. package/dist/esm/constants/icons/iconfont.css +7 -0
  7. package/dist/esm/modules/appSettings/appInfo/index.js +1 -1
  8. package/dist/esm/modules/appSettings/index.d.ts +0 -1
  9. package/dist/esm/modules/appSettings/index.js +65 -57
  10. package/dist/esm/modules/appSettings/index.less +21 -21
  11. package/dist/esm/modules/appSettings/virtualSource/index.d.ts +4 -0
  12. package/dist/esm/modules/appSettings/virtualSource/index.js +160 -0
  13. package/dist/esm/modules/appSettings/virtualSource/styles/index.less +28 -0
  14. package/dist/esm/modules/appSettings/virtualSource/styles/table.less +51 -0
  15. package/dist/esm/modules/companySetting/edit/user.js +2 -2
  16. package/dist/esm/modules/companySetting/edit/userGroup.js +2 -2
  17. package/dist/esm/modules/companySetting/virtualApp/panels/sourceItem.js +2 -1
  18. package/dist/esm/modules/companySetting/virtualApp/styles/sourceItem.less +6 -0
  19. package/dist/esm/modules/systemSetting/index.js +9 -22
  20. package/dist/esm/modules/systemSetting/notice/configItem/index.d.ts +7 -0
  21. package/dist/esm/modules/systemSetting/notice/configItem/index.js +48 -0
  22. package/dist/esm/modules/systemSetting/notice/configItem/index.less +15 -0
  23. package/dist/esm/modules/systemSetting/notice/edit/index.d.ts +15 -0
  24. package/dist/esm/modules/systemSetting/notice/edit/index.js +125 -0
  25. package/dist/esm/modules/systemSetting/notice/edit/index.less +26 -0
  26. package/dist/esm/modules/systemSetting/notice/index.d.ts +9 -0
  27. package/dist/esm/modules/systemSetting/notice/index.js +101 -0
  28. package/package.json +2 -2
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface ISettingTabsItem {
4
+ key: string;
5
+ label: string;
6
+ content: JSX.Element;
7
+ }
8
+ declare const SettingTabs: React.FC<{
9
+ items: ISettingTabsItem[];
10
+ title: JSX.Element;
11
+ }>;
12
+ export default SettingTabs;
@@ -0,0 +1,52 @@
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, { useState } from 'react';
8
+ import Sider from 'antd/lib/layout/Sider';
9
+ import Layout, { Content } from 'antd/lib/layout/layout';
10
+ import { Menu } from 'antd';
11
+ import "./index.less";
12
+ var SettingTabs = function SettingTabs(props) {
13
+ var _items$;
14
+ var title = props.title,
15
+ items = props.items;
16
+ var filterItems = items.filter(function (item) {
17
+ return !item.hidden;
18
+ });
19
+ var _useState = useState([(_items$ = items[0]) === null || _items$ === void 0 ? void 0 : _items$.key]),
20
+ _useState2 = _slicedToArray(_useState, 2),
21
+ selectedKeys = _useState2[0],
22
+ setSelectedKeys = _useState2[1];
23
+ var selectedContent = function selectedContent() {
24
+ // withRouter
25
+ var index = items.findIndex(function (item) {
26
+ return item.key === selectedKeys[0];
27
+ });
28
+ return items[index].content;
29
+ };
30
+ // 菜单点击
31
+ var menuClick = function menuClick(_ref) {
32
+ var key = _ref.key;
33
+ setSelectedKeys([key]);
34
+ };
35
+ return /*#__PURE__*/React.createElement("div", {
36
+ className: "settings-container"
37
+ }, /*#__PURE__*/React.createElement("h3", null, title), /*#__PURE__*/React.createElement(Layout, {
38
+ className: "settings-layout"
39
+ }, /*#__PURE__*/React.createElement(Sider, {
40
+ className: "settings-sider"
41
+ }, /*#__PURE__*/React.createElement(Menu, {
42
+ style: {
43
+ width: 200
44
+ },
45
+ selectedKeys: selectedKeys,
46
+ items: filterItems,
47
+ onClick: menuClick
48
+ })), /*#__PURE__*/React.createElement(Content, {
49
+ className: "settings-content"
50
+ }, selectedContent())));
51
+ };
52
+ export default SettingTabs;
@@ -0,0 +1,31 @@
1
+ .settings-container {
2
+ padding: 24px;
3
+ background: #f0f2f5;
4
+
5
+ .app-name {
6
+ font-weight: normal;
7
+ font-size: 14px;
8
+ }
9
+
10
+ .settings-layout {
11
+ height: 614px;
12
+ // overflow: auto;
13
+ padding: 24px 0px 24px;
14
+
15
+ .settings-sider {
16
+ background: white;
17
+ }
18
+
19
+ .settings-content {
20
+ max-width: 920px;
21
+ margin-left: 24px;
22
+ padding: 40px;
23
+ overflow: auto;
24
+ background: white;
25
+
26
+ .ant-menu-vertical .ant-menu-item {
27
+ margin: 0px !important;
28
+ }
29
+ }
30
+ }
31
+ }
@@ -12,6 +12,7 @@ declare let apis: {
12
12
  getCompanyAppList: string;
13
13
  editVirtualApp: string;
14
14
  queryAccountEvents: string;
15
+ editVirtualSourceApp: string;
15
16
  };
16
17
  setting: {
17
18
  updateCompanyName: string;
@@ -36,6 +37,8 @@ declare let apis: {
36
37
  updateAppName: string;
37
38
  createFilter: string;
38
39
  queryFilter: string;
40
+ queryNoticeConfig: string;
41
+ editNoticeConfig: string;
39
42
  };
40
43
  eventMeta: {
41
44
  queryEventMeta: string;
@@ -16,8 +16,10 @@ var apis = {
16
16
  // 查询公司下所有应用列表
17
17
  editVirtualApp: apiPrefix + '/common/proxy/user/editDataSource.jsp',
18
18
  // 修改虚拟应用
19
- queryAccountEvents: apiPrefix + '/common/proxy/contract/v2queryAccountEvent.jsp'
19
+ queryAccountEvents: apiPrefix + '/common/proxy/contract/v2queryAccountEvent.jsp',
20
+ editVirtualSourceApp: apiPrefix + '/common/proxy/user/editSourceApp.jsp' // 修改虚拟应用的来源应用配置
20
21
  },
22
+
21
23
  setting: {
22
24
  updateCompanyName: apiPrefix + '/common/proxy/company/v2updateInfo.jsp',
23
25
  updateLicense: apiPrefix + '/system/license',
@@ -42,7 +44,10 @@ var apis = {
42
44
  // 应用设置
43
45
  updateAppName: apiPrefix + '/common/proxy/user/updateAppName.jsp',
44
46
  createFilter: apiPrefix + '/common/proxy/user/createFilter.jsp',
45
- queryFilter: apiPrefix + '/common/proxy/user/queryFilter.jsp'
47
+ queryFilter: apiPrefix + '/common/proxy/user/queryFilter.jsp',
48
+ //系统设置
49
+ queryNoticeConfig: apiPrefix + '/systemSettings/queryNoticeSettings',
50
+ editNoticeConfig: apiPrefix + '/systemSettings/setNoticeSettings'
46
51
  },
47
52
  eventMeta: {
48
53
  queryEventMeta: apiPrefix + '/common/proxy/data/queryEventMetasOfGroup.jsp'
@@ -1465,3 +1465,10 @@
1465
1465
  content: "\e6b7";
1466
1466
  }
1467
1467
 
1468
+ .qingchu:before {
1469
+ /* content: "\e759"; */
1470
+
1471
+ content: "\e674";
1472
+
1473
+ }
1474
+
@@ -18,7 +18,7 @@ var AppInfo = function AppInfo(props) {
18
18
  var _useContext = useContext(BizGlobalDataContext),
19
19
  currentApp = _useContext.currentApp;
20
20
  var _useState = useState({
21
- appName: currentApp.appName
21
+ appName: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appName
22
22
  }),
23
23
  _useState2 = _slicedToArray(_useState, 2),
24
24
  initialValues = _useState2[0],
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import './index.less';
3
2
  declare const PersonalSetting: React.FC<{
4
3
  settingsCallback: (type: string) => void;
5
4
  }>;
@@ -1,79 +1,87 @@
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, { useState } from 'react';
8
- import { Menu } from 'antd';
1
+ import React from 'react';
9
2
  import AppInfo from "./appInfo";
10
3
  import AppMember from "./member";
11
4
  import AppSecretKey from "./secretKey";
12
5
  import AppDataAccessFilter from "./dataAccessFilter";
13
- import Layout, { Content } from 'antd/lib/layout/layout';
14
- import Sider from 'antd/lib/layout/Sider';
15
- import "./index.less";
16
6
  import { SettingOutlined } from '@ant-design/icons';
17
7
  import { useContext } from 'react';
18
8
  import { BizGlobalDataContext } from '@zgfe/business-lib';
9
+ import SettingTabs from "../../components/settingTabs";
10
+ import AppVirtualSource from "./virtualSource";
19
11
  var PersonalSetting = function PersonalSetting(props) {
20
12
  var settingsCallback = props.settingsCallback;
21
- var _useState = useState('1'),
22
- _useState2 = _slicedToArray(_useState, 2),
23
- currentTab = _useState2[0],
24
- setCurrentTab = _useState2[1];
13
+ // const [currentTab, setCurrentTab] = useState('1');
25
14
  var _useContext = useContext(BizGlobalDataContext),
26
15
  currentApp = _useContext.currentApp;
16
+ var title = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(SettingOutlined, null), "\u5E94\u7528\u8BBE\u7F6E", /*#__PURE__*/React.createElement("span", {
17
+ className: "app-name"
18
+ }, "(", currentApp === null || currentApp === void 0 ? void 0 : currentApp.appName, ")"));
27
19
  var items = [{
28
20
  key: '1',
29
- label: '应用信息'
21
+ label: '应用信息',
22
+ content: /*#__PURE__*/React.createElement(AppInfo, {
23
+ settingsCallback: settingsCallback
24
+ })
30
25
  }, {
31
26
  key: '2',
32
- label: '应用成员'
27
+ label: '应用成员',
28
+ content: /*#__PURE__*/React.createElement(AppMember, null)
33
29
  }, {
34
30
  key: '3',
35
- label: 'Secret Key'
31
+ label: '配置数据源',
32
+ content: /*#__PURE__*/React.createElement(AppVirtualSource, null),
33
+ hidden: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.appType) !== 'virtual'
36
34
  }, {
37
35
  key: '4',
38
- label: '数据采集屏蔽'
36
+ label: 'Secret Key',
37
+ content: /*#__PURE__*/React.createElement(AppSecretKey, null)
38
+ }, {
39
+ key: '5',
40
+ label: '数据采集屏蔽',
41
+ content: /*#__PURE__*/React.createElement(AppDataAccessFilter, null)
39
42
  }];
40
- var renderComponent = function renderComponent() {
41
- if (currentTab === '1') {
42
- return /*#__PURE__*/React.createElement(AppInfo, {
43
- settingsCallback: settingsCallback
44
- });
45
- } else if (currentTab === '2') {
46
- return /*#__PURE__*/React.createElement(AppMember, null);
47
- } else if (currentTab === '3') {
48
- return /*#__PURE__*/React.createElement(AppSecretKey, null);
49
- } else if (currentTab === '4') {
50
- return /*#__PURE__*/React.createElement(AppDataAccessFilter, null);
51
- }
52
- };
53
- var menuClick = function menuClick(_ref) {
54
- var key = _ref.key;
55
- setCurrentTab(key);
56
- };
57
- return /*#__PURE__*/React.createElement("div", {
58
- className: "settings-container"
59
- }, /*#__PURE__*/React.createElement("h3", null, /*#__PURE__*/React.createElement(SettingOutlined, null), "\u5E94\u7528\u8BBE\u7F6E", /*#__PURE__*/React.createElement("span", {
60
- className: "app-name"
61
- }, "(", currentApp === null || currentApp === void 0 ? void 0 : currentApp.appName, ")")), /*#__PURE__*/React.createElement(Layout, {
62
- className: "settings-layout"
63
- }, /*#__PURE__*/React.createElement(Sider, {
64
- className: "settings-sider"
65
- }, /*#__PURE__*/React.createElement(Menu, {
66
- style: {
67
- width: 200
68
- },
69
- defaultSelectedKeys: ['1'],
70
- items: items,
71
- onClick: menuClick
72
- })), /*#__PURE__*/React.createElement(Content, {
73
- className: "settings-content",
74
- style: {
75
- marginLeft: 24
76
- }
77
- }, renderComponent())));
43
+ // const renderComponent = () => {
44
+ // if (currentTab === '1') {
45
+ // return <AppInfo settingsCallback={settingsCallback}></AppInfo>;
46
+ // } else if (currentTab === '2') {
47
+ // return <AppMember></AppMember>;
48
+ // } else if (currentTab === '3') {
49
+ // return <AppSecretKey></AppSecretKey>;
50
+ // } else if (currentTab === '4') {
51
+ // return <AppDataAccessFilter></AppDataAccessFilter>;
52
+ // }
53
+ // };
54
+
55
+ // const menuClick = ({ key }: MenuItemType) => {
56
+ // setCurrentTab(key as string);
57
+ // };
58
+
59
+ return (
60
+ /*#__PURE__*/
61
+ // <div className="settings-container">
62
+ // <h3>
63
+ // <SettingOutlined />
64
+ // 应用设置
65
+ // <span className="app-name">({currentApp?.appName})</span>
66
+ // </h3>
67
+ // <Layout className="settings-layout">
68
+ // <Sider className="settings-sider">
69
+ // <Menu
70
+ // style={{ width: 200 }}
71
+ // defaultSelectedKeys={['1']}
72
+ // items={items}
73
+ // onClick={menuClick}
74
+ // />
75
+ // </Sider>
76
+ // <Content className="settings-content" style={{ marginLeft: 24 }}>
77
+ // {renderComponent()}
78
+ // </Content>
79
+ // </Layout>
80
+ // {/* </div> */}
81
+ React.createElement("div", null, /*#__PURE__*/React.createElement(SettingTabs, {
82
+ title: title,
83
+ items: items
84
+ }))
85
+ );
78
86
  };
79
87
  export default PersonalSetting;
@@ -1,21 +1,21 @@
1
- .settings-container {
2
- padding: 24px;
3
- background: #f0f2f5;
4
- .app-name {
5
- font-weight: normal;
6
- font-size: 14px;
7
- }
8
- .settings-layout {
9
- height: 614px;
10
- padding: 24px 0px 24px;
11
- .settings-sider {
12
- background: white;
13
- }
14
- .settings-content {
15
- max-width: 920px;
16
- margin-left: 24px;
17
- padding: 40px;
18
- background: white;
19
- }
20
- }
21
- }
1
+ // .settings-container {
2
+ // padding: 24px;
3
+ // background: #f0f2f5;
4
+ // .app-name {
5
+ // font-weight: normal;
6
+ // font-size: 14px;
7
+ // }
8
+ // .settings-layout {
9
+ // height: 614px;
10
+ // padding: 24px 0px 24px;
11
+ // .settings-sider {
12
+ // background: white;
13
+ // }
14
+ // .settings-content {
15
+ // max-width: 920px;
16
+ // margin-left: 24px;
17
+ // padding: 40px;
18
+ // background: white;
19
+ // }
20
+ // }
21
+ // }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './styles/index.less';
3
+ declare const AppVirtualSource: React.FC;
4
+ export default AppVirtualSource;
@@ -0,0 +1,160 @@
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 { BizGlobalDataContext } from '@zgfe/business-lib';
8
+ import { notification } from 'antd';
9
+ import React, { useEffect } from 'react';
10
+ import { useContext } from 'react';
11
+ import { useState } from 'react';
12
+ import api from "../../../constants/api";
13
+ import request, { urlRequest } from "../../../utils/ajax";
14
+ import util from "../../../utils/util";
15
+ import SourceItem from "../../companySetting/virtualApp/panels/sourceItem";
16
+ import "./styles/index.less";
17
+ var AppVirtualSource = function AppVirtualSource(props) {
18
+ var _useContext = useContext(BizGlobalDataContext),
19
+ currentApp = _useContext.currentApp;
20
+ // const { currentApp } = { currentApp: { appId: 99775 } };
21
+ var _useState = useState([]),
22
+ _useState2 = _slicedToArray(_useState, 2),
23
+ sourceApps = _useState2[0],
24
+ setSourceApps = _useState2[1];
25
+ var _useState3 = useState({}),
26
+ _useState4 = _slicedToArray(_useState3, 2),
27
+ virtualAppsIdMap = _useState4[0],
28
+ setVirtualAppsIdMap = _useState4[1];
29
+ var _useState5 = useState(null),
30
+ _useState6 = _slicedToArray(_useState5, 2),
31
+ selectApp = _useState6[0],
32
+ setSelectApp = _useState6[1];
33
+ var _useState7 = useState({}),
34
+ _useState8 = _slicedToArray(_useState7, 2),
35
+ sourceAppIdMap = _useState8[0],
36
+ setSourceAppIdMap = _useState8[1];
37
+ var _useState9 = useState([]),
38
+ _useState10 = _slicedToArray(_useState9, 2),
39
+ configData = _useState10[0],
40
+ setConfigData = _useState10[1];
41
+ useEffect(function () {
42
+ Promise.all([queryVirtualApps(), getCompanyAppList()]).then(function (res) {});
43
+ }, []);
44
+ // 普通应用列表
45
+ var getCompanyAppList = function getCompanyAppList() {
46
+ return new Promise(function (resolve, reject) {
47
+ request(api.app.getCompanyAppList, {}).then(function (res) {
48
+ var resSourceApps = res && res.applist || [];
49
+ setSourceApps(resSourceApps);
50
+ var result = [];
51
+ resSourceApps.map(function (realApp) {
52
+ if (sourceAppIdMap[realApp.id]) {
53
+ result.push({
54
+ app_id: realApp.id,
55
+ event_id: getSourceAppEventIdArr(realApp.id)
56
+ });
57
+ } else {
58
+ result.push(null);
59
+ }
60
+ });
61
+ setConfigData(result);
62
+ resolve(resSourceApps);
63
+ }).catch(function (err) {
64
+ reject(err);
65
+ notification.error({
66
+ message: '查询虚拟应用失败'
67
+ });
68
+ });
69
+ });
70
+ };
71
+ // 虚拟应用列表
72
+ var queryVirtualApps = function queryVirtualApps() {
73
+ return new Promise(function (resolve, reject) {
74
+ request(api.app.queryVirtualApps, {}).then(function (res) {
75
+ if (res.code !== 10001) {
76
+ throw new Error('查询虚拟应用失败');
77
+ }
78
+ var list = res.app_list;
79
+ var idMap = {};
80
+ list.forEach(function (item) {
81
+ idMap[item.app_id] = item;
82
+ });
83
+ // setVirtualAppList(list);
84
+ setVirtualAppsIdMap(idMap);
85
+ setSelectApp(idMap[currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
86
+ var sources = idMap[currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId].data_source || [];
87
+ var idMaps = {};
88
+ sources.forEach(function (item) {
89
+ idMaps[item.source_app_id] = item;
90
+ });
91
+ setSourceAppIdMap(idMaps);
92
+ resolve(idMaps);
93
+ }).catch(function (err) {
94
+ reject(err);
95
+ notification.error({
96
+ message: '查询虚拟应用失败'
97
+ });
98
+ });
99
+ });
100
+ };
101
+ var getSourceAppEventIdArr = function getSourceAppEventIdArr(sourceAppId) {
102
+ var sourceData = sourceAppIdMap[sourceAppId] || {};
103
+ return sourceData.source_event_id || [];
104
+ };
105
+ var changeData = function changeData(event_id, app_id, checked, index) {
106
+ var _dealData$index, _dealData$index2;
107
+ var dealData = util.clone(configData);
108
+ dealData[index] = checked ? {
109
+ app_id: app_id,
110
+ event_id: event_id
111
+ } : null;
112
+ // 保存单条数据
113
+ urlRequest(api.app.editVirtualSourceApp, {
114
+ method: 'post',
115
+ data: {
116
+ virtual_app_id: selectApp.app_id,
117
+ source_app_id: (_dealData$index = dealData[index]) === null || _dealData$index === void 0 ? void 0 : _dealData$index.app_id,
118
+ source_event_list: decodeURIComponent(JSON.stringify((_dealData$index2 = dealData[index]) === null || _dealData$index2 === void 0 ? void 0 : _dealData$index2.event_id))
119
+ }
120
+ }).then(function (res) {
121
+ if (res.code === 10001) {
122
+ notification.success({
123
+ message: '修改成功'
124
+ });
125
+ } else {
126
+ throw new Error('请求失败');
127
+ }
128
+ }).catch(function (err) {
129
+ notification.error({
130
+ message: '修改失败,请重试!'
131
+ });
132
+ });
133
+ setConfigData(dealData);
134
+ };
135
+ return /*#__PURE__*/React.createElement("div", null, selectApp ? /*#__PURE__*/React.createElement("div", {
136
+ className: "app-setting-virtual-source"
137
+ }, /*#__PURE__*/React.createElement("div", {
138
+ className: "source-app-list virtual-app-table-box"
139
+ }, /*#__PURE__*/React.createElement("div", {
140
+ className: "table-title"
141
+ }, /*#__PURE__*/React.createElement("span", {
142
+ className: "source-app-name"
143
+ }, "\u6E90\u5E94\u7528"), /*#__PURE__*/React.createElement("span", {
144
+ className: "source-app-events-num"
145
+ }, "\u5E94\u7528\u4E8B\u4EF6")), /*#__PURE__*/React.createElement("div", {
146
+ className: "table-body"
147
+ }, sourceApps === null || sourceApps === void 0 ? void 0 : sourceApps.map(function (realApp, index) {
148
+ return /*#__PURE__*/React.createElement(SourceItem, {
149
+ key: realApp.id,
150
+ sourceAppId: realApp.id,
151
+ checked: sourceAppIdMap[realApp.id],
152
+ sourceAppName: realApp.appName,
153
+ sourceEventsId: getSourceAppEventIdArr(realApp.id),
154
+ onChange: function onChange(event_id, app_id, checked) {
155
+ changeData(event_id, app_id, checked, index);
156
+ }
157
+ });
158
+ })))) : /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u6570\u636E"));
159
+ };
160
+ export default AppVirtualSource;
@@ -0,0 +1,28 @@
1
+ @import url(./table.less);
2
+
3
+ .app-setting-virtual-source {
4
+ height: 100%;
5
+ min-height: 120px;
6
+ padding: 20px;
7
+ overflow: auto;
8
+
9
+ .source-app-list {
10
+ width: 100%;
11
+ height: auto;
12
+
13
+ .source-app-name {
14
+ display: inline-block;
15
+ width: 354px;
16
+ margin-left: 10px;
17
+
18
+ .source-app-events-num {
19
+ display: inline-block;
20
+ // margin-left: 10px;
21
+
22
+ .empty-data {
23
+ line-height: 47px;
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,51 @@
1
+ .virtual-app-table-box {
2
+ display: flex;
3
+ flex-direction: column;
4
+ width: 100%;
5
+ font-size: 14px;
6
+ border: 1px solid #dadada;
7
+
8
+ .table-title {
9
+ display: flex;
10
+ flex-shrink: 0;
11
+ // padding: 0 20px;
12
+ box-sizing: border-box;
13
+ height: 32px;
14
+ color: #565656;
15
+ font-size: 0;
16
+ line-height: 32px;
17
+ background: #e6e6e6;
18
+
19
+ > div,
20
+ > span {
21
+ display: inline-block;
22
+ // margin-left: 10px;
23
+ font-size: 14px;
24
+
25
+ .table-body {
26
+ min-height: 47px;
27
+ padding: 0 20px;
28
+
29
+ .empty-data {
30
+ text-align: center;
31
+
32
+ > div,
33
+ > span {
34
+ border-bottom: 1px solid #eeeeee;
35
+
36
+ > div,
37
+ > span {
38
+ display: inline-block;
39
+ margin-left: 10px;
40
+ font-size: 14px;
41
+
42
+ &:last-child {
43
+ border: none;
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
@@ -47,7 +47,7 @@ var Info = function Info(props) {
47
47
  _useState4 = _slicedToArray(_useState3, 2),
48
48
  CEPData = _useState4[0],
49
49
  setCEPData = _useState4[1];
50
- var _useState5 = useState('io'),
50
+ var _useState5 = useState(serviceType === 2 ? 'cep' : 'io'),
51
51
  _useState6 = _slicedToArray(_useState5, 2),
52
52
  currentTab = _useState6[0],
53
53
  setCurrentTab = _useState6[1];
@@ -107,7 +107,7 @@ var Info = function Info(props) {
107
107
  var onSaveCallback = function onSaveCallback() {
108
108
  // if (currentTab === 'io'){
109
109
  // "funAuth":[{"resource":"/user/userList","opts":["all"]},{"resource":"/user/userGroup","opts":["all"]},{"resource":"/user/userTags","opts":["all"]},{"resource":"/setting/company","opts":["all"]}]
110
- var authConfig = refAuthConfig.current.getFormData();
110
+ var authConfig = serviceType !== 2 ? refAuthConfig.current.getFormData() : {};
111
111
  var groupIdArr = groups.map(function (item) {
112
112
  return item.id;
113
113
  });
@@ -59,7 +59,7 @@ var CompanySettingUserGroup = function CompanySettingUserGroup(props) {
59
59
  _useState12 = _slicedToArray(_useState11, 2),
60
60
  CEPData = _useState12[0],
61
61
  setCEPData = _useState12[1];
62
- var _useState13 = useState('io'),
62
+ var _useState13 = useState(serviceType === 2 ? 'cep' : 'io'),
63
63
  _useState14 = _slicedToArray(_useState13, 2),
64
64
  currentTab = _useState14[0],
65
65
  setCurrentTab = _useState14[1];
@@ -158,7 +158,7 @@ var CompanySettingUserGroup = function CompanySettingUserGroup(props) {
158
158
  return;
159
159
  }
160
160
  setBtnLoading(true);
161
- var authConfig = refAuthConfig.current.getFormData();
161
+ var authConfig = serviceType !== 2 ? refAuthConfig.current.getFormData() : {};
162
162
  var userIdArr = user.map(function (item) {
163
163
  return item.id;
164
164
  });
@@ -136,7 +136,8 @@ var VirtualApp = function VirtualApp(props) {
136
136
  })))), showTransfer ? /*#__PURE__*/React.createElement("div", {
137
137
  className: "source-transfer-item"
138
138
  }, /*#__PURE__*/React.createElement("span", {
139
- className: "source-app-transfer"
139
+ className: "source-app-transfer",
140
+ id: "selfTransfer"
140
141
  }, /*#__PURE__*/React.createElement(Transfer, {
141
142
  dataSource: dataSource,
142
143
  showSearch: true,
@@ -25,3 +25,9 @@
25
25
  height: 310px;
26
26
  }
27
27
  }
28
+
29
+ #selfTransfer {
30
+ .ant-transfer-list-body-with-search {
31
+ padding-top: 0px;
32
+ }
33
+ }
@@ -1,31 +1,18 @@
1
1
  import React from 'react';
2
- import { Menu } from 'antd';
3
- import Layout, { Content } from 'antd/lib/layout/layout';
4
- import Sider from 'antd/lib/layout/Sider';
5
2
  import "./index.less";
6
3
  import { DesktopOutlined } from '@ant-design/icons';
4
+ import Notice from "./notice";
5
+ import SettingTabs from "../../components/settingTabs";
7
6
  var SystemSetting = function SystemSetting() {
7
+ var title = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DesktopOutlined, null), "\u7CFB\u7EDF\u8BBE\u7F6E");
8
8
  var items = [{
9
9
  key: '1',
10
- label: '应用信息'
10
+ label: '通知配置',
11
+ content: /*#__PURE__*/React.createElement(Notice, null)
11
12
  }];
12
- return /*#__PURE__*/React.createElement("div", {
13
- className: "settings-container"
14
- }, /*#__PURE__*/React.createElement("h3", null, /*#__PURE__*/React.createElement(DesktopOutlined, null), "\u7CFB\u7EDF\u8BBE\u7F6E"), /*#__PURE__*/React.createElement(Layout, {
15
- className: "settings-layout"
16
- }, /*#__PURE__*/React.createElement(Sider, {
17
- className: "settings-sider"
18
- }, /*#__PURE__*/React.createElement(Menu, {
19
- style: {
20
- width: 200
21
- },
22
- defaultSelectedKeys: ['1'],
23
- items: items
24
- })), /*#__PURE__*/React.createElement(Content, {
25
- className: "settings-content",
26
- style: {
27
- marginLeft: 24
28
- }
29
- }, "\u901A\u77E5\u914D\u7F6E")));
13
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(SettingTabs, {
14
+ items: items,
15
+ title: title
16
+ }));
30
17
  };
31
18
  export default SystemSetting;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ declare const ConfigItem: React.FC<{
4
+ item: any;
5
+ onEdit: (item: any) => any;
6
+ }>;
7
+ export default ConfigItem;
@@ -0,0 +1,48 @@
1
+ import { Button, Col, Descriptions, Row } from 'antd';
2
+ import { EditOutlined } from '@ant-design/icons';
3
+ import React from 'react';
4
+ import "./index.less";
5
+ var ConfigItem = function ConfigItem(props) {
6
+ var _configFieldMap$get;
7
+ var onEdit = props.onEdit,
8
+ item = props.item;
9
+ var configFieldMap = new Map().set('email', [{
10
+ name: 'host',
11
+ value: 'URL'
12
+ }, {
13
+ name: 'user',
14
+ value: '邮箱账号'
15
+ }, {
16
+ name: 'port',
17
+ value: '端口号'
18
+ }, {
19
+ name: 'fromName',
20
+ value: '发件人昵称'
21
+ }]);
22
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Row, {
23
+ className: "item-title"
24
+ }, /*#__PURE__*/React.createElement(Col, {
25
+ span: 12,
26
+ className: "title-left"
27
+ }, /*#__PURE__*/React.createElement("span", null, item.name)), /*#__PURE__*/React.createElement(Col, {
28
+ span: 12,
29
+ className: "title-right"
30
+ }, /*#__PURE__*/React.createElement(Button, {
31
+ type: "primary",
32
+ onClick: function onClick() {
33
+ return onEdit(item);
34
+ }
35
+ }, /*#__PURE__*/React.createElement(EditOutlined, {
36
+ style: {
37
+ color: 'white'
38
+ }
39
+ }), "\u7F16\u8F91"))), /*#__PURE__*/React.createElement(Descriptions, {
40
+ column: 1
41
+ }, (_configFieldMap$get = configFieldMap.get(item.type)) === null || _configFieldMap$get === void 0 ? void 0 : _configFieldMap$get.map(function (field) {
42
+ return /*#__PURE__*/React.createElement(Descriptions.Item, {
43
+ key: field.value,
44
+ label: field.value
45
+ }, item.config[field.name]);
46
+ })));
47
+ };
48
+ export default ConfigItem;
@@ -0,0 +1,15 @@
1
+ .item-title {
2
+ height: 48px;
3
+ margin: 0px -40px 24px -40px;
4
+ padding: 0px 40px;
5
+ line-height: 48px;
6
+ background-color: #f7f8f9;
7
+
8
+ .title-left {
9
+ font-size: 16px;
10
+ }
11
+
12
+ .title-right {
13
+ text-align: right;
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export interface ISystemSettingItem {
4
+ host: string;
5
+ user: string;
6
+ pass: string;
7
+ port: string;
8
+ fromName: string;
9
+ }
10
+ declare const ItemEdit: React.FC<{
11
+ editSetting: any;
12
+ editCancel: () => void;
13
+ onSubmit: (values: ISystemSettingItem) => void;
14
+ }>;
15
+ export default ItemEdit;
@@ -0,0 +1,125 @@
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 { Form, Input, Button, Col, Row } from 'antd';
8
+ import React, { useState } from 'react';
9
+ import constants from "../../../../utils/constants";
10
+ import "./index.less";
11
+ var ItemEdit = function ItemEdit(props) {
12
+ var _settingsOptionsMap$g, _settingsOptionsMap$g2;
13
+ var _Form$useForm = Form.useForm(),
14
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
15
+ form = _Form$useForm2[0];
16
+ var editSetting = props.editSetting,
17
+ editCancel = props.editCancel,
18
+ onSubmit = props.onSubmit;
19
+ var _useState = useState(editSetting.config),
20
+ _useState2 = _slicedToArray(_useState, 2),
21
+ initialValues = _useState2[0],
22
+ setInitialValues = _useState2[1];
23
+ var settingsOptionsMap = new Map().set('email', {
24
+ config: [{
25
+ name: 'host',
26
+ field: 'URL',
27
+ rules: [{
28
+ required: true,
29
+ message: '邮箱服务器URL未填写'
30
+ }],
31
+ placeholder: '输入您的邮件URL'
32
+ }, {
33
+ name: 'user',
34
+ field: '邮箱账号',
35
+ rules: [{
36
+ required: true,
37
+ message: '请输入您的邮箱账号'
38
+ }, {
39
+ pattern: constants.regExp.email,
40
+ message: '请输入正确格式的邮箱'
41
+ }],
42
+ placeholder: '输入您的邮件账号'
43
+ }, {
44
+ name: 'pass',
45
+ field: '授权码',
46
+ rules: [{
47
+ required: true,
48
+ message: '授权码未填写'
49
+ }],
50
+ type: 'password',
51
+ placeholder: '输入您的授权码'
52
+ }, {
53
+ name: 'port',
54
+ field: '端口号',
55
+ rules: [{
56
+ required: true,
57
+ message: '请输入端口号'
58
+ }, {
59
+ pattern: /^\d{1,10}$/,
60
+ message: '端口请输入长度小于10的数字'
61
+ }],
62
+ placeholder: '请输入端口号'
63
+ }, {
64
+ name: 'fromName',
65
+ field: '发件人昵称',
66
+ rules: [{
67
+ max: 10,
68
+ message: '昵称长度不可大于10'
69
+ }],
70
+ required: false
71
+ }]
72
+ });
73
+
74
+ // 确认
75
+ var onFinish = function onFinish() {
76
+ onSubmit(form.getFieldsValue());
77
+ };
78
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
79
+ className: "item-edit-title"
80
+ }, editSetting.name, "\u914D\u7F6E"), /*#__PURE__*/React.createElement("div", {
81
+ className: "subtitle"
82
+ }, "\u53C2\u6570\u914D\u7F6E"), /*#__PURE__*/React.createElement(Form, {
83
+ form: form,
84
+ layout: "vertical",
85
+ labelCol: {
86
+ span: 8
87
+ },
88
+ wrapperCol: {
89
+ span: 16
90
+ },
91
+ initialValues: initialValues,
92
+ onFinish: onFinish
93
+ }, /*#__PURE__*/React.createElement(Row, null, (_settingsOptionsMap$g = settingsOptionsMap.get(editSetting.type)) === null || _settingsOptionsMap$g === void 0 ? void 0 : (_settingsOptionsMap$g2 = _settingsOptionsMap$g.config) === null || _settingsOptionsMap$g2 === void 0 ? void 0 : _settingsOptionsMap$g2.map(function (config, index) {
94
+ return /*#__PURE__*/React.createElement(Col, {
95
+ span: 12,
96
+ key: index
97
+ }, /*#__PURE__*/React.createElement(Form.Item, {
98
+ label: config.field,
99
+ name: config.name,
100
+ rules: config.rules
101
+ }, /*#__PURE__*/React.createElement(Input, {
102
+ placeholder: config.placeholder,
103
+ type: config.type === 'password' ? 'password' : 'text'
104
+ })));
105
+ }), /*#__PURE__*/React.createElement(Col, {
106
+ span: 24,
107
+ className: "operation-container"
108
+ }, /*#__PURE__*/React.createElement(Form.Item, {
109
+ shouldUpdate: true
110
+ }, function () {
111
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
112
+ type: "primary",
113
+ htmlType: "submit",
114
+ disabled: !!form.getFieldsError().filter(function (_ref) {
115
+ var errors = _ref.errors;
116
+ return errors.length;
117
+ }).length || JSON.stringify(initialValues) === JSON.stringify(form.getFieldsValue())
118
+ }, "\u786E\u8BA4"), /*#__PURE__*/React.createElement(Button, {
119
+ onClick: function onClick() {
120
+ return editCancel();
121
+ }
122
+ }, "\u53D6\u6D88"));
123
+ })))));
124
+ };
125
+ export default ItemEdit;
@@ -0,0 +1,26 @@
1
+ .item-edit-title {
2
+ height: 48px;
3
+ margin: -40px -40px 24px;
4
+ padding-left: 40px;
5
+ font-size: 16px;
6
+ line-height: 48px;
7
+ background-color: #f7f8f9;
8
+ }
9
+
10
+ .operation-container {
11
+ margin-top: 24px;
12
+
13
+ button {
14
+ margin-right: 12px;
15
+ }
16
+ }
17
+
18
+ .subtitle {
19
+ width: 700px;
20
+ margin-bottom: 24px;
21
+ color: #999;
22
+ font-weight: 400;
23
+ font-size: 16px;
24
+ font-family: PingFangSC-Regular, PingFang SC;
25
+ line-height: 14px;
26
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ISystemSettingItem } from './edit';
3
+ export interface IConfigItem {
4
+ name: string;
5
+ type: string;
6
+ config: ISystemSettingItem;
7
+ }
8
+ declare const Notice: React.FC;
9
+ export default Notice;
@@ -0,0 +1,101 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ 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."); }
7
+ 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); }
8
+ 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; }
9
+ 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; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import { notification } from 'antd';
12
+ import React from 'react';
13
+ import { useState } from 'react';
14
+ import { useEffect } from 'react';
15
+ import apis from "../../../constants/api";
16
+ import request, { urlRequest } from "../../../utils/ajax";
17
+ import ConfigItem from "./configItem";
18
+ import ItemEdit from "./edit";
19
+ var Notice = function Notice() {
20
+ var typeMap = new Map([[1, 'email']]);
21
+ var _useState = useState(new Map().set('email', {
22
+ type: 'email',
23
+ name: '邮件',
24
+ config: {}
25
+ })),
26
+ _useState2 = _slicedToArray(_useState, 2),
27
+ settingMap = _useState2[0],
28
+ setSettingMap = _useState2[1];
29
+ var _useState3 = useState(false),
30
+ _useState4 = _slicedToArray(_useState3, 2),
31
+ isEdit = _useState4[0],
32
+ setIsEdit = _useState4[1];
33
+ var _useState5 = useState({}),
34
+ _useState6 = _slicedToArray(_useState5, 2),
35
+ editSetting = _useState6[0],
36
+ setEditSetting = _useState6[1];
37
+ useEffect(function () {
38
+ // 获取配置
39
+ request(apis.setting.queryNoticeConfig, {
40
+ method: 'post'
41
+ }).then(function (res) {
42
+ res.data.forEach(function (item) {
43
+ settingMap.get(typeMap.get(item.type)).config = JSON.parse(item.config);
44
+ var newSettingMap = new Map(_toConsumableArray(settingMap));
45
+ setSettingMap(newSettingMap);
46
+ });
47
+ });
48
+ }, []);
49
+
50
+ // 点击编辑按钮
51
+ var onEdit = function onEdit(item) {
52
+ setIsEdit(true);
53
+ setEditSetting(item);
54
+ };
55
+
56
+ // 编辑-取消
57
+ var onEditCancel = function onEditCancel() {
58
+ setIsEdit(false);
59
+ };
60
+
61
+ // 编辑-确认
62
+ var onEditSubmit = function onEditSubmit(values) {
63
+ var formData = new FormData();
64
+ formData.set('type', editSetting.type);
65
+ formData.set('config', JSON.stringify(values));
66
+ urlRequest(apis.setting.editNoticeConfig, {
67
+ method: 'post',
68
+ // data: formData,
69
+ data: {
70
+ type: editSetting.type === 'email' ? 1 : null,
71
+ config: JSON.stringify(values)
72
+ }
73
+ }).then(function (res) {
74
+ if (res.status === 200) {
75
+ notification.success({
76
+ message: '配置成功'
77
+ });
78
+ settingMap.get(editSetting.type).config = values;
79
+ var newSettingMap = new Map(_toConsumableArray(settingMap));
80
+ setSettingMap(newSettingMap);
81
+ setIsEdit(false);
82
+ } else {
83
+ notification.error({
84
+ message: '配置失败'
85
+ });
86
+ }
87
+ });
88
+ };
89
+ return /*#__PURE__*/React.createElement("div", null, isEdit ? /*#__PURE__*/React.createElement(ItemEdit, {
90
+ editSetting: editSetting,
91
+ editCancel: onEditCancel,
92
+ onSubmit: onEditSubmit
93
+ }) : /*#__PURE__*/React.createElement("div", null, (_toConsumableArray(settingMap) || []).map(function (item) {
94
+ return /*#__PURE__*/React.createElement(ConfigItem, {
95
+ key: item[0],
96
+ item: item[1],
97
+ onEdit: onEdit
98
+ });
99
+ })));
100
+ };
101
+ export default Notice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-settings",
3
- "version": "1.0.1-a.7",
3
+ "version": "1.0.1-a.9",
4
4
  "module": "dist/esm/index.js",
5
5
  "typings": "dist/esm/index.d.ts",
6
6
  "files": [
@@ -50,7 +50,7 @@
50
50
  "umi-request": "^1.4.0",
51
51
  "yorkie": "^2.0.0"
52
52
  },
53
- "gitHead": "595394564889d158714137705b73dcca1bad3504",
53
+ "gitHead": "46b6d784fa0b2a7e6789f520cc8ce1763e568218",
54
54
  "gitHooks": {
55
55
  "pre-commit": "lint-staged"
56
56
  }