@zgfe/modules-event 1.0.29-zhongyuanE.0 → 1.0.29-zhongyuanE.17

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.
Files changed (92) hide show
  1. package/es/components/renderContent/styles/index.less +0 -19
  2. package/package.json +3 -3
  3. package/es/components/eventFilter/index.d.ts +0 -5
  4. package/es/components/eventFilter/index.js +0 -312
  5. package/es/components/eventFilter/setCascade.d.ts +0 -3
  6. package/es/components/eventFilter/setCascade.js +0 -286
  7. package/es/components/eventFilter/types.d.ts +0 -21
  8. package/es/components/eventFilter/types.js +0 -1
  9. package/es/components/index.d.ts +0 -4
  10. package/es/components/index.js +0 -4
  11. package/es/components/renderContent/index.d.ts +0 -5
  12. package/es/components/renderContent/index.js +0 -46
  13. package/es/components/renderContent/types.d.ts +0 -8
  14. package/es/components/renderContent/types.js +0 -1
  15. package/es/components/searchPanel/index.d.ts +0 -5
  16. package/es/components/searchPanel/index.js +0 -131
  17. package/es/components/searchPanel/styles/index.less +0 -22
  18. package/es/components/searchPanel/types.d.ts +0 -28
  19. package/es/components/searchPanel/types.js +0 -1
  20. package/es/components/table/index.d.ts +0 -6
  21. package/es/components/table/index.js +0 -319
  22. package/es/components/table/styles/index.css +0 -236
  23. package/es/components/table/styles/index.less +0 -249
  24. package/es/components/table/types.d.ts +0 -10
  25. package/es/components/table/types.js +0 -1
  26. package/es/components/topBar/index.d.ts +0 -10
  27. package/es/components/topBar/index.js +0 -174
  28. package/es/components/topBar/styles/index.less +0 -58
  29. package/es/components/topBar/types.d.ts +0 -8
  30. package/es/components/topBar/types.js +0 -1
  31. package/es/constants/apis.d.ts +0 -10
  32. package/es/constants/apis.js +0 -10
  33. package/es/constants/chart.d.ts +0 -2
  34. package/es/constants/chart.js +0 -31
  35. package/es/constants/color.d.ts +0 -1
  36. package/es/constants/color.js +0 -1
  37. package/es/constants/fields.d.ts +0 -251
  38. package/es/constants/fields.js +0 -177
  39. package/es/constants/index.d.ts +0 -6
  40. package/es/constants/index.js +0 -6
  41. package/es/constants/initData.d.ts +0 -2
  42. package/es/constants/initData.js +0 -9
  43. package/es/index.d.ts +0 -6
  44. package/es/index.js +0 -5
  45. package/es/modules/chart/demo/data.d.ts +0 -73
  46. package/es/modules/chart/demo/data.js +0 -484
  47. package/es/modules/chart/demo/index.d.ts +0 -3
  48. package/es/modules/chart/demo/index.js +0 -51
  49. package/es/modules/chart/demo/panel.d.ts +0 -3
  50. package/es/modules/chart/demo/panel.js +0 -16
  51. package/es/modules/chart/index.d.ts +0 -4
  52. package/es/modules/chart/index.js +0 -253
  53. package/es/modules/chart/types.d.ts +0 -19
  54. package/es/modules/chart/types.js +0 -1
  55. package/es/modules/content/index.d.ts +0 -5
  56. package/es/modules/content/index.js +0 -300
  57. package/es/modules/content/styles/index.less +0 -19
  58. package/es/modules/content/types.d.ts +0 -11
  59. package/es/modules/content/types.js +0 -1
  60. package/es/modules/content/utils.d.ts +0 -17
  61. package/es/modules/content/utils.js +0 -107
  62. package/es/modules/home/demo/create.d.ts +0 -3
  63. package/es/modules/home/demo/create.js +0 -58
  64. package/es/modules/home/demo/edit.d.ts +0 -3
  65. package/es/modules/home/demo/edit.js +0 -73
  66. package/es/modules/home/demo/index.d.ts +0 -4
  67. package/es/modules/home/demo/index.js +0 -55
  68. package/es/modules/home/demo/scene.d.ts +0 -3
  69. package/es/modules/home/demo/scene.js +0 -89
  70. package/es/modules/home/demo/styles/index.less +0 -33
  71. package/es/modules/home/index.d.ts +0 -5
  72. package/es/modules/home/index.js +0 -184
  73. package/es/modules/home/styles/index.less +0 -49
  74. package/es/modules/home/types.d.ts +0 -34
  75. package/es/modules/home/types.js +0 -1
  76. package/es/modules/topPanel/index.d.ts +0 -5
  77. package/es/modules/topPanel/index.js +0 -246
  78. package/es/modules/topPanel/styles/index.less +0 -50
  79. package/es/modules/topPanel/types.d.ts +0 -46
  80. package/es/modules/topPanel/types.js +0 -1
  81. package/es/style/theme.d.ts +0 -15
  82. package/es/style/theme.js +0 -14
  83. package/es/types.d.ts +0 -86
  84. package/es/types.js +0 -6
  85. package/es/utils/ajaxConfig.d.ts +0 -8
  86. package/es/utils/ajaxConfig.js +0 -40
  87. package/es/utils/base64.d.ts +0 -23
  88. package/es/utils/base64.js +0 -125
  89. package/es/utils/formData.d.ts +0 -20
  90. package/es/utils/formData.js +0 -406
  91. package/es/utils/util.d.ts +0 -32
  92. package/es/utils/util.js +0 -139
