@zgfe/modules-whole 1.0.10-zhongyuan.0
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/README.md +37 -0
- package/es/components/dataUpdateTime/index.d.ts +3 -0
- package/es/components/dataUpdateTime/index.js +53 -0
- package/es/components/eventFilter/index.d.ts +5 -0
- package/es/components/eventFilter/index.js +263 -0
- package/es/components/eventFilter/styles/index.less +36 -0
- package/es/components/eventFilter/types.d.ts +20 -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 +44 -0
- package/es/components/renderContent/styles/index.less +20 -0
- package/es/components/renderContent/types.d.ts +9 -0
- package/es/components/renderContent/types.js +1 -0
- package/es/components/searchPanel/index.d.ts +5 -0
- package/es/components/searchPanel/index.js +164 -0
- package/es/components/searchPanel/styles/index.less +22 -0
- package/es/components/searchPanel/types.d.ts +23 -0
- package/es/components/searchPanel/types.js +1 -0
- package/es/components/table/index.d.ts +5 -0
- package/es/components/table/index.js +130 -0
- package/es/components/table/styles/index.less +193 -0
- package/es/components/table/types.d.ts +9 -0
- package/es/components/table/types.js +1 -0
- package/es/components/topBar/index.d.ts +5 -0
- package/es/components/topBar/index.js +163 -0
- package/es/components/topBar/styles/index.less +71 -0
- package/es/components/topBar/types.d.ts +8 -0
- package/es/components/topBar/types.js +1 -0
- package/es/constants/apis.d.ts +8 -0
- package/es/constants/apis.js +8 -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 +271 -0
- package/es/constants/fields.js +260 -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/constants/json/line.d.ts +20 -0
- package/es/constants/json/line.js +25 -0
- package/es/index.d.ts +5 -0
- package/es/index.js +4 -0
- package/es/modules/chart/demo/data.d.ts +78 -0
- package/es/modules/chart/demo/data.js +489 -0
- package/es/modules/chart/demo/index.d.ts +3 -0
- package/es/modules/chart/demo/index.js +12 -0
- package/es/modules/chart/demo/panel.d.ts +3 -0
- package/es/modules/chart/demo/panel.js +11 -0
- package/es/modules/chart/index.d.ts +4 -0
- package/es/modules/chart/index.js +246 -0
- package/es/modules/chart/types.d.ts +15 -0
- package/es/modules/chart/types.js +1 -0
- package/es/modules/content/index.d.ts +5 -0
- package/es/modules/content/index.js +234 -0
- package/es/modules/content/styles/index.less +7 -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 +17 -0
- package/es/modules/content/utils.js +107 -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 +86 -0
- package/es/modules/home/demo/index.d.ts +4 -0
- package/es/modules/home/demo/index.js +83 -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 +218 -0
- package/es/modules/home/styles/index.less +39 -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 +154 -0
- package/es/modules/topPanel/styles/index.less +41 -0
- package/es/modules/topPanel/types.d.ts +39 -0
- package/es/modules/topPanel/types.js +1 -0
- package/es/style/image/ring.svg +9 -0
- package/es/style/index.less +62 -0
- package/es/style/theme.d.ts +15 -0
- package/es/style/theme.js +14 -0
- package/es/types.d.ts +79 -0
- package/es/types.js +6 -0
- package/es/utils/ajaxConfig.d.ts +8 -0
- package/es/utils/ajaxConfig.js +12 -0
- package/es/utils/base64.d.ts +23 -0
- package/es/utils/base64.js +125 -0
- package/es/utils/formData.d.ts +21 -0
- package/es/utils/formData.js +366 -0
- package/es/utils/util.d.ts +36 -0
- package/es/utils/util.js +167 -0
- package/package.json +63 -0
|
@@ -0,0 +1,246 @@
|
|
|
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 { Empty, message } from 'antd';
|
|
15
|
+
import { BizChart, BizGlobalDataContext, ajax, BizLoading } from '@zgfe/business-lib';
|
|
16
|
+
import { WholeTable } from '../../components';
|
|
17
|
+
import { judgeIsCity } from '../content/utils';
|
|
18
|
+
import { getValue, getMapChartData } from '../../modules/content/utils';
|
|
19
|
+
import { getShowColor, getUserGroupsCompareData, getSortData, getChartDataWholeAliasName, convertMilliseconds, sortOriginalData, formTableData } from '../../utils/formData';
|
|
20
|
+
import { WholeContext } from '../../types';
|
|
21
|
+
import _ from 'lodash';
|
|
22
|
+
import moment from 'moment';
|
|
23
|
+
import { Apis, chartColors } from '../../constants';
|
|
24
|
+
import DataUpdateTime from '../../components/dataUpdateTime';
|
|
25
|
+
var classPrefix = 'event-mi-table';
|
|
26
|
+
var WholeChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
27
|
+
var _props$params2;
|
|
28
|
+
var params = props.params;
|
|
29
|
+
var _useState = useState(false),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
isCity = _useState2[0],
|
|
32
|
+
setIsCity = _useState2[1];
|
|
33
|
+
var _useState3 = useState(props.type || 'line'),
|
|
34
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
|
+
chartType = _useState4[0],
|
|
36
|
+
setChartType = _useState4[1];
|
|
37
|
+
var _useState5 = useState(props.showList || []),
|
|
38
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
39
|
+
showList = _useState6[0],
|
|
40
|
+
setShowList = _useState6[1];
|
|
41
|
+
var _useState7 = useState(props.dataSource),
|
|
42
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
43
|
+
dataSource = _useState8[0],
|
|
44
|
+
setDataSource = _useState8[1];
|
|
45
|
+
var _useContext = useContext(WholeContext),
|
|
46
|
+
currentApp = _useContext.currentApp;
|
|
47
|
+
var _useContext2 = useContext(BizGlobalDataContext),
|
|
48
|
+
eventGroupList = _useContext2.eventGroupList,
|
|
49
|
+
eventEnvList = _useContext2.eventEnvList,
|
|
50
|
+
userPropList = _useContext2.userPropList;
|
|
51
|
+
var _useState9 = useState(false),
|
|
52
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
53
|
+
loading = _useState10[0],
|
|
54
|
+
setLoading = _useState10[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) return;
|
|
66
|
+
if ((!props.showList || !props.showList.length) && dataSource.series.length) {
|
|
67
|
+
var gLen = (params === null || params === void 0 ? void 0 : params.dimension) ? 1 : 0;
|
|
68
|
+
var _data = formTableData(dataSource, (params === null || params === void 0 ? void 0 : params.userGroup) || [0], gLen);
|
|
69
|
+
var _sortData = sortOriginalData(_data, {
|
|
70
|
+
columnKey: "field".concat(dataSource.series[0].values.length - 1),
|
|
71
|
+
order: 'descend'
|
|
72
|
+
});
|
|
73
|
+
var _showlist = [];
|
|
74
|
+
_sortData.forEach(function (item, index) {
|
|
75
|
+
if (index < 10) {
|
|
76
|
+
_showlist.push(item.nameGroup);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
setShowList(_showlist);
|
|
80
|
+
props.onChangeShow && props.onChangeShow(_showlist);
|
|
81
|
+
} else {
|
|
82
|
+
setShowList(props.showList);
|
|
83
|
+
}
|
|
84
|
+
}, [dataSource, props.showList]);
|
|
85
|
+
useEffect(function () {
|
|
86
|
+
var _params$chartType;
|
|
87
|
+
if (!params) return;
|
|
88
|
+
var chartData = ((_params$chartType = params.chartType) === null || _params$chartType === void 0 ? void 0 : _params$chartType.split(',')) || ['line'];
|
|
89
|
+
var type = chartData[0];
|
|
90
|
+
if (!props.dataSource) {
|
|
91
|
+
type = (chartData === null || chartData === void 0 ? void 0 : chartData.length) > 1 ? chartData[chartData.length - 1] : chartData[0];
|
|
92
|
+
}
|
|
93
|
+
setChartType(props.type || type);
|
|
94
|
+
if (params.id) {
|
|
95
|
+
var dimensions = params.dimension;
|
|
96
|
+
if (type === 'map' && dimensions) {
|
|
97
|
+
var _getValue;
|
|
98
|
+
setIsCity(judgeIsCity((_getValue = getValue(dimensions, eventGroupList, eventEnvList, userPropList)) === null || _getValue === void 0 ? void 0 : _getValue.name));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, [params, props.type]);
|
|
102
|
+
var fetchResult = function fetchResult() {
|
|
103
|
+
var _params$chartType2;
|
|
104
|
+
setLoading(true);
|
|
105
|
+
ajax(Apis.dataList, {
|
|
106
|
+
method: 'post',
|
|
107
|
+
data: _objectSpread(_objectSpread({
|
|
108
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
109
|
+
platform: (params === null || params === void 0 ? void 0 : params.platform) || 0
|
|
110
|
+
}, params), {}, {
|
|
111
|
+
chartType: (params === null || params === void 0 ? void 0 : (_params$chartType2 = params.chartType) === null || _params$chartType2 === void 0 ? void 0 : _params$chartType2.indexOf(',')) === -1 ? params === null || params === void 0 ? void 0 : params.chartType : 'grid'
|
|
112
|
+
})
|
|
113
|
+
}).then(function (res) {
|
|
114
|
+
if ((res === null || res === void 0 ? void 0 : res.code) != '101000') {
|
|
115
|
+
message.error(res === null || res === void 0 ? void 0 : res.msg);
|
|
116
|
+
setLoading(false);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (!res.data) {
|
|
120
|
+
setLoading(false);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
var _data = params.dimension ? res.data : getChartDataWholeAliasName(res.data, eventGroupList);
|
|
124
|
+
if (['bar', 'pie', 'map'].indexOf(params.chartType) !== -1) {
|
|
125
|
+
_data = getSortData(_data);
|
|
126
|
+
}
|
|
127
|
+
if (params.userGroup.length > 1) {
|
|
128
|
+
setDataSource(getUserGroupsCompareData(_data));
|
|
129
|
+
} else {
|
|
130
|
+
setDataSource(_data);
|
|
131
|
+
}
|
|
132
|
+
setLoading(false);
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
var onChangeShowByName = function onChangeShowByName(nameGroup) {
|
|
136
|
+
var list = _.cloneDeep(showList);
|
|
137
|
+
var index = list === null || list === void 0 ? void 0 : list.indexOf(nameGroup);
|
|
138
|
+
if (index < 0) {
|
|
139
|
+
list.push(nameGroup);
|
|
140
|
+
} else {
|
|
141
|
+
list.splice(index, 1);
|
|
142
|
+
}
|
|
143
|
+
setShowList(list);
|
|
144
|
+
if (props.onChangeShow) props.onChangeShow(list);
|
|
145
|
+
};
|
|
146
|
+
if (loading) {
|
|
147
|
+
return /*#__PURE__*/React.createElement(BizLoading, {
|
|
148
|
+
className: "".concat(classPrefix, "-loading")
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
if (!dataSource || !dataSource.xAxis.length || !dataSource.series.length) {
|
|
152
|
+
return /*#__PURE__*/React.createElement(Empty, {
|
|
153
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
154
|
+
description: "\u6682\u65E0\u6570\u636E"
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
var tooltipFormatter = function tooltipFormatter(params) {
|
|
158
|
+
var xLabel = '';
|
|
159
|
+
var array = params[0].name.split('|');
|
|
160
|
+
if (array.length > 1) {
|
|
161
|
+
xLabel = moment(array[0]).format('MM-DD') + '~' + moment(array[1]).format('MM-DD');
|
|
162
|
+
} else {
|
|
163
|
+
xLabel = moment(array[0]).isValid() ? moment(array[0]).format('MM-DD') : array[0];
|
|
164
|
+
}
|
|
165
|
+
var series = [];
|
|
166
|
+
var seriesMap = {};
|
|
167
|
+
params.forEach(function (item) {
|
|
168
|
+
var _props$params;
|
|
169
|
+
if (item.value === null || item.value === undefined || seriesMap[item.seriesName] !== null && seriesMap[item.seriesName] !== undefined) return;
|
|
170
|
+
seriesMap[item.seriesName] = item.value;
|
|
171
|
+
var value = item.value;
|
|
172
|
+
if ((props === null || props === void 0 ? void 0 : (_props$params = props.params) === null || _props$params === void 0 ? void 0 : _props$params.module) == 'duration_avg') {
|
|
173
|
+
value = convertMilliseconds(item.value);
|
|
174
|
+
}
|
|
175
|
+
var seriesName = item.seriesName || item.axisValueLabel;
|
|
176
|
+
seriesName = [seriesName].join('<br/>');
|
|
177
|
+
series.push({
|
|
178
|
+
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>"),
|
|
179
|
+
value: value
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
return "<div class='biz-chart-tooltip-title'>".concat(xLabel, "</div>").concat(series.sort(function (a, b) {
|
|
183
|
+
return parseInt(b.value) - parseInt(a.value);
|
|
184
|
+
}).map(function (item) {
|
|
185
|
+
return item.text;
|
|
186
|
+
}).join(''));
|
|
187
|
+
};
|
|
188
|
+
switch (chartType) {
|
|
189
|
+
case 'bar':
|
|
190
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
191
|
+
className: "".concat(classPrefix, "-chart-box")
|
|
192
|
+
}, !!props.dataSource && /*#__PURE__*/React.createElement(DataUpdateTime, null), /*#__PURE__*/React.createElement(BizChart, {
|
|
193
|
+
ref: ref,
|
|
194
|
+
key: chartType,
|
|
195
|
+
type: chartType,
|
|
196
|
+
data: dataSource,
|
|
197
|
+
legendPosition: "bottom",
|
|
198
|
+
showList: showList,
|
|
199
|
+
colors: showColors,
|
|
200
|
+
xRotate: dataSource.series.length > 5 ? 40 : 0,
|
|
201
|
+
reverseXAxis: (props === null || props === void 0 ? void 0 : (_props$params2 = props.params) === null || _props$params2 === void 0 ? void 0 : _props$params2.module) != 'duration',
|
|
202
|
+
yAxisFormatter: function yAxisFormatter(params) {
|
|
203
|
+
var _props$params3;
|
|
204
|
+
return (props === null || props === void 0 ? void 0 : (_props$params3 = props.params) === null || _props$params3 === void 0 ? void 0 : _props$params3.module) == 'duration_avg' ? convertMilliseconds(params) : params;
|
|
205
|
+
},
|
|
206
|
+
tooltipFormatter: tooltipFormatter,
|
|
207
|
+
isCity: isCity
|
|
208
|
+
}));
|
|
209
|
+
case 'line':
|
|
210
|
+
case 'pie':
|
|
211
|
+
case 'map':
|
|
212
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
213
|
+
className: "".concat(classPrefix, "-chart-box")
|
|
214
|
+
}, !!props.dataSource && /*#__PURE__*/React.createElement(DataUpdateTime, null), /*#__PURE__*/React.createElement(BizChart, {
|
|
215
|
+
ref: ref,
|
|
216
|
+
key: chartType,
|
|
217
|
+
type: chartType,
|
|
218
|
+
data: chartType === 'map' ? getMapChartData(dataSource) : dataSource,
|
|
219
|
+
legendPosition: "bottom",
|
|
220
|
+
showList: showList,
|
|
221
|
+
colors: showColors,
|
|
222
|
+
xRotate: 0,
|
|
223
|
+
reverseXAxis: false,
|
|
224
|
+
yAxisFormatter: function yAxisFormatter(params) {
|
|
225
|
+
var _props$params4;
|
|
226
|
+
return (props === null || props === void 0 ? void 0 : (_props$params4 = props.params) === null || _props$params4 === void 0 ? void 0 : _props$params4.module) == 'duration_avg' ? convertMilliseconds(params) : params;
|
|
227
|
+
},
|
|
228
|
+
tooltipFormatter: tooltipFormatter,
|
|
229
|
+
isCity: isCity
|
|
230
|
+
}));
|
|
231
|
+
case 'grid':
|
|
232
|
+
return /*#__PURE__*/React.createElement(WholeTable, {
|
|
233
|
+
dataSource: dataSource,
|
|
234
|
+
sourcePanel: !props.dataSource,
|
|
235
|
+
searchData: params,
|
|
236
|
+
showList: showList,
|
|
237
|
+
changeShowByName: onChangeShowByName
|
|
238
|
+
});
|
|
239
|
+
default:
|
|
240
|
+
return /*#__PURE__*/React.createElement("div", null, "\u6682\u4E0D\u652F\u6301\u8BE5\u56FE\u8868\u7C7B\u578B");
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
WholeChart.defaultProps = {
|
|
244
|
+
showList: []
|
|
245
|
+
};
|
|
246
|
+
export default WholeChart;
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
}
|
|
7
|
+
interface Props {
|
|
8
|
+
dataSource?: ChartTypesProps;
|
|
9
|
+
params?: SearchValue;
|
|
10
|
+
type?: string;
|
|
11
|
+
showList?: string[];
|
|
12
|
+
showColors?: string[];
|
|
13
|
+
onChangeShow?: (data: string[]) => void;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,234 @@
|
|
|
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, 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 { WholeContext } from '../../types';
|
|
19
|
+
import './styles/index.less';
|
|
20
|
+
import { Apis } from '../../constants';
|
|
21
|
+
import { ContentPanel, SearchPanel } from '../../components';
|
|
22
|
+
import { getUserGroupsCompareData, getSortData, getChartDataWholeAliasName, formTableData, sortOriginalData } from '../../utils/formData';
|
|
23
|
+
import TopPanel from '../topPanel';
|
|
24
|
+
var timer = 0;
|
|
25
|
+
var refreshTimer = 0;
|
|
26
|
+
var refresh = false;
|
|
27
|
+
var ajaxFlag = true;
|
|
28
|
+
var CancelToken = Request.CancelToken;
|
|
29
|
+
var cancel;
|
|
30
|
+
var classPrefix = 'whole-content';
|
|
31
|
+
var WholeContent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
32
|
+
var _topPanelRef$current4;
|
|
33
|
+
var _useContext = useContext(WholeContext),
|
|
34
|
+
currentApp = _useContext.currentApp,
|
|
35
|
+
searchData = _useContext.searchData,
|
|
36
|
+
setSearchData = _useContext.setSearchData,
|
|
37
|
+
eventGroupList = _useContext.eventGroupList,
|
|
38
|
+
loading = _useContext.loading,
|
|
39
|
+
setLoading = _useContext.setLoading,
|
|
40
|
+
afterEditTarget = _useContext.afterEditTarget,
|
|
41
|
+
panelId = _useContext.panelId,
|
|
42
|
+
onChangeUrlParam = _useContext.onChangeUrlParam,
|
|
43
|
+
setRefreshLoading = _useContext.setRefreshLoading,
|
|
44
|
+
showList = _useContext.showList,
|
|
45
|
+
setShowList = _useContext.setShowList,
|
|
46
|
+
first = _useContext.first,
|
|
47
|
+
setFirst = _useContext.setFirst;
|
|
48
|
+
var _useContext2 = useContext(BizTargetFromPanelContext),
|
|
49
|
+
handleSearch = _useContext2.handleSearch;
|
|
50
|
+
var _useState = useState(),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
wholeData = _useState2[0],
|
|
53
|
+
setWholeData = _useState2[1];
|
|
54
|
+
var _useState3 = useState(props.value.id),
|
|
55
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
56
|
+
eventId = _useState4[0],
|
|
57
|
+
setWholeId = _useState4[1];
|
|
58
|
+
var topPanelRef = useRef();
|
|
59
|
+
useImperativeHandle(ref, function () {
|
|
60
|
+
return {
|
|
61
|
+
onFormSetFieldsValue: function onFormSetFieldsValue(data) {
|
|
62
|
+
var _topPanelRef$current;
|
|
63
|
+
topPanelRef === null || topPanelRef === void 0 ? void 0 : (_topPanelRef$current = topPanelRef.current) === null || _topPanelRef$current === void 0 ? void 0 : _topPanelRef$current.onFormSetFieldsValue(data);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
var chartRef = useRef();
|
|
68
|
+
useEffect(function () {
|
|
69
|
+
if (timer) clearTimeout(timer);
|
|
70
|
+
timer = setTimeout(function () {
|
|
71
|
+
fetchRequest();
|
|
72
|
+
}, 500);
|
|
73
|
+
return function () {
|
|
74
|
+
if (timer) clearTimeout(timer);
|
|
75
|
+
};
|
|
76
|
+
}, [searchData]);
|
|
77
|
+
useEffect(function () {
|
|
78
|
+
handleSearch && handleSearch(loading);
|
|
79
|
+
}, [loading]);
|
|
80
|
+
var fetchRequest = function fetchRequest(flag) {
|
|
81
|
+
if (flag !== undefined) ajaxFlag = flag;
|
|
82
|
+
if (!ajaxFlag) return;
|
|
83
|
+
if (!refresh) setLoading(true);
|
|
84
|
+
setWholeData(undefined);
|
|
85
|
+
if (typeof cancel === 'function') {
|
|
86
|
+
cancel();
|
|
87
|
+
}
|
|
88
|
+
ajax(Apis.dataList, {
|
|
89
|
+
method: 'post',
|
|
90
|
+
data: _objectSpread(_objectSpread({
|
|
91
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
92
|
+
platform: (searchData === null || searchData === void 0 ? void 0 : searchData.platform) || 0
|
|
93
|
+
}, searchData), {}, {
|
|
94
|
+
refresh: refresh
|
|
95
|
+
}),
|
|
96
|
+
intercept: false,
|
|
97
|
+
cancelToken: new CancelToken(function executor(c) {
|
|
98
|
+
cancel = c;
|
|
99
|
+
})
|
|
100
|
+
}).then(function (res) {
|
|
101
|
+
var _searchData$userGroup;
|
|
102
|
+
setRefreshLoading(false);
|
|
103
|
+
if ((res === null || res === void 0 ? void 0 : res.code) != '101000') {
|
|
104
|
+
message.error(res === null || res === void 0 ? void 0 : res.msg);
|
|
105
|
+
setLoading(false);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
var result = res.data;
|
|
109
|
+
if (!result.series.length) {
|
|
110
|
+
setLoading(false);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
var _data = searchData.dimension ? result : getChartDataWholeAliasName(result, eventGroupList);
|
|
114
|
+
var gLen = (searchData === null || searchData === void 0 ? void 0 : searchData.dimension) ? 1 : 0;
|
|
115
|
+
var dataTemp = formTableData(_data, (searchData === null || searchData === void 0 ? void 0 : searchData.userGroup) || [0], gLen);
|
|
116
|
+
var _sortData = [];
|
|
117
|
+
if (['bar', 'pie', 'map'].indexOf(searchData.chartType) !== -1) {
|
|
118
|
+
_data = getSortData(_data);
|
|
119
|
+
} else {
|
|
120
|
+
var _data$series$;
|
|
121
|
+
_sortData = sortOriginalData(dataTemp, {
|
|
122
|
+
columnKey: "field".concat(((_data$series$ = _data.series[0]) === null || _data$series$ === void 0 ? void 0 : _data$series$.values.length) - 1),
|
|
123
|
+
order: 'descend'
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
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) {
|
|
127
|
+
_data = getUserGroupsCompareData(_data);
|
|
128
|
+
}
|
|
129
|
+
if (first) {
|
|
130
|
+
setFirst(false);
|
|
131
|
+
} else {
|
|
132
|
+
var _showlist = [];
|
|
133
|
+
_sortData.forEach(function (item, index) {
|
|
134
|
+
if (index < 10) {
|
|
135
|
+
_showlist.push(item.nameGroup);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
setShowList(_showlist);
|
|
139
|
+
}
|
|
140
|
+
setWholeData(_data);
|
|
141
|
+
onChangeUrlParam(searchData);
|
|
142
|
+
setLoading(false);
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
var refreshHandle = function refreshHandle() {
|
|
146
|
+
refresh = true;
|
|
147
|
+
setRefreshLoading(true);
|
|
148
|
+
if (refreshTimer) clearTimeout(refreshTimer);
|
|
149
|
+
refreshTimer = setTimeout(function () {
|
|
150
|
+
fetchRequest();
|
|
151
|
+
refresh = false;
|
|
152
|
+
clearTimeout(refreshTimer);
|
|
153
|
+
}, 500);
|
|
154
|
+
};
|
|
155
|
+
var onChangeContent = function onChangeContent(data) {
|
|
156
|
+
ajaxFlag = true;
|
|
157
|
+
setSearchData(function (value) {
|
|
158
|
+
return _objectSpread(_objectSpread({}, value), data);
|
|
159
|
+
});
|
|
160
|
+
setTimeout(function () {
|
|
161
|
+
var _topPanelRef$current2;
|
|
162
|
+
topPanelRef === null || topPanelRef === void 0 ? void 0 : (_topPanelRef$current2 = topPanelRef.current) === null || _topPanelRef$current2 === void 0 ? void 0 : _topPanelRef$current2.onSubmit();
|
|
163
|
+
}, 100);
|
|
164
|
+
};
|
|
165
|
+
var platformChange = function platformChange(data) {
|
|
166
|
+
ajaxFlag = true;
|
|
167
|
+
setSearchData(function (_searchData) {
|
|
168
|
+
return _objectSpread(_objectSpread({}, _searchData), {}, {
|
|
169
|
+
platform: data
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
setTimeout(function () {
|
|
173
|
+
var _topPanelRef$current3;
|
|
174
|
+
topPanelRef === null || topPanelRef === void 0 ? void 0 : (_topPanelRef$current3 = topPanelRef.current) === null || _topPanelRef$current3 === void 0 ? void 0 : _topPanelRef$current3.onSubmit();
|
|
175
|
+
}, 100);
|
|
176
|
+
};
|
|
177
|
+
var onChangeSearch = function onChangeSearch(data, flag) {
|
|
178
|
+
ajaxFlag = flag;
|
|
179
|
+
data.id ? setWholeId(data.id) : setWholeId(-1);
|
|
180
|
+
setSearchData(function (value) {
|
|
181
|
+
return _objectSpread(_objectSpread({}, data), {}, {
|
|
182
|
+
time: value.time,
|
|
183
|
+
platform: value.platform,
|
|
184
|
+
chartType: value.chartType
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
var onClickGenerateReport = function onClickGenerateReport() {
|
|
189
|
+
if (!chartRef.current) {
|
|
190
|
+
message.warning('未选择事件或查询失败!');
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
var url = chartRef.current.instance.getDataURL();
|
|
194
|
+
var params = {
|
|
195
|
+
image: url,
|
|
196
|
+
context: {
|
|
197
|
+
api: '/web/sdk/v2/event/eventAnalytics',
|
|
198
|
+
queryParam: searchData
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
if (afterEditTarget) afterEditTarget('report', params);
|
|
202
|
+
};
|
|
203
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TopBar, {
|
|
204
|
+
wholeData: wholeData,
|
|
205
|
+
searchData: searchData,
|
|
206
|
+
platformChange: platformChange,
|
|
207
|
+
showList: showList,
|
|
208
|
+
onClickGenerateReport: onClickGenerateReport
|
|
209
|
+
}), /*#__PURE__*/React.createElement(BizLayout, {
|
|
210
|
+
hasCollapse: true,
|
|
211
|
+
showTitle: !panelId,
|
|
212
|
+
collapseRef: topPanelRef === null || topPanelRef === void 0 ? void 0 : (_topPanelRef$current4 = topPanelRef.current) === null || _topPanelRef$current4 === void 0 ? void 0 : _topPanelRef$current4.getCollapseRef(),
|
|
213
|
+
topPanel: /*#__PURE__*/React.createElement(TopPanel, {
|
|
214
|
+
ref: topPanelRef,
|
|
215
|
+
onChange: onChangeSearch,
|
|
216
|
+
loading: loading,
|
|
217
|
+
value: searchData
|
|
218
|
+
})
|
|
219
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
220
|
+
className: classPrefix
|
|
221
|
+
}, /*#__PURE__*/React.createElement(SearchPanel, {
|
|
222
|
+
chartType: searchData === null || searchData === void 0 ? void 0 : searchData.chartType,
|
|
223
|
+
time: searchData === null || searchData === void 0 ? void 0 : searchData.time,
|
|
224
|
+
eventId: eventId,
|
|
225
|
+
onChange: onChangeContent,
|
|
226
|
+
refreshHandle: refreshHandle
|
|
227
|
+
}), /*#__PURE__*/React.createElement(ContentPanel, {
|
|
228
|
+
ref: chartRef,
|
|
229
|
+
wholeData: wholeData,
|
|
230
|
+
searchData: searchData,
|
|
231
|
+
showList: showList
|
|
232
|
+
}))));
|
|
233
|
+
});
|
|
234
|
+
export default WholeContent;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SearchValue } from '../../types';
|
|
2
|
+
export declare namespace WholeContentProps {
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
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 normalWholeOptions: {
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
}[];
|
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
import { ajax } from '@zgfe/business-lib';
|
|
8
|
+
import { Apis } from '../../constants';
|
|
9
|
+
import _ from 'lodash';
|
|
10
|
+
export var getMapChartData = function getMapChartData(data) {
|
|
11
|
+
var _data = _.cloneDeep(data);
|
|
12
|
+
_data.series.map(function (item) {
|
|
13
|
+
if (item.names.length > 1) {
|
|
14
|
+
if (item.names[1] === '新疆维吾尔自治区') {
|
|
15
|
+
item.names = [item.names[0], '新疆'];
|
|
16
|
+
}
|
|
17
|
+
item.names = item.names.reverse();
|
|
18
|
+
} else {
|
|
19
|
+
if (item.names[0] === '新疆维吾尔自治区') {
|
|
20
|
+
item.names = ['新疆'];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return _data;
|
|
25
|
+
};
|
|
26
|
+
export var judgeFilterValue = function judgeFilterValue(data, count) {
|
|
27
|
+
var flag = true;
|
|
28
|
+
if (data === undefined) {
|
|
29
|
+
if (count > 0) flag = false;
|
|
30
|
+
} else {
|
|
31
|
+
if (data.conditions.length <= 0 || data.conditions.length !== count) {
|
|
32
|
+
flag = false;
|
|
33
|
+
}
|
|
34
|
+
data.conditions.map(function (item) {
|
|
35
|
+
var _item$values;
|
|
36
|
+
if (item.values && (((_item$values = item.values) === null || _item$values === void 0 ? void 0 : _item$values.length) <= 0 || item.values[0] === '') && !((item === null || item === void 0 ? void 0 : item.operator) && /^is null$|^is not null$/.test(item === null || item === void 0 ? void 0 : item.operator))) flag = false;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return flag;
|
|
40
|
+
};
|
|
41
|
+
export var judgeIsCity = function judgeIsCity(name) {
|
|
42
|
+
var areaData = ['current_city', 'city'];
|
|
43
|
+
return name && areaData.indexOf(name) !== -1 ? true : false;
|
|
44
|
+
};
|
|
45
|
+
export var judgeIsArea = function judgeIsArea(name) {
|
|
46
|
+
var areaData = ['current_area', 'current_city', 'area', 'city'];
|
|
47
|
+
return name && areaData.indexOf(name) !== -1 ? true : false;
|
|
48
|
+
};
|
|
49
|
+
export var getValue = function getValue(param, eventGroupList, eventEnvList, userPropList) {
|
|
50
|
+
var res = undefined;
|
|
51
|
+
var key = "".concat(param.propCategory, "-").concat(param.value, "-").concat(param.id);
|
|
52
|
+
if ((param === null || param === void 0 ? void 0 : param.propCategory) === 'envProp') {
|
|
53
|
+
eventEnvList === null || eventEnvList === void 0 ? void 0 : eventEnvList.forEach(function (attr) {
|
|
54
|
+
if (attr.key === key) res = attr;
|
|
55
|
+
});
|
|
56
|
+
} else if ((param === null || param === void 0 ? void 0 : param.propCategory) === 'eventProp') {
|
|
57
|
+
eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
|
|
58
|
+
group.eventList.forEach(function (event) {
|
|
59
|
+
event.attrList.forEach(function (attr) {
|
|
60
|
+
if (attr.key === key) res = attr;
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
} else if ((param === null || param === void 0 ? void 0 : param.propCategory) === 'userProp') {
|
|
65
|
+
userPropList === null || userPropList === void 0 ? void 0 : userPropList.forEach(function (attr) {
|
|
66
|
+
if (attr.key === key) res = attr;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return res;
|
|
70
|
+
};
|
|
71
|
+
export var getNumberPanelData = function getNumberPanelData(data) {
|
|
72
|
+
return new Promise(function (resolve, reject) {
|
|
73
|
+
ajax(Apis.dataList, {
|
|
74
|
+
method: 'post',
|
|
75
|
+
data: _objectSpread({}, data)
|
|
76
|
+
}).then(function (res) {
|
|
77
|
+
resolve(res);
|
|
78
|
+
}).catch(function (err) {
|
|
79
|
+
reject(err);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
export var normalOptions = function normalOptions(type) {
|
|
84
|
+
return [{
|
|
85
|
+
label: "".concat(type != 'user' ? '主体数' : '人数'),
|
|
86
|
+
value: 'number'
|
|
87
|
+
}, {
|
|
88
|
+
label: '次数',
|
|
89
|
+
value: 'times'
|
|
90
|
+
}, {
|
|
91
|
+
label: '活跃比',
|
|
92
|
+
value: 'active_ratio'
|
|
93
|
+
}, {
|
|
94
|
+
label: "".concat(type != 'user' ? '主体平均次数' : '人均次数'),
|
|
95
|
+
value: 'per'
|
|
96
|
+
}];
|
|
97
|
+
};
|
|
98
|
+
export var normalWholeOptions = [{
|
|
99
|
+
label: '口径数',
|
|
100
|
+
value: 'number'
|
|
101
|
+
}, {
|
|
102
|
+
label: '次数',
|
|
103
|
+
value: 'times'
|
|
104
|
+
}, {
|
|
105
|
+
label: '平均次数',
|
|
106
|
+
value: 'per'
|
|
107
|
+
}];
|