@zgfe/modules-event 1.0.29-zhongyuanE.17 → 1.0.29-zhongyuanE.23
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 +5 -0
- package/es/components/eventFilter/index.js +315 -0
- package/es/components/eventFilter/setCascade.d.ts +3 -0
- package/es/components/eventFilter/setCascade.js +286 -0
- package/es/components/eventFilter/types.d.ts +21 -0
- package/es/components/eventFilter/types.js +1 -0
- package/es/components/index.d.ts +4 -0
- package/es/components/index.js +4 -0
- package/es/components/renderContent/index.d.ts +5 -0
- package/es/components/renderContent/index.js +46 -0
- package/es/components/renderContent/styles/index.less +19 -0
- package/es/components/renderContent/types.d.ts +8 -0
- package/es/components/renderContent/types.js +1 -0
- package/es/components/searchPanel/index.d.ts +5 -0
- package/es/components/searchPanel/index.js +134 -0
- package/es/components/searchPanel/styles/index.less +22 -0
- package/es/components/searchPanel/types.d.ts +28 -0
- package/es/components/searchPanel/types.js +1 -0
- package/es/components/table/index.d.ts +6 -0
- package/es/components/table/index.js +319 -0
- package/es/components/table/styles/index.css +236 -0
- package/es/components/table/styles/index.less +249 -0
- package/es/components/table/types.d.ts +10 -0
- package/es/components/table/types.js +1 -0
- package/es/components/topBar/index.d.ts +10 -0
- package/es/components/topBar/index.js +174 -0
- package/es/components/topBar/styles/index.less +58 -0
- package/es/components/topBar/types.d.ts +8 -0
- package/es/components/topBar/types.js +1 -0
- package/es/constants/apis.d.ts +10 -0
- package/es/constants/apis.js +10 -0
- package/es/constants/chart.d.ts +2 -0
- package/es/constants/chart.js +31 -0
- package/es/constants/color.d.ts +1 -0
- package/es/constants/color.js +1 -0
- package/es/constants/fields.d.ts +251 -0
- package/es/constants/fields.js +177 -0
- package/es/constants/index.d.ts +6 -0
- package/es/constants/index.js +6 -0
- package/es/constants/initData.d.ts +2 -0
- package/es/constants/initData.js +9 -0
- package/es/index.d.ts +6 -0
- package/es/index.js +5 -0
- package/es/modules/chart/demo/data.d.ts +73 -0
- package/es/modules/chart/demo/data.js +484 -0
- package/es/modules/chart/demo/index.d.ts +3 -0
- package/es/modules/chart/demo/index.js +51 -0
- package/es/modules/chart/demo/panel.d.ts +3 -0
- package/es/modules/chart/demo/panel.js +16 -0
- package/es/modules/chart/index.d.ts +4 -0
- package/es/modules/chart/index.js +253 -0
- package/es/modules/chart/types.d.ts +19 -0
- package/es/modules/chart/types.js +1 -0
- package/es/modules/content/index.d.ts +5 -0
- package/es/modules/content/index.js +302 -0
- package/es/modules/content/styles/index.less +19 -0
- package/es/modules/content/types.d.ts +11 -0
- package/es/modules/content/types.js +1 -0
- package/es/modules/content/utils.d.ts +18 -0
- package/es/modules/content/utils.js +134 -0
- package/es/modules/home/demo/create.d.ts +3 -0
- package/es/modules/home/demo/create.js +58 -0
- package/es/modules/home/demo/edit.d.ts +3 -0
- package/es/modules/home/demo/edit.js +73 -0
- package/es/modules/home/demo/index.d.ts +4 -0
- package/es/modules/home/demo/index.js +55 -0
- package/es/modules/home/demo/scene.d.ts +3 -0
- package/es/modules/home/demo/scene.js +89 -0
- package/es/modules/home/demo/styles/index.less +33 -0
- package/es/modules/home/index.d.ts +5 -0
- package/es/modules/home/index.js +184 -0
- package/es/modules/home/styles/index.less +49 -0
- package/es/modules/home/types.d.ts +34 -0
- package/es/modules/home/types.js +1 -0
- package/es/modules/topPanel/index.d.ts +5 -0
- package/es/modules/topPanel/index.js +246 -0
- package/es/modules/topPanel/styles/index.less +50 -0
- package/es/modules/topPanel/types.d.ts +46 -0
- package/es/modules/topPanel/types.js +1 -0
- package/es/style/theme.d.ts +15 -0
- package/es/style/theme.js +14 -0
- package/es/types.d.ts +86 -0
- package/es/types.js +6 -0
- package/es/utils/ajaxConfig.d.ts +8 -0
- package/es/utils/ajaxConfig.js +40 -0
- package/es/utils/base64.d.ts +23 -0
- package/es/utils/base64.js +125 -0
- package/es/utils/formData.d.ts +20 -0
- package/es/utils/formData.js +406 -0
- package/es/utils/util.d.ts +32 -0
- package/es/utils/util.js +139 -0
- package/package.json +2 -2
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { BizLoading } from '@zgfe/business-lib';
|
|
3
|
+
import { EventContext } from '../../types';
|
|
4
|
+
import './styles/index.less';
|
|
5
|
+
import EventChart from '../../modules/chart';
|
|
6
|
+
var classPrefix = 'render-content';
|
|
7
|
+
var ContentPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
8
|
+
var eventData = props.eventData,
|
|
9
|
+
searchData = props.searchData;
|
|
10
|
+
var _useContext = useContext(EventContext),
|
|
11
|
+
loading = _useContext.loading,
|
|
12
|
+
refreshLoading = _useContext.refreshLoading,
|
|
13
|
+
onSelectEvent = _useContext.onSelectEvent,
|
|
14
|
+
showListHome = _useContext.showListHome,
|
|
15
|
+
setShowListHome = _useContext.setShowListHome,
|
|
16
|
+
completedSearchData = _useContext.completedSearchData;
|
|
17
|
+
var onChangeShow = function onChangeShow(names) {
|
|
18
|
+
setShowListHome(names);
|
|
19
|
+
};
|
|
20
|
+
if (loading || refreshLoading) {
|
|
21
|
+
return /*#__PURE__*/React.createElement(BizLoading, {
|
|
22
|
+
className: "".concat(classPrefix, "-loading")
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
className: classPrefix
|
|
27
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
className: "".concat(classPrefix, "-chart-container")
|
|
29
|
+
}, /*#__PURE__*/React.createElement(EventChart, {
|
|
30
|
+
ref: ref,
|
|
31
|
+
dataSource: eventData,
|
|
32
|
+
params: searchData,
|
|
33
|
+
completedSearchData: completedSearchData,
|
|
34
|
+
showList: showListHome
|
|
35
|
+
})), eventData && eventData.series.length > 0 ? (/*#__PURE__*/React.createElement(EventChart, {
|
|
36
|
+
type: "grid",
|
|
37
|
+
isHideDel: true,
|
|
38
|
+
dataSource: eventData,
|
|
39
|
+
params: searchData,
|
|
40
|
+
completedSearchData: completedSearchData,
|
|
41
|
+
showList: showListHome,
|
|
42
|
+
onChangeShow: onChangeShow,
|
|
43
|
+
onSelectEvent: onSelectEvent
|
|
44
|
+
})) : null);
|
|
45
|
+
});
|
|
46
|
+
export default ContentPanel;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@import '~@zgfe/business-lib/es/assets/styles/variable.less';
|
|
2
|
+
|
|
3
|
+
.render-content {
|
|
4
|
+
&-chart-container {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
height: 392px;
|
|
9
|
+
padding: @padding-lg;
|
|
10
|
+
border: 1px solid @border-color-base;
|
|
11
|
+
border-radius: @border-radius-normal;
|
|
12
|
+
.echarts-for-react {
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
&-loading {
|
|
17
|
+
min-height: 300px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SearchValue, ResponseDataProps } from '../../types';
|
|
2
|
+
export interface RenderContentProps {
|
|
3
|
+
eventData?: ResponseDataProps;
|
|
4
|
+
searchData?: SearchValue;
|
|
5
|
+
isCity?: boolean;
|
|
6
|
+
afterEditTarget?: (type: string, value?: any) => void;
|
|
7
|
+
onChangeShow?: (data: string[]) => void;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
|
+
import { BizSelect, BizTargetDimension, useChanged, IconFont, BizDatePickerV2, BizGlobalDataContext } from '@zgfe/business-lib';
|
|
14
|
+
import { Button } from 'antd';
|
|
15
|
+
import { DatePickerTypes } from '@zgfe/business-lib/es/datePickerV2/types';
|
|
16
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
17
|
+
import { chartTypeOptions, getInitDate } from '../../constants';
|
|
18
|
+
import { EventContext } from '../../types';
|
|
19
|
+
import { normalOptions, normalEventOptions } from '../../modules/content/utils';
|
|
20
|
+
import './styles/index.less';
|
|
21
|
+
var classPrefix = 'search-panel';
|
|
22
|
+
var SearchPanel = function SearchPanel(props) {
|
|
23
|
+
var _useContext = useContext(EventContext),
|
|
24
|
+
includeToday = _useContext.includeToday,
|
|
25
|
+
searchData = _useContext.searchData,
|
|
26
|
+
currentApp = _useContext.currentApp,
|
|
27
|
+
refreshLoading = _useContext.refreshLoading;
|
|
28
|
+
var _useContext2 = useContext(BizGlobalDataContext),
|
|
29
|
+
envs = _useContext2.envs;
|
|
30
|
+
var analysisSubjectType = props.analysisSubjectType,
|
|
31
|
+
dimension = props.dimension,
|
|
32
|
+
setDimension = props.setDimension;
|
|
33
|
+
var _useState = useState(props.time || getInitDate(includeToday)),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
time = _useState2[0],
|
|
36
|
+
setTime = _useState2[1];
|
|
37
|
+
var _useState3 = useState(chartTypeOptions[0]),
|
|
38
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
39
|
+
chart = _useState4[0],
|
|
40
|
+
setChart = _useState4[1];
|
|
41
|
+
var currentNormalOptions = analysisSubjectType === 'user' ? normalOptions(currentApp === null || currentApp === void 0 ? void 0 : currentApp.type) : normalEventOptions;
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
if (searchData.chartType && searchData.chartType !== chart.value) {
|
|
44
|
+
if (searchData.chartType.indexOf(',') !== -1) {
|
|
45
|
+
setChart({
|
|
46
|
+
value: searchData.chartType.split(',')[0]
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
setChart({
|
|
50
|
+
value: searchData.chartType
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, [searchData]);
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
if (!props.enableSelectChart && chart.value === 'map') {
|
|
57
|
+
setChart({
|
|
58
|
+
value: 'line'
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}, [props.enableSelectChart]);
|
|
62
|
+
var onChangeTime = function onChangeTime(val) {
|
|
63
|
+
setTime(val);
|
|
64
|
+
props.onChange && props.onChange(_objectSpread({
|
|
65
|
+
time: val,
|
|
66
|
+
chartType: chart.value
|
|
67
|
+
}, dimension));
|
|
68
|
+
};
|
|
69
|
+
var onChange = function onChange(val) {
|
|
70
|
+
setChart(val);
|
|
71
|
+
props.onChange && props.onChange(_objectSpread({
|
|
72
|
+
time: time,
|
|
73
|
+
chartType: val.value
|
|
74
|
+
}, dimension));
|
|
75
|
+
};
|
|
76
|
+
var onDimensionChange = function onDimensionChange(data) {
|
|
77
|
+
setDimension && setDimension(data);
|
|
78
|
+
props.onChange && props.onChange({
|
|
79
|
+
time: time,
|
|
80
|
+
chartType: chart.value,
|
|
81
|
+
analysisIndex: data.analysisIndex,
|
|
82
|
+
analysisAttr: data.analysisAttr
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
useChanged(function (pre, next) {
|
|
86
|
+
if (pre === next) return;
|
|
87
|
+
onDimensionChange({
|
|
88
|
+
analysisIndex: currentNormalOptions[0].value,
|
|
89
|
+
analysisAttr: undefined
|
|
90
|
+
});
|
|
91
|
+
}, props.eventId);
|
|
92
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
className: classPrefix
|
|
94
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
style: {
|
|
96
|
+
display: 'flex'
|
|
97
|
+
}
|
|
98
|
+
}, /*#__PURE__*/React.createElement(BizDatePickerV2, {
|
|
99
|
+
defaultValue: time,
|
|
100
|
+
onChange: onChangeTime,
|
|
101
|
+
dateTypeList: [DatePickerTypes.Unit.minute, DatePickerTypes.Unit.hour, DatePickerTypes.Unit.day, DatePickerTypes.Unit.week, DatePickerTypes.Unit.month],
|
|
102
|
+
selectRangeUnit: "months",
|
|
103
|
+
selectRange: envs && envs.timeRangeOpen ? envs.timeRangeOpen : 12,
|
|
104
|
+
timeRangeOpen: envs && envs.timeRangeOpen ? envs.timeRangeOpen : 12
|
|
105
|
+
}), /*#__PURE__*/React.createElement(BizTargetDimension, {
|
|
106
|
+
normalOptions: currentNormalOptions,
|
|
107
|
+
value: dimension,
|
|
108
|
+
eventId: props.eventId,
|
|
109
|
+
isExtend: true,
|
|
110
|
+
onChange: onDimensionChange
|
|
111
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
className: "".concat(classPrefix, "-search-right")
|
|
113
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
114
|
+
className: "".concat(classPrefix, "-search-right-refresh"),
|
|
115
|
+
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
116
|
+
type: "zhongxinjiazai"
|
|
117
|
+
}),
|
|
118
|
+
loading: refreshLoading,
|
|
119
|
+
onClick: function onClick() {
|
|
120
|
+
return props.refreshHandle();
|
|
121
|
+
}
|
|
122
|
+
}, "\u5237\u65B0"), /*#__PURE__*/React.createElement(BizSelect, {
|
|
123
|
+
className: "".concat(classPrefix, "-select"),
|
|
124
|
+
options: chartTypeOptions,
|
|
125
|
+
defaultValue: chart,
|
|
126
|
+
value: chart,
|
|
127
|
+
labelField: "label",
|
|
128
|
+
keyField: "value",
|
|
129
|
+
theme: "secondary",
|
|
130
|
+
onChange: onChange,
|
|
131
|
+
disableItemList: props.enableSelectChart ? [] : [chartTypeOptions[3]]
|
|
132
|
+
})));
|
|
133
|
+
};
|
|
134
|
+
export default SearchPanel;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@import '~@zgfe/business-lib/es/assets/styles/variable.less';
|
|
2
|
+
|
|
3
|
+
.search-panel {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
height: 32px;
|
|
8
|
+
margin-bottom: 24px;
|
|
9
|
+
|
|
10
|
+
&-search-right {
|
|
11
|
+
display: flex;
|
|
12
|
+
gap: 16px;
|
|
13
|
+
&-refresh {
|
|
14
|
+
display: flex !important;
|
|
15
|
+
gap: 4px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&-select {
|
|
20
|
+
width: 112px;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DatePickerTypes } from '@zgfe/business-lib/es/datePicker/types';
|
|
2
|
+
import { EventChartTypes } from '../../types';
|
|
3
|
+
import { TargetConditionTypes } from '@zgfe/business-lib';
|
|
4
|
+
export interface AnalysisSubject {
|
|
5
|
+
subjectId?: number;
|
|
6
|
+
id?: number;
|
|
7
|
+
name?: string;
|
|
8
|
+
unit?: string;
|
|
9
|
+
subjectAlias?: string;
|
|
10
|
+
subjectName?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface SearchPanelProps {
|
|
13
|
+
refreshHandle: Function;
|
|
14
|
+
analysisIndex?: string;
|
|
15
|
+
analysisAttr?: string;
|
|
16
|
+
enableSelectChart?: boolean;
|
|
17
|
+
time?: DatePickerTypes.Value;
|
|
18
|
+
eventId?: number;
|
|
19
|
+
chartType?: EventChartTypes;
|
|
20
|
+
onChange?: (data: SearchPanelProps) => void;
|
|
21
|
+
setIsCity?: Function;
|
|
22
|
+
setEnableSelectChart?: Function;
|
|
23
|
+
analysisSubjectType?: string;
|
|
24
|
+
analysisSubject?: AnalysisSubject;
|
|
25
|
+
dimension?: TargetConditionTypes.DimensionValue;
|
|
26
|
+
setDimension?: Function;
|
|
27
|
+
optionNode?: any;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
10
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
11
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
12
|
+
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."); }
|
|
13
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
14
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
15
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
17
|
+
import { ajax, BizGlobalDataContext, IconFont } from '@zgfe/business-lib';
|
|
18
|
+
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
19
|
+
import Highlight from 'react-highlight';
|
|
20
|
+
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
|
21
|
+
import 'highlight.js/styles/vs.css';
|
|
22
|
+
import base64 from '../../utils/base64';
|
|
23
|
+
import { Apis } from '../../constants';
|
|
24
|
+
import { Modal, message, Table, ConfigProvider, Empty, Tooltip, Typography } from 'antd';
|
|
25
|
+
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
26
|
+
import { formTableData, getColumns } from '../../utils/formData';
|
|
27
|
+
import './styles/index.less';
|
|
28
|
+
import { getValue } from '../../modules/content/utils';
|
|
29
|
+
import { EventContext } from '../../types';
|
|
30
|
+
import { getEventAliasName } from '../../utils/formData';
|
|
31
|
+
var classPrefix = 'event-mi-table';
|
|
32
|
+
var Text = Typography.Text;
|
|
33
|
+
var EventTable = function EventTable(props) {
|
|
34
|
+
var dataSource = props.dataSource,
|
|
35
|
+
searchData = props.searchData,
|
|
36
|
+
showList = props.showList,
|
|
37
|
+
sourcePanel = props.sourcePanel;
|
|
38
|
+
var _useState = useState([]),
|
|
39
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
+
tableData = _useState2[0],
|
|
41
|
+
setTableData = _useState2[1];
|
|
42
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
43
|
+
_useContext$eventGrou = _useContext.eventGroupList,
|
|
44
|
+
eventGroupList = _useContext$eventGrou === void 0 ? [] : _useContext$eventGrou,
|
|
45
|
+
eventEnvList = _useContext.eventEnvList,
|
|
46
|
+
userPropList = _useContext.userPropList,
|
|
47
|
+
userGroupList = _useContext.userGroupList,
|
|
48
|
+
authority = _useContext.authority,
|
|
49
|
+
showProdDownload = _useContext.showProdDownload;
|
|
50
|
+
var _useContext2 = useContext(EventContext),
|
|
51
|
+
onUserDrill = _useContext2.onUserDrill,
|
|
52
|
+
_useContext2$defaultS = _useContext2.defaultSearch,
|
|
53
|
+
defaultSearch = _useContext2$defaultS === void 0 ? {} : _useContext2$defaultS,
|
|
54
|
+
panelName = _useContext2.panelName,
|
|
55
|
+
currentApp = _useContext2.currentApp;
|
|
56
|
+
var _useState3 = useState(false),
|
|
57
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
58
|
+
sqlModal = _useState4[0],
|
|
59
|
+
setSqlModal = _useState4[1];
|
|
60
|
+
var _useState5 = useState(''),
|
|
61
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
62
|
+
sqlText = _useState6[0],
|
|
63
|
+
setSqlText = _useState6[1];
|
|
64
|
+
var _useState7 = useState(1),
|
|
65
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
66
|
+
current = _useState8[0],
|
|
67
|
+
setCurrent = _useState8[1];
|
|
68
|
+
var _useState9 = useState(10),
|
|
69
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
70
|
+
pageSize = _useState0[0],
|
|
71
|
+
setPageSize = _useState0[1];
|
|
72
|
+
var _useState1 = useState(0),
|
|
73
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
74
|
+
total = _useState10[0],
|
|
75
|
+
setTotal = _useState10[1];
|
|
76
|
+
var _useState11 = useState(),
|
|
77
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
78
|
+
pvTitle = _useState12[0],
|
|
79
|
+
setPvTitle = _useState12[1];
|
|
80
|
+
useEffect(function () {
|
|
81
|
+
var gLen = (searchData === null || searchData === void 0 ? void 0 : searchData.dimension) ? 1 : 0;
|
|
82
|
+
var _data = formTableData(dataSource, searchData.userGroup || [0], gLen);
|
|
83
|
+
setTotal(_data.length);
|
|
84
|
+
var dataAll = [];
|
|
85
|
+
if (dataSource.userGroupEventTimeSum) {
|
|
86
|
+
dataSource.userGroupEventTimeSum.map(function (item) {
|
|
87
|
+
var data = {
|
|
88
|
+
eventName: '总计',
|
|
89
|
+
dimension: '总计',
|
|
90
|
+
isAdd: true,
|
|
91
|
+
id: Math.random(),
|
|
92
|
+
name: '总计',
|
|
93
|
+
nameGroup: '总计',
|
|
94
|
+
originalName: '总计',
|
|
95
|
+
userGroup: Object.keys(item)[0]
|
|
96
|
+
};
|
|
97
|
+
var sum = 0;
|
|
98
|
+
Object.values(item)[0].forEach(function (item, index) {
|
|
99
|
+
data["field".concat(index)] = item;
|
|
100
|
+
sum += item;
|
|
101
|
+
});
|
|
102
|
+
data.attrSum = sum;
|
|
103
|
+
dataAll.push(data);
|
|
104
|
+
});
|
|
105
|
+
setPvTitle(dataSource.eventPvTitle.split(';').map(function (item) {
|
|
106
|
+
return item.split(' ');
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
setTableData([].concat(dataAll, _toConsumableArray(_data)));
|
|
110
|
+
}, []);
|
|
111
|
+
var columns = useMemo(function () {
|
|
112
|
+
var _searchData$userGroup = searchData.userGroup,
|
|
113
|
+
userGroup = _searchData$userGroup === void 0 ? [0] : _searchData$userGroup;
|
|
114
|
+
var onShowClick = function onShowClick(nameGroup) {
|
|
115
|
+
props.changeShowByName(nameGroup);
|
|
116
|
+
};
|
|
117
|
+
var onClickToDetail = function onClickToDetail(item, time, count) {
|
|
118
|
+
var _searchData$dimension, _searchData$filters;
|
|
119
|
+
var userGroupData = userGroup[0] == null ? [] : [userGroup[0]];
|
|
120
|
+
if ((userGroup === null || userGroup === void 0 ? void 0 : userGroup.length) > 1) {
|
|
121
|
+
userGroupList && userGroupList.forEach(function (user) {
|
|
122
|
+
if (user.name === item.userGroup) {
|
|
123
|
+
userGroupData = [user.id];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
var _time = time.split('|');
|
|
128
|
+
var groupValue = '';
|
|
129
|
+
if (searchData.dimension && item.dimension) {
|
|
130
|
+
groupValue = item.originalName;
|
|
131
|
+
} else {
|
|
132
|
+
eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
|
|
133
|
+
group.eventList.forEach(function (event) {
|
|
134
|
+
if (event.name === item.originalName) {
|
|
135
|
+
groupValue = event.id.toString();
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
onUserDrill && onUserDrill({
|
|
141
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
142
|
+
platform: (searchData === null || searchData === void 0 ? void 0 : searchData.platform) || 0,
|
|
143
|
+
count: count,
|
|
144
|
+
module: 'event',
|
|
145
|
+
params: {
|
|
146
|
+
groupValue: groupValue,
|
|
147
|
+
groupValueEncry: (((_searchData$dimension = searchData.dimension) === null || _searchData$dimension === void 0 ? void 0 : _searchData$dimension.encryptionType) || 0) > 0,
|
|
148
|
+
id: searchData.id,
|
|
149
|
+
userGroup: userGroupData,
|
|
150
|
+
chartType: searchData.chartType,
|
|
151
|
+
conditions: (_searchData$filters = searchData.filters) === null || _searchData$filters === void 0 ? void 0 : _searchData$filters.conditions,
|
|
152
|
+
dimension: searchData.dimension,
|
|
153
|
+
dataType: searchData.id ? 'event' : 'overview',
|
|
154
|
+
time: _objectSpread(_objectSpread({}, searchData.time), {}, {
|
|
155
|
+
begin: _time[0],
|
|
156
|
+
end: _time.length > 1 ? _time[1] : _time[0]
|
|
157
|
+
})
|
|
158
|
+
},
|
|
159
|
+
source: 'EVENT',
|
|
160
|
+
url: searchData.analysisSubject ? '/zg/web/v2/data/eventSubjectDetail' : '/zg/web/v2/data/appEventBatch',
|
|
161
|
+
analysisSubject: searchData.analysisSubject ? searchData.analysisSubject : undefined
|
|
162
|
+
}, _objectSpread(_objectSpread({
|
|
163
|
+
source: 'EVENT'
|
|
164
|
+
}, defaultSearch), {}, {
|
|
165
|
+
name: panelName,
|
|
166
|
+
data: searchData
|
|
167
|
+
}));
|
|
168
|
+
};
|
|
169
|
+
var _getColumns = getColumns(eventGroupList, userPropList, eventEnvList, dataSource.xAxis || [], userGroup, searchData, showList, onShowClick, onClickToDetail, props === null || props === void 0 ? void 0 : props.onSelectEvent);
|
|
170
|
+
return _getColumns;
|
|
171
|
+
}, [dataSource.xAxis, showList, panelName]);
|
|
172
|
+
var seeSql = function seeSql() {
|
|
173
|
+
ajax(Apis.getEventDataSql, {
|
|
174
|
+
method: 'post',
|
|
175
|
+
data: _objectSpread({
|
|
176
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
177
|
+
platform: (searchData === null || searchData === void 0 ? void 0 : searchData.platform) || 0,
|
|
178
|
+
service: searchData.id ? 'event_sql' : 'event/overview_sql'
|
|
179
|
+
}, searchData)
|
|
180
|
+
}).then(function (res) {
|
|
181
|
+
if (res === null || res === void 0 ? void 0 : res.data) {
|
|
182
|
+
setSqlText(res.data.sql);
|
|
183
|
+
setSqlModal(true);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
var download = function download() {
|
|
188
|
+
var seriesNames = [];
|
|
189
|
+
if (searchData.userGroup && (searchData.userGroup.length > 1 || searchData.userGroup[0] !== 0)) {
|
|
190
|
+
seriesNames.push(base64.encode('用户群'));
|
|
191
|
+
}
|
|
192
|
+
if (searchData.dimension) {
|
|
193
|
+
seriesNames.push(base64.encode(getValue(searchData.dimension, eventGroupList, eventEnvList, userPropList, searchData).label));
|
|
194
|
+
}
|
|
195
|
+
if (searchData.id && !searchData.dimension || !searchData.id) {
|
|
196
|
+
seriesNames.push(base64.encode('事件'));
|
|
197
|
+
}
|
|
198
|
+
var fname = "\u4E8B\u4EF6\u5206\u6790-".concat((searchData === null || searchData === void 0 ? void 0 : searchData.name) ? getEventAliasName(searchData === null || searchData === void 0 ? void 0 : searchData.name, eventGroupList) : '事件概览');
|
|
199
|
+
var params = _objectSpread(_objectSpread({
|
|
200
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
201
|
+
platform: (searchData === null || searchData === void 0 ? void 0 : searchData.platform) || 0
|
|
202
|
+
}, searchData), {}, {
|
|
203
|
+
down: {
|
|
204
|
+
fname: base64.encode(fname),
|
|
205
|
+
titles: seriesNames
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
ajax(Apis.eventDownloadReport, {
|
|
209
|
+
method: 'post',
|
|
210
|
+
data: params,
|
|
211
|
+
responseType: 'blob',
|
|
212
|
+
fileName: fname,
|
|
213
|
+
getResponse: true
|
|
214
|
+
}).then(function () {
|
|
215
|
+
message.success('下载成功!');
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
var pageChange = function pageChange(page, pageSize) {
|
|
219
|
+
setCurrent(page);
|
|
220
|
+
setPageSize(pageSize);
|
|
221
|
+
};
|
|
222
|
+
var tableEmptyRender = function tableEmptyRender() {
|
|
223
|
+
return /*#__PURE__*/React.createElement(Empty, {
|
|
224
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
225
|
+
description: "\u6682\u65E0\u6570\u636E"
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
229
|
+
className: classPrefix
|
|
230
|
+
}, !sourcePanel && (/*#__PURE__*/React.createElement("div", {
|
|
231
|
+
className: "".concat(classPrefix, "-table-header")
|
|
232
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
233
|
+
className: "".concat(classPrefix, "-table-header-left")
|
|
234
|
+
}, "\u6307\u6807\u8BE6\u60C5", pvTitle && pvTitle.length ? (/*#__PURE__*/React.createElement("div", {
|
|
235
|
+
className: "".concat(classPrefix, "-table-header-left-box")
|
|
236
|
+
}, "\uFF08\u4E8B\u4EF6\u603B\u91CF\uFF1A", /*#__PURE__*/React.createElement("div", {
|
|
237
|
+
className: "".concat(classPrefix, "-table-header-left-content")
|
|
238
|
+
}, pvTitle.map(function (item, index) {
|
|
239
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
240
|
+
title: item[0] + ':' + item[1],
|
|
241
|
+
key: index
|
|
242
|
+
}, /*#__PURE__*/React.createElement("span", null, item[0], "\uFF1A"), /*#__PURE__*/React.createElement("span", null, item[1], index === pvTitle.length - 1 ? '' : ' | '));
|
|
243
|
+
}), "\uFF09"))) : null), /*#__PURE__*/React.createElement("div", null, authority[100051] && /*#__PURE__*/React.createElement("div", {
|
|
244
|
+
onClick: seeSql
|
|
245
|
+
}, "\u67E5\u770BSQL"), authority[100050] && showProdDownload && (/*#__PURE__*/React.createElement("div", {
|
|
246
|
+
onClick: download
|
|
247
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
248
|
+
type: "xiazai1"
|
|
249
|
+
}), "\u4E0B\u8F7D\u6570\u636E"))))), /*#__PURE__*/React.createElement("div", {
|
|
250
|
+
className: "table-area ".concat(sourcePanel ? 'sourcepanel-table-header' : '')
|
|
251
|
+
}, /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
252
|
+
renderEmpty: tableEmptyRender
|
|
253
|
+
}, /*#__PURE__*/React.createElement(Table, {
|
|
254
|
+
className: "table",
|
|
255
|
+
rowKey: 'id',
|
|
256
|
+
columns: columns,
|
|
257
|
+
dataSource: tableData,
|
|
258
|
+
scroll: {
|
|
259
|
+
x: true
|
|
260
|
+
},
|
|
261
|
+
pagination: {
|
|
262
|
+
showQuickJumper: true,
|
|
263
|
+
showSizeChanger: true,
|
|
264
|
+
total: total,
|
|
265
|
+
defaultPageSize: 10,
|
|
266
|
+
defaultCurrent: 1,
|
|
267
|
+
current: current,
|
|
268
|
+
pageSize: pageSize,
|
|
269
|
+
onChange: pageChange,
|
|
270
|
+
showTotal: function showTotal(total) {
|
|
271
|
+
return "\u603B\u6761\u6570\uFF1A".concat(total, " ");
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}))), /*#__PURE__*/React.createElement(Modal, {
|
|
275
|
+
open: sqlModal,
|
|
276
|
+
wrapClassName: "event-table-sql-modal",
|
|
277
|
+
okText: "\u786E\u5B9A",
|
|
278
|
+
cancelText: "\u53D6\u6D88",
|
|
279
|
+
closeIcon: /*#__PURE__*/React.createElement(IconFont, {
|
|
280
|
+
type: "qingchu"
|
|
281
|
+
}),
|
|
282
|
+
title: "\u67E5\u770BSQL",
|
|
283
|
+
onCancel: function onCancel() {
|
|
284
|
+
return setSqlModal(false);
|
|
285
|
+
},
|
|
286
|
+
onOk: function onOk() {
|
|
287
|
+
return setSqlModal(false);
|
|
288
|
+
},
|
|
289
|
+
maskClosable: false
|
|
290
|
+
}, /*#__PURE__*/React.createElement(Highlight, {
|
|
291
|
+
languageName: "sql",
|
|
292
|
+
style: {
|
|
293
|
+
whiteSpace: 'pre-wrap'
|
|
294
|
+
}
|
|
295
|
+
}, sqlText), /*#__PURE__*/React.createElement(CopyToClipboard, {
|
|
296
|
+
text: sqlText,
|
|
297
|
+
onCopy: function onCopy() {
|
|
298
|
+
return message.success('复制成功!');
|
|
299
|
+
}
|
|
300
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
301
|
+
className: "copy-box"
|
|
302
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
303
|
+
type: "fuzhi1"
|
|
304
|
+
}), "\u590D\u5236\u4EE3\u7801")), /*#__PURE__*/React.createElement("div", {
|
|
305
|
+
style: {
|
|
306
|
+
margin: '10px 0px 0px'
|
|
307
|
+
},
|
|
308
|
+
className: "sql-tip"
|
|
309
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
310
|
+
type: "warning"
|
|
311
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
312
|
+
title: "\u771F\u5B9E\u4E1A\u52A1\u573A\u666F\u4E0B\u7684\u67E5\u8BE2\u903B\u8F91\uFF0C\u6D89\u53CA\u590D\u6742\u4E1A\u52A1\u89C4\u5219\u4E0E\u7A0B\u5E8F\u5904\u7406\u903B\u8F91\u4EA4\u7EC7\u3002\u6B64\u5904\u5C55\u793A\u7684 SQL \u4EC5\u4F5C\u4E3A\u7B80\u5355\u4E8B\u4EF6\u67E5\u8BE2\u7684\u903B\u8F91\u53C2\u8003\u793A\u4F8B \uFF0C\u4E0D\u4EE3\u8868\u4E0E\u5F53\u524D\u754C\u9762\u6240\u9009\u67E5\u8BE2\u6761\u4EF6\u5B8C\u5168\u6620\u5C04"
|
|
313
|
+
}, /*#__PURE__*/React.createElement(ExclamationCircleOutlined, {
|
|
314
|
+
style: {
|
|
315
|
+
margin: '0px 8px 0px 0px'
|
|
316
|
+
}
|
|
317
|
+
})), "SQL \u4EC5\u4F5C\u4E3A\u7B80\u5355\u4E8B\u4EF6\u67E5\u8BE2\u7684\u903B\u8F91\u53C2\u8003\u793A\u4F8B"))));
|
|
318
|
+
};
|
|
319
|
+
export default EventTable;
|