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

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.
@@ -197,8 +197,8 @@ var EventFilter = function EventFilter(props) {
197
197
  }, /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
198
198
  ref: conditionRef,
199
199
  value: filter,
200
- onlyAnd: true,
201
200
  enableEventProp: true,
201
+ enableUserProp: props.analysisType === 'user',
202
202
  enableDelete: true,
203
203
  eventIdList: [event.id],
204
204
  onChange: onChangeFilters,
@@ -50,5 +50,6 @@ export interface EventFilterProps {
50
50
  relevancyFl?: boolean;
51
51
  relevancy?: boolean;
52
52
  subject?: SubjectTypes.Subject;
53
+ analysisType?: 'user' | 'eventProp';
53
54
  onChange?: (event: eventProps) => {};
54
55
  }
@@ -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)),
@@ -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,7 +35,7 @@ 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),
38
+ var _useContext2 = useContext(IntervalContext),
39
39
  panelName = _useContext2.panelName,
40
40
  onUserDrill = _useContext2.onUserDrill;
41
41
 
@@ -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;
@@ -105,7 +105,7 @@ var TopBar = function TopBar(props) {
105
105
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
106
106
  module: 'interval'
107
107
  }, searchData), {}, {
108
- chartType: 'line'
108
+ chartType: 'boxplot'
109
109
  }),
110
110
  onOk: function onOk(data) {
111
111
  return _onOk('scene', data);
@@ -9,7 +9,8 @@ var Apis = {
9
9
  /**
10
10
  * 主体下钻
11
11
  */
12
- subjectDrill: '/interval/eventDrill'
12
+ subjectDrill: '/interval/eventDrill',
13
+ querySubjectDisplay: '/analysisSubject/querySubDisplay'
13
14
  };
14
15
  for (var key in Apis) {
15
16
  Apis[key] = "/zg/web/v2".concat(Apis[key]);
@@ -97,12 +97,13 @@ var IntervalEventChart = function IntervalEventChart(props) {
97
97
  dataSource: dataSource,
98
98
  showList: showList,
99
99
  dataSourceList: dataSourceList,
100
- params: params
101
- }), (params === null || params === void 0 ? void 0 : params.chartType) === 'line' ? /*#__PURE__*/React.createElement(EventTable, {
100
+ params: params,
101
+ onlyChart: props.onlyChart
102
+ }), !props.onlyChart && /*#__PURE__*/React.createElement(EventTable, {
102
103
  dataSource: dataSource,
103
104
  searchData: params,
104
105
  showList: [],
105
106
  changeShow: onChangeShow
106
- }) : null);
107
+ }));
107
108
  };
108
109
  export default IntervalEventChart;
