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

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.
@@ -149,10 +149,24 @@ var EventFilter = function EventFilter(props) {
149
149
  showBuiltInTarget: false,
150
150
  popupContainer: false,
151
151
  defaultSelectAble: false,
152
+ destroyPopupOnHide: true,
152
153
  value: {
153
154
  event: event
154
155
  },
155
156
  onChange: onChangeEvent,
157
+ filter: function filter(event) {
158
+ if (!props.subject) return true;
159
+ var propMatch = false;
160
+ for (var i = 0; i < event.attrList.length; i++) {
161
+ var _props$subject;
162
+ var attr = event.attrList[i];
163
+ if (attr.label === ((_props$subject = props.subject) === null || _props$subject === void 0 ? void 0 : _props$subject.subjectName)) {
164
+ propMatch = true;
165
+ break;
166
+ }
167
+ }
168
+ return propMatch;
169
+ },
156
170
  placeholder: "\u8BF7\u9009\u62E9\u4E8B\u4EF6"
157
171
  }), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
158
172
  placement: "top",
@@ -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
  }
@@ -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
@@ -36,7 +36,8 @@ var EventTable = function EventTable(props) {
36
36
  eventEnvList = _useContext.eventEnvList,
37
37
  userPropList = _useContext.userPropList;
38
38
  var _useContext2 = useContext(EventContext),
39
- panelName = _useContext2.panelName;
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
 
@@ -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,14 @@ 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'
6
13
  };
