@zgfe/modules-interval 1.0.0-interval.1
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 +33 -0
- package/dist/esm/assets/business/demo.css +539 -0
- package/dist/esm/assets/business/demo_index.html +3178 -0
- package/dist/esm/assets/business/iconfont.css +535 -0
- package/dist/esm/assets/business/iconfont.js +43 -0
- package/dist/esm/assets/business/iconfont.json +919 -0
- package/dist/esm/assets/business/iconfont.ttf +0 -0
- package/dist/esm/assets/business/iconfont.woff +0 -0
- package/dist/esm/assets/business/iconfont.woff2 +0 -0
- package/dist/esm/assets/icons/demo.css +539 -0
- package/dist/esm/assets/icons/demo_index.html +9618 -0
- package/dist/esm/assets/icons/iconfont.css +1655 -0
- package/dist/esm/assets/icons/iconfont.js +43 -0
- package/dist/esm/assets/icons/iconfont.json +2879 -0
- package/dist/esm/assets/icons/iconfont.ttf +0 -0
- package/dist/esm/assets/icons/iconfont.woff +0 -0
- package/dist/esm/assets/icons/iconfont.woff2 +0 -0
- package/dist/esm/assets/images/empty@2x.png +0 -0
- package/dist/esm/assets/images/empty_state.png +0 -0
- package/dist/esm/assets/images/table_nodata.png +0 -0
- package/dist/esm/components/common/index.d.ts +6 -0
- package/dist/esm/components/common/index.js +21 -0
- package/dist/esm/components/common/styles/index.less +27 -0
- package/dist/esm/components/eventFilter/index.d.ts +5 -0
- package/dist/esm/components/eventFilter/index.js +187 -0
- package/dist/esm/components/eventFilter/styles/index.less +42 -0
- package/dist/esm/components/eventFilter/types.d.ts +50 -0
- package/dist/esm/components/eventFilter/types.js +1 -0
- package/dist/esm/components/index.d.ts +5 -0
- package/dist/esm/components/index.js +5 -0
- package/dist/esm/components/renderContent/index.d.ts +5 -0
- package/dist/esm/components/renderContent/index.js +58 -0
- package/dist/esm/components/renderContent/styles/index.less +23 -0
- package/dist/esm/components/renderContent/types.d.ts +31 -0
- package/dist/esm/components/renderContent/types.js +1 -0
- package/dist/esm/components/searchPanel/index.d.ts +5 -0
- package/dist/esm/components/searchPanel/index.js +122 -0
- package/dist/esm/components/searchPanel/styles/index.less +59 -0
- package/dist/esm/components/searchPanel/types.d.ts +49 -0
- package/dist/esm/components/searchPanel/types.js +1 -0
- package/dist/esm/components/table/index.d.ts +6 -0
- package/dist/esm/components/table/index.js +199 -0
- package/dist/esm/components/table/styles/index.less +123 -0
- package/dist/esm/components/table/types.d.ts +26 -0
- package/dist/esm/components/table/types.js +1 -0
- package/dist/esm/components/topBar/index.d.ts +5 -0
- package/dist/esm/components/topBar/index.js +121 -0
- package/dist/esm/components/topBar/styles/index.less +49 -0
- package/dist/esm/components/topBar/types.d.ts +8 -0
- package/dist/esm/components/topBar/types.js +1 -0
- package/dist/esm/constants/apis.d.ts +6 -0
- package/dist/esm/constants/apis.js +7 -0
- package/dist/esm/constants/chart.d.ts +2 -0
- package/dist/esm/constants/chart.js +31 -0
- package/dist/esm/constants/color.d.ts +2 -0
- package/dist/esm/constants/color.js +9 -0
- package/dist/esm/constants/fields.d.ts +226 -0
- package/dist/esm/constants/fields.js +219 -0
- package/dist/esm/constants/index.d.ts +6 -0
- package/dist/esm/constants/index.js +6 -0
- package/dist/esm/constants/initData.d.ts +2 -0
- package/dist/esm/constants/initData.js +11 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/modules/chart/customTooltip.d.ts +7 -0
- package/dist/esm/modules/chart/customTooltip.js +37 -0
- package/dist/esm/modules/chart/demo/data.d.ts +79 -0
- package/dist/esm/modules/chart/demo/data.js +495 -0
- package/dist/esm/modules/chart/demo/index.d.ts +3 -0
- package/dist/esm/modules/chart/demo/index.js +51 -0
- package/dist/esm/modules/chart/demo/panel.d.ts +3 -0
- package/dist/esm/modules/chart/demo/panel.js +30 -0
- package/dist/esm/modules/chart/index.d.ts +4 -0
- package/dist/esm/modules/chart/index.js +100 -0
- package/dist/esm/modules/chart/index.less +48 -0
- package/dist/esm/modules/chart/intervalChart.d.ts +4 -0
- package/dist/esm/modules/chart/intervalChart.js +136 -0
- package/dist/esm/modules/chart/types.d.ts +37 -0
- package/dist/esm/modules/chart/types.js +2 -0
- package/dist/esm/modules/content/index.d.ts +5 -0
- package/dist/esm/modules/content/index.js +272 -0
- package/dist/esm/modules/content/styles/index.less +7 -0
- package/dist/esm/modules/content/types.d.ts +29 -0
- package/dist/esm/modules/content/types.js +2 -0
- package/dist/esm/modules/content/utils.d.ts +21 -0
- package/dist/esm/modules/content/utils.js +51 -0
- package/dist/esm/modules/home/demo/create.d.ts +3 -0
- package/dist/esm/modules/home/demo/create.js +51 -0
- package/dist/esm/modules/home/demo/edit.d.ts +3 -0
- package/dist/esm/modules/home/demo/edit.js +90 -0
- package/dist/esm/modules/home/demo/index.d.ts +4 -0
- package/dist/esm/modules/home/demo/index.js +51 -0
- package/dist/esm/modules/home/demo/scene.d.ts +3 -0
- package/dist/esm/modules/home/demo/scene.js +87 -0
- package/dist/esm/modules/home/demo/styles/index.less +33 -0
- package/dist/esm/modules/home/index.d.ts +5 -0
- package/dist/esm/modules/home/index.js +141 -0
- package/dist/esm/modules/home/styles/index.less +53 -0
- package/dist/esm/modules/home/types.d.ts +69 -0
- package/dist/esm/modules/home/types.js +2 -0
- package/dist/esm/modules/topPanel/index.d.ts +5 -0
- package/dist/esm/modules/topPanel/index.js +250 -0
- package/dist/esm/modules/topPanel/styles/index.less +67 -0
- package/dist/esm/modules/topPanel/types.d.ts +54 -0
- package/dist/esm/modules/topPanel/types.js +1 -0
- package/dist/esm/style/image/noData.png +0 -0
- package/dist/esm/style/image/ring.svg +9 -0
- package/dist/esm/style/index.less +46 -0
- package/dist/esm/style/theme.d.ts +15 -0
- package/dist/esm/style/theme.js +16 -0
- package/dist/esm/types.d.ts +169 -0
- package/dist/esm/types.js +19 -0
- package/dist/esm/utils/ajaxConfig.d.ts +8 -0
- package/dist/esm/utils/ajaxConfig.js +47 -0
- package/dist/esm/utils/base64.d.ts +29 -0
- package/dist/esm/utils/base64.js +132 -0
- package/dist/esm/utils/formData.d.ts +76 -0
- package/dist/esm/utils/formData.js +258 -0
- package/dist/esm/utils/util.d.ts +66 -0
- package/dist/esm/utils/util.js +177 -0
- package/package.json +61 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 接口option封装
|
|
5
|
+
* @param url url
|
|
6
|
+
* @param options 操作
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
function setOptionWapper(url, options) {
|
|
10
|
+
var reqOption = _.cloneDeep(options);
|
|
11
|
+
if (/^\/v1|\.jsp$/.test(url)) {
|
|
12
|
+
if (reqOption.headers && reqOption.headers['Content-Type'] === 'application/x-www-form-urlencoded') {
|
|
13
|
+
return reqOption;
|
|
14
|
+
}
|
|
15
|
+
reqOption.headers = {
|
|
16
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
17
|
+
};
|
|
18
|
+
var transformRequest = function transformRequest(param) {
|
|
19
|
+
var arr = [];
|
|
20
|
+
for (var key in param) {
|
|
21
|
+
arr.push("".concat(key, "=").concat(encodeURIComponent(param[key])));
|
|
22
|
+
}
|
|
23
|
+
return arr.join('&');
|
|
24
|
+
};
|
|
25
|
+
reqOption.data = transformRequest(options.data);
|
|
26
|
+
}
|
|
27
|
+
return reqOption;
|
|
28
|
+
}
|
|
29
|
+
export var requestConfig = {
|
|
30
|
+
request: {
|
|
31
|
+
optionsWrapper: function optionsWrapper(url, options) {
|
|
32
|
+
var newUrl = url;
|
|
33
|
+
var reqOption = options;
|
|
34
|
+
var ajaxUrlReg = '/analysis/api/common/proxy';
|
|
35
|
+
if (/^\/v1|\.jsp$/.test(url)) {
|
|
36
|
+
if (ajaxUrlReg && !url.includes(ajaxUrlReg)) {
|
|
37
|
+
newUrl = ajaxUrlReg + url;
|
|
38
|
+
reqOption = setOptionWapper(url, options);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
url: newUrl,
|
|
43
|
+
options: reqOption
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by yqdong on 16/3/15.
|
|
3
|
+
* qq: 1013501639
|
|
4
|
+
* @author yqdong
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
declare const _default: {
|
|
8
|
+
_keyStr: string;
|
|
9
|
+
_utf8_encode: (string: string) => string;
|
|
10
|
+
_utf8_decode: (utftext: string) => string;
|
|
11
|
+
encode: (input: string, type?: any) => string;
|
|
12
|
+
decode: (input: string) => string;
|
|
13
|
+
_$: string[];
|
|
14
|
+
pw: string;
|
|
15
|
+
gString: (O6b8: {
|
|
16
|
+
[x: string]: (arg0: number) => {
|
|
17
|
+
(): any;
|
|
18
|
+
new (): any;
|
|
19
|
+
[x: string]: () => any;
|
|
20
|
+
};
|
|
21
|
+
}[], O492: {
|
|
22
|
+
[x: string]: (arg0: number) => {
|
|
23
|
+
(): any;
|
|
24
|
+
new (): any;
|
|
25
|
+
[x: string]: () => any;
|
|
26
|
+
};
|
|
27
|
+
}[]) => string;
|
|
28
|
+
};
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by yqdong on 16/3/15.
|
|
3
|
+
* qq: 1013501639
|
|
4
|
+
* @author yqdong
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export default {
|
|
8
|
+
_keyStr: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
|
9
|
+
_utf8_encode: function _utf8_encode(string) {
|
|
10
|
+
string = string.replace(/\r\n/g, '\n');
|
|
11
|
+
var utftext = '';
|
|
12
|
+
for (var n = 0; n < string.length; n++) {
|
|
13
|
+
var c = string.charCodeAt(n);
|
|
14
|
+
if (c < 128) {
|
|
15
|
+
utftext += String.fromCharCode(c);
|
|
16
|
+
} else if (c > 127 && c < 2048) {
|
|
17
|
+
utftext += String.fromCharCode(c >> 6 | 192); // jshint ignore:line
|
|
18
|
+
utftext += String.fromCharCode(c & 63 | 128); // jshint ignore:line
|
|
19
|
+
} else {
|
|
20
|
+
utftext += String.fromCharCode(c >> 12 | 224); // jshint ignore:line
|
|
21
|
+
utftext += String.fromCharCode(c >> 6 & 63 | 128); // jshint ignore:line
|
|
22
|
+
utftext += String.fromCharCode(c & 63 | 128); // jshint ignore:line
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return utftext;
|
|
27
|
+
},
|
|
28
|
+
_utf8_decode: function _utf8_decode(utftext) {
|
|
29
|
+
var string = '';
|
|
30
|
+
var i = 0,
|
|
31
|
+
c = 0,
|
|
32
|
+
c2 = 0,
|
|
33
|
+
c3 = 0;
|
|
34
|
+
while (i < utftext.length) {
|
|
35
|
+
c = utftext.charCodeAt(i);
|
|
36
|
+
if (c < 128) {
|
|
37
|
+
string += String.fromCharCode(c);
|
|
38
|
+
i++;
|
|
39
|
+
} else if (c > 191 && c < 224) {
|
|
40
|
+
c2 = utftext.charCodeAt(i + 1);
|
|
41
|
+
string += String.fromCharCode((c & 31) << 6 | c2 & 63); // jshint ignore:line
|
|
42
|
+
i += 2;
|
|
43
|
+
} else {
|
|
44
|
+
c2 = utftext.charCodeAt(i + 1);
|
|
45
|
+
c3 = utftext.charCodeAt(i + 2);
|
|
46
|
+
string += String.fromCharCode((c & 15) << 12 | (c2 & 63) << 6 | c3 & 63); // jshint ignore:line
|
|
47
|
+
i += 3;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return string;
|
|
51
|
+
},
|
|
52
|
+
encode: function encode(input, type) {
|
|
53
|
+
var output = '';
|
|
54
|
+
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
|
55
|
+
var i = 0;
|
|
56
|
+
input = this._utf8_encode(input);
|
|
57
|
+
while (i < input.length) {
|
|
58
|
+
chr1 = input.charCodeAt(i++);
|
|
59
|
+
chr2 = input.charCodeAt(i++);
|
|
60
|
+
chr3 = input.charCodeAt(i++);
|
|
61
|
+
enc1 = chr1 >> 2; // jshint ignore:line
|
|
62
|
+
enc2 = (chr1 & 3) << 4 | chr2 >> 4; // jshint ignore:line
|
|
63
|
+
enc3 = (chr2 & 15) << 2 | chr3 >> 6; // jshint ignore:line
|
|
64
|
+
enc4 = chr3 & 63; // jshint ignore:line
|
|
65
|
+
if (isNaN(chr2)) {
|
|
66
|
+
enc3 = enc4 = 64;
|
|
67
|
+
} else if (isNaN(chr3)) {
|
|
68
|
+
enc4 = 64;
|
|
69
|
+
}
|
|
70
|
+
output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
|
|
71
|
+
}
|
|
72
|
+
if (type) {
|
|
73
|
+
return output.replace(/[\+]?[\/]?[\=]?/g, '');
|
|
74
|
+
} else {
|
|
75
|
+
return output.replace(/\+/g, '-');
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
decode: function decode(input) {
|
|
79
|
+
input = input.replace(/\-/g, '+');
|
|
80
|
+
var output = '';
|
|
81
|
+
var chr1, chr2, chr3;
|
|
82
|
+
var enc1, enc2, enc3, enc4;
|
|
83
|
+
var i = 0;
|
|
84
|
+
while (i < input.length) {
|
|
85
|
+
enc1 = this._keyStr.indexOf(input.charAt(i++));
|
|
86
|
+
enc2 = this._keyStr.indexOf(input.charAt(i++));
|
|
87
|
+
enc3 = this._keyStr.indexOf(input.charAt(i++));
|
|
88
|
+
enc4 = this._keyStr.indexOf(input.charAt(i++));
|
|
89
|
+
chr1 = enc1 << 2 | enc2 >> 4; // jshint ignore:line
|
|
90
|
+
chr2 = (enc2 & 15) << 4 | enc3 >> 2; // jshint ignore:line
|
|
91
|
+
chr3 = (enc3 & 3) << 6 | enc4; // jshint ignore:line
|
|
92
|
+
output = output + String.fromCharCode(chr1);
|
|
93
|
+
if (enc3 != 64) {
|
|
94
|
+
output = output + String.fromCharCode(chr2);
|
|
95
|
+
}
|
|
96
|
+
if (enc4 != 64) {
|
|
97
|
+
output = output + String.fromCharCode(chr3);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
output = this._utf8_decode(output);
|
|
101
|
+
return output;
|
|
102
|
+
},
|
|
103
|
+
_$: [''],
|
|
104
|
+
pw: '0&Gqs0a5',
|
|
105
|
+
gString: function gString(O6b8, O492) {
|
|
106
|
+
var dfc4 = Array(0x100);
|
|
107
|
+
var O26e = Array(0x100);
|
|
108
|
+
var O999 = O492['\x6c\x65\x6e\x67\x74\x68'];
|
|
109
|
+
var O453 = O6b8['\x6c\x65\x6e\x67\x74\x68'];
|
|
110
|
+
for (var O98c = 0x0; O98c < 0x100; O98c++) {
|
|
111
|
+
dfc4[O98c] = O492[O98c % O999]['\x63\x68\x61\x72\x41\x74'](0x0)['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74']();
|
|
112
|
+
O26e[O98c] = O98c;
|
|
113
|
+
}
|
|
114
|
+
for (var O8cf = O98c = 0x0; O98c < 0x100; O98c++) {
|
|
115
|
+
O8cf = (O8cf + O26e[O98c] + dfc4[O98c]) % 0x100;
|
|
116
|
+
var O23f = O26e[O98c];
|
|
117
|
+
O26e[O98c] = O26e[O8cf];
|
|
118
|
+
O26e[O8cf] = O23f;
|
|
119
|
+
}
|
|
120
|
+
var ac35 = this._$[0];
|
|
121
|
+
for (var O577 = O8cf = O98c = 0x0; O98c < O453; O98c++) {
|
|
122
|
+
O577 = (O577 + 0x1) % 0x100;
|
|
123
|
+
O8cf = (O8cf + O26e[O577]) % 0x100;
|
|
124
|
+
var tmp = O26e[O577];
|
|
125
|
+
O26e[O577] = O26e[O8cf];
|
|
126
|
+
O26e[O8cf] = tmp;
|
|
127
|
+
var O3d6 = O26e[(O26e[O577] + O26e[O8cf]) % 0x100];
|
|
128
|
+
ac35 += String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](O6b8[O98c]['\x63\x68\x61\x72\x41\x74'](0x0)['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74']() ^ O3d6);
|
|
129
|
+
}
|
|
130
|
+
return ac35;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ColumnsType } from 'antd/es/table';
|
|
2
|
+
import { EventGroup, UserProp, EnvProp } from '@zgfe/business-lib/es/attributeSelector/types';
|
|
3
|
+
import { ResponseDataProps, SearchValue, SeriesProps } from '../types';
|
|
4
|
+
import { EventProps } from '../modules/home/types';
|
|
5
|
+
import '../style/index.less';
|
|
6
|
+
import { DisplaySetup } from '../components/searchPanel/types';
|
|
7
|
+
/**
|
|
8
|
+
* 获取table的columns
|
|
9
|
+
* @param columnData xAxis
|
|
10
|
+
* @returns column fields
|
|
11
|
+
*/
|
|
12
|
+
export declare function getColumns(eventGroupList: EventGroup[] | undefined, userPropList: UserProp[] | undefined, eventEnvList: EnvProp[] | undefined, columnData: string[], userGroup: number[], searchData: SearchValue, showList: string[]): ColumnsType<EventProps.ColumnsDataType>;
|
|
13
|
+
/**
|
|
14
|
+
* 获取属性的label
|
|
15
|
+
* @param attrData 当前属性
|
|
16
|
+
* @param eventGroupList 事件属性列表
|
|
17
|
+
* @param userPropList 用户属性列表
|
|
18
|
+
* @param eventEnvList 环境属性列表
|
|
19
|
+
* @returns label
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* 格式化表格数据
|
|
23
|
+
* @param originalData 查询的数据
|
|
24
|
+
* @param hasUserGroup 是否有多个用户群
|
|
25
|
+
* @param attrNum 属性细分个数
|
|
26
|
+
* @param showList 要展示的内容,如果没传,则展示全部
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
export declare function formTableData(originalData: ChartData): {
|
|
30
|
+
key: number;
|
|
31
|
+
time: string;
|
|
32
|
+
max: number;
|
|
33
|
+
Q1: number;
|
|
34
|
+
median: number;
|
|
35
|
+
Q3: number;
|
|
36
|
+
min: number;
|
|
37
|
+
perValue: number;
|
|
38
|
+
peopleNum: number;
|
|
39
|
+
}[] | undefined;
|
|
40
|
+
type ChartData = {
|
|
41
|
+
app_data: {
|
|
42
|
+
series?: {
|
|
43
|
+
names: string[];
|
|
44
|
+
values: number[][];
|
|
45
|
+
total: number[];
|
|
46
|
+
}[];
|
|
47
|
+
x_axis?: string[];
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* 获取查询结果的前10条
|
|
52
|
+
* @param source 结果数据
|
|
53
|
+
* @returns 获取查询结果的前10条
|
|
54
|
+
*/
|
|
55
|
+
export declare function getDefaultShow(source: ResponseDataProps, data: DisplaySetup[]): never[] | {
|
|
56
|
+
app_data: any;
|
|
57
|
+
xAxis?: string[] | undefined;
|
|
58
|
+
x_axis?: string[] | undefined;
|
|
59
|
+
series: SeriesProps[];
|
|
60
|
+
tongbi?: number[] | undefined;
|
|
61
|
+
huanbi?: number[] | undefined;
|
|
62
|
+
total?: number[] | undefined;
|
|
63
|
+
yesterDay?: string[] | undefined;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* 获取显示事件对应的颜色
|
|
67
|
+
* @param source 结果数据
|
|
68
|
+
* @param showList 展示列表
|
|
69
|
+
* @returns 展示列表对应的颜色
|
|
70
|
+
*/
|
|
71
|
+
export declare function getShowColor(source: ResponseDataProps, showList: string[]): string[];
|
|
72
|
+
export declare function extractNames(data: ChartData): {
|
|
73
|
+
value: number;
|
|
74
|
+
label: string;
|
|
75
|
+
}[] | undefined;
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,258 @@
|
|
|
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 _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
9
|
+
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); }
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { chartColors } from "../constants/color";
|
|
12
|
+
import "../style/index.less";
|
|
13
|
+
var classPrefix = 'event-form-data';
|
|
14
|
+
function convertToHMS(seconds) {
|
|
15
|
+
var hours = Math.floor(seconds / 3600);
|
|
16
|
+
var h = hours ? hours + '时' : '';
|
|
17
|
+
var minutes = Math.floor(seconds % 3600 / 60);
|
|
18
|
+
var m = minutes ? minutes + '分' : '';
|
|
19
|
+
var remainingSeconds = seconds % 60;
|
|
20
|
+
var s = remainingSeconds ? remainingSeconds + '秒' : '0秒';
|
|
21
|
+
return h + m + s;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 获取table的columns
|
|
25
|
+
* @param columnData xAxis
|
|
26
|
+
* @returns column fields
|
|
27
|
+
*/
|
|
28
|
+
export function getColumns(eventGroupList, userPropList, eventEnvList, columnData, userGroup, searchData, showList
|
|
29
|
+
// onClickToDetailCallback: Function,
|
|
30
|
+
) {
|
|
31
|
+
// 显示
|
|
32
|
+
var data = [{
|
|
33
|
+
title: '日期',
|
|
34
|
+
width: 148,
|
|
35
|
+
ellipsis: true,
|
|
36
|
+
key: 'time',
|
|
37
|
+
align: 'center',
|
|
38
|
+
dataIndex: 'time',
|
|
39
|
+
className: "".concat(classPrefix, "-table-td"),
|
|
40
|
+
render: function render(text, record) {
|
|
41
|
+
return /*#__PURE__*/React.createElement("span", null, " ", text);
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
title: '最大值',
|
|
45
|
+
width: 148,
|
|
46
|
+
ellipsis: true,
|
|
47
|
+
align: 'center',
|
|
48
|
+
dataIndex: 'min',
|
|
49
|
+
key: 'min',
|
|
50
|
+
className: "".concat(classPrefix, "-table-td"),
|
|
51
|
+
render: function render(text, record) {
|
|
52
|
+
return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
title: '上四分位',
|
|
56
|
+
width: 148,
|
|
57
|
+
ellipsis: true,
|
|
58
|
+
align: 'center',
|
|
59
|
+
key: 'Q1',
|
|
60
|
+
dataIndex: 'Q1',
|
|
61
|
+
className: "".concat(classPrefix, "-table-td"),
|
|
62
|
+
render: function render(text, record) {
|
|
63
|
+
return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
title: '中位数',
|
|
67
|
+
width: 148,
|
|
68
|
+
ellipsis: true,
|
|
69
|
+
align: 'center',
|
|
70
|
+
dataIndex: 'median',
|
|
71
|
+
key: 'median',
|
|
72
|
+
className: "".concat(classPrefix, "-table-td"),
|
|
73
|
+
render: function render(text, record) {
|
|
74
|
+
return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
|
|
75
|
+
}
|
|
76
|
+
}, {
|
|
77
|
+
title: '下四分位',
|
|
78
|
+
width: 148,
|
|
79
|
+
ellipsis: true,
|
|
80
|
+
align: 'center',
|
|
81
|
+
dataIndex: 'Q3',
|
|
82
|
+
key: 'Q3',
|
|
83
|
+
className: "".concat(classPrefix, "-table-td"),
|
|
84
|
+
render: function render(text, record) {
|
|
85
|
+
return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
title: '最小值',
|
|
89
|
+
width: 148,
|
|
90
|
+
ellipsis: true,
|
|
91
|
+
align: 'center',
|
|
92
|
+
key: 'max',
|
|
93
|
+
dataIndex: 'max',
|
|
94
|
+
className: "".concat(classPrefix, "-table-td"),
|
|
95
|
+
render: function render(text, record) {
|
|
96
|
+
return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
|
|
97
|
+
}
|
|
98
|
+
}, {
|
|
99
|
+
title: '人均值',
|
|
100
|
+
width: 148,
|
|
101
|
+
ellipsis: true,
|
|
102
|
+
align: 'center',
|
|
103
|
+
dataIndex: 'perValue',
|
|
104
|
+
key: 'perValue',
|
|
105
|
+
className: "".concat(classPrefix, "-table-td"),
|
|
106
|
+
render: function render(text, record) {
|
|
107
|
+
return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
title: '人数',
|
|
111
|
+
width: 148,
|
|
112
|
+
ellipsis: true,
|
|
113
|
+
align: 'center',
|
|
114
|
+
dataIndex: 'peopleNum',
|
|
115
|
+
key: 'peopleNum',
|
|
116
|
+
className: "".concat(classPrefix, "-table-td"),
|
|
117
|
+
render: function render(text, record) {
|
|
118
|
+
return /*#__PURE__*/React.createElement("span", null, " ", text);
|
|
119
|
+
}
|
|
120
|
+
}];
|
|
121
|
+
return data;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 获取属性的label
|
|
126
|
+
* @param attrData 当前属性
|
|
127
|
+
* @param eventGroupList 事件属性列表
|
|
128
|
+
* @param userPropList 用户属性列表
|
|
129
|
+
* @param eventEnvList 环境属性列表
|
|
130
|
+
* @returns label
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* 格式化表格数据
|
|
135
|
+
* @param originalData 查询的数据
|
|
136
|
+
* @param hasUserGroup 是否有多个用户群
|
|
137
|
+
* @param attrNum 属性细分个数
|
|
138
|
+
* @param showList 要展示的内容,如果没传,则展示全部
|
|
139
|
+
* @returns
|
|
140
|
+
*/
|
|
141
|
+
export function formTableData(originalData) {
|
|
142
|
+
var result = createNewArray(originalData);
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
function createNewArray(data) {
|
|
146
|
+
var _series$;
|
|
147
|
+
var series = data.app_data.series;
|
|
148
|
+
if (series && ((_series$ = series[0]) === null || _series$ === void 0 ? void 0 : _series$.total.length) === 0) {
|
|
149
|
+
return getChildrenData(data, 0);
|
|
150
|
+
} else {
|
|
151
|
+
var newArray = series === null || series === void 0 ? void 0 : series.map(function (item, i) {
|
|
152
|
+
return {
|
|
153
|
+
key: i + 1,
|
|
154
|
+
time: item.names[0],
|
|
155
|
+
max: item.total[0] || 0,
|
|
156
|
+
Q1: item.total[1] || 0,
|
|
157
|
+
median: item.total[2] || 0,
|
|
158
|
+
Q3: item.total[3] || 0,
|
|
159
|
+
min: item.total[4] || 0,
|
|
160
|
+
perValue: item.total[5] || 0,
|
|
161
|
+
peopleNum: item.total[6] || 0,
|
|
162
|
+
children: getChildrenData(data, i)
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
return newArray;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function getChildrenData(data, index) {
|
|
169
|
+
var _data$app_data = data.app_data,
|
|
170
|
+
series = _data$app_data.series,
|
|
171
|
+
x_axis = _data$app_data.x_axis;
|
|
172
|
+
var firstSeries = series === null || series === void 0 ? void 0 : series[index];
|
|
173
|
+
if (x_axis && firstSeries) {
|
|
174
|
+
var values = firstSeries.values;
|
|
175
|
+
return x_axis.map(function (time, i) {
|
|
176
|
+
return {
|
|
177
|
+
key: i + (index + 1) * 10,
|
|
178
|
+
time: time,
|
|
179
|
+
max: values[i][0] || 0,
|
|
180
|
+
Q1: values[i][1] || 0,
|
|
181
|
+
median: values[i][2] || 0,
|
|
182
|
+
Q3: values[i][3] || 0,
|
|
183
|
+
min: values[i][4] || 0,
|
|
184
|
+
perValue: values[i][5] || 0,
|
|
185
|
+
peopleNum: values[i][6] || 0
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* 获取查询结果的前10条
|
|
193
|
+
* @param source 结果数据
|
|
194
|
+
* @returns 获取查询结果的前10条
|
|
195
|
+
*/
|
|
196
|
+
export function getDefaultShow(source, data) {
|
|
197
|
+
if (source.app_data.series) {
|
|
198
|
+
var filteredArr = source.app_data.series.filter(function (obj) {
|
|
199
|
+
var names = obj.names;
|
|
200
|
+
return data.some(function (item) {
|
|
201
|
+
return names.includes(item.label);
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
return _objectSpread(_objectSpread({}, source), {}, {
|
|
205
|
+
app_data: _objectSpread(_objectSpread({}, source.app_data), {}, {
|
|
206
|
+
series: filteredArr
|
|
207
|
+
})
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return [];
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* 获取显示事件对应的颜色
|
|
214
|
+
* @param source 结果数据
|
|
215
|
+
* @param showList 展示列表
|
|
216
|
+
* @returns 展示列表对应的颜色
|
|
217
|
+
*/
|
|
218
|
+
export function getShowColor(source, showList) {
|
|
219
|
+
var colors = [];
|
|
220
|
+
source.series.forEach(function (item, index) {
|
|
221
|
+
if (item.names) {
|
|
222
|
+
var _item$names;
|
|
223
|
+
var name = item === null || item === void 0 ? void 0 : (_item$names = item.names) === null || _item$names === void 0 ? void 0 : _item$names.join(',');
|
|
224
|
+
showList.forEach(function (show) {
|
|
225
|
+
if (name === show) {
|
|
226
|
+
colors.push(chartColors[index % 20]);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
return colors;
|
|
233
|
+
}
|
|
234
|
+
export function extractNames(data) {
|
|
235
|
+
var series = data.app_data.series;
|
|
236
|
+
var namesArray = [];
|
|
237
|
+
if (series) {
|
|
238
|
+
var _iterator = _createForOfIteratorHelper(series),
|
|
239
|
+
_step;
|
|
240
|
+
try {
|
|
241
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
242
|
+
var item = _step.value;
|
|
243
|
+
for (var i = 0; i < item.names.length; i++) {
|
|
244
|
+
var nameObj = {
|
|
245
|
+
value: (namesArray === null || namesArray === void 0 ? void 0 : namesArray.length) + 1,
|
|
246
|
+
label: item.names[i]
|
|
247
|
+
};
|
|
248
|
+
namesArray.push(nameObj);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
} catch (err) {
|
|
252
|
+
_iterator.e(err);
|
|
253
|
+
} finally {
|
|
254
|
+
_iterator.f();
|
|
255
|
+
}
|
|
256
|
+
return namesArray;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
declare let util: {
|
|
2
|
+
dayTime: number;
|
|
3
|
+
type(obj: any): string;
|
|
4
|
+
isObject(obj: any): boolean;
|
|
5
|
+
isArray(obj: any): boolean;
|
|
6
|
+
isString(obj: any): boolean;
|
|
7
|
+
isNumber(obj: any): boolean;
|
|
8
|
+
isDate(obj: any): boolean;
|
|
9
|
+
isFunction(obj: any): boolean;
|
|
10
|
+
isEqual(a?: {}, b?: {}): boolean;
|
|
11
|
+
equal(a: any, b: any): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* 获取指定范围的随机数
|
|
14
|
+
* @param min
|
|
15
|
+
* @param max
|
|
16
|
+
* @returns {*}
|
|
17
|
+
*/
|
|
18
|
+
random(min: number, max: number): number;
|
|
19
|
+
guid(): string;
|
|
20
|
+
mergeObject(defaults: {
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
}, option: {
|
|
23
|
+
[x: string]: any;
|
|
24
|
+
}): {
|
|
25
|
+
[x: string]: any;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 将数字转为千分位分割格式
|
|
29
|
+
* @param num
|
|
30
|
+
* @returns {string}
|
|
31
|
+
*/
|
|
32
|
+
toThousands(num: number): string;
|
|
33
|
+
/**
|
|
34
|
+
* 为单数前补0
|
|
35
|
+
* @param num
|
|
36
|
+
* @returns {string}
|
|
37
|
+
*/
|
|
38
|
+
toDoubleNumber(num: number): string;
|
|
39
|
+
/**
|
|
40
|
+
* 日期格式化
|
|
41
|
+
* @param date
|
|
42
|
+
* @param formatter
|
|
43
|
+
* @returns {string}
|
|
44
|
+
*/
|
|
45
|
+
dateFormat(date?: any, formatter?: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* 日期格式化
|
|
48
|
+
* @param date
|
|
49
|
+
* @param formatter
|
|
50
|
+
* @returns {string}
|
|
51
|
+
*/
|
|
52
|
+
timeFormat(date: any, formatter: string | undefined, autoShort: any): string | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* 从中间拆分字符串,长度超出的话,解析为xxx...xxx
|
|
55
|
+
* @param str
|
|
56
|
+
* @param config
|
|
57
|
+
* @returns {string}
|
|
58
|
+
*/
|
|
59
|
+
strMiddleSplit(str: string, config?: {
|
|
60
|
+
maxLength: number;
|
|
61
|
+
beginLength: number;
|
|
62
|
+
endLength: number;
|
|
63
|
+
replaceStr: string;
|
|
64
|
+
}): string;
|
|
65
|
+
};
|
|
66
|
+
export default util;
|