@@ -87,7 +87,7 @@ var IntervalChart = function IntervalChart(props) {
87
87
  right: 3,
88
88
  height: 20 // 设置内置的dataZoom的高度
89
89
  }, {
90
- show: (params === null || params === void 0 ? void 0 : params.module) === 'interval' ? false : true,
90
+ show: props.onlyChart ? false : true,
91
91
  type: 'slider',
92
92
  bottom: '38px',
93
93
  xAxisIndex: [0],
@@ -13,6 +13,7 @@ export declare namespace eventChartProps {
13
13
  */
14
14
  dataSource?: ChartTypesProps;
15
15
  dataSourceList?: DisplaySetup[];
16
+ onlyChart?: boolean;
16
17
  /**
17
18
  * 查询条件
18
19
  */
@@ -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";
@@ -56,15 +56,11 @@ var EventContent = function EventContent(props) {
56
56
  _useState12 = _slicedToArray(_useState11, 2),
57
57
  isCity = _useState12[0],
58
58
  setIsCity = _useState12[1];
59
- var _useState13 = useState(false),
59
+ var _useState13 = useState(-1),
60
60
  _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),
61
+ eventId = _useState14[0],
62
+ setEventId = _useState14[1];
63
+ var _useContext2 = useContext(IntervalContext),
68
64
  searchData = _useContext2.searchData,
69
65
  setSearchData = _useContext2.setSearchData,
70
66
  eventGroupList = _useContext2.eventGroupList,
@@ -72,11 +68,17 @@ var EventContent = function EventContent(props) {
72
68
  userPropList = _useContext2.userPropList;
73
69
  var _useContext3 = useContext(BizTargetFromPanelContext),
74
70
  handleSearch = _useContext3.handleSearch;
71
+ var _useState15 = useState(),
72
+ _useState16 = _slicedToArray(_useState15, 2),
73
+ searchTimer = _useState16[0],
74
+ setSearchTimer = _useState16[1];
75
75
  var collapseRef = useRef();
76
76
  // 初始化
77
77
  useEffect(function () {
78
78
  if (props.defaultValue) {
79
79
  setEventId(props.defaultValue.id);
80
+ } else {
81
+ setLoading(false);
80
82
  }
81
83
  }, [props.defaultValue]);
82
84
  useEffect(function () {
@@ -88,42 +90,28 @@ var EventContent = function EventContent(props) {
88
90
  setIsCity(judgeIsCity(_attrName));
89
91
  }
90
92
  }
91
- if (timer) clearTimeout(timer);
92
- var flag = true;
93
- timer = setTimeout(function () {
94
- if (flag) {
95
- fetchRequest(false);
96
- }
97
- }, 500);
93
+ if (!searchData || !searchData.analysisModel) return;
94
+ if (searchTimer) clearTimeout(searchTimer);
95
+ setSearchTimer(setTimeout(function () {
96
+ fetchRequest();
97
+ }, 300));
98
98
  return function () {
99
- // 清理异步任务
100
- if (timer) clearTimeout(timer);
101
- flag = false;
99
+ clearTimeout(searchTimer);
102
100
  };
103
101
  }, [searchData]);
104
102
  useEffect(function () {
105
103
  handleSearch && handleSearch(loading);
106
104
  }, [loading]);
107
- useEffect(function () {
108
- if (ajaxFlag) {
109
- fetchRequest(true);
110
- }
111
- }, [ajaxFlag]);
105
+
112
106
  // 查询
113
- var fetchRequest = function fetchRequest(flag) {
107
+ var fetchRequest = function fetchRequest() {
114
108
  var _searchData$start, _searchData$end, _searchData$associate, _searchData$associate2, _searchData$associate3;
115
- if (flag !== undefined) setAjaxFlag(flag);
116
- if (!ajaxFlag) return;
117
109
  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
110
  setLoading(false);
119
111
  return;
120
112
  }
121
113
  setEventData(undefined);
122
114
  setLoading(true);
123
- // 取消上次未完成的请求
124
- // if (typeof cancel === 'function') {
125
- // cancel();
126
- // }
127
115
  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
116
  setLoading(false);
129
117
  return message.error('您查询的属性不一致,暂不支持查询');
@@ -159,7 +147,6 @@ var EventContent = function EventContent(props) {
159
147
  setSearchData(function (value) {
160
148
  return _objectSpread(_objectSpread({}, value), data);
161
149
  });
162
- setAjaxFlag(true);
163
150
  };
164
151
 
165
152
  // 改变显示内容
@@ -174,9 +161,6 @@ var EventContent = function EventContent(props) {
174
161
  platform: data
175
162
  });
176
163
  });
177
- setTimeout(function () {
178
- setAjaxFlag(true);
179
- }, 100);
180
164
  };
181
165
 
182
166
  // TopPanel组件数值变更
@@ -188,7 +172,6 @@ var EventContent = function EventContent(props) {
188
172
  analysisSubject: data.analysisSubject ? data.analysisSubject : undefined
189
173
  });
190
174
  });
191
- setAjaxFlag(false);
192
175
  };
193
176
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TopBar, {
194
177
  searchData: searchData,
@@ -205,11 +188,8 @@ var EventContent = function EventContent(props) {
205
188
  collapseRef: collapseRef,
206
189
  onChange: onChangeSearch,
207
190
  defaultValue: searchData,
208
- urlParam: props.urlParam,
209
- ajaxFlag: ajaxFlag,
210
191
  loading: loading,
211
- finalSearchData: finalSearchData,
212
- fetchRequest: fetchRequest
192
+ finalSearchData: finalSearchData
213
193
  })