7
14
  for (var key in Apis) {
8
15
  Apis[key] = "/zg/web/v2".concat(Apis[key]);
@@ -183,7 +183,10 @@ var EventContent = function EventContent(props) {
183
183
  var onChangeSearch = function onChangeSearch(data, flag) {
184
184
  data.id ? setEventId(data.id) : setEventId(-1);
185
185
  setSearchData(function (_searchData) {
186
- return _objectSpread(_objectSpread({}, _searchData), data);
186
+ return _objectSpread(_objectSpread(_objectSpread({}, _searchData), data), {}, {
187
+ userGroup: data.analysisSubject ? undefined : data.userGroup,
188
+ analysisSubject: data.analysisSubject ? data.analysisSubject : undefined
189
+ });
187
190
  });
188
191
  setAjaxFlag(false);
189
192
  };
@@ -192,7 +195,7 @@ var EventContent = function EventContent(props) {
192
195
  loading: loading,
193
196
  eventData: eventData,
194
197
  platformChange: platformChange,
195
- onUserDrill: props.onUserDrill
198
+ onJumpWarning: props.onJumpWarning
196
199
  }), /*#__PURE__*/React.createElement(BizLayout, {
197
200
  showTitle: false,
198
201
  hasCollapse: true,
@@ -1,4 +1,5 @@
1
1
  import { SearchValue, UserDrillParamsProp } from '../../types';
2
+ import { IntervalProps } from '../home/types';
2
3
  export declare namespace EventContentProps {
3
4
  interface Props {
4
5
  /**
@@ -19,6 +20,7 @@ export declare namespace EventContentProps {
19
20
  */
20
21
  onSearching?: (flag: boolean) => void;
21
22
  onUserDrill: (data: UserDrillParamsProp, searchData: SearchValue) => void;
23
+ onJumpWarning: IntervalProps.Props['onJumpWarning'];
22
24
  /**
23
25
  * 查询条件回调
24
26
  */
@@ -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) {
@@ -39,7 +39,7 @@ export default (function () {
39
39
  };
40
40
  return /*#__PURE__*/React.createElement(DemoWrapper, {
41
41
  needMeta: true,
42
- defaultApp: 204
42
+ defaultApp: 271
43
43
  }, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
44
44
  onClick: function onClick() {
45
45
  return setIsDetail(false);
@@ -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;
@@ -126,7 +126,8 @@ var ModuleInterval = function ModuleInterval(props) {
126
126
  enableAddScene: props.defaultValue && props.defaultValue.enableAddScene === false ? false : true,
127
127
  changeLoading: changeLoading,
128
128
  afterEditTarget: props.afterEditTarget,
129
- onUserDrill: props.onUserDrill
129
+ onUserDrill: props.onUserDrill,
130
+ onJumpWarning: props.onJumpWarning
130
131
  }
131
132
  }, /*#__PURE__*/React.createElement(EventContent, {
132
133
  defaultValue: props.defaultValue ? props.defaultValue.data : undefined,
@@ -134,6 +135,7 @@ var ModuleInterval = function ModuleInterval(props) {
134
135
  show: showList,
135
136
  urlParam: props.urlParam,
136
137
  onUserDrill: props.onUserDrill,
138
+ onJumpWarning: props.onJumpWarning,
137
139
  onChange: setSearchData,
138
140
  initSearch: initSearch
139
141
  })));
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { SearchValue, UserDrillParamsProp } from '../../types';
3
- export declare namespace EventProps {
3
+ export declare namespace IntervalProps {
4
4
  interface Props {
5
5
  /**
6
6
  * @description 默认查询值
@@ -23,7 +23,8 @@ export declare namespace EventProps {
23
23
  /**
24
24
  * 用户钻取
25
25
  */
26
- onUserDrill: (data: UserDrillParamsProp, searchData: SearchValue) => void;
26
+ onUserDrill: (data: UserDrillParamsProp) => void;
27
+ onJumpWarning: (data: Record<string, any>, searchData: SearchValue) => void;
27
28
  }
28
29
  interface Value {
29
30
  /**
@@ -1,2 +1,2 @@
1
- export var EventProps;
2
- (function (_EventProps) {})(EventProps || (EventProps = {}));
1
+ export var IntervalProps;
2
+ (function (_IntervalProps) {})(IntervalProps || (IntervalProps = {}));
@@ -10,13 +10,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
10
10
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
11
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import React, { useContext, useState } from 'react';
13
+ import React, { 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";
20
19
  var classPrefix = 'top-panel-interval';
21
20
  var TopPanel = function TopPanel(props) {
22
21
  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;
@@ -45,8 +44,9 @@ var TopPanel = function TopPanel(props) {
45
44
  _useState8 = _slicedToArray(_useState7, 2),
46
45
  relevancyFl = _useState8[0],
47
46
  setRelevancyFl = _useState8[1];
48
- var _useContext = useContext(BizGlobalDataContext),
49
- currentApp = _useContext.currentApp;
47
+ var _useSubject = useSubject(),
48
+ subjectList = _useSubject.subjectList,
49
+ subjectLoading = _useSubject.loading;
50
50
  var _ref = defaultValue,
51
51
  userGroup = _ref.userGroup;
52
52
  // 细分属性初始值
@@ -54,6 +54,14 @@ var TopPanel = function TopPanel(props) {
54
54
  _useState10 = _slicedToArray(_useState9, 2),
55
55
  bizAttributeSelectorValue = _useState10[0],
56
56
  setBizAttributeSelectorValue = _useState10[1];
57
+ var _useState11 = useState('user'),
58
+ _useState12 = _slicedToArray(_useState11, 2),
59
+ analysisType = _useState12[0],
60
+ setAnalysisType = _useState12[1];
61
+ var _useState13 = useState(),
62
+ _useState14 = _slicedToArray(_useState13, 2),
63
+ currentSubject = _useState14[0],
64
+ setCurrentSubject = _useState14[1];
57
65
  // 用户组和事件变更
58
66
  var onValuesChange = function onValuesChange(data, allData) {
59
67
  var _data = {};
@@ -80,7 +88,14 @@ var TopPanel = function TopPanel(props) {
80
88
  _data.userGroup = allData.userGroup;
81
89
  if (_data.userGroup.length <= 0) _data.userGroup = [0];
82
90
  }
83
- props.onChange(allData, (finalSearchData === null || finalSearchData === void 0 ? void 0 : finalSearchData.chartType) === 'boxplot' ? true : false);
91
+ props.onChange(_objectSpread(_objectSpread({}, allData), {}, {
92
+ analysisSubject: allData.analysisSubject ? {
93
+ subjectId: allData.analysisSubject.id,
94
+ subjectName: allData.analysisSubject.subjectName,
95
+ subjectAlias: allData.analysisSubject.subjectAlias,
96
+ unit: allData.analysisSubject.unit
97
+ } : undefined
98
+ }), (finalSearchData === null || finalSearchData === void 0 ? void 0 : finalSearchData.chartType) === 'boxplot' ? true : false);
84
99
  };
85
100
  var resetting = function resetting() {
86
101
  form.resetFields();
@@ -94,6 +109,7 @@ var TopPanel = function TopPanel(props) {
94
109
  associatedNextAttr: undefined
95
110
  });
96
111
  setRelevancy(false);
112
+ setCurrentSubject(undefined);
97
113
  props.onChange({
98
114
  userGroup: [0],
99
115
  start: undefined,
@@ -147,14 +163,6 @@ var TopPanel = function TopPanel(props) {
147
163
  });
148
164
  }
149
165
  };
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
166
  return /*#__PURE__*/React.createElement(Form, {
159
167
  form: form,
160
168
  component: "div",
@@ -184,7 +192,8 @@ var TopPanel = function TopPanel(props) {
184
192
  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
193
  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
194
  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
- })
195
+ }),
196
+ analysisModel: (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.analysisModel) || AnalysisMode.common
188
197
  },
189
198
  scrollToFirstError: true,
190
199
  onValuesChange: onValuesChange
@@ -199,14 +208,27 @@ var TopPanel = function TopPanel(props) {
199
208
  label: '事件属性',
200
209
  value: 'eventProp'
201
210
  }],
202
- keyField: "value"
203
- })), /*#__PURE__*/React.createElement(Form.Item, {
211
+ keyField: "value",
212
+ defaultValue: {
213
+ value: analysisType
214
+ },
215
+ onChange: function onChange(val) {
216
+ setAnalysisType(val.value);
217
+ resetting();
218
+ }
219
+ })), analysisType === 'eventProp' && /*#__PURE__*/React.createElement(Form.Item, {
204
220
  label: "\u4E3B\u4F53\u540D\u79F0",
205
221
  name: "analysisSubject",
206
222
  className: "panel-form-interval-item"
207
223
  }, /*#__PURE__*/React.createElement(BizSelect, {
208
- options: []
209
- })), /*#__PURE__*/React.createElement(Form.Item, {
224
+ options: subjectList,
225
+ aliasField: "subjectAlias",
226
+ labelField: "subjectName",
227
+ keyField: "id",
228
+ onChange: function onChange(val) {
229
+ setCurrentSubject(val);
230
+ }
231
+ })), analysisType === 'user' && /*#__PURE__*/React.createElement(Form.Item, {
210
232
  label: "",
211
233
  name: "userGroup",
212
234
  className: "space-item interval-item",
@@ -223,6 +245,7 @@ var TopPanel = function TopPanel(props) {
223
245
  label: "\u5F00\u59CB\u4E8B\u4EF6",
224
246
  name: "start"
225
247
  }, /*#__PURE__*/React.createElement(EventFilter, {
248
+ subject: currentSubject,
226
249
  relevancyFl: relevancyFl,
227
250
  relevancy: true
228
251
  })), relevancy ? /*#__PURE__*/React.createElement(Form.Item, {
@@ -287,7 +310,9 @@ var TopPanel = function TopPanel(props) {
287
310
  })) : '', /*#__PURE__*/React.createElement(Form.Item, {
288
311
  label: "\u7ED3\u675F\u4E8B\u4EF6",
289
312
  name: "end"
290
- }, /*#__PURE__*/React.createElement(EventFilter, null)), /*#__PURE__*/React.createElement(Form.Item, {
313
+ }, /*#__PURE__*/React.createElement(EventFilter, {
314
+ subject: currentSubject
315
+ })), /*#__PURE__*/React.createElement(Form.Item, {
291
316
  label: "\u6309\u5C5E\u6027\u7EC6\u5206",
292
317
  name: "dimension",
293
318
  className: "dimension-interval"
@@ -315,7 +340,7 @@ var TopPanel = function TopPanel(props) {
315
340
  }, /*#__PURE__*/React.createElement(Button, {
316
341
  onClick: resetting
317
342
  }, "\u91CD\u7F6E"), /*#__PURE__*/React.createElement(Button, {
318
- loading: loading,
343
+ loading: loading || subjectLoading,
319
344
  disabled: loading || !startId || !endId || relevancy && !(defaultValue !== null && defaultValue !== void 0 && defaultValue.associatedNextAttr) && !(defaultValue !== null && defaultValue !== void 0 && defaultValue.associatedNextAttr),
320
345
  type: "primary",
321
346
  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
  /**
@@ -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,24 +117,25 @@ export interface SearchValue {
117
117
  * @description 分类
118
118
  */
119
119
  module?: string;
120
- }
121
- export interface UserDrillParamsProp {
122
120
  /**
123
- * @description 应用id
121
+ * 分析模型
124
122
  */
125
- appId: number;
123
+ analysisModel?: AnalysisMode;
126
124
  /**
127
- * @description 平台
125
+ * 分析主体
128
126
  */
129
- platform: number;
127
+ analysisSubject?: {
128
+ subjectId: number;
129
+ subjectName: string;
130
+ subjectAlias?: string;
131
+ unit: string;
132
+ };
133
+ }
134
+ export interface UserDrillParamsProp {
130
135
  /**
131
136
  * @description 用户数量
132
137
  */
133
138
  count: number;
134
- /**
135
- * @description 模型类型 整体|事件|漏斗|留存|获取|粘性|崩溃|微信生态-整体|微信生态-小程序
136
- */
137
- source: string;
138
139
  /**
139
140
  * @description 查询接口
140
141
  */
@@ -143,10 +144,6 @@ export interface UserDrillParamsProp {
143
144
  * @description 查询对象
144
145
  */
145
146
  params?: Record<string, any>;
146
- /**
147
- * @description 间隔分析,数据格式与其他业务不一致,间隔分析单独提出来了,其他业务在data里面
148
- */
149
- module?: string;
150
147
  }
151
148
  export type EventChartTypes = 'line' | 'bar' | 'pie' | 'map' | 'boxplot';
152
149
  /**
@@ -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,6 +35,7 @@ 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;
39
40
  }[] | {
40
41
  key: number;
@@ -45,6 +46,7 @@ export declare function formTableData(originalData: ChartData): {
45
46
  Q3: number;
46
47
  min: number;
47
48
  perValue: number;
49
+ total: number;
48
50
  peopleNum: number;
49
51
  children: {
50
52
  key: string;
@@ -55,6 +57,7 @@ export declare function formTableData(originalData: ChartData): {
55
57
  Q3: number;
56
58
  min: number;
57
59
  perValue: number;
60
+ total: number;
58
61
  peopleNum: number;
59
62
  }[];
60
63
  }[] | undefined;
@@ -1,19 +1,21 @@
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";
17
19
  var classPrefix = 'interval-form-data';
18
20
  function convertToHMS(seconds) {
19
21
  var hours = Math.floor(seconds / 3600);
@@ -29,7 +31,7 @@ function convertToHMS(seconds) {
29
31
  * @param columnData xAxis
30
32
  * @returns column fields
31
33
  */
32
- export function getColumns(eventGroupList, userPropList, eventEnvList, columnData, dataSource, userGroup, searchData, showList
34
+ export function getColumns(eventGroupList, userPropList, eventEnvList, columnData, dataSource, userGroup, searchData, showList, onUserDrill
33
35
  // onClickToDetailCallback: Function,
34
36
  ) {
35
37
  var _dataSource$appData, _dataSource$appData$s, _searchData$dimension;
@@ -121,7 +123,7 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
121
123
  return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
122
124
  }
123
125
  }, {
124
- title: '人均值',
126
+ title: '均值',
125
127
  width: 148,
126
128
  ellipsis: true,
127
129
  align: 'right',
@@ -136,7 +138,17 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
136
138
  return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
137
139
  }
138
140
  }, {
139
- title: '人数',
141
+ title: '合计',
142
+ width: 148,
143
+ ellipsis: true,
144
+ align: 'right',
145
+ dataIndex: 'total',
146
+ key: 'total',
147
+ render: function render(text, record) {
148
+ return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
149
+ }
150
+ }, {
151
+ title: searchData.analysisSubject ? "".concat(searchData.analysisSubject.subjectAlias || searchData.analysisSubject.subjectName, "\u6570") : '人数',
140
152
  width: 148,
141
153
  ellipsis: true,
142
154
  align: 'right',
@@ -148,7 +160,30 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
148
160
  key: 'peopleNum',
149
161
  className: "".concat(classPrefix, "-table-td"),
150
162
  render: function render(text, record) {
151
- return /*#__PURE__*/React.createElement("span", null, " ", text);
163
+ return /*#__PURE__*/React.createElement("span", {
164
+ className: "interval-drill",
165
+ onClick: function onClick() {
166
+ var params;
167
+ // 主体下钻
168
+ if (searchData.analysisSubject) {
169
+ params = {
170
+ url: Apis.subjectDrill,
171
+ count: Number(text),
172
+ params: _objectSpread({}, searchData)
173
+ };
174
+ } else {
175
+ // 用户下钻
176
+ params = {
177
+ url: Apis.userDrill,
178
+ count: Number(text),
179
+ params: _objectSpread({}, searchData)
180
+ };
181
+ }
182
+ onUserDrill === null || onUserDrill === void 0 ? void 0 : onUserDrill(params);
183
+ }
184
+ }, /*#__PURE__*/React.createElement(IconFont, {
185
+ type: "a-yanjingkai"
186
+ }), " ", text);
152
187
  }
153
188
  }];
154
189
  return data;
@@ -192,7 +227,8 @@ function createNewArray(data) {
192
227
  Q3: item.total[3] || 0,
193
228
  min: item.total[4] || 0,
194
229
  perValue: item.total[5] || 0,
195
- peopleNum: item.total[6] || 0,
230
+ total: item.total[6] || 0,
231
+ peopleNum: item.total[7] || 0,
196
232
  children: getChildrenData(data, i)
197
233
  };
198
234
  });
@@ -221,7 +257,7 @@ export function convertDateArray(params, dateArray) {
221
257
  var resultArray = dateArray.map(function (date) {
222
258
  var dateObj = new Date(date);
223
259
  var weekday = weekdays[dateObj.getDay()];
224
- return "".concat(date, " (").concat(weekday, ")");
260
+ return "".concat(date).concat(weekday ? " (".concat(weekday, ")") : '');
225
261
  });
226
262
  return resultArray;
227
263
  break;
@@ -245,7 +281,8 @@ function getChildrenData(data, index) {
245
281
  Q3: values[i][3] || 0,
246
282
  min: values[i][4] || 0,
247
283
  perValue: values[i][5] || 0,
248
- peopleNum: values[i][6] || 0
284
+ total: values[i][6] || 0,
285
+ peopleNum: values[i][7] || 0
249
286
  };
250
287
  });
251
288
  }
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.2",
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": "680096640933239c71ddd9636ed7cc86dc20e40f"
66
66
  }