@zgfe/modules-event 0.0.2-alpha.2 → 0.0.2-alpha.22
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/eventFilter/index.d.ts +2 -1
- package/es/components/eventFilter/index.js +31 -19
- package/es/components/eventFilter/styles/index.less +1 -0
- package/es/components/eventFilter/types.d.ts +5 -0
- package/es/components/renderContent/index.d.ts +1 -1
- package/es/components/renderContent/index.js +2 -3
- package/es/components/renderContent/types.d.ts +2 -4
- package/es/components/searchPanel/index.js +6 -6
- package/es/components/searchPanel/types.d.ts +2 -5
- package/es/components/table/index.js +34 -36
- package/es/components/topBar/index.d.ts +2 -1
- package/es/components/topBar/index.js +13 -7
- package/es/components/topBar/styles/index.less +2 -1
- package/es/components/topBar/types.d.ts +3 -5
- package/es/modules/chart/index.d.ts +1 -1
- package/es/modules/chart/index.js +12 -8
- package/es/modules/content/index.js +41 -108
- package/es/modules/content/styles/index.less +0 -11
- package/es/modules/content/types.d.ts +1 -0
- package/es/modules/content/utils.d.ts +4 -0
- package/es/modules/content/utils.js +23 -0
- package/es/modules/home/demo/create.js +1 -1
- package/es/modules/home/demo/edit.js +27 -38
- package/es/modules/home/demo/scene.js +32 -20
- package/es/modules/home/index.js +12 -3
- package/es/modules/home/styles/index.less +6 -2
- package/es/modules/home/types.d.ts +11 -2
- package/es/modules/topPanel/index.d.ts +5 -0
- package/es/modules/topPanel/index.js +110 -0
- package/es/modules/topPanel/styles/index.less +14 -0
- package/es/modules/topPanel/types.d.ts +25 -0
- package/es/modules/topPanel/types.js +1 -0
- package/es/types.d.ts +8 -6
- package/es/utils/formData.d.ts +3 -2
- package/es/utils/formData.js +11 -24
- package/package.json +3 -3
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
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; }
|
|
3
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
5
|
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."); }
|
|
3
6
|
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); }
|
|
@@ -8,6 +11,7 @@ import { Tooltip } from 'antd';
|
|
|
8
11
|
import React, { useEffect, useRef, useState } from 'react';
|
|
9
12
|
import { BizEventSelector, BizAttributeSelector, IconFont, BizAttrConditionGroup } from '@zgfe/business-lib';
|
|
10
13
|
import './styles/index.less';
|
|
14
|
+
import _ from 'lodash';
|
|
11
15
|
var classPrefix = 'eventfilter-box';
|
|
12
16
|
var EventFilter = function EventFilter(props) {
|
|
13
17
|
var _useState = useState(0),
|
|
@@ -26,7 +30,7 @@ var EventFilter = function EventFilter(props) {
|
|
|
26
30
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
27
31
|
event = _useState6[0],
|
|
28
32
|
setEvent = _useState6[1];
|
|
29
|
-
var _useState7 = useState(
|
|
33
|
+
var _useState7 = useState(false),
|
|
30
34
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
31
35
|
eventOverview = _useState8[0],
|
|
32
36
|
setEventOverview = _useState8[1];
|
|
@@ -39,15 +43,23 @@ var EventFilter = function EventFilter(props) {
|
|
|
39
43
|
bizAttributeSelectorValue = _useState12[0],
|
|
40
44
|
setBizAttributeSelectorValue = _useState12[1];
|
|
41
45
|
useEffect(function () {
|
|
42
|
-
if (props.value
|
|
43
|
-
var _data = props.value
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
if (props.value) {
|
|
47
|
+
var _data = props.value;
|
|
48
|
+
if (_data && _data.id) {
|
|
49
|
+
setEvent({
|
|
50
|
+
id: _data.id,
|
|
51
|
+
name: _data.name
|
|
52
|
+
});
|
|
53
|
+
setEventOverview(true);
|
|
54
|
+
}
|
|
55
|
+
if (_data.filters) {
|
|
56
|
+
setFilter(_data.filters);
|
|
57
|
+
}
|
|
58
|
+
if (_data.dimension) {
|
|
59
|
+
setBizAttributeSelectorValue(_objectSpread(_objectSpread({}, _data.dimension), {}, {
|
|
60
|
+
key: _data.dimension.propCategory === 'eventProp' ? _data.dimension.value : _data.dimension.propCategory + '-' + _data.dimension.value
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
51
63
|
}
|
|
52
64
|
}, []);
|
|
53
65
|
var onAdd = function onAdd() {
|
|
@@ -72,9 +84,9 @@ var EventFilter = function EventFilter(props) {
|
|
|
72
84
|
};
|
|
73
85
|
var onChangeEvent = function onChangeEvent(event) {
|
|
74
86
|
if (event && event.event && event.event.id === -100) {
|
|
75
|
-
setEventOverview(true);
|
|
76
|
-
} else {
|
|
77
87
|
setEventOverview(false);
|
|
88
|
+
} else {
|
|
89
|
+
setEventOverview(true);
|
|
78
90
|
}
|
|
79
91
|
if (event && event.event) {
|
|
80
92
|
setEvent(event.event);
|
|
@@ -85,17 +97,15 @@ var EventFilter = function EventFilter(props) {
|
|
|
85
97
|
setCount(0);
|
|
86
98
|
};
|
|
87
99
|
var onChangeAttr = function onChangeAttr(attr) {
|
|
88
|
-
console.log('细分属性', attr);
|
|
89
100
|
if (attr === undefined) {
|
|
90
101
|
setBizAttributeSelectorValue(undefined);
|
|
91
102
|
} else {
|
|
103
|
+
var _value = attr.propCategory === 'eventProp' ? attr.id : attr.name;
|
|
92
104
|
setBizAttributeSelectorValue({
|
|
93
|
-
id: attr.id,
|
|
94
105
|
propCategory: attr.propCategory,
|
|
95
|
-
name: attr.name,
|
|
96
106
|
category: attr.category,
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
value: _value,
|
|
108
|
+
key: attr.propCategory === 'eventProp' ? attr.id : attr.propCategory + '-' + _value
|
|
99
109
|
});
|
|
100
110
|
}
|
|
101
111
|
};
|
|
@@ -108,7 +118,9 @@ var EventFilter = function EventFilter(props) {
|
|
|
108
118
|
_event.filters = filter;
|
|
109
119
|
}
|
|
110
120
|
if (bizAttributeSelectorValue) {
|
|
111
|
-
|
|
121
|
+
var _dimension = _.cloneDeep(bizAttributeSelectorValue);
|
|
122
|
+
delete _dimension.key;
|
|
123
|
+
_event.dimension = _dimension;
|
|
112
124
|
}
|
|
113
125
|
props.onChange && props.onChange(_event);
|
|
114
126
|
}, [bizAttributeSelectorValue, filter, event]);
|
|
@@ -124,7 +136,7 @@ var EventFilter = function EventFilter(props) {
|
|
|
124
136
|
},
|
|
125
137
|
onChange: onChangeEvent,
|
|
126
138
|
placeholder: "\u8BF7\u9009\u62E9\u4E8B\u4EF6"
|
|
127
|
-
}),
|
|
139
|
+
}), eventOverview && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BizAttributeSelector, {
|
|
128
140
|
enableEventProp: true,
|
|
129
141
|
enableUserProp: true,
|
|
130
142
|
enableEnvProp: true,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { eventProps } from '../../types';
|
|
1
2
|
export interface ConditionsnProps {
|
|
2
3
|
attrId: number | undefined;
|
|
3
4
|
propCategory: string | undefined;
|
|
@@ -9,3 +10,7 @@ export interface ConditionsnProps {
|
|
|
9
10
|
label?: string | undefined;
|
|
10
11
|
dimensionSub?: string | undefined;
|
|
11
12
|
}
|
|
13
|
+
export interface EventFilterProps {
|
|
14
|
+
value?: eventProps;
|
|
15
|
+
onChange?: (event: eventProps) => {};
|
|
16
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RenderContentProps } from './types';
|
|
3
3
|
import './styles/index.less';
|
|
4
|
-
declare const ContentPanel: React.
|
|
4
|
+
declare const ContentPanel: React.FC<RenderContentProps>;
|
|
5
5
|
export default ContentPanel;
|
|
@@ -10,7 +10,7 @@ import { MiNone, MiSpin } from '..';
|
|
|
10
10
|
import './styles/index.less';
|
|
11
11
|
import EventChart from '../../modules/chart';
|
|
12
12
|
var classPrefix = 'render-content';
|
|
13
|
-
var ContentPanel =
|
|
13
|
+
var ContentPanel = function ContentPanel(props) {
|
|
14
14
|
var loading = props.loading,
|
|
15
15
|
eventData = props.eventData,
|
|
16
16
|
searchData = props.searchData;
|
|
@@ -37,7 +37,6 @@ var ContentPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
37
37
|
}, /*#__PURE__*/React.createElement("div", {
|
|
38
38
|
className: "".concat(classPrefix, "-chart-container")
|
|
39
39
|
}, eventData ? /*#__PURE__*/React.createElement(EventChart, {
|
|
40
|
-
ref: ref,
|
|
41
40
|
dataSource: eventData,
|
|
42
41
|
params: searchData,
|
|
43
42
|
showList: showList
|
|
@@ -50,5 +49,5 @@ var ContentPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
50
49
|
showList: showList,
|
|
51
50
|
onChangeShow: onChangeShow
|
|
52
51
|
}) : null);
|
|
53
|
-
}
|
|
52
|
+
};
|
|
54
53
|
export default ContentPanel;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { SearchValue } from '../../types';
|
|
2
|
-
import { ChartTypes } from '@zgfe/business-lib/es/chart/types';
|
|
1
|
+
import { SearchValue, ResponseDataProps } from '../../types';
|
|
3
2
|
export interface RenderContentProps {
|
|
4
3
|
loading?: boolean;
|
|
5
|
-
eventData?:
|
|
4
|
+
eventData?: ResponseDataProps;
|
|
6
5
|
searchData?: SearchValue;
|
|
7
6
|
showList: string[];
|
|
8
7
|
isCity?: boolean;
|
|
9
|
-
onClickGenerateReport?: (value: any) => void;
|
|
10
8
|
afterEditTarget?: (type: string, value?: any) => void;
|
|
11
9
|
onChangeShow?: (data: string[]) => void;
|
|
12
10
|
}
|
|
@@ -35,9 +35,9 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
35
35
|
dimension = _useState8[0],
|
|
36
36
|
setDimension = _useState8[1];
|
|
37
37
|
useEffect(function () {
|
|
38
|
-
if (props.
|
|
38
|
+
if (props.chartType && props.chartType !== chart.value) {
|
|
39
39
|
setChart({
|
|
40
|
-
value: props.
|
|
40
|
+
value: props.chartType
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
var _dimension = {
|
|
@@ -52,12 +52,12 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
52
52
|
_dimension['analysisAttr'] = props.analysisAttr;
|
|
53
53
|
}
|
|
54
54
|
setDimension(_objectSpread({}, _dimension));
|
|
55
|
-
}, [props.
|
|
55
|
+
}, [props.chartType]);
|
|
56
56
|
var onChangeTime = function onChangeTime(val) {
|
|
57
57
|
if (timer) clearTimeout(timer);
|
|
58
58
|
setTimer(setTimeout(function () {
|
|
59
59
|
setTime(val);
|
|
60
|
-
props.onChange(_objectSpread({
|
|
60
|
+
props.onChange && props.onChange(_objectSpread({
|
|
61
61
|
time: val,
|
|
62
62
|
chartType: chart.value
|
|
63
63
|
}, dimension));
|
|
@@ -65,14 +65,14 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
65
65
|
};
|
|
66
66
|
var onChange = function onChange(val) {
|
|
67
67
|
setChart(val);
|
|
68
|
-
props.onChange(_objectSpread({
|
|
68
|
+
props.onChange && props.onChange(_objectSpread({
|
|
69
69
|
time: time,
|
|
70
70
|
chartType: val.value
|
|
71
71
|
}, dimension));
|
|
72
72
|
};
|
|
73
73
|
var onDimensionChange = function onDimensionChange(data) {
|
|
74
74
|
setDimension(data);
|
|
75
|
-
props.onChange(_objectSpread({
|
|
75
|
+
props.onChange && props.onChange(_objectSpread({
|
|
76
76
|
time: time,
|
|
77
77
|
chartType: chart.value
|
|
78
78
|
}, data));
|
|
@@ -7,10 +7,7 @@ export interface SearchPanelProps {
|
|
|
7
7
|
enableSelectChart?: boolean;
|
|
8
8
|
time?: DatePickerTypes.Value;
|
|
9
9
|
eventId?: number;
|
|
10
|
-
|
|
10
|
+
chartType?: EventChartTypes;
|
|
11
11
|
optionNode?: ReactNode;
|
|
12
|
-
onChange
|
|
13
|
-
time: any;
|
|
14
|
-
chartType: string;
|
|
15
|
-
}) => void;
|
|
12
|
+
onChange?: (data: SearchPanelProps) => void;
|
|
16
13
|
}
|
|
@@ -17,6 +17,7 @@ import { Apis } from '../../constants';
|
|
|
17
17
|
import { Modal, message } from 'antd';
|
|
18
18
|
import { formTableData, getColumns } from '../../utils/formData';
|
|
19
19
|
import './styles/index.less';
|
|
20
|
+
import { getValue } from '../../modules/content/utils';
|
|
20
21
|
import { EventContext } from '../../types';
|
|
21
22
|
var classPrefix = 'mi-table';
|
|
22
23
|
var EventTable = function EventTable(props) {
|
|
@@ -30,7 +31,9 @@ var EventTable = function EventTable(props) {
|
|
|
30
31
|
var _useContext = useContext(BizGlobalDataContext),
|
|
31
32
|
currentApp = _useContext.currentApp,
|
|
32
33
|
_useContext$eventGrou = _useContext.eventGroupList,
|
|
33
|
-
eventGroupList = _useContext$eventGrou === void 0 ? [] : _useContext$eventGrou
|
|
34
|
+
eventGroupList = _useContext$eventGrou === void 0 ? [] : _useContext$eventGrou,
|
|
35
|
+
eventEnvList = _useContext.eventEnvList,
|
|
36
|
+
userPropList = _useContext.userPropList;
|
|
34
37
|
var _useContext2 = useContext(EventContext),
|
|
35
38
|
onUserDrill = _useContext2.onUserDrill,
|
|
36
39
|
_useContext2$defaultS = _useContext2.defaultSearch,
|
|
@@ -53,8 +56,8 @@ var EventTable = function EventTable(props) {
|
|
|
53
56
|
sqlText = _useState10[0],
|
|
54
57
|
setSqlText = _useState10[1];
|
|
55
58
|
useEffect(function () {
|
|
56
|
-
var gLen = (searchData === null || searchData === void 0 ? void 0 : searchData.
|
|
57
|
-
var sortData = formTableData(dataSource, searchData.userGroup || [0], gLen
|
|
59
|
+
var gLen = (searchData === null || searchData === void 0 ? void 0 : searchData.dimension) ? 1 : 0;
|
|
60
|
+
var sortData = formTableData(dataSource, searchData.userGroup || [0], gLen);
|
|
58
61
|
setSearchTable(sortData);
|
|
59
62
|
setSortTable(sortData);
|
|
60
63
|
setTableData(sortData.slice(0, 10));
|
|
@@ -66,47 +69,40 @@ var EventTable = function EventTable(props) {
|
|
|
66
69
|
props.changeShowByName(nameGroup);
|
|
67
70
|
};
|
|
68
71
|
var onClickToDetail = function onClickToDetail(item, time, count) {
|
|
69
|
-
var _searchData$
|
|
70
|
-
|
|
71
|
-
var
|
|
72
|
-
if (searchData.
|
|
73
|
-
|
|
72
|
+
var _searchData$filters;
|
|
73
|
+
var _time = time.split('|');
|
|
74
|
+
var groupValue = '';
|
|
75
|
+
if (searchData.dimension && item.dimension) {
|
|
76
|
+
groupValue = item.dimension;
|
|
74
77
|
} else {
|
|
75
78
|
eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
|
|
76
79
|
group.eventList.forEach(function (event) {
|
|
77
80
|
if (event.name === item.name) {
|
|
78
|
-
|
|
81
|
+
groupValue = event.id.toString();
|
|
79
82
|
}
|
|
80
83
|
});
|
|
81
84
|
});
|
|
82
85
|
}
|
|
83
|
-
var group_by = [['bar', 'map', 'pie'].includes(searchData.chartType) ? 'total' : (_searchData$time = searchData.time) === null || _searchData$time === void 0 ? void 0 : _searchData$time.unit];
|
|
84
|
-
if (searchData.filterConditions && searchData.filterConditions[0].eventAttr) {
|
|
85
|
-
var _searchData$filterCon;
|
|
86
|
-
group_by.push((_searchData$filterCon = searchData.filterConditions[0].eventAttr) === null || _searchData$filterCon === void 0 ? void 0 : _searchData$filterCon.dimensionSub);
|
|
87
|
-
} else {
|
|
88
|
-
group_by.push('');
|
|
89
|
-
}
|
|
90
86
|
onUserDrill && onUserDrill({
|
|
91
87
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
92
88
|
platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0,
|
|
93
89
|
count: count,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
90
|
+
module: 'event',
|
|
91
|
+
params: {
|
|
92
|
+
groupValue: groupValue,
|
|
93
|
+
id: searchData.id,
|
|
94
|
+
userGroup: searchData.userGroup,
|
|
95
|
+
chartType: searchData.chartType,
|
|
96
|
+
conditions: (_searchData$filters = searchData.filters) === null || _searchData$filters === void 0 ? void 0 : _searchData$filters.conditions,
|
|
97
|
+
dimension: searchData.dimension,
|
|
98
|
+
dataType: searchData.id ? 'event' : 'overview',
|
|
103
99
|
time: _objectSpread(_objectSpread({}, searchData.time), {}, {
|
|
104
|
-
begin:
|
|
105
|
-
end:
|
|
100
|
+
begin: _time[0],
|
|
101
|
+
end: _time.length > 1 ? _time[1] : _time[0]
|
|
106
102
|
})
|
|
107
|
-
}
|
|
103
|
+
},
|
|
108
104
|
source: 'EVENT',
|
|
109
|
-
url: '/data/appEventBatch
|
|
105
|
+
url: '/zg/web/v2/data/appEventBatch'
|
|
110
106
|
}, _objectSpread(_objectSpread({
|
|
111
107
|
source: 'EVENT'
|
|
112
108
|
}, defaultSearch), {}, {
|
|
@@ -114,7 +110,7 @@ var EventTable = function EventTable(props) {
|
|
|
114
110
|
data: searchData
|
|
115
111
|
}));
|
|
116
112
|
};
|
|
117
|
-
var _getColumns = getColumns(dataSource.xAxis || [], userGroup, searchData, showList, onShowClick, onClickToDetail);
|
|
113
|
+
var _getColumns = getColumns(eventGroupList, userPropList, eventEnvList, dataSource.xAxis || [], userGroup, searchData, showList, onShowClick, onClickToDetail);
|
|
118
114
|
return _getColumns;
|
|
119
115
|
}, [dataSource.xAxis, showList, sortTable, panelName]);
|
|
120
116
|
var onChangeTable = function onChangeTable(pagination) {
|
|
@@ -128,11 +124,13 @@ var EventTable = function EventTable(props) {
|
|
|
128
124
|
data: _objectSpread({
|
|
129
125
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
130
126
|
platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0,
|
|
131
|
-
service: !searchData.
|
|
127
|
+
service: !searchData.dimension ? 'event/overview_sql' : 'event_sql'
|
|
132
128
|
}, searchData)
|
|
133
129
|
}).then(function (res) {
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
if (res === null || res === void 0 ? void 0 : res.data) {
|
|
131
|
+
setSqlText(res.data.sql);
|
|
132
|
+
setSqlModal(true);
|
|
133
|
+
}
|
|
136
134
|
});
|
|
137
135
|
};
|
|
138
136
|
var download = function download() {
|
|
@@ -140,10 +138,10 @@ var EventTable = function EventTable(props) {
|
|
|
140
138
|
if (searchData.userGroup && searchData.userGroup.length > 1) {
|
|
141
139
|
seriesNames.push(base64.encode('用户群'));
|
|
142
140
|
}
|
|
143
|
-
if (searchData.
|
|
144
|
-
seriesNames.push(base64.encode(searchData.
|
|
141
|
+
if (searchData.dimension) {
|
|
142
|
+
seriesNames.push(base64.encode(getValue(searchData.dimension, eventGroupList, eventEnvList, userPropList).label));
|
|
145
143
|
}
|
|
146
|
-
if (searchData.
|
|
144
|
+
if (searchData.id && !searchData.dimension || !searchData.id) {
|
|
147
145
|
seriesNames.push(base64.encode('事件'));
|
|
148
146
|
}
|
|
149
147
|
var params = _objectSpread(_objectSpread({
|
|
@@ -17,7 +17,8 @@ var classPrefix = 'modules-event-topbar';
|
|
|
17
17
|
var TopBar = function TopBar(props) {
|
|
18
18
|
var _useContext = useContext(EventContext),
|
|
19
19
|
panelId = _useContext.panelId,
|
|
20
|
-
afterEditTarget = _useContext.afterEditTarget
|
|
20
|
+
afterEditTarget = _useContext.afterEditTarget,
|
|
21
|
+
enableAddScene = _useContext.enableAddScene;
|
|
21
22
|
var _useState = useState(false),
|
|
22
23
|
_useState2 = _slicedToArray(_useState, 2),
|
|
23
24
|
showPanel = _useState2[0],
|
|
@@ -30,11 +31,14 @@ var TopBar = function TopBar(props) {
|
|
|
30
31
|
currentApp = _useContext2.currentApp;
|
|
31
32
|
var searchData = props.searchData,
|
|
32
33
|
platformChange = props.platformChange;
|
|
33
|
-
|
|
34
|
-
var _useState5 = useState(),
|
|
34
|
+
var _useState5 = useState((searchData === null || searchData === void 0 ? void 0 : searchData.platform) === undefined ? 0 : searchData.platform),
|
|
35
35
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
selectPlatform = _useState6[0],
|
|
37
|
+
setselectPlatform = _useState6[1];
|
|
38
|
+
var _useState7 = useState(),
|
|
39
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
40
|
+
panelType = _useState8[0],
|
|
41
|
+
setPanelType = _useState8[1];
|
|
38
42
|
var closeHandle = function closeHandle(type) {
|
|
39
43
|
if (type === 'panel') {
|
|
40
44
|
setPanelType(undefined);
|
|
@@ -68,7 +72,7 @@ var TopBar = function TopBar(props) {
|
|
|
68
72
|
onOk: function onOk(data) {
|
|
69
73
|
return _onOk('panel', data);
|
|
70
74
|
}
|
|
71
|
-
})),
|
|
75
|
+
})), enableAddScene && /*#__PURE__*/React.createElement("div", {
|
|
72
76
|
className: "".concat(classPrefix, "-scene")
|
|
73
77
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
74
78
|
onClick: function onClick() {
|
|
@@ -95,9 +99,11 @@ var TopBar = function TopBar(props) {
|
|
|
95
99
|
className: "".concat(classPrefix, "-platform")
|
|
96
100
|
}, platformOption.map(function (item) {
|
|
97
101
|
return /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
className: "".concat(selectPlatform === item.key ? 'active' : ''),
|
|
98
103
|
key: item.key,
|
|
99
104
|
onClick: function onClick() {
|
|
100
|
-
|
|
105
|
+
setselectPlatform(item.key);
|
|
106
|
+
platformChange(item.key);
|
|
101
107
|
}
|
|
102
108
|
}, item.value);
|
|
103
109
|
})));
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import { SearchValue } from '../../types';
|
|
1
2
|
export interface TopBarProps {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
onSave?: () => void;
|
|
5
|
-
onSaveAs?: () => void;
|
|
6
|
-
onEditTitle?: (val: string) => void;
|
|
3
|
+
searchData?: SearchValue;
|
|
4
|
+
platformChange: (data: number) => void;
|
|
7
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { eventChartProps } from './types';
|
|
3
|
-
declare const EventChart: React.
|
|
3
|
+
declare const EventChart: React.FC<eventChartProps.Props>;
|
|
4
4
|
export default EventChart;
|
|
@@ -11,11 +11,12 @@ import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
|
11
11
|
import { BizChart, BizGlobalDataContext, ajax } from '@zgfe/business-lib';
|
|
12
12
|
import { EventTable, MiNone } from '../../components';
|
|
13
13
|
import { judgeIsCity } from '../content/utils';
|
|
14
|
+
import { getValue } from '../../modules/content/utils';
|
|
14
15
|
import { getDefaultShow, getShowColor } from '../../utils/formData';
|
|
15
16
|
import _ from 'lodash';
|
|
16
17
|
import { Apis, chartColors } from '../../constants';
|
|
17
18
|
import { Spin } from 'antd';
|
|
18
|
-
var EventChart =
|
|
19
|
+
var EventChart = function EventChart(props) {
|
|
19
20
|
var params = props.params;
|
|
20
21
|
var _useState = useState(false),
|
|
21
22
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -34,7 +35,10 @@ var EventChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
34
35
|
dataSource = _useState8[0],
|
|
35
36
|
setDataSource = _useState8[1];
|
|
36
37
|
var _useContext = useContext(BizGlobalDataContext),
|
|
37
|
-
currentApp = _useContext.currentApp
|
|
38
|
+
currentApp = _useContext.currentApp,
|
|
39
|
+
eventGroupList = _useContext.eventGroupList,
|
|
40
|
+
eventEnvList = _useContext.eventEnvList,
|
|
41
|
+
userPropList = _useContext.userPropList;
|
|
38
42
|
var _useState9 = useState(false),
|
|
39
43
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
40
44
|
loading = _useState10[0],
|
|
@@ -70,10 +74,11 @@ var EventChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
70
74
|
var chartData = ((_params$chartType = params.chartType) === null || _params$chartType === void 0 ? void 0 : _params$chartType.split(',')) || ['line'];
|
|
71
75
|
var type = (chartData === null || chartData === void 0 ? void 0 : chartData.length) > 1 ? chartData[chartData.length - 1] : chartData[0];
|
|
72
76
|
setChartType(props.type || type);
|
|
73
|
-
if (params.
|
|
74
|
-
var dimensions = params.
|
|
75
|
-
if (type === 'map' && dimensions
|
|
76
|
-
|
|
77
|
+
if (params.id) {
|
|
78
|
+
var dimensions = params.dimension;
|
|
79
|
+
if (type === 'map' && dimensions) {
|
|
80
|
+
var _getValue;
|
|
81
|
+
setIsCity(judgeIsCity((_getValue = getValue(dimensions, eventGroupList, eventEnvList, userPropList)) === null || _getValue === void 0 ? void 0 : _getValue.name));
|
|
77
82
|
}
|
|
78
83
|
}
|
|
79
84
|
}, [params, props.type]);
|
|
@@ -123,7 +128,6 @@ var EventChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
123
128
|
case 'pie':
|
|
124
129
|
case 'map':
|
|
125
130
|
return /*#__PURE__*/React.createElement(BizChart, {
|
|
126
|
-
ref: ref,
|
|
127
131
|
key: chartType,
|
|
128
132
|
type: chartType,
|
|
129
133
|
data: chartData,
|
|
@@ -146,7 +150,7 @@ var EventChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
146
150
|
default:
|
|
147
151
|
return /*#__PURE__*/React.createElement("div", null, "\u6682\u4E0D\u652F\u6301\u8BE5\u56FE\u8868\u7C7B\u578B");
|
|
148
152
|
}
|
|
149
|
-
}
|
|
153
|
+
};
|
|
150
154
|
EventChart.defaultProps = {
|
|
151
155
|
showList: []
|
|
152
156
|
};
|