214
194
  }, /*#__PURE__*/React.createElement("div", {
215
195
  className: classPrefix
@@ -1,4 +1,4 @@
1
- import { SearchValue, UserDrillParamsProp } from '../../types';
1
+ import { SearchValue } from '../../types';
2
2
  import { IntervalProps } from '../home/types';
3
3
  export declare namespace EventContentProps {
4
4
  interface Props {
@@ -10,7 +10,6 @@ export declare namespace EventContentProps {
10
10
  * 默认值
11
11
  */
12
12
  value: SearchValue;
13
- urlParam?: SearchValue;
14
13
  /**
15
14
  * 展示列表
16
15
  */
@@ -19,7 +18,7 @@ export declare namespace EventContentProps {
19
18
  * 是否查询中
20
19
  */
21
20
  onSearching?: (flag: boolean) => void;
22
- onUserDrill: (data: UserDrillParamsProp, searchData: SearchValue) => void;
21
+ onUserDrill: IntervalProps.Props['onUserDrill'];
23
22
  onJumpWarning: IntervalProps.Props['onJumpWarning'];
24
23
  /**
25
24
  * 查询条件回调
@@ -91,7 +91,7 @@ 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,
@@ -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
  }, []);
@@ -45,9 +39,42 @@ export default (function () {
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
+ defaultValue: {
45
+ data: {
46
+ time: {
47
+ begin: '2023-08-01',
48
+ end: '2023-10-18',
49
+ unit: 'day'
50
+ },
51
+ chartType: 'boxplot',
52
+ start: {
53
+ id: 7612,
54
+ name: '间隔事件-01',
55
+ relevancy: false
56
+ },
57
+ end: {
58
+ id: 7614,
59
+ name: '间隔事件-02'
60
+ },
61
+ dimension: {
62
+ alias: '',
63
+ eventId: 7612,
64
+ id: 151567,
65
+ isHidden: 0,
66
+ key: 'eventProp-151567',
67
+ label: '商品数量',
68
+ propCategory: 'eventProp',
69
+ type: 2,
70
+ realTime: true,
71
+ dimensionSub: 'event_attr'
72
+ },
73
+ userGroups: [0],
74
+ analysisModel: 'commonInterval',
75
+ analysisIndex: 'number'
76
+ }
77
+ },
78
+ onJumpWarning: function onJumpWarning() {}
52
79
  }));
53
80
  });
@@ -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',
@@ -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,
@@ -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,10 +131,11 @@ 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
137
  enableAddScene: props.defaultValue && props.defaultValue.enableAddScene === false ? false : true,
127
- changeLoading: changeLoading,
138
+ changeLoading: setLoading,
128
139
  afterEditTarget: props.afterEditTarget,
129
140
  onUserDrill: props.onUserDrill,
130
141
  onJumpWarning: props.onJumpWarning
@@ -133,7 +144,6 @@ var ModuleInterval = function ModuleInterval(props) {
133
144
  defaultValue: props.defaultValue ? props.defaultValue.data : undefined,
134
145
  value: searchData,
135
146
  show: showList,
136
- urlParam: props.urlParam,
137
147
  onUserDrill: props.onUserDrill,
138
148
  onJumpWarning: props.onJumpWarning,
139
149
  onChange: setSearchData,
@@ -8,6 +8,12 @@
8
8
  min-width: 1000px;
9
9
  height: 100%;
10
10
  background: #fafafb;
11
+ &-loading {
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ height: 100%;
16
+ }
11
17
  .interval-layout {
12
18
  .biz-layout-collapse-container {
13
19
  height: 24px;
@@ -1,12 +1,11 @@
1
1
  /// <reference types="react" />
2
- import { SearchValue, UserDrillParamsProp } from '../../types';
2
+ import { SearchValue, IntervalDrillParams } from '../../types';
3
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,8 +22,9 @@ export declare namespace IntervalProps {
23
22
  /**
24
23
  * 用户钻取
25
24
  */
26
- onUserDrill: (data: UserDrillParamsProp) => void;
25
+ onUserDrill: (data: IntervalDrillParams, isSubject: boolean) => void;
27
26
  onJumpWarning: (data: Record<string, any>, searchData: SearchValue) => void;
27
+ onChange?: (data: SearchValue) => void;
28
28
  }
29
29
  interface Value {
30
30
  /**
@@ -70,6 +70,8 @@ export declare namespace IntervalProps {
70
70
  min?: number;
71
71
  perValue?: number;
72
72
  peopleNum?: number;
73
+ names?: string[];
74
+ total?: number;
73
75
  children?: ColumnsDataType[];
74
76
  }
75
77
  }
@@ -10,20 +10,20 @@ 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, { useState } from 'react';
13
+ import React, { useContext, useEffect, useState } from 'react';
14
14
  import { Form, Button, Radio } from 'antd';
15
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 { IntervalContext } from "../../types";
19
20
  var classPrefix = 'top-panel-interval';
20
21
  var TopPanel = function TopPanel(props) {
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;
22
+ var _props$defaultValue, _props$defaultValue2, _props$defaultValue3, _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, _currentParams$start2, _currentParams$end2, _currentParams$start3, _currentParams$end3;
22
23
  var defaultValue = props.defaultValue,
23
24
  loading = props.loading,
24
25
  collapseRef = props.collapseRef,
25
- finalSearchData = props.finalSearchData,
26
- fetchRequest = props.fetchRequest;
26
+ finalSearchData = props.finalSearchData;
27
27
  var _Form$useForm = Form.useForm(),
28
28
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
29
29
  form = _Form$useForm2[0];
@@ -47,7 +47,9 @@ var TopPanel = function TopPanel(props) {
47
47
  var _useSubject = useSubject(),
48
48
  subjectList = _useSubject.subjectList,
49
49
  subjectLoading = _useSubject.loading;
50
- var _ref = defaultValue,
50
+ var _useContext = useContext(IntervalContext),
51
+ subjectEnable = _useContext.subjectEnable;
52
+ var _ref = defaultValue || {},
51
53
  userGroup = _ref.userGroup;
52
54
  // 细分属性初始值
53
55
  var _useState9 = useState(),
@@ -62,6 +64,18 @@ var TopPanel = function TopPanel(props) {
62
64
  _useState14 = _slicedToArray(_useState13, 2),
63
65
  currentSubject = _useState14[0],
64
66
  setCurrentSubject = _useState14[1];
67
+ var _useState15 = useState(false),
68
+ _useState16 = _slicedToArray(_useState15, 2),
69
+ inited = _useState16[0],
70
+ setInited = _useState16[1];
71
+ var _useState17 = useState(),
72
+ _useState18 = _slicedToArray(_useState17, 2),
73
+ currentParams = _useState18[0],
74
+ setCurrentParams = _useState18[1];
75
+ var _useState19 = useState(true),
76
+ _useState20 = _slicedToArray(_useState19, 2),
77
+ searchDisabled = _useState20[0],
78
+ setSearchDisabled = _useState20[1];
65
79
  // 用户组和事件变更
66
80
  var onValuesChange = function onValuesChange(data, allData) {
67
81
  var _data = {};
@@ -88,15 +102,36 @@ var TopPanel = function TopPanel(props) {
88
102
  _data.userGroup = allData.userGroup;
89
103
  if (_data.userGroup.length <= 0) _data.userGroup = [0];
90
104
  }
91
- props.onChange(_objectSpread(_objectSpread({}, allData), {}, {
105
+ setCurrentParams(_objectSpread(_objectSpread({}, allData), {}, {
92
106
  analysisSubject: allData.analysisSubject ? {
93
107
  subjectId: allData.analysisSubject.id,
94
108
  subjectName: allData.analysisSubject.subjectName,
95
109
  subjectAlias: allData.analysisSubject.subjectAlias,
96
110
  unit: allData.analysisSubject.unit
97
111
  } : undefined
98
- }), (finalSearchData === null || finalSearchData === void 0 ? void 0 : finalSearchData.chartType) === 'boxplot' ? true : false);
112
+ }));
99
113
  };
114
+ useEffect(function () {
115
+ var _currentParams$start, _currentParams$start$, _currentParams$start$2, _currentParams$end, _currentParams$end$fi, _currentParams$end$fi2;
116
+ var conditionValid = true;
117
+ currentParams === null || currentParams === void 0 ? void 0 : (_currentParams$start = currentParams.start) === null || _currentParams$start === void 0 ? void 0 : (_currentParams$start$ = _currentParams$start.filters) === null || _currentParams$start$ === void 0 ? void 0 : (_currentParams$start$2 = _currentParams$start$.conditions) === null || _currentParams$start$2 === void 0 ? void 0 : _currentParams$start$2.forEach(function (item) {
118
+ var _item$values;
119
+ if (!/null/.test(item.operator || '') && !((_item$values = item.values) !== null && _item$values !== void 0 && _item$values.length)) {
120
+ conditionValid = false;
121
+ }
122
+ });
123
+ currentParams === null || currentParams === void 0 ? void 0 : (_currentParams$end = currentParams.end) === null || _currentParams$end === void 0 ? void 0 : (_currentParams$end$fi = _currentParams$end.filters) === null || _currentParams$end$fi === void 0 ? void 0 : (_currentParams$end$fi2 = _currentParams$end$fi.conditions) === null || _currentParams$end$fi2 === void 0 ? void 0 : _currentParams$end$fi2.forEach(function (item) {
124
+ var _item$values2;
125
+ if (!/null/.test(item.operator || '') && !((_item$values2 = item.values) !== null && _item$values2 !== void 0 && _item$values2.length)) {
126
+ conditionValid = false;
127
+ }
128
+ });
129
+ if (loading || !(currentParams !== null && currentParams !== void 0 && currentParams.start) || !(currentParams !== null && currentParams !== void 0 && currentParams.start.id) || !(currentParams !== null && currentParams !== void 0 && currentParams.end) || !(currentParams !== null && currentParams !== void 0 && currentParams.end.id) || !conditionValid || relevancy && !(currentParams !== null && currentParams !== void 0 && currentParams.associatedNextAttr) && !(currentParams !== null && currentParams !== void 0 && currentParams.associatedNextAttr) || analysisType === 'eventProp' && !currentSubject) {
130
+ setSearchDisabled(true);
131
+ } else {
132
+ setSearchDisabled(false);
133
+ }
134
+ }, [currentParams]);
100
135
  var resetting = function resetting() {
101
136
  form.resetFields();
102
137
  form.setFieldsValue({
@@ -163,6 +198,20 @@ var TopPanel = function TopPanel(props) {
163
198
  });
164
199
  }
165
200
  };
201
+ useEffect(function () {
202
+ if (!defaultValue) {
203
+ setInited(true);
204
+ return;
205
+ }
206
+ setInited(false);
207
+ if (defaultValue.analysisSubject) {
208
+ setAnalysisType('eventProp');
209
+ } else {
210
+ setAnalysisType('user');
211
+ }
212
+ setInited(true);
213
+ }, []);
214
+ if (!inited) return null;
166
215
  return /*#__PURE__*/React.createElement(Form, {
167
216
  form: form,
168
217
  component: "div",
@@ -170,7 +219,8 @@ var TopPanel = function TopPanel(props) {
170
219
  className: "panel-form-interval",
171
220
  layout: "vertical",
172
221
  initialValues: {
173
- 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],
222
+ 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],
223
+ analysisSubject: props === null || props === void 0 ? void 0 : (_props$defaultValue3 = props.defaultValue) === null || _props$defaultValue3 === void 0 ? void 0 : _props$defaultValue3.analysisSubject,
174
224
  start: _objectSpread(_objectSpread({}, defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.start), {}, {
175
225
  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
176
226
  }),
@@ -197,7 +247,7 @@ var TopPanel = function TopPanel(props) {
197
247
  },
198
248
  scrollToFirstError: true,
199
249
  onValuesChange: onValuesChange
200
- }, /*#__PURE__*/React.createElement(Form.Item, {
250
+ }, subjectEnable && /*#__PURE__*/React.createElement(Form.Item, {
201
251
  label: "\u5206\u6790\u4E3B\u4F53",
202
252
  className: "panel-form-interval-item"
203
253
  }, /*#__PURE__*/React.createElement(BizSelect, {
@@ -227,6 +277,11 @@ var TopPanel = function TopPanel(props) {
227
277
  keyField: "id",
228
278
  onChange: function onChange(val) {
229
279
  setCurrentSubject(val);
280
+ setRelevancy(false);
281
+ form.setFieldsValue({
282
+ start: undefined,
283
+ end: undefined
284
+ });
230
285
  }
231
286
  })), analysisType === 'user' && /*#__PURE__*/React.createElement(Form.Item, {
232
287
  label: "",
@@ -247,7 +302,9 @@ var TopPanel = function TopPanel(props) {
247
302
  }, /*#__PURE__*/React.createElement(EventFilter, {
248
303
  subject: currentSubject,
249
304
  relevancyFl: relevancyFl,
250
- relevancy: true
305
+ relevancy: true,
306
+ key: "".concat(currentSubject === null || currentSubject === void 0 ? void 0 : currentSubject.subjectName, "-start"),
307
+ analysisType: analysisType
251
308
  })), relevancy ? /*#__PURE__*/React.createElement(Form.Item, {
252
309
  className: "associated"
253
310
  }, /*#__PURE__*/React.createElement("span", {
@@ -273,6 +330,7 @@ var TopPanel = function TopPanel(props) {
273
330
  value: bizAttributeSelectorValue,
274
331
  enableDelete: true,
275
332
  onChange: onChangeAttr,
333
+ key: "".concat(currentParams === null || currentParams === void 0 ? void 0 : (_currentParams$start2 = currentParams.start) === null || _currentParams$start2 === void 0 ? void 0 : _currentParams$start2.id, "-").concat(currentParams === null || currentParams === void 0 ? void 0 : (_currentParams$end2 = currentParams.end) === null || _currentParams$end2 === void 0 ? void 0 : _currentParams$end2.id, "-pre"),
276
334
  onDelete: function onDelete() {
277
335
  onChangeAttr(undefined, 'associatedPreAttr');
278
336
  }
@@ -291,6 +349,7 @@ var TopPanel = function TopPanel(props) {
291
349
  value: bizAttributeSelectorValue,
292
350
  enableDelete: true,
293
351
  onChange: onChangeAttr,
352
+ key: "".concat(currentParams === null || currentParams === void 0 ? void 0 : (_currentParams$start3 = currentParams.start) === null || _currentParams$start3 === void 0 ? void 0 : _currentParams$start3.id, "-").concat(currentParams === null || currentParams === void 0 ? void 0 : (_currentParams$end3 = currentParams.end) === null || _currentParams$end3 === void 0 ? void 0 : _currentParams$end3.id, "-next"),
294
353
  onDelete: function onDelete() {
295
354
  onChangeAttr(undefined, 'associatedNextAttr');
296
355
  }
@@ -311,15 +370,18 @@ var TopPanel = function TopPanel(props) {
311
370
  label: "\u7ED3\u675F\u4E8B\u4EF6",
312
371
  name: "end"
313
372
  }, /*#__PURE__*/React.createElement(EventFilter, {
314
- subject: currentSubject
373
+ subject: currentSubject,
374
+ analysisType: analysisType,
375
+ key: "".concat(currentSubject === null || currentSubject === void 0 ? void 0 : currentSubject.subjectName, "-start")
315
376
  })), /*#__PURE__*/React.createElement(Form.Item, {
316
377
  label: "\u6309\u5C5E\u6027\u7EC6\u5206",
317
378
  name: "dimension",
318
379
  className: "dimension-interval"
319
380
  }, /*#__PURE__*/React.createElement(BizAttributeSelector, {
320
381
  enableEventProp: true,
321
- enableUserProp: true,
382
+ enableUserProp: analysisType === 'user',
322
383
  enableEnvProp: true,
384
+ key: "".concat(currentSubject === null || currentSubject === void 0 ? void 0 : currentSubject.subjectName, "-dimension"),
323
385
  eventIdList: startId === endId ? [startId] : [startId, endId],
324
386
  value: bizAttributeSelectorValue,
325
387
  enableDelete: true,
@@ -341,10 +403,10 @@ var TopPanel = function TopPanel(props) {
341
403
  onClick: resetting
342
404
  }, "\u91CD\u7F6E"), /*#__PURE__*/React.createElement(Button, {
343
405
  loading: loading || subjectLoading,
344
- disabled: loading || !startId || !endId || relevancy && !(defaultValue !== null && defaultValue !== void 0 && defaultValue.associatedNextAttr) && !(defaultValue !== null && defaultValue !== void 0 && defaultValue.associatedNextAttr),
406
+ disabled: searchDisabled,
345
407
  type: "primary",
346
408
  onClick: function onClick() {
347
- fetchRequest(true);
409
+ props.onChange(currentParams, (finalSearchData === null || finalSearchData === void 0 ? void 0 : finalSearchData.chartType) === 'boxplot' ? true : false);
348
410
  }
349
411
  }, "\u67E5\u8BE2"))));
350
412
  };
@@ -19,13 +19,13 @@
19
19
  .panel-form-interval {
20
20
  &-item {
21
21
  .ant-form-item-label {
22
- padding-left: 24px;
22
+ padding-left: 24px !important;
23
23
  font-weight: 500;
24
24
  }
25
25
  .ant-form-item-control-input-content {
26
26
  height: 40px;
27
- padding: 0 24px;
28
- line-height: 40px;
27
+ padding: 0 24px !important;
28
+ line-height: 40px !important;
29
29
  .biz-select-handle {
30
30
  display: inline-block;
31
31
  width: 208px;
@@ -42,23 +42,14 @@ export interface TopPanelProps {
42
42
  * 默认值
43
43
  */
44
44
  defaultValue?: SearchValue;
45
- urlParam?: SearchValue;
46
45
  loading?: boolean;
47
46
  /**
48
47
  * 数据更新
49
48
  */
50
49
  onChange: (data: SearchValue, flag: boolean) => void;
51
- /**
52
- * 是否请求数据
53
- */
54
- ajaxFlag: boolean;
55
50
  /**
56
51
  * 请求后的最新查询数据
57
52
  */
58
53
  finalSearchData?: SearchValue;
59
- /**
60
- * 请求数据方法
61
- */
62
- fetchRequest: (flag?: boolean) => void;
63
54
  collapseRef?: any;
64
55
  }
@@ -131,20 +131,6 @@ export interface SearchValue {
131
131
  unit: string;
132
132
  };
133
133
  }
134
- export interface UserDrillParamsProp {
135
- /**
136
- * @description 用户数量
137
- */
138
- count: number;
139
- /**
140
- * @description 查询接口
141
- */
142
- url: string;
143
- /**
144
- * @description 查询对象
145
- */
146
- params?: Record<string, any>;
147
- }
148
134
  export type EventChartTypes = 'line' | 'bar' | 'pie' | 'map' | 'boxplot';
149
135
  /**
150
136
  * 图表选择类型
@@ -187,4 +173,18 @@ export interface TableChildrenProps {
187
173
  name: string;
188
174
  values: number[];
189
175
  }
190
- 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);
@@ -37,6 +37,7 @@ export declare function formTableData(originalData: ChartData): {
37
37
  perValue: number;
38
38
  total: number;
39
39
  peopleNum: number;
40
+ names: string[];
40
41
  }[] | {
41
42
  key: number;
42
43
  time: string;
@@ -59,6 +60,7 @@ export declare function formTableData(originalData: ChartData): {
59
60
  perValue: number;
60
61
  total: number;
61
62
  peopleNum: number;
63
+ names: string[];
62
64
  }[];
63
65
  }[] | undefined;
64
66
  type ChartData = {
@@ -16,6 +16,7 @@ import { chartColors } from "../constants/color";
16
16
  import "../style/index.less";
17
17
  import { IconFont } from '@zgfe/business-lib';
18
18
  import { Apis } from "../constants";
19
+ import { searchDataParams } from "../modules/content/utils";
19
20
  var classPrefix = 'interval-form-data';
20
21
  function convertToHMS(seconds) {
21
22
  var hours = Math.floor(seconds / 3600);
@@ -144,6 +145,11 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
144
145
  align: 'right',
145
146
  dataIndex: 'total',
146
147
  key: 'total',
148
+ className: "".concat(classPrefix, "-table-td"),
149
+ sorter: function sorter(a, b) {
150
+ var _a$total, _b$total;
151
+ return ((_a$total = a === null || a === void 0 ? void 0 : a.total) !== null && _a$total !== void 0 ? _a$total : 0) - ((_b$total = b === null || b === void 0 ? void 0 : b.total) !== null && _b$total !== void 0 ? _b$total : 0);
152
+ },
147
153
  render: function render(text, record) {
148
154
  return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
149
155
  }
@@ -164,22 +170,30 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
164
170
  className: "interval-drill",
165
171
  onClick: function onClick() {
166
172
  var params;
173
+ var searchParam = searchDataParams(searchData);
167
174
  // 主体下钻
168
175
  if (searchData.analysisSubject) {
169
176
  params = {
170
177
  url: Apis.subjectDrill,
171
178
  count: Number(text),
172
- params: _objectSpread({}, searchData)
179
+ params: _objectSpread({}, searchParam)
173
180
  };
174
181
  } else {
175
182
  // 用户下钻
176
183
  params = {
177
184
  url: Apis.userDrill,
178
185
  count: Number(text),
179
- params: _objectSpread({}, searchData)
186
+ params: _objectSpread({}, searchParam)
180
187
  };
181
188
  }
182
- onUserDrill === null || onUserDrill === void 0 ? void 0 : onUserDrill(params);
189
+ if (searchParam.dimension) {
190
+ params.params.groupValue = /\d{4}-\d{2}-\d{2}/.test(record.time || '') ? record.names ? record.names[0] : undefined : record.time;
191
+ }
192
+ if (/\d{4}-\d{2}-\d{2}/.test(record.time || '')) {
193
+ params.params.time.begin = record.time.split('|')[0];
194
+ params.params.time.end = record.time.split('|')[1] || record.time.split('|')[0];
195
+ }
196
+ onUserDrill === null || onUserDrill === void 0 ? void 0 : onUserDrill(params, searchData.analysisSubject ? true : false);
183
197
  }
184
198
  }, /*#__PURE__*/React.createElement(IconFont, {
185
199
  type: "a-yanjingkai"
@@ -282,7 +296,8 @@ function getChildrenData(data, index) {
282
296
  min: values[i][4] || 0,
283
297
  perValue: values[i][5] || 0,
284
298
  total: values[i][6] || 0,
285
- peopleNum: values[i][7] || 0
299
+ peopleNum: values[i][7] || 0,
300
+ names: firstSeries.names
286
301
  };
287
302
  });
288
303
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-interval",
3
- "version": "1.0.3-alpha.2",
3
+ "version": "1.0.3-alpha.20",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -62,5 +62,5 @@
62
62
  "umi-request": "^1.4.0",
63
63
  "yorkie": "^2.0.0"
64
64
  },
65
- "gitHead": "680096640933239c71ddd9636ed7cc86dc20e40f"
65
+ "gitHead": "c2b22cc5dc375e76bfa62ae6355d2479ee2211ae"
66
66
  }