@@ -1,253 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- 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; }
3
- 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; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _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(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); }
10
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
12
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import React, { useContext, useEffect, useMemo, useState } from 'react';
14
- import { Tooltip, Empty } from 'antd';
15
- import { BizChart, BizGlobalDataContext, ajax, BizLoading, BizEmpty } from '@zgfe/business-lib';
16
- import { EventTable } from '../../components';
17
- import { judgeIsCity } from '../content/utils';
18
- import { getValue, getMapChartData } from '../../modules/content/utils';
19
- import { getShowColor, getUserGroupsCompareData, getSortData, getChartDataEventAliasName, formTableData, sortOriginalData } from '../../utils/formData';
20
- import _ from 'lodash';
21
- import moment from 'moment';
22
- import { Apis, chartColors } from '../../constants';
23
- var classPrefix = 'event-mi-table';
24
- var EventChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
25
- var params = props.params;
26
- var _useState = useState(props === null || props === void 0 ? void 0 : props.completedSearchData),
27
- _useState2 = _slicedToArray(_useState, 2),
28
- completedSearchData = _useState2[0],
29
- setCompletedSearchData = _useState2[1];
30
- var _useState3 = useState(false),
31
- _useState4 = _slicedToArray(_useState3, 2),
32
- isCity = _useState4[0],
33
- setIsCity = _useState4[1];
34
- var _useState5 = useState(props.type || 'line'),
35
- _useState6 = _slicedToArray(_useState5, 2),
36
- chartType = _useState6[0],
37
- setChartType = _useState6[1];
38
- var _useState7 = useState(props.showList || []),
39
- _useState8 = _slicedToArray(_useState7, 2),
40
- showList = _useState8[0],
41
- setShowList = _useState8[1];
42
- var _useState9 = useState(props.dataSource),
43
- _useState10 = _slicedToArray(_useState9, 2),
44
- dataSource = _useState10[0],
45
- setDataSource = _useState10[1];
46
- var _useContext = useContext(BizGlobalDataContext),
47
- eventGroupList = _useContext.eventGroupList,
48
- eventEnvList = _useContext.eventEnvList,
49
- userPropList = _useContext.userPropList,
50
- currentApp = _useContext.currentApp;
51
- var _useState11 = useState(false),
52
- _useState12 = _slicedToArray(_useState11, 2),
53
- loading = _useState12[0],
54
- setLoading = _useState12[1];
55
- var showColors = useMemo(function () {
56
- if (!dataSource) return chartColors;
57
- return getShowColor(dataSource, showList);
58
- }, [showList]);
59
- useEffect(function () {
60
- if (!props.dataSource) {
61
- fetchResult();
62
- }
63
- }, [params]);
64
- useEffect(function () {
65
- if (!dataSource || !dataSource.series.length) return;
66
- if (!props.showList || !props.showList.length) {
67
- var _dataSource$series$;
68
- var gLen = (params === null || params === void 0 ? void 0 : params.dimension) ? 1 : 0;
69
- var _data = formTableData(dataSource, (params === null || params === void 0 ? void 0 : params.userGroup) || [0], gLen);
70
- var _sortData = sortOriginalData(_data, {
71
- columnKey: "field".concat(((_dataSource$series$ = dataSource.series[0]) === null || _dataSource$series$ === void 0 ? void 0 : _dataSource$series$.values.length) - 1),
72
- order: 'descend'
73
- });
74
- var _showlist = [];
75
- _sortData.forEach(function (item, index) {
76
- if (index < 10) {
77
- _showlist.push(item.nameGroup);
78
- }
79
- });
80
- setShowList(_showlist);
81
- props.onChangeShow && props.onChangeShow(_showlist);
82
- } else {
83
- setShowList(props.showList);
84
- }
85
- }, [dataSource, props.showList]);
86
- useEffect(function () {
87
- var _completedSearchData$;
88
- if (!completedSearchData) return;
89
- var chartData = ((_completedSearchData$ = completedSearchData.chartType) === null || _completedSearchData$ === void 0 ? void 0 : _completedSearchData$.split(',')) || ['line'];
90
- var type = chartData[0];
91
- if (!props.dataSource) {
92
- type = (chartData === null || chartData === void 0 ? void 0 : chartData.length) > 1 ? chartData[chartData.length - 1] : chartData[0];
93
- }
94
- setChartType(props.type || type);
95
- if (completedSearchData.id) {
96
- var dimensions = completedSearchData.dimension;
97
- if (type === 'map' && dimensions) {
98
- var _getValue;
99
- setIsCity(judgeIsCity((_getValue = getValue(dimensions, eventGroupList, eventEnvList, userPropList)) === null || _getValue === void 0 ? void 0 : _getValue.name));
100
- }
101
- }
102
- }, [completedSearchData, props.type]);
103
- var fetchResult = function fetchResult() {
104
- var _params$chartType;
105
- setLoading(true);
106
- ajax(Apis.dataList, {
107
- method: 'post',
108
- data: _objectSpread(_objectSpread({
109
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
110
- platform: (params === null || params === void 0 ? void 0 : params.platform) || 0
111
- }, params), {}, {
112
- chartType: (params === null || params === void 0 ? void 0 : (_params$chartType = params.chartType) === null || _params$chartType === void 0 ? void 0 : _params$chartType.indexOf(',')) === -1 ? params === null || params === void 0 ? void 0 : params.chartType : 'grid'
113
- })
114
- }).then(function (res) {
115
- var _params$userGroup;
116
- setCompletedSearchData(params);
117
- if (!res) {
118
- setLoading(false);
119
- return;
120
- }
121
- var _data = params.dimension ? res.data : getChartDataEventAliasName(res.data, eventGroupList);
122
- if (['bar', 'pie', 'map'].indexOf(params.chartType) !== -1) {
123
- _data = getSortData(_data);
124
- }
125
- if ((params === null || params === void 0 ? void 0 : params.userGroup) && (params === null || params === void 0 ? void 0 : (_params$userGroup = params.userGroup) === null || _params$userGroup === void 0 ? void 0 : _params$userGroup.length) > 1) {
126
- setDataSource(getUserGroupsCompareData(_data));
127
- } else {
128
- setDataSource(_data);
129
- }
130
- setLoading(false);
131
- });
132
- };
133
- var onChangeShowByName = function onChangeShowByName(nameGroup) {
134
- var list = _.cloneDeep(showList);
135
- var index = list === null || list === void 0 ? void 0 : list.indexOf(nameGroup);
136
- if (index < 0) {
137
- list.push(nameGroup);
138
- } else {
139
- list.splice(index, 1);
140
- }
141
- setShowList(list);
142
- if (props.onChangeShow) props.onChangeShow(list);
143
- };
144
- if (loading) {
145
- return /*#__PURE__*/React.createElement(BizLoading, {
146
- className: "".concat(classPrefix, "-loading")
147
- });
148
- }
149
- if (dataSource && dataSource.delEvent) {
150
- if (!props.isHideDel) {
151
- return /*#__PURE__*/React.createElement("div", {
152
- style: {
153
- display: 'flex',
154
- minHeight: 345,
155
- justifyContent: 'center',
156
- alignItems: 'center'
157
- }
158
- }, /*#__PURE__*/React.createElement(BizEmpty, {
159
- imageStyle: {
160
- height: 58
161
- },
162
- description: /*#__PURE__*/React.createElement("span", {
163
- style: {
164
- color: '#9AA1A9'
165
- }
166
- }, "\u4E8B\u4EF6\u5DF2\u88AB\u5220\u9664\u65E0\u6CD5\u67E5\u770B\uFF0C\u8BF7\u91CD\u65B0\u8BBE\u7F6E")
167
- }));
168
- } else {
169
- return null;
170
- }
171
- }
172
- if (!dataSource || !dataSource.xAxis.length || !dataSource.series.length) {
173
- return /*#__PURE__*/React.createElement(Empty, {
174
- image: Empty.PRESENTED_IMAGE_SIMPLE,
175
- description: "\u6682\u65E0\u6570\u636E"
176
- });
177
- }
178
- var dataUpdateTime = function dataUpdateTime() {
179
- return /*#__PURE__*/React.createElement(Tooltip, {
180
- className: "".concat(classPrefix, "-chart-box-tooltip"),
181
- title: '当前图表数据实时更新,约每分钟更新一次'
182
- }, /*#__PURE__*/React.createElement("div", null, "\u6570\u636E\u66F4\u65B0\u65F6\u95F4\uFF1A", moment().format('YYYY-MM-DD HH:mm')));
183
- };
184
- var tooltipFormatter = function tooltipFormatter(data) {
185
- var xLabel = '';
186
- var params = data[0] ? data : [data];
187
- var array = params[0].name.split('|');
188
- if (array.length > 1) {
189
- xLabel = moment(array[0]).format('MM-DD') + '~' + moment(array[1]).format('MM-DD');
190
- } else {
191
- var _props$params, _props$params$time, _props$params2, _props$params2$time;
192
- if ((props === null || props === void 0 ? void 0 : (_props$params = props.params) === null || _props$params === void 0 ? void 0 : (_props$params$time = _props$params.time) === null || _props$params$time === void 0 ? void 0 : _props$params$time.unit) == 'hour') {
193
- xLabel = moment(array[0]).isValid() ? moment(array[0]).format('MM-DD HH') : array[0];
194
- } else if ((props === null || props === void 0 ? void 0 : (_props$params2 = props.params) === null || _props$params2 === void 0 ? void 0 : (_props$params2$time = _props$params2.time) === null || _props$params2$time === void 0 ? void 0 : _props$params2$time.unit) == 'minute') {
195
- xLabel = moment(array[0]).isValid() ? moment(array[0]).format('MM-DD HH:mm') : array[0];
196
- } else xLabel = moment(array[0]).isValid() ? moment(array[0]).format('MM-DD') : array[0];
197
- }
198
- var series = [];
199
- var seriesMap = {};
200
- params.forEach(function (item) {
201
- if (item.value === null || item.value === undefined || seriesMap[item.seriesName] !== null && seriesMap[item.seriesName] !== undefined) return;
202
- seriesMap[item.seriesName] = item.value;
203
- var value = item.value;
204
- var seriesName = item.seriesName || item.axisValueLabel;
205
- seriesName = [seriesName].join('<br/>');
206
- series.push({
207
- text: "<div class='biz-chart-tooltip-item'>\n <div class='biz-chart-tooltip-content'>\n <span class=\"biz-tooltip-marker\" style=\"background:".concat(item.color, "\"></span>\n <div class=\"biz-tooltip-name\">").concat(seriesName, "</div>\n </div> \n <div class='biz-chart-tooltip-value'>\n ").concat(value, "\n </div>\n </div>"),
208
- value: value
209
- });
210
- });
211
- return "<div class='biz-chart-tooltip-title'>".concat(xLabel, "</div>").concat(series.sort(function (a, b) {
212
- return parseInt(b.value) - parseInt(a.value);
213
- }).map(function (item) {
214
- return item.text;
215
- }).join(''));
216
- };
217
- switch (chartType) {
218
- case 'line':
219
- case 'bar':
220
- case 'pie':
221
- case 'map':
222
- return /*#__PURE__*/React.createElement("div", {
223
- className: "".concat(classPrefix, "-chart-box")
224
- }, !!props.dataSource && dataUpdateTime(), /*#__PURE__*/React.createElement(BizChart, {
225
- ref: ref,
226
- key: chartType,
227
- type: chartType,
228
- data: chartType === 'map' ? getMapChartData(dataSource) : dataSource,
229
- legendPosition: "bottom",
230
- showList: showList,
231
- colors: showColors,
232
- xRotate: chartType === 'bar' && dataSource.series.length > 5 ? 40 : 0,
233
- reverseXAxis: chartType === 'bar',
234
- isCity: isCity,
235
- tooltipFormatter: tooltipFormatter
236
- }));
237
- case 'grid':
238
- return /*#__PURE__*/React.createElement(EventTable, {
239
- dataSource: dataSource,
240
- sourcePanel: !props.dataSource,
241
- searchData: params,
242
- showList: showList,
243
- changeShowByName: onChangeShowByName,
244
- onSelectEvent: props === null || props === void 0 ? void 0 : props.onSelectEvent
245
- });
246
- default:
247
- return /*#__PURE__*/React.createElement("div", null, "\u6682\u4E0D\u652F\u6301\u8BE5\u56FE\u8868\u7C7B\u578B");
248
- }
249
- });
250
- EventChart.defaultProps = {
251
- showList: []
252
- };
253
- export default EventChart;
@@ -1,19 +0,0 @@
1
- import { ChartTypes } from '@zgfe/business-lib/es/chart/types';
2
- import { SearchValue } from '../../types';
3
- export declare namespace eventChartProps {
4
- interface ChartTypesProps extends ChartTypes.Value {
5
- xAxis: [];
6
- delEvent?: number;
7
- }
8
- interface Props {
9
- dataSource?: ChartTypesProps;
10
- params?: SearchValue;
11
- completedSearchData?: SearchValue;
12
- type?: string;
13
- showList?: string[];
14
- showColors?: string[];
15
- onChangeShow?: (data: string[]) => void;
16
- onSelectEvent?: (id: number, name: string) => void;
17
- isHideDel?: boolean;
18
- }
19
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { EventContentProps } from './types';
3
- import './styles/index.less';
4
- declare const EventContent: React.ForwardRefExoticComponent<EventContentProps.Props & React.RefAttributes<any>>;
5
- export default EventContent;
@@ -1,300 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- 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; }
3
- 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; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _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(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); }
10
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
12
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import { ajax, BizGlobalDataContext, BizLayout, BizTargetFromPanelContext } from '@zgfe/business-lib';
14
- import { message } from 'antd';
15
- import React, { useContext, useEffect, useRef, useState, useImperativeHandle } from 'react';
16
- import Request from 'umi-request';
17
- import TopBar from '../../components/topBar';
18
- import { EventContext } from '../../types';
19
- import './styles/index.less';
20
- import { Apis } from '../../constants';
21
- import { ContentPanel, SearchPanel } from '../../components';
22
- import { getUserGroupsCompareData, getSortData, getChartDataEventAliasName, sortOriginalData, formTableData } from '../../utils/formData';
23
- import TopPanel from '../topPanel';
24
- var timer = 0;
25
- var ajaxFlag = true;
26
- var refresh = false;
27
- var CancelToken = Request.CancelToken;
28
- var cancel;
29
- var classPrefix = 'event-content';
30
- var EventContent = /*#__PURE__*/React.forwardRef(function (props, ref) {
31
- var _props$value, _props$value2, _topPanelRef$current4;
32
- var _useContext = useContext(BizGlobalDataContext),
33
- authority = _useContext.authority;
34
- var _useContext2 = useContext(EventContext),
35
- currentApp = _useContext2.currentApp,
36
- searchData = _useContext2.searchData,
37
- setSearchData = _useContext2.setSearchData,
38
- eventGroupList = _useContext2.eventGroupList,
39
- loading = _useContext2.loading,
40
- setLoading = _useContext2.setLoading,
41
- afterEditTarget = _useContext2.afterEditTarget,
42
- onChangeUrlParam = _useContext2.onChangeUrlParam,
43
- panelId = _useContext2.panelId,
44
- setShowListHome = _useContext2.setShowListHome,
45
- setRefreshLoading = _useContext2.setRefreshLoading,
46
- setCompletedSearchData = _useContext2.setCompletedSearchData;
47
- var _useState = useState(),
48
- _useState2 = _slicedToArray(_useState, 2),
49
- eventData = _useState2[0],
50
- setEventData = _useState2[1];
51
- var _useState3 = useState(false),
52
- _useState4 = _slicedToArray(_useState3, 2),
53
- enableSelectChart = _useState4[0],
54
- setEnableSelectChart = _useState4[1];
55
- var _useState5 = useState(false),
56
- _useState6 = _slicedToArray(_useState5, 2),
57
- isCity = _useState6[0],
58
- setIsCity = _useState6[1];
59
- var _useState7 = useState(props.value.id),
60
- _useState8 = _slicedToArray(_useState7, 2),
61
- eventId = _useState8[0],
62
- setEventId = _useState8[1];
63
- var _useState9 = useState(true),
64
- _useState10 = _slicedToArray(_useState9, 2),
65
- first = _useState10[0],
66
- setFirst = _useState10[1];
67
- var _useContext3 = useContext(BizTargetFromPanelContext),
68
- handleSearch = _useContext3.handleSearch;
69
- var topPanelRef = useRef();
70
- useImperativeHandle(ref, function () {
71
- return {
72
- onFormSetFieldsValue: function onFormSetFieldsValue(data) {
73
- var _topPanelRef$current;
74
- topPanelRef === null || topPanelRef === void 0 ? void 0 : (_topPanelRef$current = topPanelRef.current) === null || _topPanelRef$current === void 0 ? void 0 : _topPanelRef$current.onFormSetFieldsValue(data);
75
- }
76
- };
77
- });
78
- var chartRef = useRef();
79
- var _useState11 = useState('user'),
80
- _useState12 = _slicedToArray(_useState11, 2),
81
- analysisSubjectType = _useState12[0],
82
- setAnalysisSubjectType = _useState12[1];
83
- var _useState13 = useState(false),
84
- _useState14 = _slicedToArray(_useState13, 2),
85
- subDisplay = _useState14[0],
86
- setSubDisplay = _useState14[1];
87
- var _useState15 = useState({
88
- analysisIndex: ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.analysisIndex) || 'number',
89
- analysisAttr: (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.analysisAttr
90
- }),
91
- _useState16 = _slicedToArray(_useState15, 2),
92
- dimension = _useState16[0],
93
- setDimension = _useState16[1];
94
- useEffect(function () {
95
- if (timer) clearTimeout(timer);
96
- var flag = true;
97
- timer = setTimeout(function () {
98
- if (flag) {
99
- fetchRequest();
100
- }
101
- }, 500);
102
- return function () {
103
- if (timer) clearTimeout(timer);
104
- flag = false;
105
- };
106
- }, [searchData]);
107
- useEffect(function () {
108
- handleSearch && handleSearch(loading);
109
- }, [loading]);
110
- useEffect(function () {
111
- querySubDisplay();
112
- }, []);
113
- function querySubDisplay() {
114
- ajax(Apis.querySubDisplayApi, {
115
- method: 'post',
116
- data: {
117
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
118
- }
119
- }).then(function (res) {
120
- if (!res) return;
121
- setSubDisplay(res.data);
122
- });
123
- }
124
- var fetchRequest = function fetchRequest(flag) {
125
- if (!authority[100047]) {
126
- message.error('无查询权限');
127
- return;
128
- }
129
- if (flag !== undefined) ajaxFlag = flag;
130
- if (analysisSubjectType === 'eventProp' && !searchData.analysisSubject) return;
131
- if (!ajaxFlag) return;
132
- if (!refresh) setLoading(true);
133
- setEventData(undefined);
134
- if (typeof cancel === 'function') {
135
- cancel();
136
- }
137
- ajax(Apis.dataList, {
138
- method: 'post',
139
- data: _objectSpread(_objectSpread({
140
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
141
- platform: (searchData === null || searchData === void 0 ? void 0 : searchData.platform) || 0
142
- }, searchData), {}, {
143
- refresh: refresh
144
- }),
145
- cancelToken: new CancelToken(function executor(c) {
146
- cancel = c;
147
- })
148
- }).then(function (res) {
149
- var _searchData$userGroup;
150
- setCompletedSearchData && setCompletedSearchData(searchData);
151
- setRefreshLoading(false);
152
- if (!res) {
153
- setLoading(false);
154
- return;
155
- }
156
- var result = res.data;
157
- if (!(result === null || result === void 0 ? void 0 : result.series.length)) {
158
- setLoading(false);
159
- return;
160
- }
161
- var _data = searchData.dimension ? result : getChartDataEventAliasName(result, eventGroupList);
162
- var gLen = (searchData === null || searchData === void 0 ? void 0 : searchData.dimension) ? 1 : 0;
163
- var dataTemp = formTableData(_data, (searchData === null || searchData === void 0 ? void 0 : searchData.userGroup) || [0], gLen);
164
- var _sortData = [];
165
- if (['bar', 'pie', 'map'].indexOf(searchData.chartType) !== -1) {
166
- _data = getSortData(_data);
167
- } else {
168
- var _data2, _data2$series$;
169
- _sortData = sortOriginalData(dataTemp, {
170
- columnKey: "field".concat(((_data2 = _data) === null || _data2 === void 0 ? void 0 : (_data2$series$ = _data2.series[0]) === null || _data2$series$ === void 0 ? void 0 : _data2$series$.values.length) - 1),
171
- order: 'descend'
172
- });
173
- }
174
- if (searchData && (searchData === null || searchData === void 0 ? void 0 : searchData.userGroup) && (searchData === null || searchData === void 0 ? void 0 : (_searchData$userGroup = searchData.userGroup) === null || _searchData$userGroup === void 0 ? void 0 : _searchData$userGroup.length) > 1) {
175
- _data = getUserGroupsCompareData(_data);
176
- }
177
- if (first) {
178
- setFirst(false);
179
- } else {
180
- var _showlist = [];
181
- _sortData.forEach(function (item, index) {
182
- if (index < 10) {
183
- _showlist.push(item.nameGroup);
184
- }
185
- });
186
- setShowListHome(_showlist);
187
- }
188
- setEventData(_data);
189
- onChangeUrlParam(searchData);
190
- setLoading(false);
191
- });
192
- };
193
- var refreshHandle = function refreshHandle() {
194
- refresh = true;
195
- setRefreshLoading(true);
196
- if (timer) clearTimeout(timer);
197
- timer = setTimeout(function () {
198
- fetchRequest();
199
- refresh = false;
200
- clearTimeout(timer);
201
- }, 500);
202
- };
203
- var onChangeContent = function onChangeContent(data) {
204
- var _topPanelRef$current2;
205
- ajaxFlag = true;
206
- (_topPanelRef$current2 = topPanelRef.current) === null || _topPanelRef$current2 === void 0 ? void 0 : _topPanelRef$current2.submit();
207
- setSearchData(function (value) {
208
- return _objectSpread(_objectSpread(_objectSpread({}, value), data), {}, {
209
- analysisAttr: data.analysisAttr,
210
- analysisIndex: data.analysisIndex
211
- });
212
- });
213
- };
214
- var platformChange = function platformChange(data) {
215
- var _topPanelRef$current3;
216
- ajaxFlag = true;
217
- (_topPanelRef$current3 = topPanelRef.current) === null || _topPanelRef$current3 === void 0 ? void 0 : _topPanelRef$current3.submit();
218
- setSearchData(function (_searchData) {
219
- return _objectSpread(_objectSpread({}, _searchData), {}, {
220
- platform: data
221
- });
222
- });
223
- };
224
- var onChangeSearch = function onChangeSearch(data, flag) {
225
- ajaxFlag = flag;
226
- data.id ? setEventId(data.id) : setEventId(-1);
227
- setSearchData(_objectSpread(_objectSpread(_objectSpread({}, searchData), {}, {
228
- dimension: data.dimension,
229
- filters: data.filters,
230
- id: data.id,
231
- eventIds: data.eventIds,
232
- name: data.name
233
- }, data), {}, {
234
- userGroup: data.analysisSubject ? [] : data.userGroup,
235
- analysisSubject: data.analysisSubject ? data.analysisSubject : undefined,
236
- analysisAttr: dimension.analysisAttr,
237
- analysisIndex: dimension.analysisIndex
238
- }));
239
- };
240
- var onChangeSubjectType = function onChangeSubjectType(type) {
241
- setAnalysisSubjectType(type);
242
- };
243
- var onClickGenerateReport = function onClickGenerateReport() {
244
- if (!chartRef.current) {
245
- message.warning('未选择事件或查询失败!');
246
- return;
247
- }
248
- var url = chartRef.current.instance.getDataURL();
249
- var params = {
250
- image: url,
251
- context: {
252
- api: '/web/sdk/v2/event/eventAnalytics',
253
- queryParam: searchData
254
- }
255
- };
256
- if (afterEditTarget) afterEditTarget('report', params);
257
- };
258
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BizLayout, {
259
- showTitle: !panelId,
260
- hasCollapse: true,
261
- collapseRef: topPanelRef === null || topPanelRef === void 0 ? void 0 : (_topPanelRef$current4 = topPanelRef.current) === null || _topPanelRef$current4 === void 0 ? void 0 : _topPanelRef$current4.getCollapseRef(),
262
- topPanel: /*#__PURE__*/React.createElement(TopPanel, {
263
- ref: topPanelRef,
264
- onChange: onChangeSearch,
265
- loading: loading,
266
- value: searchData,
267
- subDisplay: subDisplay,
268
- setIsCity: setIsCity,
269
- setEnableSelectChart: setEnableSelectChart,
270
- onChangeSubjectType: onChangeSubjectType
271
- }),
272
- toolbar: /*#__PURE__*/React.createElement(TopBar, {
273
- eventData: eventData,
274
- searchData: searchData,
275
- platformChange: platformChange,
276
- enableSelectChart: enableSelectChart,
277
- onClickGenerateReport: onClickGenerateReport
278
- })
279
- }, /*#__PURE__*/React.createElement("div", {
280
- className: classPrefix
281
- }, /*#__PURE__*/React.createElement(SearchPanel, {
282
- chartType: searchData === null || searchData === void 0 ? void 0 : searchData.chartType,
283
- time: searchData === null || searchData === void 0 ? void 0 : searchData.time,
284
- setIsCity: setIsCity,
285
- setEnableSelectChart: setEnableSelectChart,
286
- eventId: eventId,
287
- enableSelectChart: enableSelectChart,
288
- onChange: onChangeContent,
289
- dimension: dimension,
290
- setDimension: setDimension,
291
- analysisSubjectType: analysisSubjectType,
292
- refreshHandle: refreshHandle
293
- }), /*#__PURE__*/React.createElement(ContentPanel, {
294
- ref: chartRef,
295
- isCity: isCity,
296
- eventData: eventData,
297
- searchData: searchData
298
- }))));
299
- });
300
- export default EventContent;
@@ -1,19 +0,0 @@
1
- .event-content-topBar {
2
- display: flex;
3
- align-items: center;
4
- justify-content: space-between;
5
- > span {
6
- color: #021429;
7
- font-size: 16px;
8
- }
9
- .modules-event-topbar {
10
- padding-right: 0;
11
- }
12
- }
13
- .event-content {
14
- &-options {
15
- display: flex;
16
- justify-content: flex-end;
17
- margin-bottom: 16px;
18
- }
19
- }
@@ -1,11 +0,0 @@
1
- import { SearchValue } from '../../types';
2
- export declare namespace EventContentProps {
3
- interface Props {
4
- elementId: number | undefined;
5
- value: SearchValue;
6
- show?: string[];
7
- onSearching?: (flag: boolean) => void;
8
- initSearch?: () => void;
9
- onChangeShow?: (data: string[]) => void;
10
- }
11
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,17 +0,0 @@
1
- import { AttributeSelect, AttrConditionTypes } from '@zgfe/business-lib';
2
- import { bizAttributeSelectorValueProp } from '../../types';
3
- import { EventGroup, UserProp, EnvProp } from '@zgfe/business-lib/es/attributeSelector/types';
4
- export declare const getMapChartData: (data: any) => any;
5
- export declare const judgeFilterValue: (data: AttrConditionTypes.GroupValue | undefined, count: number) => boolean;
6
- export declare const judgeIsCity: (name: string | undefined) => boolean;
7
- export declare const judgeIsArea: (name: string | undefined) => boolean;
8
- export declare const getValue: (param: bizAttributeSelectorValueProp, eventGroupList: EventGroup[] | undefined, eventEnvList: EnvProp[] | undefined, userPropList: UserProp[] | undefined) => AttributeSelect.Value | undefined;
9
- export declare const getNumberPanelData: (data: any) => Promise<unknown>;
10
- export declare const normalOptions: (type: any) => {
11
- label: string;
12
- value: string;
13
- }[];
14
- export declare const normalEventOptions: {
15
- label: string;
16
- value: string;
17
- }[];