@zgfe/modules-interval 1.0.8 → 1.0.10-beiming.1

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 (64) hide show
  1. package/README.md +33 -33
  2. package/dist/esm/components/common/styles/index.less +40 -40
  3. package/dist/esm/components/eventFilter/index.js +17 -21
  4. package/dist/esm/components/eventFilter/styles/index.less +39 -39
  5. package/dist/esm/components/eventFilter/types.d.ts +4 -3
  6. package/dist/esm/components/renderContent/styles/index.less +36 -33
  7. package/dist/esm/components/searchPanel/index.js +5 -11
  8. package/dist/esm/components/searchPanel/styles/index.less +64 -64
  9. package/dist/esm/components/table/index.js +5 -4
  10. package/dist/esm/components/table/styles/index.less +138 -138
  11. package/dist/esm/components/topBar/index.js +4 -4
  12. package/dist/esm/components/topBar/styles/index.less +50 -50
  13. package/dist/esm/components/topBar/types.d.ts +3 -2
  14. package/dist/esm/constants/apis.d.ts +1 -5
  15. package/dist/esm/constants/apis.js +15 -4
  16. package/dist/esm/constants/fields.js +4 -4
  17. package/dist/esm/modules/chart/index.js +4 -3
  18. package/dist/esm/modules/chart/index.less +58 -58
  19. package/dist/esm/modules/chart/intervalChart.js +2 -2
  20. package/dist/esm/modules/chart/types.d.ts +1 -0
  21. package/dist/esm/modules/content/index.js +28 -44
  22. package/dist/esm/modules/content/styles/index.less +7 -7
  23. package/dist/esm/modules/content/types.d.ts +4 -3
  24. package/dist/esm/modules/content/utils.d.ts +2 -0
  25. package/dist/esm/modules/content/utils.js +16 -14
  26. package/dist/esm/modules/home/demo/edit.js +1 -1
  27. package/dist/esm/modules/home/demo/index.js +7 -15
  28. package/dist/esm/modules/home/demo/scene.js +1 -1
  29. package/dist/esm/modules/home/demo/styles/index.less +33 -33
  30. package/dist/esm/modules/home/index.d.ts +2 -2
  31. package/dist/esm/modules/home/index.js +59 -46
  32. package/dist/esm/modules/home/styles/index.less +66 -60
  33. package/dist/esm/modules/home/types.d.ts +7 -4
  34. package/dist/esm/modules/home/types.js +2 -2
  35. package/dist/esm/modules/topPanel/index.js +246 -127
  36. package/dist/esm/modules/topPanel/styles/index.less +213 -186
  37. package/dist/esm/modules/topPanel/types.d.ts +6 -9
  38. package/dist/esm/modules/topPanel/types.js +5 -1
  39. package/dist/esm/style/image/empty.png +0 -0
  40. package/dist/esm/style/image/ring.svg +9 -9
  41. package/dist/esm/style/index.less +67 -53
  42. package/dist/esm/types.d.ts +25 -28
  43. package/dist/esm/types.js +7 -7
  44. package/dist/esm/utils/ajaxConfig.js +5 -5
  45. package/dist/esm/utils/formData.d.ts +7 -2
  46. package/dist/esm/utils/formData.js +91 -39
  47. package/dist/esm/utils/util.js +28 -28
  48. package/package.json +9 -4
  49. package/dist/esm/assets/business/demo.css +0 -539
  50. package/dist/esm/assets/business/demo_index.html +0 -3316
  51. package/dist/esm/assets/business/iconfont.css +0 -559
  52. package/dist/esm/assets/business/iconfont.js +0 -43
  53. package/dist/esm/assets/business/iconfont.json +0 -961
  54. package/dist/esm/assets/business/iconfont.ttf +0 -0
  55. package/dist/esm/assets/business/iconfont.woff +0 -0
  56. package/dist/esm/assets/business/iconfont.woff2 +0 -0
  57. package/dist/esm/assets/icons/demo.css +0 -539
  58. package/dist/esm/assets/icons/demo_index.html +0 -9618
  59. package/dist/esm/assets/icons/iconfont.css +0 -1655
  60. package/dist/esm/assets/icons/iconfont.js +0 -43
  61. package/dist/esm/assets/icons/iconfont.json +0 -2879
  62. package/dist/esm/assets/icons/iconfont.ttf +0 -0
  63. package/dist/esm/assets/icons/iconfont.woff +0 -0
  64. package/dist/esm/assets/icons/iconfont.woff2 +0 -0
