@zgfe/modules-interval 1.0.3-alpha.0 → 1.0.3-alpha.10

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.
@@ -12,7 +12,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import { Switch, Tooltip, message } from 'antd';
14
14
  import React, { useEffect, useRef, useState } from 'react';
15
- import { BizEventSelector, IconFont, BizAttrConditionGroup } from '@zgfe/business-lib';
15
+ import { BizEventSelector, IconFont, BizAttrConditionGroup, useChanged } from '@zgfe/business-lib';
16
16
  import "./styles/index.less";
17
17
  import _ from 'lodash';
18
18
  var classPrefix = 'interval-box';
@@ -59,7 +59,7 @@ var EventFilter = function EventFilter(props) {
59
59
  setBizAttributeSelectorValue = _useState14[1];
60
60
 
61
61
  // 初始化
62
- useEffect(function () {
62
+ useChanged(function () {
63
63
  if (props.value) {
64
64
  var _data = props.value;
65
65
  if (_data && _data.id) {
@@ -80,8 +80,17 @@ var EventFilter = function EventFilter(props) {
80
80
  key: _data.dimension.propCategory === 'eventProp' ? _data.dimension.value : _data.dimension.propCategory + '-' + _data.dimension.value
81
81
  }));
82
82
  }
83
+ } else {
84
+ setEvent({
85
+ id: null,
86
+ name: ''
87
+ });
88
+ setEventOverview(false);
89
+ setFilter(undefined);
90
+ setBizAttributeSelectorValue(undefined);
91
+ setRelevancy(false);
83
92
  }
84
- }, []);
93
+ }, props.value);
85
94
 
86
95
  // 添加筛选
87
96
  var onAdd = function onAdd() {
@@ -149,10 +158,24 @@ var EventFilter = function EventFilter(props) {
149
158
  showBuiltInTarget: false,
150
159
  popupContainer: false,
151
160
  defaultSelectAble: false,
161
+ destroyPopupOnHide: true,
152
162
  value: {
153
163
  event: event
154
164
  },
155
165
  onChange: onChangeEvent,
166
+ filter: function filter(event) {
167
+ if (!props.subject) return true;
168
+ var propMatch = false;
169
+ for (var i = 0; i < event.attrList.length; i++) {
170
+ var _props$subject;
171
+ var attr = event.attrList[i];
172
+ if (attr.label === ((_props$subject = props.subject) === null || _props$subject === void 0 ? void 0 : _props$subject.subjectName)) {
173
+ propMatch = true;
174
+ break;
175
+ }
176
+ }
177
+ return propMatch;
178
+ },
156
179
  placeholder: "\u8BF7\u9009\u62E9\u4E8B\u4EF6"
157
180
  }), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
158
181
  placement: "top",
@@ -183,8 +206,8 @@ var EventFilter = function EventFilter(props) {
183
206
  }, /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
184
207
  ref: conditionRef,
185
208
  value: filter,
186
- onlyAnd: true,
187
209
  enableEventProp: true,
210
+ enableUserProp: props.subject ? false : true,
188
211
  enableDelete: true,
189
212
  eventIdList: [event.id],
190
213
  onChange: onChangeFilters,
@@ -1,3 +1,4 @@
1
+ import SubjectTypes from '@zgfe/business-lib/es/hooks/types/subject';
1
2
  import { eventProps } from '../../types';
