@zgfe/modules-event 0.0.2-event.10 → 0.0.2-event.13
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.
- package/es/components/searchPanel/index.js +3 -0
- package/es/components/topBar/index.js +2 -13
- package/es/modules/chart/index.js +6 -2
- package/es/modules/content/index.js +6 -2
- package/es/modules/content/utils.d.ts +4 -0
- package/es/modules/content/utils.js +15 -2
- package/es/modules/topPanel/index.js +3 -25
- package/es/style/index.less +6 -3
- package/es/utils/formData.d.ts +3 -0
- package/es/utils/formData.js +68 -9
- package/package.json +3 -3
|
@@ -11,6 +11,7 @@ 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
15
|
import './styles/index.less';
|
|
15
16
|
var classPrefix = 'search-panel';
|
|
16
17
|
var SearchPanel = function SearchPanel(props) {
|
|
@@ -77,6 +78,7 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
77
78
|
chartType: chart.value
|
|
78
79
|
}, data));
|
|
79
80
|
};
|
|
81
|
+
console.log('BizTargetDimension', props.eventId);
|
|
80
82
|
return /*#__PURE__*/React.createElement("div", {
|
|
81
83
|
className: classPrefix
|
|
82
84
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -88,6 +90,7 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
88
90
|
onChange: onChangeTime,
|
|
89
91
|
selectRange: 365
|
|
90
92
|
}), /*#__PURE__*/React.createElement(BizTargetDimension, {
|
|
93
|
+
normalOptions: normalOptions,
|
|
91
94
|
value: dimension,
|
|
92
95
|
eventId: props.eventId,
|
|
93
96
|
onChange: onDimensionChange
|
|
@@ -13,6 +13,7 @@ import { BizAddToPanel, BizAddToScene, BizGlobalDataContext } from '@zgfe/busine
|
|
|
13
13
|
import './styles/index.less';
|
|
14
14
|
import { EventContext } from '../../types';
|
|
15
15
|
import { chartTypes, platformOption } from '../../constants/fields';
|
|
16
|
+
import { getWarningId } from '../../utils/formData';
|
|
16
17
|
var classPrefix = 'modules-event-topbar';
|
|
17
18
|
var TopBar = function TopBar(props) {
|
|
18
19
|
var _useContext = useContext(EventContext),
|
|
@@ -49,19 +50,7 @@ var TopBar = function TopBar(props) {
|
|
|
49
50
|
warningId = _useState10[0],
|
|
50
51
|
setWarningId = _useState10[1];
|
|
51
52
|
useEffect(function () {
|
|
52
|
-
|
|
53
|
-
if (searchData === null || searchData === void 0 ? void 0 : searchData.id) {
|
|
54
|
-
setWarningId(searchData === null || searchData === void 0 ? void 0 : searchData.id);
|
|
55
|
-
} else {
|
|
56
|
-
var _eventGroupList$, _eventGroupList$$even;
|
|
57
|
-
if (eventGroupList && ((_eventGroupList$ = eventGroupList[0]) === null || _eventGroupList$ === void 0 ? void 0 : (_eventGroupList$$even = _eventGroupList$.eventList[0]) === null || _eventGroupList$$even === void 0 ? void 0 : _eventGroupList$$even.id)) {
|
|
58
|
-
var _eventGroupList$2, _eventGroupList$2$eve;
|
|
59
|
-
setWarningId((_eventGroupList$2 = eventGroupList[0]) === null || _eventGroupList$2 === void 0 ? void 0 : (_eventGroupList$2$eve = _eventGroupList$2.eventList[0]) === null || _eventGroupList$2$eve === void 0 ? void 0 : _eventGroupList$2$eve.id);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
} else {
|
|
63
|
-
setWarningId(-1);
|
|
64
|
-
}
|
|
53
|
+
setWarningId(getWarningId(searchData, eventData, eventGroupList));
|
|
65
54
|
}, [searchData, eventData, eventGroupList]);
|
|
66
55
|
useEffect(function () {
|
|
67
56
|
if (searchData === null || searchData === void 0 ? void 0 : searchData.id) {
|
|
@@ -13,7 +13,7 @@ import { BizChart, BizGlobalDataContext, ajax } from '@zgfe/business-lib';
|
|
|
13
13
|
import { EventTable, MiNone } from '../../components';
|
|
14
14
|
import { judgeIsCity } from '../content/utils';
|
|
15
15
|
import { getValue } from '../../modules/content/utils';
|
|
16
|
-
import { getDefaultShow, getShowColor } from '../../utils/formData';
|
|
16
|
+
import { getDefaultShow, getShowColor, getUserGroupsCompareData } from '../../utils/formData';
|
|
17
17
|
import _ from 'lodash';
|
|
18
18
|
import moment from 'moment';
|
|
19
19
|
import { Apis, chartColors } from '../../constants';
|
|
@@ -99,7 +99,11 @@ var EventChart = function EventChart(props) {
|
|
|
99
99
|
if (!res) {
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
if (params.userGroup.length > 1) {
|
|
103
|
+
setDataSource(getUserGroupsCompareData(res.data));
|
|
104
|
+
} else {
|
|
105
|
+
setDataSource(res.data);
|
|
106
|
+
}
|
|
103
107
|
setLoading(false);
|
|
104
108
|
}).catch(function () {
|
|
105
109
|
setLoading(false);
|
|
@@ -16,7 +16,7 @@ import './styles/index.less';
|
|
|
16
16
|
import { Apis } from '../../constants';
|
|
17
17
|
import { judgeIsCity, judgeIsArea, getValue } from './utils';
|
|
18
18
|
import { ContentPanel, SearchPanel } from '../../components';
|
|
19
|
-
import { getDefaultShow } from '../../utils/formData';
|
|
19
|
+
import { getDefaultShow, getUserGroupsCompareData } from '../../utils/formData';
|
|
20
20
|
import TopPanel from '../topPanel';
|
|
21
21
|
var timer = 0;
|
|
22
22
|
var ajaxFlag = true;
|
|
@@ -115,7 +115,11 @@ var EventContent = function EventContent(props) {
|
|
|
115
115
|
}
|
|
116
116
|
var result = res.data;
|
|
117
117
|
setShowList(result ? getDefaultShow(result) : []);
|
|
118
|
-
|
|
118
|
+
if (searchData.userGroup.length > 1) {
|
|
119
|
+
setEventData(getUserGroupsCompareData(result));
|
|
120
|
+
} else {
|
|
121
|
+
setEventData(result);
|
|
122
|
+
}
|
|
119
123
|
setFinalSearchData(_objectSpread({}, searchData));
|
|
120
124
|
setTimeout(function () {
|
|
121
125
|
setLoading(false);
|
|
@@ -6,3 +6,7 @@ export declare const judgeIsCity: (name: string | undefined) => boolean;
|
|
|
6
6
|
export declare const judgeIsArea: (name: string | undefined) => boolean;
|
|
7
7
|
export declare const getValue: (param: bizAttributeSelectorValueProp, eventGroupList: EventGroup[] | undefined, eventEnvList: EnvProp[] | undefined, userPropList: UserProp[] | undefined) => AttributeSelect.Value | undefined;
|
|
8
8
|
export declare const getNumberPanelData: (data: any) => Promise<unknown>;
|
|
9
|
+
export declare const normalOptions: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
@@ -13,7 +13,7 @@ export var judgeFilterValue = function judgeFilterValue(data, count) {
|
|
|
13
13
|
}
|
|
14
14
|
data.conditions.map(function (item) {
|
|
15
15
|
var _item$values;
|
|
16
|
-
if (item.values && ((_item$values = item.values) === null || _item$values === void 0 ? void 0 : _item$values.length) <= 0) flag = false;
|
|
16
|
+
if (item.values && (((_item$values = item.values) === null || _item$values === void 0 ? void 0 : _item$values.length) <= 0 || item.values[0] === '')) flag = false;
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
return flag;
|
|
@@ -60,4 +60,17 @@ export var getNumberPanelData = function getNumberPanelData(data) {
|
|
|
60
60
|
reject(err);
|
|
61
61
|
});
|
|
62
62
|
});
|
|
63
|
-
};
|
|
63
|
+
};
|
|
64
|
+
export var normalOptions = [{
|
|
65
|
+
label: '人数',
|
|
66
|
+
value: 'number'
|
|
67
|
+
}, {
|
|
68
|
+
label: '次数',
|
|
69
|
+
value: 'times'
|
|
70
|
+
}, {
|
|
71
|
+
label: '活跃比',
|
|
72
|
+
value: 'active_ratio'
|
|
73
|
+
}, {
|
|
74
|
+
label: '人均次数',
|
|
75
|
+
value: 'per'
|
|
76
|
+
}];
|
|
@@ -8,7 +8,6 @@ import React, { useState } from 'react';
|
|
|
8
8
|
import { Form, Button } from 'antd';
|
|
9
9
|
import { BizUserGroupHeader } from '@zgfe/business-lib';
|
|
10
10
|
import EventFilter from '../../components/eventFilter';
|
|
11
|
-
import util from '../../utils/util';
|
|
12
11
|
import './styles/index.less';
|
|
13
12
|
var classPrefix = 'top-panel';
|
|
14
13
|
var TopPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -33,20 +32,7 @@ var TopPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
if (allData.userGroup) {
|
|
36
|
-
_data.userGroup =
|
|
37
|
-
allData.userGroup.map(function (item) {
|
|
38
|
-
if (util.isArray(item)) {
|
|
39
|
-
var _arr = [];
|
|
40
|
-
item.map(function (_item) {
|
|
41
|
-
var _item$;
|
|
42
|
-
var _name = "".concat(_item[1].id, ":").concat((_item$ = _item[2]) === null || _item$ === void 0 ? void 0 : _item$.layerLabelId);
|
|
43
|
-
_arr.push(_name);
|
|
44
|
-
});
|
|
45
|
-
_data.userGroup && _data.userGroup.push(_arr);
|
|
46
|
-
} else {
|
|
47
|
-
_data.userGroup && _data.userGroup.push(item.id);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
35
|
+
_data.userGroup = allData.userGroup;
|
|
50
36
|
if (_data.userGroup.length <= 0) _data.userGroup = [0];
|
|
51
37
|
}
|
|
52
38
|
if (data.filterConditions) {
|
|
@@ -62,9 +48,7 @@ var TopPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
62
48
|
var resetting = function resetting() {
|
|
63
49
|
form.resetFields();
|
|
64
50
|
form.setFieldsValue({
|
|
65
|
-
userGroup: [
|
|
66
|
-
id: 0
|
|
67
|
-
}],
|
|
51
|
+
userGroup: [0],
|
|
68
52
|
filterConditions: null
|
|
69
53
|
});
|
|
70
54
|
props.onChange({
|
|
@@ -81,13 +65,7 @@ var TopPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
81
65
|
colon: false,
|
|
82
66
|
layout: "vertical",
|
|
83
67
|
initialValues: {
|
|
84
|
-
userGroup: userGroup ? userGroup
|
|
85
|
-
return {
|
|
86
|
-
id: item
|
|
87
|
-
};
|
|
88
|
-
}) : [{
|
|
89
|
-
id: 0
|
|
90
|
-
}],
|
|
68
|
+
userGroup: userGroup ? userGroup : [0],
|
|
91
69
|
filterConditions: {
|
|
92
70
|
id: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.id,
|
|
93
71
|
name: defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.name,
|
package/es/style/index.less
CHANGED
|
@@ -39,10 +39,7 @@
|
|
|
39
39
|
&-link {
|
|
40
40
|
display: flex;
|
|
41
41
|
justify-content: flex-end;
|
|
42
|
-
cursor: pointer;
|
|
43
42
|
&:hover {
|
|
44
|
-
color: @primary-color;
|
|
45
|
-
// text-decoration: underline;
|
|
46
43
|
.a-yanjingkai {
|
|
47
44
|
display: block;
|
|
48
45
|
}
|
|
@@ -52,6 +49,12 @@
|
|
|
52
49
|
margin-right: 10px;
|
|
53
50
|
}
|
|
54
51
|
}
|
|
52
|
+
&-link:not(.not-to-detail) {
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
&:hover {
|
|
55
|
+
color: @primary-color;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
55
58
|
}
|
|
56
59
|
&-table-event-data {
|
|
57
60
|
text-align: right !important;
|
package/es/utils/formData.d.ts
CHANGED
|
@@ -5,7 +5,10 @@ import { ResponseDataProps, SearchValue } from '../types';
|
|
|
5
5
|
import { EventProps } from '../modules/home/types';
|
|
6
6
|
import '../style/index.less';
|
|
7
7
|
export declare function getColumns(eventGroupList: EventGroup[] | undefined, userPropList: UserProp[] | undefined, eventEnvList: EnvProp[] | undefined, columnData: string[], userGroup: number[], searchData: SearchValue, showList: string[], onShowCallback: Function, onClickToDetailCallback: Function): ColumnsType<EventProps.ColumnsDataType>;
|
|
8
|
+
export declare function getEventAliasName(name: string): string;
|
|
9
|
+
export declare function getUserGroupsCompareData(data: ResponseDataProps): ResponseDataProps;
|
|
8
10
|
export declare function marketEventGroupList(eventGroupList: EventGroup[] | undefined): string[];
|
|
11
|
+
export declare function getWarningId(searchData: SearchValue, eventData: ResponseDataProps, eventGroupList: EventGroup[] | undefined): number;
|
|
9
12
|
export declare function getAttrLabel(attrData: AttrConditionTypes.ItemValue, eventGroupList: EventGroup[] | undefined, userPropList: UserProp[] | undefined, eventEnvList: EnvProp[] | undefined): string | undefined;
|
|
10
13
|
export declare function formTableData(originalData: ResponseDataProps, userGroups: number[], attrNum: number, showList?: string[]): EventProps.ColumnsDataType[];
|
|
11
14
|
export declare function getDefaultShow(source: ResponseDataProps): string[];
|
package/es/utils/formData.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { util, IconFont } from '@zgfe/business-lib';
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import { util, IconFont, BizGlobalDataContext } from '@zgfe/business-lib';
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
3
|
import { message } from 'antd';
|
|
4
|
+
import _ from 'lodash';
|
|
4
5
|
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
|
5
6
|
import { chartColors } from '../constants/color';
|
|
6
7
|
import { PropCategory } from '@zgfe/business-lib/es/attributeSelector/types';
|
|
@@ -88,20 +89,22 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
|
|
|
88
89
|
ellipsis: true,
|
|
89
90
|
fixed: true,
|
|
90
91
|
render: function render(val) {
|
|
92
|
+
console.log('事件', val);
|
|
93
|
+
var _val = getEventAliasName(val);
|
|
91
94
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
92
95
|
className: "tooltip-name-box",
|
|
93
|
-
title:
|
|
96
|
+
title: _val
|
|
94
97
|
}, /*#__PURE__*/React.createElement("div", {
|
|
95
98
|
className: "tooltip-name-box-market"
|
|
96
|
-
}, marketEventNameList.indexOf(
|
|
99
|
+
}, marketEventNameList.indexOf(_val) !== -1 && /*#__PURE__*/React.createElement(IconFont, {
|
|
97
100
|
type: "shoucang"
|
|
98
|
-
}), util.strMiddleSplit(
|
|
101
|
+
}), util.strMiddleSplit(_val, {
|
|
99
102
|
maxLength: 20,
|
|
100
103
|
beginLength: 10,
|
|
101
104
|
endLength: 6,
|
|
102
105
|
replaceStr: '...'
|
|
103
106
|
})), /*#__PURE__*/React.createElement(CopyToClipboard, {
|
|
104
|
-
text:
|
|
107
|
+
text: _val,
|
|
105
108
|
onCopy: function onCopy() {
|
|
106
109
|
return message.success('复制成功!');
|
|
107
110
|
}
|
|
@@ -137,12 +140,13 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
|
|
|
137
140
|
return a["field".concat(i)] - b["field".concat(i)];
|
|
138
141
|
},
|
|
139
142
|
render: function render(text, record) {
|
|
143
|
+
var click = text > 0 && searchData.analysisIndex === 'number' ? true : false;
|
|
140
144
|
return /*#__PURE__*/React.createElement("div", {
|
|
141
|
-
className: "".concat(classPrefix, "-table-td-link"),
|
|
145
|
+
className: "".concat(classPrefix, "-table-td-link ").concat(click ? '' : 'not-to-detail'),
|
|
142
146
|
onClick: function onClick() {
|
|
143
|
-
|
|
147
|
+
click ? onClickToDetailCallback(record, columnData[i], text) : null;
|
|
144
148
|
}
|
|
145
|
-
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
149
|
+
}, click && /*#__PURE__*/React.createElement(IconFont, {
|
|
146
150
|
type: "a-yanjingkai"
|
|
147
151
|
}), text);
|
|
148
152
|
}
|
|
@@ -153,6 +157,41 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
|
|
|
153
157
|
}
|
|
154
158
|
return data;
|
|
155
159
|
}
|
|
160
|
+
export function getEventAliasName(name) {
|
|
161
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
162
|
+
eventGroupList = _useContext.eventGroupList;
|
|
163
|
+
var aliasName = '';
|
|
164
|
+
eventGroupList && eventGroupList.map(function (item) {
|
|
165
|
+
item.eventList.map(function (_item) {
|
|
166
|
+
if (_item.name === name) {
|
|
167
|
+
aliasName = _item.alias ? _item.alias : name;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
return aliasName;
|
|
172
|
+
}
|
|
173
|
+
export function getUserGroupsCompareData(data) {
|
|
174
|
+
if (data.series.length <= 0) {
|
|
175
|
+
return data;
|
|
176
|
+
} else {
|
|
177
|
+
var _data = _.cloneDeep(data);
|
|
178
|
+
var _series = [];
|
|
179
|
+
_data.series.map(function (item, index) {
|
|
180
|
+
_series.push(item);
|
|
181
|
+
_data.series.map(function (_item, _index) {
|
|
182
|
+
if (item.names[1] === _item.names[1] && index !== _index) {
|
|
183
|
+
_series.push(_item);
|
|
184
|
+
delete _data.series[_index];
|
|
185
|
+
console.log(3333, _data.series);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
delete _data.series[index];
|
|
189
|
+
});
|
|
190
|
+
console.log('_tempData', _series);
|
|
191
|
+
_data.series = _series;
|
|
192
|
+
return _data;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
156
195
|
export function marketEventGroupList(eventGroupList) {
|
|
157
196
|
var _marketName = [];
|
|
158
197
|
eventGroupList && eventGroupList.map(function (item) {
|
|
@@ -163,6 +202,26 @@ export function marketEventGroupList(eventGroupList) {
|
|
|
163
202
|
console.log(666, _marketName);
|
|
164
203
|
return _marketName;
|
|
165
204
|
}
|
|
205
|
+
export function getWarningId(searchData, eventData, eventGroupList) {
|
|
206
|
+
var id = -1;
|
|
207
|
+
if (eventData && eventData.series.length > 0) {
|
|
208
|
+
if (searchData === null || searchData === void 0 ? void 0 : searchData.id) {
|
|
209
|
+
id = searchData === null || searchData === void 0 ? void 0 : searchData.id;
|
|
210
|
+
} else {
|
|
211
|
+
if (eventGroupList && eventGroupList.length > 0 && eventData) {
|
|
212
|
+
eventGroupList.map(function (item) {
|
|
213
|
+
item.eventList.map(function (_item) {
|
|
214
|
+
var _name = eventData.series[0].names[searchData.userGroup.length > 1 ? 1 : 0];
|
|
215
|
+
if (_item.name === _name || _item.alias === _name) {
|
|
216
|
+
id = _item.id;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return id;
|
|
224
|
+
}
|
|
166
225
|
export function getAttrLabel(attrData, eventGroupList, userPropList, eventEnvList) {
|
|
167
226
|
if (!attrData) return;
|
|
168
227
|
var type = attrData.propCategory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/modules-event",
|
|
3
|
-
"version": "0.0.2-event.
|
|
3
|
+
"version": "0.0.2-event.13",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@types/lodash": "^4.14.191",
|
|
37
37
|
"@umijs/fabric": "^2.8.1",
|
|
38
38
|
"@umijs/test": "^3.0.5",
|
|
39
|
-
"@zgfe/business-lib": "1.1.81-
|
|
39
|
+
"@zgfe/business-lib": "1.1.81-page.9",
|
|
40
40
|
"antd": "^4.22.6",
|
|
41
41
|
"dumi": "^1.1.0",
|
|
42
42
|
"echarts": "^5.3.2",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"react": "^16.12.0 || ^17.0.0",
|
|
50
50
|
"yorkie": "^2.0.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "29f7fb17b85c32080fc2ccf71d9db4275b6c60f5",
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"react-copy-to-clipboard": "^5.1.0",
|
|
55
55
|
"react-highlight": "^0.15.0"
|