@@ -14,14 +14,13 @@ import { ajax, BizGlobalDataContext, BizLayout, BizTargetFromPanelContext } from
14
14
  import React, { useContext, useEffect, useRef, useState } from 'react';
15
15
  import Request from 'umi-request';
16
16
  import TopBar from "../../components/topBar";
17
- import { EventContext } from "../../types";
17
+ import { IntervalContext } from "../../types";
18
18
  import "./styles/index.less";
19
19
  import { Apis } from "../../constants";
20
20
  import { judgeIsCity, judgeIsArea, getValue, searchDataParams } from "./utils";
21
21
  import { ContentPanel, SearchPanel } from "../../components";
22
22
  import TopPanel from "../topPanel";
23
23
  import { message } from 'antd';
24
- var timer = 0;
25
24
  var CancelToken = Request.CancelToken;
26
25
  var cancel;
27
26
  var classPrefix = 'interval-content';
@@ -56,15 +55,11 @@ var EventContent = function EventContent(props) {
56
55
  _useState12 = _slicedToArray(_useState11, 2),
57
56
  isCity = _useState12[0],
58
57
  setIsCity = _useState12[1];
59
- var _useState13 = useState(false),
58
+ var _useState13 = useState(-1),
60
59
  _useState14 = _slicedToArray(_useState13, 2),
61
- ajaxFlag = _useState14[0],
62
- setAjaxFlag = _useState14[1];
63
- var _useState15 = useState(-1),
64
- _useState16 = _slicedToArray(_useState15, 2),
65
- eventId = _useState16[0],
66
- setEventId = _useState16[1];
67
- var _useContext2 = useContext(EventContext),
60
+ eventId = _useState14[0],
61
+ setEventId = _useState14[1];
62
+ var _useContext2 = useContext(IntervalContext),
68
63
  searchData = _useContext2.searchData,
69
64
  setSearchData = _useContext2.setSearchData,
70
65
  eventGroupList = _useContext2.eventGroupList,
@@ -72,11 +67,17 @@ var EventContent = function EventContent(props) {
72
67
  userPropList = _useContext2.userPropList;
73
68
  var _useContext3 = useContext(BizTargetFromPanelContext),
74
69
  handleSearch = _useContext3.handleSearch;
70
+ var _useState15 = useState(),
71
+ _useState16 = _slicedToArray(_useState15, 2),
72
+ searchTimer = _useState16[0],
73
+ setSearchTimer = _useState16[1];
75
74
  var collapseRef = useRef();
76
75
  // 初始化
77
76
  useEffect(function () {
78
77
  if (props.defaultValue) {
79
78
  setEventId(props.defaultValue.id);
79
+ } else {
80
+ setLoading(false);
80
81
  }
81
82
  }, [props.defaultValue]);
82
83
  useEffect(function () {
@@ -88,42 +89,28 @@ var EventContent = function EventContent(props) {
88
89
  setIsCity(judgeIsCity(_attrName));
89
90
  }
90
91
  }
91
- if (timer) clearTimeout(timer);
92
- var flag = true;
93
- timer = setTimeout(function () {
94
- if (flag) {
95
- fetchRequest(false);
96
- }
97
- }, 500);
92
+ if (!searchData || !searchData.analysisModel) return;
93
+ if (searchTimer) clearTimeout(searchTimer);
94
+ setSearchTimer(setTimeout(function () {
95
+ fetchRequest();
96
+ }, 300));
98
97
  return function () {
99
- // 清理异步任务
100
- if (timer) clearTimeout(timer);
101
- flag = false;
98
+ clearTimeout(searchTimer);
102
99
  };
103
100
  }, [searchData]);
104
101
  useEffect(function () {
105
102
  handleSearch && handleSearch(loading);
106
103
  }, [loading]);
107
- useEffect(function () {
108
- if (ajaxFlag) {
109
- fetchRequest(true);
110
- }
111
- }, [ajaxFlag]);
104
+
112
105
  // 查询
113
- var fetchRequest = function fetchRequest(flag) {
106
+ var fetchRequest = function fetchRequest() {
114
107
  var _searchData$start, _searchData$end, _searchData$associate, _searchData$associate2, _searchData$associate3;
115
- if (flag !== undefined) setAjaxFlag(flag);
116
- if (!ajaxFlag) return;
117
108
  if ((searchData === null || searchData === void 0 ? void 0 : (_searchData$start = searchData.start) === null || _searchData$start === void 0 ? void 0 : _searchData$start.id) === null || (searchData === null || searchData === void 0 ? void 0 : (_searchData$end = searchData.end) === null || _searchData$end === void 0 ? void 0 : _searchData$end.id) === null) {
118
109
  setLoading(false);
119
110
  return;
120
111
  }
121
112
  setEventData(undefined);
122
113
  setLoading(true);
123
- // 取消上次未完成的请求
124
- // if (typeof cancel === 'function') {
125
- // cancel();
126
- // }
127
114
  if (searchData !== null && searchData !== void 0 && (_searchData$associate = searchData.associatedNextAttr) !== null && _searchData$associate !== void 0 && _searchData$associate.type && (searchData === null || searchData === void 0 ? void 0 : (_searchData$associate2 = searchData.associatedPreAttr) === null || _searchData$associate2 === void 0 ? void 0 : _searchData$associate2.type) !== (searchData === null || searchData === void 0 ? void 0 : (_searchData$associate3 = searchData.associatedNextAttr) === null || _searchData$associate3 === void 0 ? void 0 : _searchData$associate3.type)) {
128
115
  setLoading(false);
129
116
  return message.error('您查询的属性不一致,暂不支持查询');
@@ -159,7 +146,6 @@ var EventContent = function EventContent(props) {
159
146
  setSearchData(function (value) {
160
147
  return _objectSpread(_objectSpread({}, value), data);
161
148
  });
162
- setAjaxFlag(true);
163
149
  };
164
150
 
165
151
  // 改变显示内容
@@ -174,25 +160,26 @@ var EventContent = function EventContent(props) {
174
160
  platform: data
175
161
  });
176
162
  });
177
- setTimeout(function () {
178
- setAjaxFlag(true);
179
- }, 100);
180
163
  };