2
3
  /**
3
4
  * 事件属性
@@ -48,5 +49,6 @@ export interface EventFilterProps {
48
49
  value?: eventProps;
49
50
  relevancyFl?: boolean;
50
51
  relevancy?: boolean;
52
+ subject?: SubjectTypes.Subject;
51
53
  onChange?: (event: eventProps) => {};
52
54
  }
@@ -13,12 +13,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import { BizDatePicker, BizSelect } from '@zgfe/business-lib';
14
14
  import React, { useContext, useEffect, useState } from 'react';
15
15
  import { chartTypeOptions, getInitDate } from "../../constants";
16
- import { EventContext } from "../../types";
16
+ import { IntervalContext } from "../../types";
17
17
  import "./styles/index.less";
18
18
  import { extractNames } from "../../utils/formData";
19
19
  var classPrefix = 'search-panel-interval';
20
20
  var SearchPanel = function SearchPanel(props) {
21
- var _useContext = useContext(EventContext),
21
+ var _useContext = useContext(IntervalContext),
22
22
  includeToday = _useContext.includeToday;
23
23
  // 当前时间段
24
24
  var _useState = useState(props.time || getInitDate(includeToday)),
@@ -105,9 +105,8 @@ var SearchPanel = function SearchPanel(props) {
105
105
  display: 'flex'
106
106
  }
107
107
  }, /*#__PURE__*/React.createElement(BizDatePicker, {
108
- dateTypeList: ['day', 'week', 'month'],
108
+ dateTypeList: ['day', 'week', 'month', 'custom'],
109
109
  value: time,
110
- mode: "simple",
111
110
  includeToday: true,
112
111
  onChange: onChangeTime,
113
112
  selectRange: 365
@@ -17,7 +17,7 @@ import { message } from 'antd';
17
17
  import { formTableData, getColumns } from "../../utils/formData";
18
18
  import "./styles/index.less";
19
19
  import { searchDataParams } from "../../modules/content/utils";
20
- import { EventContext } from "../../types";
20
+ import { IntervalContext } from "../../types";
21
21
  var classPrefix = 'mi-interval-table';
22
22
  var EventTable = function EventTable(props) {
23
23
  var _dataSource$appData2;
@@ -35,8 +35,9 @@ var EventTable = function EventTable(props) {
35
35
  eventGroupList = _useContext$eventGrou === void 0 ? [] : _useContext$eventGrou,
36
36
  eventEnvList = _useContext.eventEnvList,
37
37
  userPropList = _useContext.userPropList;
38
- var _useContext2 = useContext(EventContext),
39
- panelName = _useContext2.panelName;
38
+ var _useContext2 = useContext(IntervalContext),
39
+ panelName = _useContext2.panelName,
40
+ onUserDrill = _useContext2.onUserDrill;
40
41
 
41
42
  // 按属性排序后的数据(用于合并行)
42
43
  var _useState3 = useState({
@@ -69,7 +70,7 @@ var EventTable = function EventTable(props) {
69
70
  var _dataSource$appData;
70
71
  var _searchData$userGroup = searchData.userGroup,
71
72
  userGroup = _searchData$userGroup === void 0 ? [0] : _searchData$userGroup;
72
- var _getColumns = getColumns(eventGroupList, userPropList, eventEnvList, (dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$appData = dataSource.appData) === null || _dataSource$appData === void 0 ? void 0 : _dataSource$appData.x_axis) || [], dataSource, userGroup, searchData, showList);
73
+ var _getColumns = getColumns(eventGroupList, userPropList, eventEnvList, (dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$appData = dataSource.appData) === null || _dataSource$appData === void 0 ? void 0 : _dataSource$appData.x_axis) || [], dataSource, userGroup, searchData, showList, onUserDrill);
73
74
  return _getColumns;
74
75
  }, [dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$appData2 = dataSource.appData) === null || _dataSource$appData2 === void 0 ? void 0 : _dataSource$appData2.x_axis, showList, sortTable, panelName]);
75
76
 
@@ -14,12 +14,12 @@ import { Button } from 'antd';
14
14
  import React, { useContext, useEffect, useState } from 'react';
15
15
  import { BizAddToPanel, BizAddToScene, BizGlobalDataContext } from '@zgfe/business-lib';
16
16
  import "./styles/index.less";
17
- import { EventContext } from "../../types";
17
+ import { IntervalContext } from "../../types";
18
18
  import { chartTypes, platformOption } from "../../constants/fields";
19
19
  import { appVersionType } from '@zgfe/business-lib/es/context';
20
20
  var classPrefix = 'modules-interval-topbar';
21
21
  var TopBar = function TopBar(props) {
22
- var _useContext = useContext(EventContext),
22
+ var _useContext = useContext(IntervalContext),
23
23
  panelId = _useContext.panelId,
24
24
  afterEditTarget = _useContext.afterEditTarget,
25
25
  enableAddScene = _useContext.enableAddScene;
@@ -118,7 +118,7 @@ var TopBar = function TopBar(props) {
118
118
  type: "primary",
119
119
  disabled: showLoading,
120
120
  onClick: function onClick() {
121
- props.onUserDrill({
121
+ props.onJumpWarning({
122
122
  appId: Number(currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId),
123
123
  module: 'interval',
124
124
  platform: 0,
@@ -1,4 +1,5 @@
1
- import { ResponseDataProps, SearchValue, UserDrillParamsProp } from '../../types';
1
+ import { IntervalProps } from '../../modules/home/types';
2
+ import { ResponseDataProps, SearchValue } from '../../types';
2
3
  export interface TopBarProps {
3
4
  /**
4
5
  * @description 标题
@@ -6,6 +7,6 @@ export interface TopBarProps {
6
7
  searchData?: SearchValue;
7
8
  loading?: boolean;
8
9
  eventData?: ResponseDataProps;
9
- onUserDrill: (data: UserDrillParamsProp, searchData: SearchValue) => void;
10
+ onJumpWarning: IntervalProps.Props['onJumpWarning'];
10
11
  platformChange: (data: number) => void;
11
12
  }
@@ -2,7 +2,15 @@ var Apis = {
2
2
  dataList: '/interval/intervalData',
3
3
  getEventDataSql: '/dataSql/getEventDataSql',
4
4
  eventDownloadReport: '/interval/downLoadintervalData',
5
- querySubject: '/analysisSubject/queryAllSubject'
5
+ /**
6
+ * 用户下钻
7
+ */
8
+ userDrill: '/interval/userDrill',
9
+ /**
10
+ * 主体下钻
11
+ */
12
+ subjectDrill: '/interval/eventDrill',
13
+ querySubjectDisplay: '/analysisSubject/querySubDisplay'
6
14
  };
7
15
  for (var key in Apis) {
8
16
  Apis[key] = "/zg/web/v2".concat(Apis[key]);
@@ -14,7 +14,7 @@ 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";
@@ -64,7 +64,7 @@ var EventContent = function EventContent(props) {
64
64
  _useState16 = _slicedToArray(_useState15, 2),
65
65
  eventId = _useState16[0],
66
66
  setEventId = _useState16[1];
67
- var _useContext2 = useContext(EventContext),
67
+ var _useContext2 = useContext(IntervalContext),
68
68
  searchData = _useContext2.searchData,
69
69
  setSearchData = _useContext2.setSearchData,
70
70
  eventGroupList = _useContext2.eventGroupList,
@@ -88,6 +88,7 @@ var EventContent = function EventContent(props) {
88
88
  setIsCity(judgeIsCity(_attrName));
89
89
  }
90
90
  }
91
+ if (!searchData || !searchData.analysisModel) return;
91
92
  if (timer) clearTimeout(timer);
92
93
  var flag = true;
93
94
  timer = setTimeout(function () {
@@ -183,7 +184,10 @@ var EventContent = function EventContent(props) {
183
184
  var onChangeSearch = function onChangeSearch(data, flag) {
184
185
  data.id ? setEventId(data.id) : setEventId(-1);
185
186
  setSearchData(function (_searchData) {
186
- return _objectSpread(_objectSpread({}, _searchData), data);
187
+ return _objectSpread(_objectSpread(_objectSpread({}, _searchData), data), {}, {
188
+ userGroup: data.analysisSubject ? undefined : data.userGroup,
189
+ analysisSubject: data.analysisSubject ? data.analysisSubject : undefined
190
+ });
187
191
  });
188
192
  setAjaxFlag(false);
189
193
  };
@@ -192,7 +196,7 @@ var EventContent = function EventContent(props) {
192
196
  loading: loading,
193
197
  eventData: eventData,
194
198
  platformChange: platformChange,
195
- onUserDrill: props.onUserDrill
199
+ onJumpWarning: props.onJumpWarning
196
200
  }), /*#__PURE__*/React.createElement(BizLayout, {
197
201
  showTitle: false,
198
202
  hasCollapse: true,
@@ -202,7 +206,6 @@ var EventContent = function EventContent(props) {
202
206
  collapseRef: collapseRef,
203
207
  onChange: onChangeSearch,
204
208
  defaultValue: searchData,
205
- urlParam: props.urlParam,
206
209
  ajaxFlag: ajaxFlag,
207
210
  loading: loading,
208
211
  finalSearchData: finalSearchData,
@@ -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[];
@@ -96,7 +96,9 @@ export function searchDataParams(params) {
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,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
  }, []);
@@ -39,15 +33,14 @@ export default (function () {
39
33
  };
40
34
  return /*#__PURE__*/React.createElement(DemoWrapper, {
41
35
  needMeta: true,
42
- defaultApp: 204
36
+ defaultApp: 271
43
37
  }, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
44
38
  onClick: function onClick() {
45
39
  return setIsDetail(false);
46
40
  }
47
41
  }, "\u8FD4\u56DE")) : /*#__PURE__*/React.createElement(ModuleInterval, {
48
- defaultValue: searchParams,
49
- urlParam: urlParam,
50
42
  afterEditTarget: afterEditTarget,
51
- onUserDrill: onUserDrill
43
+ onUserDrill: onUserDrill,
44
+ onJumpWarning: function onJumpWarning() {}
52
45
  }));
53
46
  });
@@ -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
  // 查询条件初始化
@@ -83,14 +92,6 @@ var ModuleInterval = function ModuleInterval(props) {
83
92
  chartType: 'line'
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);
93
- }
94
95
  return /*#__PURE__*/React.createElement(Spin, {
95
96
  spinning: loading,
96
97
  wrapperClassName: classPrefix
@@ -112,7 +113,7 @@ var ModuleInterval = function ModuleInterval(props) {
112
113
  children: ""
113
114
  }), !panelId && /*#__PURE__*/React.createElement("div", {
114
115
  className: "".concat(classPrefix, "-header-title")
115
- }, "\u95F4\u9694\u5206\u6790"), /*#__PURE__*/React.createElement(EventContext.Provider, {
116
+ }, "\u95F4\u9694\u5206\u6790"), /*#__PURE__*/React.createElement(IntervalContext.Provider, {
116
117
  value: {
117
118
  panelId: panelId,
118
119
  elementId: elementId,
@@ -121,19 +122,21 @@ var ModuleInterval = function ModuleInterval(props) {
121
122
  userPropList: userPropList,
122
123
  searchData: searchData,
123
124
  setSearchData: setSearchData,
125
+ subjectEnable: subjectEnable,
124
126
  panelName: title,
125
127
  includeToday: props.includeToday,
126
128
  enableAddScene: props.defaultValue && props.defaultValue.enableAddScene === false ? false : true,
127
- changeLoading: changeLoading,
129
+ changeLoading: setLoading,
128
130
  afterEditTarget: props.afterEditTarget,
129
- onUserDrill: props.onUserDrill
131
+ onUserDrill: props.onUserDrill,
132
+ onJumpWarning: props.onJumpWarning
130
133
  }
131
134
  }, /*#__PURE__*/React.createElement(EventContent, {
132
135
  defaultValue: props.defaultValue ? props.defaultValue.data : undefined,
133
136
  value: searchData,
134
137
  show: showList,
135
- urlParam: props.urlParam,
136
138
  onUserDrill: props.onUserDrill,
139
+ onJumpWarning: props.onJumpWarning,
137
140
  onChange: setSearchData,
138
141
  initSearch: initSearch
139
142
  })));
@@ -1,12 +1,11 @@
1
1
  /// <reference types="react" />
2
- import { SearchValue, UserDrillParamsProp } from '../../types';
3
- export declare namespace EventProps {
2
+ import { SearchValue, IntervalDrillParams } from '../../types';
3
+ export declare namespace IntervalProps {
4
4
  interface Props {
5
5
  /**
6
6
  * @description 默认查询值
7
7
  */
8
8
  defaultValue?: Value;
9
- urlParam?: SearchValue;
10
9
  /**
11
10
  * @description 看板是否可禁用, true禁用
12
11
  */
@@ -23,7 +22,8 @@ export declare namespace EventProps {
23
22
  /**
24
23
  * 用户钻取
25
24
  */
26
- onUserDrill: (data: UserDrillParamsProp, searchData: SearchValue) => void;
25
+ onUserDrill: (data: IntervalDrillParams, isSubject: boolean) => void;
26
+ onJumpWarning: (data: Record<string, any>, searchData: SearchValue) => void;
27
27
  }
28
28
  interface Value {
29
29
  /**
@@ -69,6 +69,7 @@ export declare namespace EventProps {
69
69
  min?: number;
70
70
  perValue?: number;
71
71
  peopleNum?: number;
72
+ names?: string[];
72
73
  children?: ColumnsDataType[];
73
74
  }
74
75
  }
@@ -1,2 +1,2 @@
1
- export var EventProps;
2
- (function (_EventProps) {})(EventProps || (EventProps = {}));
1
+ export var IntervalProps;
2
+ (function (_IntervalProps) {})(IntervalProps || (IntervalProps = {}));
@@ -12,14 +12,14 @@ 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, useState } from 'react';
14
14
  import { Form, Button, Radio } from 'antd';
15
- import { BizAttributeSelector, BizGlobalDataContext, BizSelect, BizUserGroupHeader, ajax, useChanged } from '@zgfe/business-lib';
15
+ import { BizAttributeSelector, BizSelect, BizUserGroupHeader, useSubject } from '@zgfe/business-lib';
16
16
  import EventFilter from "../../components/eventFilter";
17
17
  import "./styles/index.less";
18
18
  import { AnalysisMode } from "./types";
19
- import { Apis } from "../../constants";
19
+ import { IntervalContext } from "../../types";
20
20
  var classPrefix = 'top-panel-interval';
21
21
  var TopPanel = function TopPanel(props) {
22
- var _props$urlParam, _props$urlParam2, _defaultValue$associa, _defaultValue$associa2, _finalSearchData$asso, _finalSearchData$asso2, _defaultValue$associa3, _finalSearchData$asso3, _defaultValue$associa4, _finalSearchData$asso4, _defaultValue$associa5, _finalSearchData$asso5, _defaultValue$associa6, _finalSearchData$asso6, _defaultValue$associa7, _finalSearchData$asso7, _defaultValue$associa8, _finalSearchData$asso8, _defaultValue$associa9, _finalSearchData$asso9, _defaultValue$associa10, _finalSearchData$asso10, _defaultValue$dimensi, _finalSearchData$dime, _defaultValue$dimensi2, _finalSearchData$dime2, _defaultValue$dimensi3, _finalSearchData$dime3, _defaultValue$dimensi4, _finalSearchData$dime4;
22
+ var _props$defaultValue, _props$defaultValue2, _defaultValue$associa, _defaultValue$associa2, _finalSearchData$asso, _finalSearchData$asso2, _defaultValue$associa3, _finalSearchData$asso3, _defaultValue$associa4, _finalSearchData$asso4, _defaultValue$associa5, _finalSearchData$asso5, _defaultValue$associa6, _finalSearchData$asso6, _defaultValue$associa7, _finalSearchData$asso7, _defaultValue$associa8, _finalSearchData$asso8, _defaultValue$associa9, _finalSearchData$asso9, _defaultValue$associa10, _finalSearchData$asso10, _defaultValue$dimensi, _finalSearchData$dime, _defaultValue$dimensi2, _finalSearchData$dime2, _defaultValue$dimensi3, _finalSearchData$dime3, _defaultValue$dimensi4, _finalSearchData$dime4;
23
23
  var defaultValue = props.defaultValue,
24
24
  loading = props.loading,
25
25
  collapseRef = props.collapseRef,
@@ -45,15 +45,26 @@ var TopPanel = function TopPanel(props) {
45
45
  _useState8 = _slicedToArray(_useState7, 2),
46
46
  relevancyFl = _useState8[0],
47
47
  setRelevancyFl = _useState8[1];
48
- var _useContext = useContext(BizGlobalDataContext),
49
- currentApp = _useContext.currentApp;
50
- var _ref = defaultValue,
48
+ var _useSubject = useSubject(),
49
+ subjectList = _useSubject.subjectList,
50
+ subjectLoading = _useSubject.loading;
51
+ var _useContext = useContext(IntervalContext),
52
+ subjectEnable = _useContext.subjectEnable;
53
+ var _ref = defaultValue || {},
51
54
  userGroup = _ref.userGroup;
52
55
  // 细分属性初始值
53
56
  var _useState9 = useState(),
54
57
  _useState10 = _slicedToArray(_useState9, 2),
55
58
  bizAttributeSelectorValue = _useState10[0],
56
59
  setBizAttributeSelectorValue = _useState10[1];
60
+ var _useState11 = useState('user'),
61
+ _useState12 = _slicedToArray(_useState11, 2),
62
+ analysisType = _useState12[0],
63
+ setAnalysisType = _useState12[1];
64
+ var _useState13 = useState(),
65
+ _useState14 = _slicedToArray(_useState13, 2),
66
+ currentSubject = _useState14[0],
67
+ setCurrentSubject = _useState14[1];
57
68
  // 用户组和事件变更
58
69
  var onValuesChange = function onValuesChange(data, allData) {
59
70
  var _data = {};
@@ -80,7 +91,14 @@ var TopPanel = function TopPanel(props) {
80
91
  _data.userGroup = allData.userGroup;
81
92
  if (_data.userGroup.length <= 0) _data.userGroup = [0];
82
93
  }
83
- props.onChange(allData, (finalSearchData === null || finalSearchData === void 0 ? void 0 : finalSearchData.chartType) === 'boxplot' ? true : false);
94
+ props.onChange(_objectSpread(_objectSpread({}, allData), {}, {
95
+ analysisSubject: allData.analysisSubject ? {
96
+ subjectId: allData.analysisSubject.id,
97
+ subjectName: allData.analysisSubject.subjectName,
98
+ subjectAlias: allData.analysisSubject.subjectAlias,
99
+ unit: allData.analysisSubject.unit
100
+ } : undefined
101
+ }), (finalSearchData === null || finalSearchData === void 0 ? void 0 : finalSearchData.chartType) === 'boxplot' ? true : false);
84
102
  };
85
103
  var resetting = function resetting() {
86
104
  form.resetFields();
@@ -94,6 +112,7 @@ var TopPanel = function TopPanel(props) {
94
112
  associatedNextAttr: undefined
95
113
  });
96
114
  setRelevancy(false);
115
+ setCurrentSubject(undefined);
97
116
  props.onChange({
98
117
  userGroup: [0],
99
118
  start: undefined,
@@ -147,14 +166,6 @@ var TopPanel = function TopPanel(props) {
147
166
  });
148
167
  }
149
168
  };
150
- useChanged(function () {
151
- ajax(Apis.querySubject, {
152
- method: 'post',
153
- data: {
154
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.id
155
- }
156
- });
157
- }, currentApp === null || currentApp === void 0 ? void 0 : currentApp.id);
158
169
  return /*#__PURE__*/React.createElement(Form, {
159
170
  form: form,
160
171
  component: "div",
@@ -162,7 +173,7 @@ var TopPanel = function TopPanel(props) {
162
173
  className: "panel-form-interval",
163
174
  layout: "vertical",
164
175
  initialValues: {
165
- userGroup: props !== null && props !== void 0 && (_props$urlParam = props.urlParam) !== null && _props$urlParam !== void 0 && _props$urlParam.userGroup ? props === null || props === void 0 ? void 0 : (_props$urlParam2 = props.urlParam) === null || _props$urlParam2 === void 0 ? void 0 : _props$urlParam2.userGroup : userGroup ? userGroup : [0],
176
+ userGroup: props !== null && props !== void 0 && (_props$defaultValue = props.defaultValue) !== null && _props$defaultValue !== void 0 && _props$defaultValue.userGroup ? props === null || props === void 0 ? void 0 : (_props$defaultValue2 = props.defaultValue) === null || _props$defaultValue2 === void 0 ? void 0 : _props$defaultValue2.userGroup : userGroup ? userGroup : [0],
166
177
  start: _objectSpread(_objectSpread({}, defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.start), {}, {
167
178
  relevancy: defaultValue !== null && defaultValue !== void 0 && (_defaultValue$associa = defaultValue.associated_next_attr) !== null && _defaultValue$associa !== void 0 && _defaultValue$associa.event_id && defaultValue !== null && defaultValue !== void 0 && (_defaultValue$associa2 = defaultValue.associated_pre_attr) !== null && _defaultValue$associa2 !== void 0 && _defaultValue$associa2.event_id || finalSearchData !== null && finalSearchData !== void 0 && (_finalSearchData$asso = finalSearchData.associatedNextAttr) !== null && _finalSearchData$asso !== void 0 && _finalSearchData$asso.eventId && finalSearchData !== null && finalSearchData !== void 0 && (_finalSearchData$asso2 = finalSearchData.associatedPreAttr) !== null && _finalSearchData$asso2 !== void 0 && _finalSearchData$asso2.eventId ? true : false
168
179
  }),
@@ -184,14 +195,15 @@ var TopPanel = function TopPanel(props) {
184
195
  isHidden: (defaultValue === null || defaultValue === void 0 ? void 0 : (_defaultValue$dimensi2 = defaultValue.dimension) === null || _defaultValue$dimensi2 === void 0 ? void 0 : _defaultValue$dimensi2.is_hidden) || (finalSearchData === null || finalSearchData === void 0 ? void 0 : (_finalSearchData$dime2 = finalSearchData.dimension) === null || _finalSearchData$dime2 === void 0 ? void 0 : _finalSearchData$dime2.isHidden),
185
196
  propCategory: (defaultValue === null || defaultValue === void 0 ? void 0 : (_defaultValue$dimensi3 = defaultValue.dimension) === null || _defaultValue$dimensi3 === void 0 ? void 0 : _defaultValue$dimensi3.prop_category) || (finalSearchData === null || finalSearchData === void 0 ? void 0 : (_finalSearchData$dime3 = finalSearchData.dimension) === null || _finalSearchData$dime3 === void 0 ? void 0 : _finalSearchData$dime3.propCategory),
186
197
  eventId: (defaultValue === null || defaultValue === void 0 ? void 0 : (_defaultValue$dimensi4 = defaultValue.dimension) === null || _defaultValue$dimensi4 === void 0 ? void 0 : _defaultValue$dimensi4.event_id) || (finalSearchData === null || finalSearchData === void 0 ? void 0 : (_finalSearchData$dime4 = finalSearchData.dimension) === null || _finalSearchData$dime4 === void 0 ? void 0 : _finalSearchData$dime4.eventId)
187
- })
198
+ }),
199
+ analysisModel: (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.analysisModel) || AnalysisMode.common
188
200
  },
189
201
  scrollToFirstError: true,
190
202
  onValuesChange: onValuesChange
191
203
  }, /*#__PURE__*/React.createElement(Form.Item, {
192
204
  label: "\u5206\u6790\u4E3B\u4F53",
193
205
  className: "panel-form-interval-item"
194
- }, /*#__PURE__*/React.createElement(BizSelect, {
206
+ }, subjectEnable && /*#__PURE__*/React.createElement(BizSelect, {
195
207
  options: [{
196
208
  label: '用户',
197
209
  value: 'user'
@@ -199,14 +211,31 @@ var TopPanel = function TopPanel(props) {
199
211
  label: '事件属性',
200
212
  value: 'eventProp'
201
213
  }],
202
- keyField: "value"
203
- })), /*#__PURE__*/React.createElement(Form.Item, {
214
+ keyField: "value",
215
+ defaultValue: {
216
+ value: analysisType
217
+ },
218
+ onChange: function onChange(val) {
219
+ setAnalysisType(val.value);
220
+ resetting();
221
+ }
222
+ })), analysisType === 'eventProp' && /*#__PURE__*/React.createElement(Form.Item, {
204
223
  label: "\u4E3B\u4F53\u540D\u79F0",
205
224
  name: "analysisSubject",
206
225
  className: "panel-form-interval-item"
207
226
  }, /*#__PURE__*/React.createElement(BizSelect, {
208
- options: []
209
- })), /*#__PURE__*/React.createElement(Form.Item, {
227
+ options: subjectList,
228
+ aliasField: "subjectAlias",
229
+ labelField: "subjectName",
230
+ keyField: "id",
231
+ onChange: function onChange(val) {
232
+ setCurrentSubject(val);
233
+ form.setFieldsValue({
234
+ start: undefined,
235
+ end: undefined
236
+ });
237
+ }
238
+ })), analysisType === 'user' && /*#__PURE__*/React.createElement(Form.Item, {
210
239
  label: "",
211
240
  name: "userGroup",
212
241
  className: "space-item interval-item",
@@ -223,8 +252,10 @@ var TopPanel = function TopPanel(props) {
223
252
  label: "\u5F00\u59CB\u4E8B\u4EF6",
224
253
  name: "start"
225
254
  }, /*#__PURE__*/React.createElement(EventFilter, {
255
+ subject: currentSubject,
226
256
  relevancyFl: relevancyFl,
227
- relevancy: true
257
+ relevancy: true,
258
+ key: "begin"
228
259
  })), relevancy ? /*#__PURE__*/React.createElement(Form.Item, {
229
260
  className: "associated"
230
261
  }, /*#__PURE__*/React.createElement("span", {
@@ -287,13 +318,16 @@ var TopPanel = function TopPanel(props) {
287
318
  })) : '', /*#__PURE__*/React.createElement(Form.Item, {
288
319
  label: "\u7ED3\u675F\u4E8B\u4EF6",
289
320
  name: "end"
290
- }, /*#__PURE__*/React.createElement(EventFilter, null)), /*#__PURE__*/React.createElement(Form.Item, {
321
+ }, /*#__PURE__*/React.createElement(EventFilter, {
322
+ subject: currentSubject,
323
+ key: "end"
324
+ })), /*#__PURE__*/React.createElement(Form.Item, {
291
325
  label: "\u6309\u5C5E\u6027\u7EC6\u5206",
292
326
  name: "dimension",
293
327
  className: "dimension-interval"
294
328
  }, /*#__PURE__*/React.createElement(BizAttributeSelector, {
295
329
  enableEventProp: true,
296
- enableUserProp: true,
330
+ enableUserProp: analysisType === 'user',
297
331
  enableEnvProp: true,
298
332
  eventIdList: startId === endId ? [startId] : [startId, endId],
299
333
  value: bizAttributeSelectorValue,
@@ -315,7 +349,7 @@ var TopPanel = function TopPanel(props) {
315
349
  }, /*#__PURE__*/React.createElement(Button, {
316
350
  onClick: resetting
317
351
  }, "\u91CD\u7F6E"), /*#__PURE__*/React.createElement(Button, {
318
- loading: loading,
352
+ loading: loading || subjectLoading,
319
353
  disabled: loading || !startId || !endId || relevancy && !(defaultValue !== null && defaultValue !== void 0 && defaultValue.associatedNextAttr) && !(defaultValue !== null && defaultValue !== void 0 && defaultValue.associatedNextAttr),
320
354
  type: "primary",
321
355
  onClick: function onClick() {
@@ -1,5 +1,6 @@
1
1
  import { AttrConditionTypes } from '@zgfe/business-lib';
2
2
  import { bizAttributeSelectorValueProp, SearchValue } from '../../types';
3
+ import SubjectTypes from '@zgfe/business-lib/es/hooks/types/subject';
3
4
  export declare enum AnalysisMode {
4
5
  common = "commonInterval",
5
6
  firstAndLast = "firstLastInterval"
@@ -28,6 +29,7 @@ export interface FormDataProps {
28
29
  dimension?: bizAttributeSelectorValueProp;
29
30
  associatedPreAttr?: bizAttributeSelectorValueProp;
30
31
  associatedNextAttr?: bizAttributeSelectorValueProp;
32
+ analysisSubject?: SubjectTypes.Subject;
31
33
  }
32
34
  export interface FormHandelDataProps extends start {
33
35
  /**
@@ -40,7 +42,6 @@ export interface TopPanelProps {
40
42
  * 默认值
41
43
  */
42
44
  defaultValue?: SearchValue;
43
- urlParam?: SearchValue;
44
45
  loading?: boolean;
45
46
  /**
46
47
  * 数据更新
@@ -51,3 +51,17 @@
51
51
  }
52
52
  }
53
53
  }
54
+ .interval-drill {
55
+ display: block;
56
+ .bsicon {
57
+ display: none;
58
+ margin-right: 4px;
59
+ }
60
+ &:hover {
61
+ color: @primary-color;
62
+ cursor: pointer;
63
+ .bsicon {
64
+ display: inline;
65
+ }
66
+ }
67
+ }
@@ -1,7 +1,7 @@
1
1
  import { AttrConditionTypes } from '@zgfe/business-lib';
2
2
  import { DatePickerTypes } from '@zgfe/business-lib/es/datePicker/types';
3
3
  import { ReactNode } from 'react';
4
- import { FormDataProps, start } from './modules/topPanel/types';
4
+ import { AnalysisMode, FormDataProps, start } from './modules/topPanel/types';
5
5
  /**
6
6
  * 属性选择器 默认值
7
7
  */
@@ -117,36 +117,19 @@ export interface SearchValue {
117
117
  * @description 分类
118
118
  */
119
119
  module?: string;
120
- }
121
- export interface UserDrillParamsProp {
122
- /**
123
- * @description 应用id
124
- */
125
- appId: number;
126
- /**
127
- * @description 平台
128
- */
129
- platform: number;
130
- /**
131
- * @description 用户数量
132
- */
133
- count: number;
134
- /**
135
- * @description 模型类型 整体|事件|漏斗|留存|获取|粘性|崩溃|微信生态-整体|微信生态-小程序
136
- */
137
- source: string;
138
- /**
139
- * @description 查询接口
140
- */
141
- url: string;
142
120
  /**
143
- * @description 查询对象
121
+ * 分析模型
144
122
  */
145
- params?: Record<string, any>;
123
+ analysisModel?: AnalysisMode;
146
124
  /**
147
- * @description 间隔分析,数据格式与其他业务不一致,间隔分析单独提出来了,其他业务在data里面
125
+ * 分析主体
148
126
  */
149
- module?: string;
127
+ analysisSubject?: {
128
+ subjectId: number;
129
+ subjectName: string;
130
+ subjectAlias?: string;
131
+ unit: string;
132
+ };
150
133
  }
151
134
  export type EventChartTypes = 'line' | 'bar' | 'pie' | 'map' | 'boxplot';
152
135
  /**
@@ -190,4 +173,18 @@ export interface TableChildrenProps {
190
173
  name: string;
191
174
  values: number[];
192
175
  }
193
- export declare const EventContext: import("react").Context<any>;
176
+ export declare const IntervalContext: import("react").Context<any>;
177
+ export interface IntervalDrillParams {
178
+ /**
179
+ * @description 用户数量
180
+ */
181
+ count: number;
182
+ /**
183
+ * @description 查询接口
184
+ */
185
+ url: string;
186
+ /**
187
+ * @description 查询对象
188
+ */
189
+ params?: Record<string, any>;
190
+ }
package/dist/esm/types.js CHANGED
@@ -16,4 +16,4 @@ var defaultContext = {
16
16
  onUserDrill: null,
17
17
  defaultSearch: {}
18
18
  };
19
- export var EventContext = /*#__PURE__*/createContext(defaultContext);
19
+ export var IntervalContext = /*#__PURE__*/createContext(defaultContext);
@@ -1,7 +1,7 @@
1
1
  import type { ColumnsType } from 'antd/es/table';
2
2
  import { EventGroup, UserProp, EnvProp } from '@zgfe/business-lib/es/attributeSelector/types';
3
3
  import { ResponseDataProps, SearchValue, SeriesProps } from '../types';
4
- import { EventProps } from '../modules/home/types';
4
+ import { IntervalProps } from '../modules/home/types';
5
5
  import '../style/index.less';
6
6
  import { DisplaySetup } from '../components/searchPanel/types';
7
7
  /**
@@ -9,7 +9,7 @@ import { DisplaySetup } from '../components/searchPanel/types';
9
9
  * @param columnData xAxis
10
10
  * @returns column fields
11
11
  */
12
- export declare function getColumns(eventGroupList: EventGroup[] | undefined, userPropList: UserProp[] | undefined, eventEnvList: EnvProp[] | undefined, columnData: string[], dataSource: ResponseDataProps, userGroup: number[], searchData: SearchValue, showList: string[]): ColumnsType<EventProps.ColumnsDataType>;
12
+ export declare function getColumns(eventGroupList: EventGroup[] | undefined, userPropList: UserProp[] | undefined, eventEnvList: EnvProp[] | undefined, columnData: string[], dataSource: ResponseDataProps, userGroup: number[], searchData: SearchValue, showList: string[], onUserDrill: IntervalProps.Props['onUserDrill']): ColumnsType<IntervalProps.ColumnsDataType>;
13
13
  /**
14
14
  * 获取属性的label
15
15
  * @param attrData 当前属性
@@ -35,7 +35,9 @@ export declare function formTableData(originalData: ChartData): {
35
35
  Q3: number;
36
36
  min: number;
37
37
  perValue: number;
38
+ total: number;
38
39
  peopleNum: number;
40
+ names: string[];
39
41
  }[] | {
40
42
  key: number;
41
43
  time: string;
@@ -45,6 +47,7 @@ export declare function formTableData(originalData: ChartData): {
45
47
  Q3: number;
46
48
  min: number;
47
49
  perValue: number;
50
+ total: number;
48
51
  peopleNum: number;
49
52
  children: {
50
53
  key: string;
@@ -55,7 +58,9 @@ export declare function formTableData(originalData: ChartData): {
55
58
  Q3: number;
56
59
  min: number;
57
60
  perValue: number;
61
+ total: number;
58
62
  peopleNum: number;
63
+ names: string[];
59
64
  }[];
60
65
  }[] | undefined;
61
66
  type ChartData = {
@@ -1,19 +1,22 @@
1
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
2
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
3
- 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; }
4
- 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; }
5
- 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; }
6
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
- 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); }
8
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
4
  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."); }
10
5
  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); }
11
6
  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; }
12
7
  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; } }
13
8
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ 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; }
10
+ 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; }
11
+ 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; }
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
+ 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); }
14
14
  import React from 'react';
15
15
  import { chartColors } from "../constants/color";
16
16
  import "../style/index.less";
17
+ import { IconFont } from '@zgfe/business-lib';
18
+ import { Apis } from "../constants";
19
+ import { searchDataParams } from "../modules/content/utils";
17
20
  var classPrefix = 'interval-form-data';
18
21
  function convertToHMS(seconds) {
19
22
  var hours = Math.floor(seconds / 3600);
@@ -29,7 +32,7 @@ function convertToHMS(seconds) {
29
32
  * @param columnData xAxis
30
33
  * @returns column fields
31
34
  */
32
- export function getColumns(eventGroupList, userPropList, eventEnvList, columnData, dataSource, userGroup, searchData, showList
35
+ export function getColumns(eventGroupList, userPropList, eventEnvList, columnData, dataSource, userGroup, searchData, showList, onUserDrill
33
36
  // onClickToDetailCallback: Function,
34
37
  ) {
35
38
  var _dataSource$appData, _dataSource$appData$s, _searchData$dimension;
@@ -121,7 +124,7 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
121
124
  return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
122
125
  }
123
126
  }, {
124
- title: '人均值',
127
+ title: '均值',
125
128
  width: 148,
126
129
  ellipsis: true,
127
130
  align: 'right',
@@ -136,7 +139,17 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
136
139
  return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
137
140
  }
138
141
  }, {
139
- title: '人数',
142
+ title: '合计',
143
+ width: 148,
144
+ ellipsis: true,
145
+ align: 'right',
146
+ dataIndex: 'total',
147
+ key: 'total',
148
+ render: function render(text, record) {
149
+ return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
150
+ }
151
+ }, {
152
+ title: searchData.analysisSubject ? "".concat(searchData.analysisSubject.subjectAlias || searchData.analysisSubject.subjectName, "\u6570") : '人数',
140
153
  width: 148,
141
154
  ellipsis: true,
142
155
  align: 'right',
@@ -148,7 +161,38 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
148
161
  key: 'peopleNum',
149
162
  className: "".concat(classPrefix, "-table-td"),
150
163
  render: function render(text, record) {
151
- return /*#__PURE__*/React.createElement("span", null, " ", text);
164
+ return /*#__PURE__*/React.createElement("span", {
165
+ className: "interval-drill",
166
+ onClick: function onClick() {
167
+ var params;
168
+ var searchParam = searchDataParams(searchData);
169
+ // 主体下钻
170
+ if (searchData.analysisSubject) {
171
+ params = {
172
+ url: Apis.subjectDrill,
173
+ count: Number(text),
174
+ params: _objectSpread({}, searchParam)
175
+ };
176
+ } else {
177
+ // 用户下钻
178
+ params = {
179
+ url: Apis.userDrill,
180
+ count: Number(text),
181
+ params: _objectSpread({}, searchParam)
182
+ };
183
+ }
184
+ if (searchParam.dimension) {
185
+ params.params.groupValue = /\d{4}-\d{2}-\d{2}/.test(record.time || '') ? record.names ? record.names[0] : undefined : record.time;
186
+ }
187
+ if (/\d{4}-\d{2}-\d{2}/.test(record.time || '')) {
188
+ params.params.time.begin = record.time.split('|')[0];
189
+ params.params.time.end = record.time.split('|')[1] || record.time.split('|')[0];
190
+ }
191
+ onUserDrill === null || onUserDrill === void 0 ? void 0 : onUserDrill(params, searchData.analysisSubject ? true : false);
192
+ }
193
+ }, /*#__PURE__*/React.createElement(IconFont, {
194
+ type: "a-yanjingkai"
195
+ }), " ", text);
152
196
  }
153
197
  }];
154
198
  return data;
@@ -192,7 +236,8 @@ function createNewArray(data) {
192
236
  Q3: item.total[3] || 0,
193
237
  min: item.total[4] || 0,
194
238
  perValue: item.total[5] || 0,
195
- peopleNum: item.total[6] || 0,
239
+ total: item.total[6] || 0,
240
+ peopleNum: item.total[7] || 0,
196
241
  children: getChildrenData(data, i)
197
242
  };
198
243
  });
@@ -221,7 +266,7 @@ export function convertDateArray(params, dateArray) {
221
266
  var resultArray = dateArray.map(function (date) {
222
267
  var dateObj = new Date(date);
223
268
  var weekday = weekdays[dateObj.getDay()];
224
- return "".concat(date, " (").concat(weekday, ")");
269
+ return "".concat(date).concat(weekday ? " (".concat(weekday, ")") : '');
225
270
  });
226
271
  return resultArray;
227
272
  break;
@@ -245,7 +290,9 @@ function getChildrenData(data, index) {
245
290
  Q3: values[i][3] || 0,
246
291
  min: values[i][4] || 0,
247
292
  perValue: values[i][5] || 0,
248
- peopleNum: values[i][6] || 0
293
+ total: values[i][6] || 0,
294
+ peopleNum: values[i][7] || 0,
295
+ names: firstSeries.names
249
296
  };
250
297
  });
251
298
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-interval",
3
- "version": "1.0.3-alpha.0",
3
+ "version": "1.0.3-alpha.10",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -47,7 +47,7 @@
47
47
  "@types/uuid": "^9.0.2",
48
48
  "@umijs/fabric": "^2.8.1",
49
49
  "@umijs/test": "^3.0.5",
50
- "@zgfe/business-lib": "^1.1.88",
50
+ "@zgfe/business-lib": "1.1.89-qirui.10",
51
51
  "@zgfe/modules-demo-manage": "^1.0.1",
52
52
  "antd": "^4.22.6",
53
53
  "dumi": "^1.1.0",
@@ -62,5 +62,5 @@
62
62
  "umi-request": "^1.4.0",
63
63
  "yorkie": "^2.0.0"
64
64
  },
65
- "gitHead": "728b3ca2a91011150266aed6e52bcae3ec9962de"
65
+ "gitHead": "ba968441f35ef1af38f430b93de7e4f344efefa2"
66
66
  }