@zgfe/modules-attribution 1.0.1-alpha.14 → 1.0.1-alpha.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.
- package/es/components/option/index.js +1 -5
- package/es/components/option/types.d.ts +2 -6
- package/es/components/searchTime/index.js +0 -2
- package/es/components/tableList/index.d.ts +2 -2
- package/es/components/title/index.js +1 -1
- package/es/constants/apis.d.ts +0 -4
- package/es/constants/apis.js +0 -4
- package/es/constants/fields.d.ts +0 -139
- package/es/constants/fields.js +1 -148
- package/es/constants/index.d.ts +2 -4
- package/es/constants/index.js +2 -4
- package/es/modules/content/index.d.ts +2 -2
- package/es/modules/content/index.js +5 -15
- package/es/modules/content/types.d.ts +3 -3
- package/es/modules/home/demo/create.js +4 -34
- package/es/modules/home/demo/edit.js +6 -36
- package/es/modules/home/demo/index.js +3 -35
- package/es/modules/home/demo/scene.js +4 -34
- package/es/modules/home/index.d.ts +2 -2
- package/es/modules/home/index.js +3 -9
- package/es/modules/home/types.d.ts +1 -5
- package/es/modules/searchPanel/components/attributableEvents.js +17 -27
- package/es/modules/searchPanel/components/globalAttribute.d.ts +2 -1
- package/es/modules/searchPanel/components/globalAttribute.js +0 -1
- package/es/modules/searchPanel/components/targetEvent.js +5 -12
- package/es/modules/searchPanel/index.js +6 -24
- package/es/modules/searchPanel/types.d.ts +13 -10
- package/es/modules/searchPanel/utils.d.ts +4 -5
- package/es/modules/searchPanel/utils.js +26 -99
- package/es/types.d.ts +25 -39
- package/package.json +2 -2
- package/es/constants/chart.d.ts +0 -2
- package/es/constants/chart.js +0 -24
- package/es/constants/color.d.ts +0 -1
- package/es/constants/color.js +0 -1
- package/es/modules/searchPanel/demo/index.d.ts +0 -2
- package/es/modules/searchPanel/demo/index.js +0 -28
- package/es/utils/transfer.d.ts +0 -65
- package/es/utils/transfer.js +0 -173
|
@@ -1,87 +1,16 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
export function removeEmptyValue(source) {
|
|
3
|
-
var data = _.cloneDeep(source);
|
|
4
|
-
var getValue = function getValue(formData) {
|
|
5
|
-
if (!formData) return formData;
|
|
6
|
-
var newData = [];
|
|
7
|
-
formData.forEach(function (item) {
|
|
8
|
-
if (item) {
|
|
9
|
-
if (item.filters) {
|
|
10
|
-
var conditions = getConditionList(item.filters.conditions);
|
|
11
|
-
if (conditions) {
|
|
12
|
-
item.filters.conditions = conditions;
|
|
13
|
-
} else {
|
|
14
|
-
item.filters = undefined;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
newData.push(item);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
if (newData.length) return newData.length ? newData : undefined;
|
|
21
|
-
};
|
|
22
|
-
data.targetFilters = getValue(data.targetFilters)[0];
|
|
23
|
-
data.sourceFilters = getValue(data.sourceFilters);
|
|
24
|
-
if (data.globalFilters) {
|
|
25
|
-
var conditions = getConditionList(data.globalFilters.conditions);
|
|
26
|
-
if (conditions) {
|
|
27
|
-
data.globalFilters.conditions = conditions;
|
|
28
|
-
} else {
|
|
29
|
-
data.globalFilters = undefined;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return data;
|
|
33
|
-
}
|
|
34
|
-
export function verifyHandle(data) {
|
|
35
|
-
console.log('判断表单校验是否通过', data);
|
|
36
|
-
var targetFilters = data.targetFilters,
|
|
37
|
-
sourceFilters = data.sourceFilters;
|
|
38
|
-
var _verify = true;
|
|
39
|
-
targetFilters.map(function (item) {
|
|
40
|
-
if (item.eventId === -100 || item === undefined) _verify = false;
|
|
41
|
-
});
|
|
42
|
-
sourceFilters.map(function (item) {
|
|
43
|
-
if (item.eventId === -100 || item === undefined) _verify = false;
|
|
44
|
-
});
|
|
45
|
-
return _verify;
|
|
46
|
-
}
|
|
47
|
-
var OperateTypes;
|
|
48
|
-
(function (OperateTypes) {
|
|
49
|
-
OperateTypes["IsNull"] = "is null";
|
|
50
|
-
OperateTypes["IsNotNull"] = "is not null";
|
|
51
|
-
})(OperateTypes || (OperateTypes = {}));
|
|
52
|
-
function getConditionList(condition) {
|
|
53
|
-
if (!condition) return;
|
|
54
|
-
var conditionList = [];
|
|
55
|
-
condition.forEach(function (item) {
|
|
56
|
-
if (!item.attrId && !item.attrName) return;
|
|
57
|
-
if (!item.values || !item.values.length) {
|
|
58
|
-
if (item.operator === OperateTypes.IsNotNull || item.operator === OperateTypes.IsNull) {
|
|
59
|
-
conditionList.push(item);
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
conditionList.push(item);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
return conditionList.length ? conditionList : undefined;
|
|
66
|
-
}
|
|
67
1
|
export function targetChangeCallback(data, eList, eventGroupList) {
|
|
68
2
|
if (eList[0] === -100) {
|
|
69
3
|
data.globalFilters = undefined;
|
|
70
4
|
} else {
|
|
71
5
|
if (data.globalFilters && data.globalFilters.conditions) {
|
|
72
|
-
var
|
|
73
|
-
flag = true;
|
|
6
|
+
var flag = true;
|
|
74
7
|
data.globalFilters.conditions.forEach(function (condition) {
|
|
75
8
|
if (condition) {
|
|
76
9
|
if (condition.propCategory === 'eventProp' && condition.attrId) {
|
|
77
10
|
var hasExit = judgeAttrInEvents(eList, condition.attrId, eventGroupList);
|
|
78
|
-
if (hasExit) {
|
|
79
|
-
newFilters.push(condition);
|
|
80
|
-
} else {
|
|
11
|
+
if (!hasExit) {
|
|
81
12
|
flag = false;
|
|
82
13
|
}
|
|
83
|
-
} else {
|
|
84
|
-
newFilters.push(condition);
|
|
85
14
|
}
|
|
86
15
|
}
|
|
87
16
|
});
|
|
@@ -92,6 +21,30 @@ export function targetChangeCallback(data, eList, eventGroupList) {
|
|
|
92
21
|
}
|
|
93
22
|
return data;
|
|
94
23
|
}
|
|
24
|
+
var judgeAttrInEvents = function judgeAttrInEvents(elds, attrId, eventGroupList) {
|
|
25
|
+
var flag = false;
|
|
26
|
+
if (!eventGroupList) return false;
|
|
27
|
+
eventGroupList.forEach(function (group) {
|
|
28
|
+
group.eventList.forEach(function (event) {
|
|
29
|
+
if (elds.includes(event.id)) {
|
|
30
|
+
event.attrList.forEach(function (attr) {
|
|
31
|
+
if (attr.id === attrId) {
|
|
32
|
+
flag = true;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
return flag;
|
|
40
|
+
};
|
|
41
|
+
export function submitButtonDisableHandle(data, attrSourceCount, attrTargetCount, mincePropCount) {
|
|
42
|
+
var flag = false;
|
|
43
|
+
data.attributionType === undefined ? flag = true : null;
|
|
44
|
+
buttonDisable(data, 'sourceFilters', attrSourceCount, mincePropCount) ? flag = true : null;
|
|
45
|
+
buttonDisable(data, 'targetFilters', attrTargetCount) ? flag = true : null;
|
|
46
|
+
return flag;
|
|
47
|
+
}
|
|
95
48
|
var buttonDisable = function buttonDisable(data, type, count, mincePropCount) {
|
|
96
49
|
var flag = false;
|
|
97
50
|
data[type].map(function (item) {
|
|
@@ -118,36 +71,10 @@ var buttonDisable = function buttonDisable(data, type, count, mincePropCount) {
|
|
|
118
71
|
((_item$filters3 = item.filters) === null || _item$filters3 === void 0 ? void 0 : _item$filters3.conditions.length) != count ? flag = true : null;
|
|
119
72
|
} else {
|
|
120
73
|
var _item$filters4;
|
|
121
|
-
console.log('问题排查', item, count);
|
|
122
74
|
((_item$filters4 = item.filters) === null || _item$filters4 === void 0 ? void 0 : _item$filters4.conditions.length) != count[item.eventId] ? flag = true : null;
|
|
123
75
|
}
|
|
124
76
|
}
|
|
125
77
|
}
|
|
126
78
|
});
|
|
127
79
|
return flag;
|
|
128
|
-
};
|
|
129
|
-
export function submitButtonDisableHandle(data, attrSourceCount, attrTargetCount, mincePropCount) {
|
|
130
|
-
var flag = false;
|
|
131
|
-
data.attributionType === undefined ? flag = true : null;
|
|
132
|
-
buttonDisable(data, 'sourceFilters', attrSourceCount, mincePropCount) ? flag = true : null;
|
|
133
|
-
buttonDisable(data, 'targetFilters', attrTargetCount) ? flag = true : null;
|
|
134
|
-
console.log('判断提交按钮是否可点击', mincePropCount, flag, data);
|
|
135
|
-
return flag;
|
|
136
|
-
}
|
|
137
|
-
var judgeAttrInEvents = function judgeAttrInEvents(elds, attrId, eventGroupList) {
|
|
138
|
-
var flag = false;
|
|
139
|
-
if (!eventGroupList) return false;
|
|
140
|
-
eventGroupList.forEach(function (group) {
|
|
141
|
-
group.eventList.forEach(function (event) {
|
|
142
|
-
if (elds.includes(event.id)) {
|
|
143
|
-
event.attrList.forEach(function (attr) {
|
|
144
|
-
if (attr.id === attrId) {
|
|
145
|
-
flag = true;
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
return flag;
|
|
153
80
|
};
|
package/es/types.d.ts
CHANGED
|
@@ -1,45 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AttrConditionTypes } from '@zgfe/business-lib';
|
|
2
3
|
import { DatePickerTypes } from '@zgfe/business-lib/es/datePicker/types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
sourceFilters?: Array<TargetConditionTypes.Value>;
|
|
4
|
+
export interface SearchValueProps {
|
|
5
|
+
targetFilters: Array<FiltersProps>;
|
|
6
|
+
sourceFilters: Array<FiltersProps>;
|
|
7
7
|
globalFilters?: AttrConditionTypes.GroupValue;
|
|
8
8
|
globalDimensions?: Array<AttrConditionTypes.ItemValue>;
|
|
9
9
|
time?: DatePickerTypes.Value;
|
|
10
10
|
otherEvent?: boolean;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
targetFilters: Array<TargetConditionTypes.Value>;
|
|
14
|
-
sourceFilters: Array<TargetConditionTypes.Value>;
|
|
15
|
-
globalFilters?: AttrConditionTypes.GroupValue;
|
|
16
|
-
time?: DatePickerTypes.Value;
|
|
11
|
+
windowCnt?: number;
|
|
12
|
+
windowType?: 'hour' | 'day';
|
|
17
13
|
attributionType?: number;
|
|
18
|
-
otherEvent?: boolean;
|
|
19
14
|
}
|
|
20
|
-
export interface
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
export interface
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export interface SeriesProps {
|
|
35
|
-
names?: string[];
|
|
36
|
-
values: number[];
|
|
37
|
-
index?: string;
|
|
38
|
-
duration?: TableChildrenProps[];
|
|
39
|
-
}
|
|
40
|
-
export interface TableChildrenProps {
|
|
41
|
-
name: string;
|
|
42
|
-
values: number[];
|
|
15
|
+
export interface FiltersProps {
|
|
16
|
+
eventId: number;
|
|
17
|
+
eventName: string;
|
|
18
|
+
filters?: AttrConditionTypes.GroupValue | undefined;
|
|
19
|
+
propfilters?: PropfiltersProps | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface PropfiltersProps {
|
|
22
|
+
attrId: number | undefined;
|
|
23
|
+
propCategory: string | undefined;
|
|
24
|
+
type: string | undefined;
|
|
25
|
+
id?: number | undefined;
|
|
26
|
+
name?: string | undefined;
|
|
27
|
+
category?: string | undefined;
|
|
28
|
+
attrName?: string | undefined;
|
|
43
29
|
}
|
|
44
30
|
export interface TableDataHandleProps {
|
|
45
31
|
xAxis: string[];
|
|
@@ -47,6 +33,10 @@ export interface TableDataHandleProps {
|
|
|
47
33
|
values: string[];
|
|
48
34
|
}[];
|
|
49
35
|
}
|
|
36
|
+
export interface TableDataProps {
|
|
37
|
+
columns?: ColumnsProps[];
|
|
38
|
+
dataSource?: DataSourceProps[];
|
|
39
|
+
}
|
|
50
40
|
export interface DataSourceProps {
|
|
51
41
|
[x: string]: string;
|
|
52
42
|
}
|
|
@@ -55,8 +45,4 @@ export interface ColumnsProps {
|
|
|
55
45
|
title: string;
|
|
56
46
|
dataIndex: string;
|
|
57
47
|
}
|
|
58
|
-
export interface TableDataProps {
|
|
59
|
-
columns?: ColumnsProps[];
|
|
60
|
-
dataSource?: DataSourceProps[];
|
|
61
|
-
}
|
|
62
48
|
export declare const AttributableContext: import("react").Context<any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/modules-attribution",
|
|
3
|
-
"version": "1.0.1-alpha.
|
|
3
|
+
"version": "1.0.1-alpha.17",
|
|
4
4
|
"module": "es/index.js",
|
|
5
5
|
"typings": "es/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"react": "^16.12.0 || ^17.0.0",
|
|
51
51
|
"yorkie": "^2.0.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "42736ac302cd121803ec35470562312ca4b452fe"
|
|
54
54
|
}
|
package/es/constants/chart.d.ts
DELETED
package/es/constants/chart.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { IconFont } from '@zgfe/business-lib';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export var chartTypeOptions = [{
|
|
4
|
-
label: '趋势图',
|
|
5
|
-
value: 'line',
|
|
6
|
-
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
7
|
-
type: "qushitu1",
|
|
8
|
-
size: 16
|
|
9
|
-
})
|
|
10
|
-
}, {
|
|
11
|
-
label: '汇总图',
|
|
12
|
-
value: 'bar',
|
|
13
|
-
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
14
|
-
type: "huizongtu",
|
|
15
|
-
size: 16
|
|
16
|
-
})
|
|
17
|
-
}, {
|
|
18
|
-
label: '地图',
|
|
19
|
-
value: 'map',
|
|
20
|
-
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
21
|
-
type: "ditu",
|
|
22
|
-
size: 16
|
|
23
|
-
})
|
|
24
|
-
}];
|
package/es/constants/color.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const chartColors: string[];
|
package/es/constants/color.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export var chartColors = ['#165DFF', '#80E1D9', '#65789B', '#F8BC3B', '#6F66ED', '#66AFED', '#9661BC', '#FF7557', '#4DB273', '#F08BB4', '#CDDBFD', '#CDF3F0', '#CED4DE', '#FCE7B9', '#D1CEFD', '#D3E7F9', '#DFCFEA', '#FFD1C7', '#BBDEC8', '#FFE0ED'];
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { DemoWrapper } from '@zgfe/business-lib';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import SearchPanel from '..';
|
|
4
|
-
var defaultValue = {
|
|
5
|
-
targets: [{
|
|
6
|
-
type: 'event',
|
|
7
|
-
alias: '事件概览',
|
|
8
|
-
eventId: -100,
|
|
9
|
-
eventName: '事件概览',
|
|
10
|
-
eventGroupId: 0,
|
|
11
|
-
analysisDimension: {
|
|
12
|
-
analysisIndex: 'number'
|
|
13
|
-
}
|
|
14
|
-
}],
|
|
15
|
-
userGroup: [0]
|
|
16
|
-
};
|
|
17
|
-
export default (function () {
|
|
18
|
-
var onChange = function onChange(data) {
|
|
19
|
-
console.log(data);
|
|
20
|
-
};
|
|
21
|
-
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
22
|
-
needMeta: true,
|
|
23
|
-
defaultApp: 177
|
|
24
|
-
}, /*#__PURE__*/React.createElement(SearchPanel, {
|
|
25
|
-
defaultValue: defaultValue,
|
|
26
|
-
onChange: onChange
|
|
27
|
-
}));
|
|
28
|
-
});
|
package/es/utils/transfer.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { EnvProp, EventGroup, UserProp } from '@zgfe/business-lib/es/attributeSelector/types';
|
|
2
|
-
interface OldSearchData {
|
|
3
|
-
app_id: number;
|
|
4
|
-
platform: number;
|
|
5
|
-
analysis_index: string;
|
|
6
|
-
module: 'event';
|
|
7
|
-
chartType: 'string';
|
|
8
|
-
event_attr?: string;
|
|
9
|
-
user_attr?: string;
|
|
10
|
-
event?: number;
|
|
11
|
-
time: {
|
|
12
|
-
dimension_date: string;
|
|
13
|
-
begin_date: string | number;
|
|
14
|
-
end_date: string | number;
|
|
15
|
-
} | string;
|
|
16
|
-
event_group_id?: number;
|
|
17
|
-
user_group: string;
|
|
18
|
-
analysis_attr?: string;
|
|
19
|
-
dimension_sub?: string;
|
|
20
|
-
filter_condition?: {
|
|
21
|
-
eventCondition?: {
|
|
22
|
-
eventSingleConditions?: [
|
|
23
|
-
{
|
|
24
|
-
attrConditions: OldEventCondition[];
|
|
25
|
-
environmentConditions: OldCondition[];
|
|
26
|
-
eventId: number;
|
|
27
|
-
eventName: string;
|
|
28
|
-
extra?: string;
|
|
29
|
-
happenTime?: {
|
|
30
|
-
name: string;
|
|
31
|
-
operator: string;
|
|
32
|
-
params: any[];
|
|
33
|
-
type: number;
|
|
34
|
-
};
|
|
35
|
-
isNew?: boolean;
|
|
36
|
-
}
|
|
37
|
-
];
|
|
38
|
-
operator: 'and';
|
|
39
|
-
};
|
|
40
|
-
userCondition: {
|
|
41
|
-
userSingleConditions: OldUserCondition[];
|
|
42
|
-
operator: 'and';
|
|
43
|
-
};
|
|
44
|
-
} | string;
|
|
45
|
-
}
|
|
46
|
-
interface OldCondition {
|
|
47
|
-
attrId: number;
|
|
48
|
-
name: string;
|
|
49
|
-
type: number;
|
|
50
|
-
category: 'fixed' | 'custom';
|
|
51
|
-
operator: string;
|
|
52
|
-
text: string;
|
|
53
|
-
params: any[];
|
|
54
|
-
}
|
|
55
|
-
interface OldUserCondition extends OldCondition {
|
|
56
|
-
isUserProp: boolean;
|
|
57
|
-
subtype?: number;
|
|
58
|
-
}
|
|
59
|
-
interface OldEventCondition extends OldCondition {
|
|
60
|
-
isEventProp: boolean;
|
|
61
|
-
eventId: number;
|
|
62
|
-
eventName: string;
|
|
63
|
-
}
|
|
64
|
-
export declare function transferEventSearchData(params: OldSearchData, userPropList?: UserProp[], eventGroupList?: EventGroup[], eventEnvList?: EnvProp[]): any;
|
|
65
|
-
export {};
|
package/es/utils/transfer.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
import moment from 'moment';
|
|
5
|
-
import util from './util';
|
|
6
|
-
export function transferEventSearchData(params) {
|
|
7
|
-
var userPropList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
8
|
-
var eventGroupList = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
9
|
-
var eventEnvList = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
10
|
-
var result = {
|
|
11
|
-
userGroup: params.user_group.split(','),
|
|
12
|
-
targets: [],
|
|
13
|
-
chartType: params.chartType
|
|
14
|
-
};
|
|
15
|
-
var timeData = params.time;
|
|
16
|
-
if (util.isString(timeData)) {
|
|
17
|
-
timeData = JSON.parse(timeData);
|
|
18
|
-
}
|
|
19
|
-
var time = timeData.dimension_date.split(',');
|
|
20
|
-
var unit = time[0];
|
|
21
|
-
var begin = timeData.begin_date;
|
|
22
|
-
var end = timeData.end_date;
|
|
23
|
-
if (time.includes('total') || begin.indexOf('-') < 0) {
|
|
24
|
-
result.time = {
|
|
25
|
-
unit: unit,
|
|
26
|
-
relative: [begin, end],
|
|
27
|
-
begin: moment().subtract(begin, unit).format('YYYY-MM-DD'),
|
|
28
|
-
end: moment().subtract(end, 'days').format('YYYY-MM-DD')
|
|
29
|
-
};
|
|
30
|
-
} else {
|
|
31
|
-
result.time = {
|
|
32
|
-
unit: unit,
|
|
33
|
-
begin: begin,
|
|
34
|
-
end: end
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
if (params.platform) {
|
|
38
|
-
var envData;
|
|
39
|
-
eventEnvList.forEach(function (env) {
|
|
40
|
-
if (env.name === 'platform') {
|
|
41
|
-
envData = env;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
if (envData) {
|
|
45
|
-
var platforms = ['android', 'ios', 'js'];
|
|
46
|
-
result.globalFilters = {
|
|
47
|
-
relation: 'and',
|
|
48
|
-
conditions: [{
|
|
49
|
-
attrId: envData.id,
|
|
50
|
-
attrName: 'platform',
|
|
51
|
-
dimensionSub: 'platform',
|
|
52
|
-
label: envData.label,
|
|
53
|
-
category: envData.category,
|
|
54
|
-
type: envData.type,
|
|
55
|
-
operator: 'equal',
|
|
56
|
-
propCategory: 'envProp',
|
|
57
|
-
values: [platforms[params.platform - 1]]
|
|
58
|
-
}]
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (params.dimension_sub && params.event) {
|
|
63
|
-
var data = transferDimension(userPropList, eventGroupList, eventEnvList, params.dimension_sub, params.event, params.event_attr, params.user_attr);
|
|
64
|
-
if (data) {
|
|
65
|
-
result.globalDimensions = [data];
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
var targets = {
|
|
69
|
-
type: params.module,
|
|
70
|
-
alias: '',
|
|
71
|
-
eventGroupId: params.event_group_id || 0,
|
|
72
|
-
eventId: params.event || -100,
|
|
73
|
-
analysisDimension: {
|
|
74
|
-
analysisIndex: params.analysis_index,
|
|
75
|
-
analysisAttr: params.event_attr
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
if (params.filter_condition) {
|
|
79
|
-
var conditions = [];
|
|
80
|
-
var filterCondition = params.filter_condition;
|
|
81
|
-
if (util.isString(filterCondition)) {
|
|
82
|
-
filterCondition = JSON.parse(filterCondition);
|
|
83
|
-
}
|
|
84
|
-
var _filterCondition = filterCondition,
|
|
85
|
-
eventCondition = _filterCondition.eventCondition,
|
|
86
|
-
userCondition = _filterCondition.userCondition;
|
|
87
|
-
if (eventCondition && eventCondition.eventSingleConditions) {
|
|
88
|
-
eventCondition.eventSingleConditions.forEach(function (e) {
|
|
89
|
-
if (e.happenTime && e.happenTime.params.length) {
|
|
90
|
-
if (e.happenTime.params[0] === 'relative') {
|
|
91
|
-
result.time.relative = [e.happenTime.params[1], e.happenTime.params[2]];
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (e.eventName) {
|
|
95
|
-
targets.eventName = e.eventName;
|
|
96
|
-
}
|
|
97
|
-
if (e.attrConditions) {
|
|
98
|
-
conditions = conditions.concat(transferCondition(e.attrConditions));
|
|
99
|
-
}
|
|
100
|
-
if (e.environmentConditions) {
|
|
101
|
-
conditions = conditions.concat(transferCondition(e.environmentConditions));
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
if (userCondition && userCondition.userSingleConditions) {
|
|
106
|
-
conditions = conditions.concat(transferCondition(userCondition.userSingleConditions));
|
|
107
|
-
}
|
|
108
|
-
targets.filters = {
|
|
109
|
-
conditions: conditions,
|
|
110
|
-
relation: 'and'
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
result.targets = [targets];
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
116
|
-
function transferDimension(userPropList, eventGroupList, eventEnvList, dimensionSub, eventId, eventAttr, userAttr) {
|
|
117
|
-
var data;
|
|
118
|
-
if (eventAttr) {
|
|
119
|
-
eventGroupList.forEach(function (group) {
|
|
120
|
-
group.eventList.forEach(function (event) {
|
|
121
|
-
if (event.id === eventId) {
|
|
122
|
-
event.attrList.forEach(function (attr) {
|
|
123
|
-
if (attr.label === eventAttr && !data) {
|
|
124
|
-
data = {
|
|
125
|
-
attrId: attr.id,
|
|
126
|
-
attrName: attr.label,
|
|
127
|
-
propCategory: 'eventProp',
|
|
128
|
-
type: attr.type
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
} else if (userAttr) {
|
|
136
|
-
userPropList.forEach(function (user) {
|
|
137
|
-
if (user.name === userAttr) {
|
|
138
|
-
data = _objectSpread({
|
|
139
|
-
attrId: user.id,
|
|
140
|
-
attrName: user.name
|
|
141
|
-
}, user);
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
} else {
|
|
145
|
-
eventEnvList.forEach(function (env) {
|
|
146
|
-
if (env.name === dimensionSub) {
|
|
147
|
-
data = _objectSpread({
|
|
148
|
-
attrId: env.id,
|
|
149
|
-
attrName: env.name
|
|
150
|
-
}, env);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
return data;
|
|
155
|
-
}
|
|
156
|
-
function transferCondition(conditions) {
|
|
157
|
-
var result = [];
|
|
158
|
-
conditions.forEach(function (attr) {
|
|
159
|
-
result.push({
|
|
160
|
-
subtype: attr.subtype,
|
|
161
|
-
attrId: attr.attrId,
|
|
162
|
-
attrName: attr.name,
|
|
163
|
-
label: attr.text,
|
|
164
|
-
type: attr.type,
|
|
165
|
-
propCategory: attr.isEventProp ? 'eventProp' : attr.isUserProp ? 'userProp' : 'envProp',
|
|
166
|
-
category: attr.category,
|
|
167
|
-
dimensionSub: attr.category,
|
|
168
|
-
operator: attr.operator,
|
|
169
|
-
values: attr.params
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
return result;
|
|
173
|
-
}
|