181
164
 
182
165
  // TopPanel组件数值变更
183
- var onChangeSearch = function onChangeSearch(data, flag) {
166
+ var onChangeSearch = function onChangeSearch(data) {
184
167
  data.id ? setEventId(data.id) : setEventId(-1);
185
168
  setSearchData(function (_searchData) {
186
- return _objectSpread(_objectSpread({}, _searchData), data);
169
+ return _objectSpread(_objectSpread({}, data), {}, {
170
+ time: _searchData.time,
171
+ platform: _searchData.platform,
172
+ userGroup: data.analysisSubject ? undefined : data.userGroup,
173
+ analysisSubject: data.analysisSubject ? data.analysisSubject : undefined
174
+ });
187
175
  });
188
- setAjaxFlag(false);
189
176
  };
190
177
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TopBar, {
191
178
  searchData: searchData,
192
179
  loading: loading,
193
180
  eventData: eventData,
194
181
  platformChange: platformChange,
195
- onUserDrill: props.onUserDrill
182
+ onJumpWarning: props.onJumpWarning
196
183
  }), /*#__PURE__*/React.createElement(BizLayout, {
197
184
  showTitle: false,
198
185
  hasCollapse: true,
@@ -202,11 +189,8 @@ var EventContent = function EventContent(props) {
202
189
  collapseRef: collapseRef,
203
190
  onChange: onChangeSearch,
204
191
  defaultValue: searchData,
205
- urlParam: props.urlParam,
206
- ajaxFlag: ajaxFlag,
207
192
  loading: loading,
208
- finalSearchData: finalSearchData,
209
- fetchRequest: fetchRequest
193
+ finalSearchData: finalSearchData
210
194
  })
211
195
  }, /*#__PURE__*/React.createElement("div", {
212
196
  className: classPrefix
@@ -1,7 +1,7 @@
1
- .interval-content {
2
- &-options {
3
- display: flex;
4
- justify-content: flex-end;
5
- margin-bottom: 16px;
6
- }
7
- }
1
+ .interval-content {
2
+ &-options {
3
+ display: flex;
4
+ justify-content: flex-end;
5
+ margin-bottom: 16px;
6
+ }
7
+ }
@@ -1,4 +1,5 @@
1
- import { SearchValue, UserDrillParamsProp } from '../../types';
1
+ import { SearchValue } from '../../types';
2
+ import { IntervalProps } from '../home/types';
2
3
  export declare namespace EventContentProps {
3
4
  interface Props {
4
5
  /**
@@ -9,7 +10,6 @@ export declare namespace EventContentProps {
9
10
  * 默认值
10
11
  */
11
12
  value: SearchValue;
12
- urlParam?: SearchValue;
13
13
  /**
14
14
  * 展示列表
15
15
  */
@@ -18,7 +18,8 @@ export declare namespace EventContentProps {
18
18
  * 是否查询中
19
19
  */
20
20
  onSearching?: (flag: boolean) => void;
21
- onUserDrill: (data: UserDrillParamsProp, searchData: SearchValue) => void;
21
+ onUserDrill: IntervalProps.Props['onUserDrill'];
22
+ onJumpWarning: IntervalProps.Props['onJumpWarning'];
22
23
  /**
23
24
  * 查询条件回调
24
25
  */
@@ -51,5 +51,7 @@ export declare function searchDataParams(params: any): {
51
51
  } | null;
52
52
  associatedPreAttr: any;
53
53
  associatedNextAttr: any;
54
+ analysisModel: any;
55
+ analysisSubject: any;
54
56
  };
55
57
  export declare function transformData(data: any[][]): string[];
@@ -4,30 +4,30 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
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
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
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
- /**
8
- * 判断当前细分属性是否为”城市“
9
- * @param name 属性名称
10
- * @returns true标识为:是城市
7
+ /**
8
+ * 判断当前细分属性是否为”城市“
9
+ * @param name 属性名称
10
+ * @returns true标识为:是城市
11
11
  */
12
12
  export var judgeIsCity = function judgeIsCity(name) {
13
13
  var areaData = ['current_city', 'city'];
14
14
  return name && areaData.indexOf(name) !== -1 ? true : false;
15
15
  };
16
16
 
17
- /**
18
- * 判断当前细分属性,地图是否可选
19
- * @param name 属性名称
20
- * @returns true标识为:地图可选
17
+ /**
18
+ * 判断当前细分属性,地图是否可选
19
+ * @param name 属性名称
20
+ * @returns true标识为:地图可选
21
21
  */
22
22
  export var judgeIsArea = function judgeIsArea(name) {
23
23
  var areaData = ['current_area', 'current_city', 'area', 'city'];
24
24
  return name && areaData.indexOf(name) !== -1 ? true : false;
25
25
  };
26
26
 
27
- /**
28
- * 获取当前属性的全部数据
29
- * @param param 属性的部分数据
30
- * @returns 属性的全部数据
27
+ /**
28
+ * 获取当前属性的全部数据
29
+ * @param param 属性的部分数据
30
+ * @returns 属性的全部数据
31
31
  */
32
32
  export var getValue = function getValue(param, eventGroupList, eventEnvList, userPropList) {
33
33
  var res = undefined;
@@ -91,12 +91,14 @@ export function searchDataParams(params) {
91
91
  sub: (params === null || params === void 0 ? void 0 : (_params$dimension2 = params.dimension) === null || _params$dimension2 === void 0 ? void 0 : _params$dimension2.propCategory) === 'userProp' ? 'user_attr' : (params === null || params === void 0 ? void 0 : (_params$dimension3 = params.dimension) === null || _params$dimension3 === void 0 ? void 0 : _params$dimension3.propCategory) === 'eventProp' ? 'event_attr' : params === null || params === void 0 ? void 0 : (_params$dimension4 = params.dimension) === null || _params$dimension4 === void 0 ? void 0 : _params$dimension4.name,
92
92
  category: (params === null || params === void 0 ? void 0 : (_params$dimension5 = params.dimension) === null || _params$dimension5 === void 0 ? void 0 : _params$dimension5.category) || 'custom',
93
93
  attrId: params === null || params === void 0 ? void 0 : (_params$dimension6 = params.dimension) === null || _params$dimension6 === void 0 ? void 0 : _params$dimension6.id,
94
- userAttr: (params === null || params === void 0 ? void 0 : (_params$dimension7 = params.dimension) === null || _params$dimension7 === void 0 ? void 0 : _params$dimension7.propCategory) === 'userProp' ? params === null || params === void 0 ? void 0 : (_params$dimension8 = params.dimension) === null || _params$dimension8 === void 0 ? void 0 : _params$dimension8.dimensionSub : null,
94
+ userAttr: (params === null || params === void 0 ? void 0 : (_params$dimension7 = params.dimension) === null || _params$dimension7 === void 0 ? void 0 : _params$dimension7.propCategory) === 'userProp' ? params === null || params === void 0 ? void 0 : (_params$dimension8 = params.dimension) === null || _params$dimension8 === void 0 ? void 0 : _params$dimension8.name : null,
95
95
  eventAttr: (params === null || params === void 0 ? void 0 : (_params$dimension9 = params.dimension) === null || _params$dimension9 === void 0 ? void 0 : _params$dimension9.propCategory) === 'eventProp' ? params === null || params === void 0 ? void 0 : (_params$dimension10 = params.dimension) === null || _params$dimension10 === void 0 ? void 0 : _params$dimension10.label : null,
96
96
  event: (params === null || params === void 0 ? void 0 : (_params$dimension11 = params.dimension) === null || _params$dimension11 === void 0 ? void 0 : _params$dimension11.propCategory) !== 'envProp' ? params === null || params === void 0 ? void 0 : (_params$dimension12 = params.dimension) === null || _params$dimension12 === void 0 ? void 0 : _params$dimension12.eventId : null
97
97
  } : null,
98
98
  associatedPreAttr: params === null || params === void 0 ? void 0 : (_params$associatedPre = params.associatedPreAttr) === null || _params$associatedPre === void 0 ? void 0 : _params$associatedPre.id,
99
- associatedNextAttr: params === null || params === void 0 ? void 0 : (_params$associatedNex = params.associatedNextAttr) === null || _params$associatedNex === void 0 ? void 0 : _params$associatedNex.id
99
+ associatedNextAttr: params === null || params === void 0 ? void 0 : (_params$associatedNex = params.associatedNextAttr) === null || _params$associatedNex === void 0 ? void 0 : _params$associatedNex.id,
100
+ analysisModel: params.analysisModel,
101
+ analysisSubject: params.analysisSubject
100
102
  };
101
103
  }
102
104
  export function transformData(data) {
@@ -17,7 +17,7 @@ var defaultValue = {
17
17
  panelId: 400900,
18
18
  panelType: 'edit',
19
19
  data: {
20
- chartType: 'line',
20
+ chartType: 'boxplot',
21
21
  analysisIndex: 'per',
22
22
  id: 7565,
23
23
  name: '测试6666',
@@ -17,17 +17,11 @@ export default (function () {
17
17
  isDetail = _useState2[0],
18
18
  setIsDetail = _useState2[1];
19
19
  var _useState3 = useState(),
20
- _useState4 = _slicedToArray(_useState3, 2),
21
- detailParams = _useState4[0],
22
- setDetailParams = _useState4[1];
20
+ _useState4 = _slicedToArray(_useState3, 1),
21
+ detailParams = _useState4[0];
23
22
  var _useState5 = useState(),
24
- _useState6 = _slicedToArray(_useState5, 2),
25
- searchParams = _useState6[0],
26
- setSearchParams = _useState6[1];
27
- var _useState7 = useState(),
28
- _useState8 = _slicedToArray(_useState7, 2),
29
- urlParam = _useState8[0],
30
- setUrlParam = _useState8[1];
23
+ _useState6 = _slicedToArray(_useState5, 1),
24
+ searchParams = _useState6[0];
31
25
  useEffect(function () {
32
26
  setGlobalConfig(requestConfig);
33
27
  }, []);
@@ -38,16 +32,14 @@ export default (function () {
38
32
  console.log('onUserDrill:111', data, searchData);
39
33
  };
40
34
  return /*#__PURE__*/React.createElement(DemoWrapper, {
41
- needMeta: true,
42
- defaultApp: 204
35
+ needMeta: true
43
36
  }, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
44
37
  onClick: function onClick() {
45
38
  return setIsDetail(false);
46
39
  }
47
40
  }, "\u8FD4\u56DE")) : /*#__PURE__*/React.createElement(ModuleInterval, {
48
- defaultValue: searchParams,
49
- urlParam: urlParam,
50
41
  afterEditTarget: afterEditTarget,
51
- onUserDrill: onUserDrill
42
+ onUserDrill: onUserDrill,
43
+ onJumpWarning: function onJumpWarning() {}
52
44
  }));
53
45
  });
@@ -13,7 +13,7 @@ var defaultValue = {
13
13
  data: {
14
14
  module: 'event',
15
15
  analysisIndex: 'times',
16
- chartType: 'line',
16
+ chartType: 'boxplot',
17
17
  name: 'wqeqwe',
18
18
  time: {
19
19
  unit: 'day',
@@ -1,33 +1,33 @@
1
- /*滚动条凹槽的颜色,还可以设置边框属性 */
2
- ::-webkit-scrollbar-track-piece {
3
- background-color: #fff;
4
- -webkit-border-radius: 10px;
5
- -moz-border-radius: 10px;
6
- border-radius: 10px;
7
- }
8
-
9
- /*滚动条的宽度*/
10
- ::-webkit-scrollbar {
11
- width: 10px;
12
- height: 10px;
13
- }
14
-
15
- /*滚动条的设置*/
16
- ::-webkit-scrollbar-thumb {
17
- background-color: #cacdd4;
18
- background-clip: padding-box;
19
- border: 2px solid #fff;
20
- -webkit-border-radius: 10px;
21
- -moz-border-radius: 10px;
22
- border-radius: 10px;
23
- }
24
-
25
- /*滚动条鼠标移上去*/
26
- ::-webkit-scrollbar-thumb:hover {
27
- // background-color: #bbb;
28
- }
29
-
30
- ::-webkit-scrollbar-track-piece {
31
- width: 6px;
32
- height: 6px;
33
- }
1
+ /*滚动条凹槽的颜色,还可以设置边框属性 */
2
+ ::-webkit-scrollbar-track-piece {
3
+ background-color: #fff;
4
+ -webkit-border-radius: 10px;
5
+ -moz-border-radius: 10px;
6
+ border-radius: 10px;
7
+ }
8
+
9
+ /*滚动条的宽度*/
10
+ ::-webkit-scrollbar {
11
+ width: 10px;
12
+ height: 10px;
13
+ }
14
+
15
+ /*滚动条的设置*/
16
+ ::-webkit-scrollbar-thumb {
17
+ background-color: #cacdd4;
18
+ background-clip: padding-box;
19
+ border: 2px solid #fff;
20
+ -webkit-border-radius: 10px;
21
+ -moz-border-radius: 10px;
22
+ border-radius: 10px;
23
+ }
24
+
25
+ /*滚动条鼠标移上去*/
26
+ ::-webkit-scrollbar-thumb:hover {
27
+ // background-color: #bbb;
28
+ }
29
+
30
+ ::-webkit-scrollbar-track-piece {
31
+ width: 6px;
32
+ height: 6px;
33
+ }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import './styles/index.less';
3
- import { EventProps } from './types';
4
- declare const ModuleInterval: React.FC<EventProps.Props>;
3
+ import { IntervalProps } from './types';
4
+ declare const ModuleInterval: React.FC<IntervalProps.Props>;
5
5
  export default ModuleInterval;
@@ -12,12 +12,12 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import React, { useContext, useEffect, useState } from 'react';
14
14
  import { Spin } from 'antd';
15
- import { BizGlobalDataContext, BizTargetFromPanel } from '@zgfe/business-lib';
15
+ import { BizGlobalDataContext, BizTargetFromPanel, ajax } from '@zgfe/business-lib';
16
16
  import "./styles/index.less";
17
- import { EventContext } from "../../types";
17
+ import { IntervalContext } from "../../types";
18
18
  import { getInitDate } from "../../constants/initData";
19
19
  import EventContent from "../content";
20
- import { chartTypes } from "../../constants";
20
+ import { Apis, chartTypes } from "../../constants";
21
21
  var classPrefix = 'interval-module-container';
22
22
  var ModuleInterval = function ModuleInterval(props) {
23
23
  // 属性
@@ -36,43 +36,52 @@ var ModuleInterval = function ModuleInterval(props) {
36
36
  _useState4 = _slicedToArray(_useState3, 2),
37
37
  loading = _useState4[0],
38
38
  setLoading = _useState4[1];
39
- var _useState5 = useState(true),
40
- _useState6 = _slicedToArray(_useState5, 2),
41
- pageLoading = _useState6[0],
42
- setPageLoading = _useState6[1];
43
39
  // 指标标题
40
+ var _useState5 = useState(),
41
+ _useState6 = _slicedToArray(_useState5, 2),
42
+ title = _useState6[0],
43
+ setTitle = _useState6[1];
44
44
  var _useState7 = useState(),
45
45
  _useState8 = _slicedToArray(_useState7, 2),
46
- title = _useState8[0],
47
- setTitle = _useState8[1];
46
+ panelId = _useState8[0],
47
+ setPanelId = _useState8[1];
48
48
  var _useState9 = useState(),
49
49
  _useState10 = _slicedToArray(_useState9, 2),
50
- panelId = _useState10[0],
51
- setPanelId = _useState10[1];
50
+ elementId = _useState10[0],
51
+ setElementId = _useState10[1];
52
52
  var _useState11 = useState(),
53
53
  _useState12 = _slicedToArray(_useState11, 2),
54
- elementId = _useState12[0],
55
- setElementId = _useState12[1];
56
- var _useState13 = useState(),
54
+ showList = _useState12[0],
55
+ setShowList = _useState12[1];
56
+ var _useState13 = useState(false),
57
57
  _useState14 = _slicedToArray(_useState13, 2),
58
- showList = _useState14[0],
59
- setShowList = _useState14[1];
58
+ subjectEnable = _useState14[0],
59
+ setSubjectEnable = _useState14[1];
60
60
  // 初始化
61
61
  useEffect(function () {
62
- setPageLoading(true);
63
- // 设置初始值
64
- if (!props.defaultValue) {
65
- initSearch();
66
- } else {
67
- setShowList(props.defaultValue.chosen_data);
68
- setPanelId(props.defaultValue.panelId);
69
- setElementId(props.defaultValue.id);
70
- setTitle(props.defaultValue.name);
71
- setSearchData(props.defaultValue.data);
72
- }
73
- setTimeout(function () {
74
- setPageLoading(false);
75
- }, 0);
62
+ setLoading(true);
63
+ ajax(Apis.querySubjectDisplay, {
64
+ method: 'post',
65
+ data: {
66
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
67
+ }
68
+ }).then(function (res) {
69
+ if (!res) return;
70
+ setSubjectEnable(res.data);
71
+ // 设置初始值
72
+ if (!props.defaultValue) {
73
+ initSearch();
74
+ } else {
75
+ setShowList(props.defaultValue.chosen_data);
76
+ setPanelId(props.defaultValue.panelId);
77
+ setElementId(props.defaultValue.id);
78
+ setTitle(props.defaultValue.name);
79
+ setSearchData(props.defaultValue.data);
80
+ }
81
+ setTimeout(function () {
82
+ setLoading(false);
83
+ });
84
+ });
76
85
  }, []);
77
86
 
78
87
  // 查询条件初始化
@@ -80,20 +89,21 @@ var ModuleInterval = function ModuleInterval(props) {
80
89
  setSearchData({
81
90
  userGroup: (userGroupList === null || userGroupList === void 0 ? void 0 : userGroupList.length) > 0 ? [userGroupList[0].id] : [0],
82
91
  time: getInitDate(props.includeToday),
83
- chartType: 'line'
92
+ chartType: 'boxplot'
84
93
  });
85
94
  };
86
-
87
- // 改变loading
88
- var changeLoading = function changeLoading(flag) {
89
- setLoading(flag);
90
- };
91
- if (pageLoading) {
92
- return /*#__PURE__*/React.createElement(Spin, null);
95
+ useEffect(function () {
96
+ if (props.onChange) props.onChange(searchData);
97
+ }, [searchData]);
98
+ if (loading) {
99
+ return /*#__PURE__*/React.createElement("div", {
100
+ className: classPrefix
101
+ }, /*#__PURE__*/React.createElement(Spin, {
102
+ className: "".concat(classPrefix, "-loading")
103
+ }));
93
104
  }
94
- return /*#__PURE__*/React.createElement(Spin, {
95
- spinning: loading,
96
- wrapperClassName: classPrefix
105
+ return /*#__PURE__*/React.createElement("div", {
106
+ className: classPrefix
97
107
  }, /*#__PURE__*/React.createElement(BizTargetFromPanel, {
98
108
  value: panelId ? {
99
109
  panelId: panelId,
@@ -102,7 +112,7 @@ var ModuleInterval = function ModuleInterval(props) {
102
112
  name: title,
103
113
  params: _objectSpread({
104
114
  app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
105
- module: 'event'
115
+ module: 'interval'
106
116
  }, searchData)
107
117
  }
108
118
  } : undefined,
@@ -112,7 +122,7 @@ var ModuleInterval = function ModuleInterval(props) {
112
122
  children: ""
113
123
  }), !panelId && /*#__PURE__*/React.createElement("div", {
114
124
  className: "".concat(classPrefix, "-header-title")
115
- }, "\u95F4\u9694\u5206\u6790"), /*#__PURE__*/React.createElement(EventContext.Provider, {
125
+ }, "\u95F4\u9694\u5206\u6790"), /*#__PURE__*/React.createElement(IntervalContext.Provider, {
116
126
  value: {
117
127
  panelId: panelId,
118
128
  elementId: elementId,
@@ -121,18 +131,21 @@ var ModuleInterval = function ModuleInterval(props) {
121
131
  userPropList: userPropList,
122
132
  searchData: searchData,
123
133
  setSearchData: setSearchData,
134
+ subjectEnable: subjectEnable,
124
135
  panelName: title,
125
136
  includeToday: props.includeToday,
126
- changeLoading: changeLoading,
137
+ enableAddScene: props.defaultValue && props.defaultValue.enableAddScene === false ? false : true,
138
+ changeLoading: setLoading,
127
139
  afterEditTarget: props.afterEditTarget,
128
- onUserDrill: props.onUserDrill
140
+ onUserDrill: props.onUserDrill,
141
+ onJumpWarning: props.onJumpWarning
129
142
  }
130
143
  }, /*#__PURE__*/React.createElement(EventContent, {
131
144
  defaultValue: props.defaultValue ? props.defaultValue.data : undefined,
132
145
  value: searchData,
133
146
  show: showList,
134
- urlParam: props.urlParam,
135
147
  onUserDrill: props.onUserDrill,
148
+ onJumpWarning: props.onJumpWarning,
136
149
  onChange: setSearchData,
137
150
  initSearch: initSearch
138
151
  })));