@zgfe/modules-attribution 1.0.1-alpha.1 → 1.0.1-alpha.14
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 +15 -5
- package/es/components/option/types.d.ts +1 -0
- package/es/components/searchTime/index.js +2 -1
- package/es/components/tableList/index.js +9 -3
- package/es/components/title/index.js +6 -5
- package/es/modules/content/index.js +46 -17
- package/es/modules/content/utils.d.ts +0 -6
- package/es/modules/content/utils.js +0 -163
- package/es/modules/home/demo/create.js +1 -1
- package/es/modules/home/demo/edit.js +105 -122
- package/es/modules/home/demo/index.js +1 -1
- package/es/modules/home/demo/scene.js +1 -1
- package/es/modules/home/index.js +7 -17
- package/es/modules/searchPanel/components/attributableEvents.js +102 -23
- package/es/modules/searchPanel/components/targetEvent.js +25 -14
- package/es/modules/searchPanel/index.d.ts +1 -1
- package/es/modules/searchPanel/index.js +56 -21
- package/es/modules/searchPanel/types.d.ts +14 -3
- package/es/modules/searchPanel/utils.d.ts +5 -1
- package/es/modules/searchPanel/utils.js +21 -7
- package/package.json +2 -2
|
@@ -11,144 +11,127 @@ import { requestConfig } from '../../../utils/ajaxConfig';
|
|
|
11
11
|
import { Button } from 'antd';
|
|
12
12
|
var defaultValue = {
|
|
13
13
|
id: 1426,
|
|
14
|
-
name: '
|
|
14
|
+
name: '999',
|
|
15
15
|
type: 0,
|
|
16
16
|
enlarged: 0,
|
|
17
17
|
panelId: 438,
|
|
18
18
|
panelType: 'edit',
|
|
19
19
|
data: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
filters: {
|
|
37
|
-
relation: 'and',
|
|
38
|
-
conditions: [{
|
|
39
|
-
attrId: 263,
|
|
40
|
-
propCategory: 'eventProp',
|
|
41
|
-
type: 1,
|
|
42
|
-
operator: 'equal',
|
|
43
|
-
values: ['事件属性1', '事件属性2'],
|
|
44
|
-
dimensionSub: 'event_attr',
|
|
45
|
-
label: '机身宽度',
|
|
46
|
-
attrName: '机身宽度'
|
|
47
|
-
}, {
|
|
48
|
-
attrId: 3,
|
|
49
|
-
propCategory: 'userProp',
|
|
50
|
-
type: 1,
|
|
51
|
-
operator: 'equal',
|
|
52
|
-
values: ['用户属性【名称1】', '用户属性【名称2】'],
|
|
53
|
-
dimensionSub: 'name',
|
|
54
|
-
label: '名称',
|
|
55
|
-
attrName: 'name',
|
|
56
|
-
category: 'fixed'
|
|
20
|
+
"app_id": 21,
|
|
21
|
+
"module": "attribution",
|
|
22
|
+
"targetFilters": {
|
|
23
|
+
"eventId": 6078,
|
|
24
|
+
"eventName": "埋点事件-11",
|
|
25
|
+
"filters": {
|
|
26
|
+
"relation": "and",
|
|
27
|
+
"conditions": [{
|
|
28
|
+
"attrId": 139498,
|
|
29
|
+
"propCategory": "eventProp",
|
|
30
|
+
"type": 2,
|
|
31
|
+
"operator": "gt",
|
|
32
|
+
"values": ["99"],
|
|
33
|
+
"dimensionSub": "event_attr",
|
|
34
|
+
"label": "商品总价",
|
|
35
|
+
"attrName": "商品总价"
|
|
57
36
|
}, {
|
|
58
|
-
attrId:
|
|
59
|
-
propCategory:
|
|
60
|
-
type: 1,
|
|
61
|
-
operator:
|
|
62
|
-
values: [
|
|
63
|
-
dimensionSub:
|
|
64
|
-
label:
|
|
65
|
-
attrName:
|
|
66
|
-
category: 'fixed'
|
|
37
|
+
"attrId": 139372,
|
|
38
|
+
"propCategory": "eventProp",
|
|
39
|
+
"type": 1,
|
|
40
|
+
"operator": "equal",
|
|
41
|
+
"values": ["12"],
|
|
42
|
+
"dimensionSub": "event_attr",
|
|
43
|
+
"label": "机身宽度",
|
|
44
|
+
"attrName": "机身宽度"
|
|
67
45
|
}]
|
|
68
46
|
}
|
|
69
47
|
},
|
|
70
|
-
sourceFilters: [{
|
|
71
|
-
eventId:
|
|
72
|
-
eventName:
|
|
73
|
-
|
|
74
|
-
relation:
|
|
75
|
-
conditions: [{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
48
|
+
"sourceFilters": [{
|
|
49
|
+
"eventId": 6090,
|
|
50
|
+
"eventName": "间隔事件-01",
|
|
51
|
+
"filters": {
|
|
52
|
+
"relation": "and",
|
|
53
|
+
"conditions": [{
|
|
54
|
+
"attrId": 139498,
|
|
55
|
+
"propCategory": "eventProp",
|
|
56
|
+
"type": 2,
|
|
57
|
+
"operator": "gt",
|
|
58
|
+
"values": ["11"],
|
|
59
|
+
"dimensionSub": "event_attr",
|
|
60
|
+
"label": "商品总价",
|
|
61
|
+
"attrName": "商品总价"
|
|
62
|
+
}, {
|
|
63
|
+
"attrId": 139488,
|
|
64
|
+
"propCategory": "eventProp",
|
|
65
|
+
"type": 2,
|
|
66
|
+
"operator": "gt",
|
|
67
|
+
"values": ["77"],
|
|
68
|
+
"dimensionSub": "event_attr",
|
|
69
|
+
"label": "商品单价",
|
|
70
|
+
"attrName": "商品单价"
|
|
81
71
|
}]
|
|
82
72
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
attrName: 'name',
|
|
103
|
-
category: 'fixed'
|
|
73
|
+
"propfilters": {
|
|
74
|
+
"propCategory": "eventProp",
|
|
75
|
+
"type": 1,
|
|
76
|
+
"attrId": 139499
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
"eventId": 6088,
|
|
80
|
+
"eventName": "间隔事件-02",
|
|
81
|
+
"filters": {
|
|
82
|
+
"relation": "and",
|
|
83
|
+
"conditions": [{
|
|
84
|
+
"attrId": 139494,
|
|
85
|
+
"propCategory": "eventProp",
|
|
86
|
+
"type": 2,
|
|
87
|
+
"operator": "gt",
|
|
88
|
+
"values": ["22"],
|
|
89
|
+
"dimensionSub": "event_attr",
|
|
90
|
+
"label": "商品总价",
|
|
91
|
+
"attrName": "商品总价"
|
|
104
92
|
}, {
|
|
105
|
-
attrId:
|
|
106
|
-
propCategory:
|
|
107
|
-
type:
|
|
108
|
-
operator:
|
|
109
|
-
values: [
|
|
110
|
-
dimensionSub:
|
|
111
|
-
label:
|
|
112
|
-
attrName:
|
|
113
|
-
category: 'fixed'
|
|
93
|
+
"attrId": 139493,
|
|
94
|
+
"propCategory": "eventProp",
|
|
95
|
+
"type": 2,
|
|
96
|
+
"operator": "gt",
|
|
97
|
+
"values": ["33"],
|
|
98
|
+
"dimensionSub": "event_attr",
|
|
99
|
+
"label": "商品单价",
|
|
100
|
+
"attrName": "商品单价"
|
|
114
101
|
}]
|
|
102
|
+
},
|
|
103
|
+
"propfilters": {
|
|
104
|
+
"propCategory": "eventProp",
|
|
105
|
+
"type": 1,
|
|
106
|
+
"attrId": 139490
|
|
115
107
|
}
|
|
116
108
|
}],
|
|
117
|
-
globalFilters: {
|
|
118
|
-
relation:
|
|
119
|
-
conditions: [{
|
|
120
|
-
attrId:
|
|
121
|
-
propCategory:
|
|
122
|
-
type:
|
|
123
|
-
operator:
|
|
124
|
-
values: [
|
|
125
|
-
dimensionSub:
|
|
126
|
-
label:
|
|
127
|
-
attrName:
|
|
128
|
-
}, {
|
|
129
|
-
attrId: 3,
|
|
130
|
-
propCategory: 'userProp',
|
|
131
|
-
type: 1,
|
|
132
|
-
operator: 'equal',
|
|
133
|
-
values: ['用户属性【名称1】', '用户属性【名称2】'],
|
|
134
|
-
dimensionSub: 'name',
|
|
135
|
-
label: '名称',
|
|
136
|
-
attrName: 'name',
|
|
137
|
-
category: 'fixed'
|
|
138
|
-
}, {
|
|
139
|
-
attrId: 0,
|
|
140
|
-
propCategory: 'envProp',
|
|
141
|
-
type: 1,
|
|
142
|
-
operator: 'equal',
|
|
143
|
-
values: ['触发环境1', '触发环境2'],
|
|
144
|
-
dimensionSub: 'utm_source',
|
|
145
|
-
label: 'utm_source',
|
|
146
|
-
attrName: 'utm_source',
|
|
147
|
-
category: 'fixed'
|
|
109
|
+
"globalFilters": {
|
|
110
|
+
"relation": "and",
|
|
111
|
+
"conditions": [{
|
|
112
|
+
"attrId": 139300,
|
|
113
|
+
"propCategory": "eventProp",
|
|
114
|
+
"type": 2,
|
|
115
|
+
"operator": "gt",
|
|
116
|
+
"values": ["87"],
|
|
117
|
+
"dimensionSub": "event_attr",
|
|
118
|
+
"label": "商品价格",
|
|
119
|
+
"attrName": "商品价格"
|
|
148
120
|
}]
|
|
149
|
-
}
|
|
121
|
+
},
|
|
122
|
+
"attributionType": 3,
|
|
123
|
+
"otherEvent": true,
|
|
124
|
+
"windowCnt": 2,
|
|
125
|
+
"windowType": "hour",
|
|
126
|
+
"time": {
|
|
127
|
+
"unit": "day",
|
|
128
|
+
"relative": [14, 0],
|
|
129
|
+
"begin": "2023-05-17",
|
|
130
|
+
"end": "2023-05-31"
|
|
131
|
+
},
|
|
132
|
+
"chartType": "grid"
|
|
150
133
|
},
|
|
151
|
-
chosen_data: [
|
|
134
|
+
chosen_data: []
|
|
152
135
|
};
|
|
153
136
|
export default (function () {
|
|
154
137
|
var _useState = useState(false),
|
|
@@ -177,7 +160,7 @@ export default (function () {
|
|
|
177
160
|
};
|
|
178
161
|
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
179
162
|
needMeta: true,
|
|
180
|
-
defaultApp:
|
|
163
|
+
defaultApp: 21
|
|
181
164
|
}, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
|
|
182
165
|
onClick: function onClick() {
|
|
183
166
|
return setIsDetail(false);
|
|
@@ -37,7 +37,7 @@ export default (function () {
|
|
|
37
37
|
};
|
|
38
38
|
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
39
39
|
needMeta: true,
|
|
40
|
-
defaultApp:
|
|
40
|
+
defaultApp: 21
|
|
41
41
|
}, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
|
|
42
42
|
onClick: function onClick() {
|
|
43
43
|
return setIsDetail(false);
|
|
@@ -61,7 +61,7 @@ export default (function () {
|
|
|
61
61
|
};
|
|
62
62
|
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
63
63
|
needMeta: true,
|
|
64
|
-
defaultApp:
|
|
64
|
+
defaultApp: 21
|
|
65
65
|
}, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
|
|
66
66
|
onClick: function onClick() {
|
|
67
67
|
return setIsDetail(false);
|
package/es/modules/home/index.js
CHANGED
|
@@ -7,22 +7,17 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
7
7
|
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; }
|
|
8
8
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
9
9
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
10
|
-
import React, {
|
|
10
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
11
11
|
import { Spin } from 'antd';
|
|
12
|
-
import { BizGlobalDataContext } from '@zgfe/business-lib';
|
|
13
12
|
import './styles/index.less';
|
|
14
13
|
import { AttributableContext } from '../../types';
|
|
15
14
|
import EditTitle from '../../components/title';
|
|
16
15
|
import { getInitDate, initTarget } from '../../constants/initData';
|
|
17
|
-
import { transferEventSearchData } from '../../utils/transfer';
|
|
18
16
|
import InsightContent from '../content';
|
|
19
17
|
var classPrefix = 'attribution-container';
|
|
20
18
|
var AttributionHome = function AttributionHome(props) {
|
|
21
19
|
var _props$defaultValue;
|
|
22
|
-
|
|
23
|
-
userPropList = _useContext.userPropList,
|
|
24
|
-
eventGroupList = _useContext.eventGroupList,
|
|
25
|
-
eventEnvList = _useContext.eventEnvList;
|
|
20
|
+
console.log('AttributionHome-props: ', props);
|
|
26
21
|
var _useState = useState(),
|
|
27
22
|
_useState2 = _slicedToArray(_useState, 2),
|
|
28
23
|
searchData = _useState2[0],
|
|
@@ -68,16 +63,9 @@ var AttributionHome = function AttributionHome(props) {
|
|
|
68
63
|
if (!initData) {
|
|
69
64
|
initSearch();
|
|
70
65
|
} else {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
if (!initData.userGroup || !initData.targets) {
|
|
75
|
-
setSearchData(function (data) {
|
|
76
|
-
return _objectSpread(_objectSpread({}, data), initData);
|
|
77
|
-
});
|
|
78
|
-
} else {
|
|
79
|
-
setSearchData(_objectSpread({}, initData));
|
|
80
|
-
}
|
|
66
|
+
setSearchData(_objectSpread(_objectSpread({}, initData), {}, {
|
|
67
|
+
targetFilters: [initData.targetFilters]
|
|
68
|
+
}));
|
|
81
69
|
}
|
|
82
70
|
}
|
|
83
71
|
setTimeout(function () {
|
|
@@ -96,11 +84,13 @@ var AttributionHome = function AttributionHome(props) {
|
|
|
96
84
|
};
|
|
97
85
|
var onSave = function onSave() {
|
|
98
86
|
if (insightRef) {
|
|
87
|
+
insightRef.current.onGetSearchData();
|
|
99
88
|
insightRef.current.savePanel();
|
|
100
89
|
}
|
|
101
90
|
};
|
|
102
91
|
var onSaveAs = function onSaveAs() {
|
|
103
92
|
if (insightRef) {
|
|
93
|
+
insightRef.current.onGetSearchData();
|
|
104
94
|
insightRef.current.saveAsPanel();
|
|
105
95
|
}
|
|
106
96
|
};
|
|
@@ -8,12 +8,16 @@ import React, { useEffect, useRef, useState, useContext } from 'react';
|
|
|
8
8
|
import { BizAttributeSelector, BizAttrConditionGroup, BizEventSelector, IconFont } from '@zgfe/business-lib';
|
|
9
9
|
import { AttributableContext } from '../../../types';
|
|
10
10
|
import _ from 'lodash';
|
|
11
|
-
import { Tooltip } from 'antd';
|
|
11
|
+
import { Tooltip, message } from 'antd';
|
|
12
12
|
var AttributableEvents = function AttributableEvents(props) {
|
|
13
13
|
var value = props.value,
|
|
14
|
-
|
|
14
|
+
setMincePropCount = props.setMincePropCount,
|
|
15
|
+
mincePropCount = props.mincePropCount,
|
|
16
|
+
attrSourceCount = props.attrSourceCount,
|
|
15
17
|
setAttrSourceCount = props.setAttrSourceCount,
|
|
18
|
+
formData = props.formData,
|
|
16
19
|
showOverview = props.showOverview,
|
|
20
|
+
eventIdList = props.eventIdList,
|
|
17
21
|
onDelete = props.onDelete;
|
|
18
22
|
var _useContext = useContext(AttributableContext),
|
|
19
23
|
setButtonDisable = _useContext.setButtonDisable;
|
|
@@ -29,11 +33,14 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
29
33
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
30
34
|
filters = _useState6[0],
|
|
31
35
|
setFilters = _useState6[1];
|
|
36
|
+
useEffect(function () {
|
|
37
|
+
console.log('初始化-filters', filters);
|
|
38
|
+
}, [filters]);
|
|
32
39
|
var _useState7 = useState(0),
|
|
33
40
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
34
41
|
count = _useState8[0],
|
|
35
42
|
setCount = _useState8[1];
|
|
36
|
-
var _useState9 = useState(
|
|
43
|
+
var _useState9 = useState(false),
|
|
37
44
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
38
45
|
isAdd = _useState10[0],
|
|
39
46
|
setIsAdd = _useState10[1];
|
|
@@ -46,33 +53,101 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
46
53
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
47
54
|
aloneAttr = _useState14[0],
|
|
48
55
|
setAloneAttr = _useState14[1];
|
|
56
|
+
var bizEventSelectorDefaultValue;
|
|
57
|
+
if (value && value.eventId && value.eventId != -100) {
|
|
58
|
+
bizEventSelectorDefaultValue = {
|
|
59
|
+
event: {
|
|
60
|
+
id: value.eventId,
|
|
61
|
+
name: value.eventName
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
var _useState15 = useState(),
|
|
66
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
67
|
+
bizAttributeSelectorValue = _useState16[0],
|
|
68
|
+
setBizAttributeSelectorValue = _useState16[1];
|
|
49
69
|
useEffect(function () {
|
|
70
|
+
console.log('初始化-1236', value, mincePropCount);
|
|
50
71
|
if (value) {
|
|
51
72
|
var _value$filters;
|
|
73
|
+
setReasonData({
|
|
74
|
+
event: {
|
|
75
|
+
id: value.eventId,
|
|
76
|
+
name: value.eventName
|
|
77
|
+
}
|
|
78
|
+
});
|
|
52
79
|
setFilters(value.filters);
|
|
80
|
+
setAloneAttr(value.propfilters);
|
|
81
|
+
if (eventIdList && eventIdList.length >= 0) {
|
|
82
|
+
setEventId(eventIdList[0]);
|
|
83
|
+
}
|
|
84
|
+
if (value.propfilters) {
|
|
85
|
+
setBizAttributeSelectorValue({
|
|
86
|
+
id: value.propfilters.attrId,
|
|
87
|
+
propCategory: value.propfilters.propCategory
|
|
88
|
+
});
|
|
89
|
+
setAttrSelectShow(true);
|
|
90
|
+
}
|
|
53
91
|
if ((_value$filters = value.filters) === null || _value$filters === void 0 ? void 0 : _value$filters.conditions) {
|
|
54
92
|
setCount(value.filters.conditions.length);
|
|
55
93
|
}
|
|
56
94
|
}
|
|
57
95
|
}, []);
|
|
58
96
|
useEffect(function () {
|
|
59
|
-
console.log('判断提交按钮是否可点击-123', count);
|
|
60
|
-
|
|
97
|
+
console.log('判断提交按钮是否可点击-123', ReasonData, count);
|
|
98
|
+
if (ReasonData) {
|
|
99
|
+
handleCount('add', attrSourceCount, setAttrSourceCount, count);
|
|
100
|
+
}
|
|
61
101
|
setTimeout(function () {
|
|
62
102
|
onChangeHandle(ReasonData, filters, aloneAttr);
|
|
63
103
|
}, 0);
|
|
64
104
|
}, [count]);
|
|
105
|
+
var onEventDelete = function onEventDelete() {
|
|
106
|
+
if (formData && formData.sourceFilters.length <= 1) {
|
|
107
|
+
message.error('至少保留一个待归因事件');
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (ReasonData) {
|
|
111
|
+
handleCount('delete', attrSourceCount, setAttrSourceCount);
|
|
112
|
+
handleCount('delete', mincePropCount, setMincePropCount);
|
|
113
|
+
}
|
|
114
|
+
onDelete();
|
|
115
|
+
};
|
|
116
|
+
var handleCount = function handleCount(type, _attrCount, _setAttrCount, count) {
|
|
117
|
+
if (ReasonData) {
|
|
118
|
+
var __attrCount = _.cloneDeep(_attrCount);
|
|
119
|
+
if (type === 'add' && count) {
|
|
120
|
+
__attrCount[ReasonData.event.id] = count;
|
|
121
|
+
} else {
|
|
122
|
+
delete __attrCount[ReasonData.event.id];
|
|
123
|
+
}
|
|
124
|
+
_setAttrCount(__attrCount);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
65
127
|
var onChangeFilters = function onChangeFilters(data) {
|
|
66
128
|
console.log('归因事件-2', data);
|
|
67
129
|
setFilters(data);
|
|
68
130
|
onChangeHandle(ReasonData, data, aloneAttr);
|
|
69
131
|
};
|
|
70
132
|
var onAdd = function onAdd() {
|
|
71
|
-
if (ReasonData
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
133
|
+
if (ReasonData === undefined && bizEventSelectorDefaultValue === undefined) {
|
|
134
|
+
message.error('请先选择待归因事件');
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (count >= 10) {
|
|
138
|
+
message.error('最多可添加10条属性筛选');
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
setIsAdd(true);
|
|
142
|
+
setTimeout(function () {
|
|
143
|
+
conditionRef.current.add();
|
|
144
|
+
}, 0);
|
|
145
|
+
};
|
|
146
|
+
var onMinceProp = function onMinceProp() {
|
|
147
|
+
if (ReasonData !== undefined || bizEventSelectorDefaultValue !== undefined) {
|
|
148
|
+
setAttrSelectShow(true);
|
|
149
|
+
setButtonDisable(true);
|
|
150
|
+
handleCount('add', mincePropCount, setMincePropCount, 1);
|
|
76
151
|
}
|
|
77
152
|
};
|
|
78
153
|
var onChangeReason = function onChangeReason(reason) {
|
|
@@ -85,6 +160,14 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
85
160
|
};
|
|
86
161
|
var onChangeAttr = function onChangeAttr(attr) {
|
|
87
162
|
console.log('归因事件-3', attr);
|
|
163
|
+
if (attr === undefined) {
|
|
164
|
+
handleCount('delete', mincePropCount, setMincePropCount);
|
|
165
|
+
} else {
|
|
166
|
+
setBizAttributeSelectorValue({
|
|
167
|
+
id: attr.id,
|
|
168
|
+
propCategory: attr.propCategory
|
|
169
|
+
});
|
|
170
|
+
}
|
|
88
171
|
var _aloneAttr = attr === undefined ? undefined : {
|
|
89
172
|
propCategory: attr.propCategory,
|
|
90
173
|
type: attr.type,
|
|
@@ -96,6 +179,7 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
96
179
|
onChangeHandle(ReasonData, filters, _aloneAttr);
|
|
97
180
|
};
|
|
98
181
|
var onChangeHandle = function onChangeHandle(reason, filterData, aloneAttr) {
|
|
182
|
+
console.log('为啥呢?', reason, filterData, aloneAttr);
|
|
99
183
|
if (props.onChange) {
|
|
100
184
|
var _reason$event2;
|
|
101
185
|
if (!reason || !reason.event || !((_reason$event2 = reason.event) === null || _reason$event2 === void 0 ? void 0 : _reason$event2.id)) return;
|
|
@@ -114,19 +198,19 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
114
198
|
className: "attributable-events-box"
|
|
115
199
|
}, /*#__PURE__*/React.createElement("div", {
|
|
116
200
|
className: "select-and-attr"
|
|
117
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
118
|
-
className: "".concat(verify && ReasonData === undefined ? 'verify-error' : '')
|
|
119
201
|
}, /*#__PURE__*/React.createElement(BizEventSelector, {
|
|
120
202
|
showBuiltInTarget: true,
|
|
121
203
|
showAllEvent: showOverview,
|
|
122
204
|
popupContainer: false,
|
|
123
205
|
defaultSelectAble: false,
|
|
124
|
-
onChange: onChangeReason
|
|
125
|
-
|
|
206
|
+
onChange: onChangeReason,
|
|
207
|
+
defaultValue: bizEventSelectorDefaultValue
|
|
208
|
+
}), attrSelectShow && /*#__PURE__*/React.createElement(BizAttributeSelector, {
|
|
126
209
|
enableEventProp: true,
|
|
127
210
|
enableUserProp: true,
|
|
128
211
|
enableEnvProp: true,
|
|
129
212
|
eventIdList: [eventId],
|
|
213
|
+
value: bizAttributeSelectorValue,
|
|
130
214
|
enableDelete: true,
|
|
131
215
|
onChange: onChangeAttr,
|
|
132
216
|
onDelete: function onDelete() {
|
|
@@ -137,24 +221,19 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
137
221
|
className: "button-box"
|
|
138
222
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
139
223
|
type: "qingchu",
|
|
140
|
-
onClick:
|
|
224
|
+
onClick: onEventDelete
|
|
141
225
|
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
142
226
|
placement: "top",
|
|
143
227
|
title: '添加属性细分'
|
|
144
228
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
145
|
-
className: "".concat(attrSelectShow || ReasonData === undefined ? 'disable' : ''),
|
|
229
|
+
className: "".concat(attrSelectShow || ReasonData === undefined && bizEventSelectorDefaultValue === undefined ? 'disable' : ''),
|
|
146
230
|
type: "tianjia2",
|
|
147
|
-
onClick:
|
|
148
|
-
if (ReasonData !== undefined) {
|
|
149
|
-
setAttrSelectShow(true);
|
|
150
|
-
setButtonDisable(true);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
231
|
+
onClick: onMinceProp
|
|
153
232
|
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
154
233
|
placement: "top",
|
|
155
234
|
title: '添加属性筛选'
|
|
156
235
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
157
|
-
className: "".concat(count >= 10 || ReasonData === undefined ? 'disable' : ''),
|
|
236
|
+
className: "".concat(count >= 10 || ReasonData === undefined && bizEventSelectorDefaultValue === undefined ? 'disable' : ''),
|
|
158
237
|
type: "shaixuan",
|
|
159
238
|
onClick: function onClick() {
|
|
160
239
|
return onAdd();
|
|
@@ -10,9 +10,9 @@ import _ from 'lodash';
|
|
|
10
10
|
import { Select, Tooltip, message } from 'antd';
|
|
11
11
|
var TargetEvent = function TargetEvent(props) {
|
|
12
12
|
var value = props.value,
|
|
13
|
-
verify = props.verify,
|
|
14
13
|
setAttrTargetCount = props.setAttrTargetCount,
|
|
15
|
-
showOverview = props.showOverview
|
|
14
|
+
showOverview = props.showOverview,
|
|
15
|
+
eventIdList = props.eventIdList;
|
|
16
16
|
var _useState = useState(),
|
|
17
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
18
|
targetData = _useState2[0],
|
|
@@ -34,26 +34,40 @@ var TargetEvent = function TargetEvent(props) {
|
|
|
34
34
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
35
35
|
eventId = _useState10[0],
|
|
36
36
|
setEventId = _useState10[1];
|
|
37
|
+
var bizEventSelectorDefaultValue;
|
|
38
|
+
if (value && value.eventId && value.eventId != -100) {
|
|
39
|
+
bizEventSelectorDefaultValue = {
|
|
40
|
+
event: {
|
|
41
|
+
id: value.eventId,
|
|
42
|
+
name: value.eventName
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
37
46
|
useEffect(function () {
|
|
38
47
|
if (value) {
|
|
39
48
|
var _value$filters;
|
|
40
|
-
|
|
49
|
+
setTargetData({
|
|
50
|
+
event: {
|
|
51
|
+
id: value.eventId,
|
|
52
|
+
name: value.eventName
|
|
53
|
+
}
|
|
54
|
+
});
|
|
41
55
|
setFilters(value.filters);
|
|
56
|
+
if (eventIdList && eventIdList.length >= 0) {
|
|
57
|
+
setEventId(eventIdList[0]);
|
|
58
|
+
}
|
|
42
59
|
if ((_value$filters = value.filters) === null || _value$filters === void 0 ? void 0 : _value$filters.conditions) {
|
|
43
60
|
setCount(value.filters.conditions.length);
|
|
44
61
|
}
|
|
45
62
|
}
|
|
46
63
|
}, []);
|
|
47
|
-
useEffect(function () {
|
|
48
|
-
console.log('verify', verify);
|
|
49
|
-
}, [verify]);
|
|
50
64
|
var onChangeFilters = function onChangeFilters(data) {
|
|
51
65
|
console.log('归因事件-2', data);
|
|
52
66
|
setFilters(data);
|
|
53
67
|
onChangeHandle(targetData, data);
|
|
54
68
|
};
|
|
55
69
|
var onAdd = function onAdd() {
|
|
56
|
-
if (targetData === undefined) {
|
|
70
|
+
if (targetData === undefined && bizEventSelectorDefaultValue === undefined) {
|
|
57
71
|
message.error('请先选择目标事件');
|
|
58
72
|
return;
|
|
59
73
|
}
|
|
@@ -102,15 +116,14 @@ var TargetEvent = function TargetEvent(props) {
|
|
|
102
116
|
className: "target-events-box"
|
|
103
117
|
}, /*#__PURE__*/React.createElement("div", {
|
|
104
118
|
className: "selector-content"
|
|
105
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
106
|
-
className: "".concat(verify && targetData === undefined ? 'verify-error' : '')
|
|
107
119
|
}, /*#__PURE__*/React.createElement(BizEventSelector, {
|
|
108
120
|
showBuiltInTarget: true,
|
|
109
121
|
showAllEvent: showOverview,
|
|
110
122
|
popupContainer: false,
|
|
111
123
|
defaultSelectAble: false,
|
|
124
|
+
defaultValue: bizEventSelectorDefaultValue,
|
|
112
125
|
onChange: onChangeTarget
|
|
113
|
-
})
|
|
126
|
+
}), /*#__PURE__*/React.createElement(Select, {
|
|
114
127
|
defaultValue: 1,
|
|
115
128
|
style: {
|
|
116
129
|
width: 88
|
|
@@ -129,14 +142,12 @@ var TargetEvent = function TargetEvent(props) {
|
|
|
129
142
|
placement: "top",
|
|
130
143
|
title: '添加属性筛选'
|
|
131
144
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
132
|
-
className: "".concat(count >= 5 || targetData === undefined ? 'disable' : ''),
|
|
145
|
+
className: "".concat(count >= 5 || targetData === undefined && bizEventSelectorDefaultValue === undefined ? 'disable' : ''),
|
|
133
146
|
type: "shaixuan",
|
|
134
147
|
onClick: function onClick() {
|
|
135
148
|
return onAdd();
|
|
136
149
|
}
|
|
137
|
-
}))),
|
|
138
|
-
className: "error-tips"
|
|
139
|
-
}, "\u8BF7\u9009\u62E9\u76EE\u6807\u4E8B\u4EF6"), /*#__PURE__*/React.createElement("div", null, (filters || isAdd) && /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
|
|
150
|
+
}))), /*#__PURE__*/React.createElement("div", null, (filters || isAdd) && /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
|
|
140
151
|
ref: conditionRef,
|
|
141
152
|
value: filters,
|
|
142
153
|
enableEventProp: true,
|
|
@@ -2,5 +2,5 @@ import React from 'react';
|
|
|
2
2
|
import { SearchPanelTypes } from './types';
|
|
3
3
|
import './styles/index.less';
|
|
4
4
|
export declare const classPrefix = "mi-left-form";
|
|
5
|
-
declare const SearchPanel: React.
|
|
5
|
+
declare const SearchPanel: React.ForwardRefExoticComponent<SearchPanelTypes.Props & React.RefAttributes<any>>;
|
|
6
6
|
export default SearchPanel;
|