@zgfe/modules-event 0.0.2-event.78 → 0.0.2-event.80

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.
@@ -11,12 +11,15 @@ import { BizDatePicker, BizSelect, BizTargetDimension } from '@zgfe/business-lib
11
11
  import React, { useContext, useEffect, useState } from 'react';
12
12
  import { chartTypeOptions, getInitDate } from '../../constants';
13
13
  import { EventContext } from '../../types';
14
- import { normalOptions } from '../../modules/content/utils';
14
+ import { normalOptions, judgeIsCity, judgeIsArea } from '../../modules/content/utils';
15
15
  import './styles/index.less';
16
16
  var classPrefix = 'search-panel';
17
17
  var SearchPanel = function SearchPanel(props) {
18
18
  var _useContext = useContext(EventContext),
19
- includeToday = _useContext.includeToday;
19
+ includeToday = _useContext.includeToday,
20
+ searchData = _useContext.searchData;
21
+ var setEnableSelectChart = props.setEnableSelectChart,
22
+ setIsCity = props.setIsCity;
20
23
  var _useState = useState(props.time || getInitDate(includeToday)),
21
24
  _useState2 = _slicedToArray(_useState, 2),
22
25
  time = _useState2[0],
@@ -36,6 +39,7 @@ var SearchPanel = function SearchPanel(props) {
36
39
  dimension = _useState8[0],
37
40
  setDimension = _useState8[1];
38
41
  useEffect(function () {
42
+ console.log('123123123', props.chartType, searchData);
39
43
  if (props.chartType && props.chartType !== chart.value) {
40
44
  if (props.chartType.indexOf(',') !== -1) {
41
45
  setChart({
@@ -59,7 +63,19 @@ var SearchPanel = function SearchPanel(props) {
59
63
  _dimension['analysisAttr'] = props.analysisAttr;
60
64
  }
61
65
  setDimension(_objectSpread({}, _dimension));
62
- }, [props.chartType]);
66
+ }, []);
67
+ useEffect(function () {
68
+ if (searchData.dimension) {
69
+ var _value = searchData.dimension.value;
70
+ setEnableSelectChart && setEnableSelectChart(judgeIsArea(_value));
71
+ setIsCity && setIsCity(judgeIsCity(_value));
72
+ if (judgeIsArea(_value)) {
73
+ setChart({
74
+ value: 'map'
75
+ });
76
+ }
77
+ }
78
+ }, [searchData]);
63
79
  useEffect(function () {
64
80
  if (!props.enableSelectChart && chart.value === 'map') {
65
81
  setChart({
@@ -10,4 +10,6 @@ export interface SearchPanelProps {
10
10
  chartType?: EventChartTypes;
11
11
  optionNode?: ReactNode;
12
12
  onChange?: (data: SearchPanelProps) => void;
13
+ setIsCity?: Function;
14
+ setEnableSelectChart?: Function;
13
15
  }
@@ -18,6 +18,7 @@ import { Apis } from '../../constants';
18
18
  import { judgeIsCity, judgeIsArea, getValue } from './utils';
19
19
  import { ContentPanel, SearchPanel } from '../../components';
20
20
  import { getDefaultShow, getUserGroupsCompareData, getSortData, getChartDataEventAliasName } from '../../utils/formData';
21
+ import _ from 'lodash';
21
22
  import TopPanel from '../topPanel';
22
23
  var timer = 0;
23
24
  var ajaxFlag = true;
@@ -81,7 +82,29 @@ var EventContent = function EventContent(props) {
81
82
  handleSearch && handleSearch(loading);
82
83
  }, [loading]);
83
84
  var fetchRequest = function fetchRequest(flag) {
84
- if (JSON.stringify(searchData) === JSON.stringify(finalSearchData)) {
85
+ var _searchData = _.cloneDeep(searchData);
86
+ if (_searchData.dimension) {
87
+ var _getValue;
88
+ var _attrName = (_getValue = getValue(_searchData.dimension, eventGroupList, eventEnvList, userPropList)) === null || _getValue === void 0 ? void 0 : _getValue.name;
89
+ if (_attrName) {
90
+ setEnableSelectChart(judgeIsArea(_attrName));
91
+ setIsCity(judgeIsCity(_attrName));
92
+ if (!judgeIsArea(_attrName)) {
93
+ if (_searchData.chartType === 'map') {
94
+ console.log(222);
95
+ _searchData.chartType = 'line';
96
+ }
97
+ }
98
+ }
99
+ } else {
100
+ setEnableSelectChart(false);
101
+ setIsCity(false);
102
+ if (_searchData.chartType === 'map') {
103
+ console.log(1111);
104
+ _searchData.chartType = 'line';
105
+ }
106
+ }
107
+ if (JSON.stringify(_searchData) === JSON.stringify(finalSearchData)) {
85
108
  console.log('数据没变,终止请求');
86
109
  return;
87
110
  }
@@ -96,8 +119,8 @@ var EventContent = function EventContent(props) {
96
119
  method: 'post',
97
120
  data: _objectSpread({
98
121
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
99
- platform: (searchData === null || searchData === void 0 ? void 0 : searchData.platform) || 0
100
- }, searchData),
122
+ platform: (_searchData === null || _searchData === void 0 ? void 0 : _searchData.platform) || 0
123
+ }, _searchData),
101
124
  cancelToken: new CancelToken(function executor(c) {
102
125
  cancel = c;
103
126
  })
@@ -107,19 +130,19 @@ var EventContent = function EventContent(props) {
107
130
  return;
108
131
  }
109
132
  var result = res.data;
110
- var _data = searchData.dimension ? result : getChartDataEventAliasName(result, eventGroupList);
133
+ var _data = _searchData.dimension ? result : getChartDataEventAliasName(result, eventGroupList);
111
134
  console.log('dataSource66888', _data);
112
135
  setShowList(_data ? getDefaultShow(_data) : []);
113
- if (['bar', 'pie', 'map'].indexOf(searchData.chartType) !== -1) {
136
+ if (['bar', 'pie', 'map'].indexOf(_searchData.chartType) !== -1) {
114
137
  _data = getSortData(_data);
115
138
  }
116
- if (searchData.userGroup.length > 1) {
139
+ if (_searchData.userGroup.length > 1) {
117
140
  setEventData(getUserGroupsCompareData(_data));
118
141
  } else {
119
142
  setEventData(_data);
120
143
  }
121
- setFinalSearchData(_objectSpread({}, searchData));
122
- onChangeUrlParam(searchData);
144
+ setFinalSearchData(_objectSpread({}, _searchData));
145
+ onChangeUrlParam(_searchData);
123
146
  setTimeout(function () {
124
147
  setLoading(false);
125
148
  }, 0);
@@ -143,6 +166,7 @@ var EventContent = function EventContent(props) {
143
166
  });
144
167
  };
145
168
  var onChangeSearch = function onChangeSearch(data, flag) {
169
+ console.log('TopPanel查询条件变更,', data);
146
170
  ajaxFlag = flag;
147
171
  data.id ? setEventId(data.id) : setEventId(-1);
148
172
  setSearchData(function (_searchData) {
@@ -151,25 +175,6 @@ var EventContent = function EventContent(props) {
151
175
  dimension: data.dimension,
152
176
  filters: data.filters
153
177
  }, data);
154
- if (_data.dimension) {
155
- var _getValue;
156
- var _attrName = (_getValue = getValue(_data.dimension, eventGroupList, eventEnvList, userPropList)) === null || _getValue === void 0 ? void 0 : _getValue.name;
157
- if (_attrName) {
158
- setEnableSelectChart(judgeIsArea(_attrName));
159
- setIsCity(judgeIsCity(_attrName));
160
- if (!judgeIsArea(_attrName)) {
161
- if (_data.chartType === 'map') {
162
- _data.chartType = 'line';
163
- }
164
- }
165
- }
166
- } else {
167
- setEnableSelectChart(false);
168
- setIsCity(false);
169
- if (_data.chartType === 'map') {
170
- _data.chartType = 'line';
171
- }
172
- }
173
178
  return _objectSpread({}, _data);
174
179
  });
175
180
  };
@@ -212,6 +217,8 @@ var EventContent = function EventContent(props) {
212
217
  }, /*#__PURE__*/React.createElement(SearchPanel, {
213
218
  chartType: searchData === null || searchData === void 0 ? void 0 : searchData.chartType,
214
219
  time: searchData === null || searchData === void 0 ? void 0 : searchData.time,
220
+ setIsCity: setIsCity,
221
+ setEnableSelectChart: setEnableSelectChart,
215
222
  analysisAttr: searchData === null || searchData === void 0 ? void 0 : searchData.analysisAttr,
216
223
  analysisIndex: searchData === null || searchData === void 0 ? void 0 : searchData.analysisIndex,
217
224
  eventId: eventId,
@@ -9,33 +9,33 @@ import { DemoWrapper, setGlobalConfig } from '@zgfe/business-lib';
9
9
  import { ModuleEvent } from '../../../index';
10
10
  import { requestConfig } from '../../../utils/ajaxConfig';
11
11
  import { Button } from 'antd';
12
- var defaultValue2 = {
12
+ var defaultValue = {
13
13
  enlarged: 0,
14
- id: 2551,
14
+ id: 2526,
15
15
  isPerfect: 1,
16
- name: '省市000',
16
+ name: '事件分析',
17
17
  reqParam: {
18
18
  data: {
19
- appId: 251,
20
- platform: 0,
19
+ app_id: 251,
21
20
  module: 'event',
22
- userGroup: [0],
23
21
  time: {
24
- begin: '2023-09-17',
25
- end: '2023-09-24',
22
+ begin: '2023-09-16',
23
+ end: '2023-09-23',
26
24
  relative: [7, 0],
27
25
  unit: 'day'
28
26
  },
27
+ analysisIndex: 'number',
29
28
  chartType: 'map',
30
- id: 16816,
31
- name: '加购商品',
29
+ id: 16818,
30
+ name: 'click',
32
31
  dimension: {
33
32
  propCategory: 'envProp',
34
33
  category: 'fixed',
35
34
  value: 'area',
36
35
  id: 0
37
36
  },
38
- analysisIndex: 'number'
37
+ userGroup: [0],
38
+ appId: 251
39
39
  },
40
40
  chosen_data: []
41
41
  },
@@ -43,31 +43,31 @@ var defaultValue2 = {
43
43
  unExistEvent: '',
44
44
  renderType: 'normal',
45
45
  source: 'PANEL',
46
- panelId: 342,
46
+ panelId: 286,
47
47
  panelType: 'edit',
48
48
  data: {
49
- appId: 251,
50
- platform: 0,
49
+ app_id: 251,
51
50
  module: 'event',
52
- userGroup: [0],
53
51
  time: {
54
- begin: '2023-09-17',
55
- end: '2023-09-24',
52
+ begin: '2023-09-16',
53
+ end: '2023-09-23',
56
54
  relative: [7, 0],
57
55
  unit: 'day'
58
56
  },
57
+ analysisIndex: 'number',
59
58
  chartType: 'map',
60
- id: 16816,
61
- name: '加购商品',
59
+ id: 16818,
60
+ name: 'click',
62
61
  dimension: {
63
62
  propCategory: 'envProp',
64
63
  category: 'fixed',
65
64
  value: 'area',
66
65
  id: 0
67
66
  },
68
- analysisIndex: 'number'
67
+ userGroup: [0],
68
+ appId: 251
69
69
  },
70
- chosen_data: ['北京市']
70
+ chosen_data: []
71
71
  };
72
72
  export default (function () {
73
73
  var _useState = useState(false),
@@ -78,7 +78,7 @@ export default (function () {
78
78
  _useState4 = _slicedToArray(_useState3, 2),
79
79
  detailParams = _useState4[0],
80
80
  setDetailParams = _useState4[1];
81
- var _useState5 = useState(defaultValue2),
81
+ var _useState5 = useState(defaultValue),
82
82
  _useState6 = _slicedToArray(_useState5, 2),
83
83
  searchParams = _useState6[0],
84
84
  setSearchParams = _useState6[1];
@@ -1,5 +1,5 @@
1
1
  import { AttrConditionTypes } from '@zgfe/business-lib';
2
- import { bizAttributeSelectorValueProp, SearchValue } from '../../types';
2
+ import { bizAttributeSelectorValueProp, SearchValue, EventChartTypes } from '../../types';
3
3
  interface filterConditions {
4
4
  id?: number;
5
5
  name?: string;
@@ -14,6 +14,7 @@ export interface FormDataProps {
14
14
  }
15
15
  export interface FormHandelDataProps extends filterConditions {
16
16
  userGroup?: any[];
17
+ chartType?: EventChartTypes | undefined;
17
18
  }
18
19
  export interface TopPanelProps {
19
20
  value?: SearchValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-event",
3
- "version": "0.0.2-event.78",
3
+ "version": "0.0.2-event.80",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -49,7 +49,7 @@
49
49
  "react": "^16.12.0 || ^17.0.0",
50
50
  "yorkie": "^2.0.0"
51
51
  },
52
- "gitHead": "b706bb6ba27d077399b49a097288fe33b08a9186",
52
+ "gitHead": "ccef46071bc2255d0e1b18724c75d886030c7de2",
53
53
  "dependencies": {
54
54
  "react-copy-to-clipboard": "^5.1.0",
55
55
  "react-highlight": "^0.15.0"