@zgfe/modules-attribution 1.0.1-alpha.2 → 1.0.1-alpha.23
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 +12 -5
- package/es/components/option/types.d.ts +3 -6
- package/es/components/searchTime/index.js +0 -1
- package/es/components/tableList/index.d.ts +2 -2
- package/es/components/tableList/index.js +9 -3
- package/es/components/title/index.js +7 -6
- 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 +3 -3
- package/es/modules/content/index.js +41 -22
- package/es/modules/content/types.d.ts +3 -3
- package/es/modules/content/utils.d.ts +0 -6
- package/es/modules/content/utils.js +0 -163
- package/es/modules/home/demo/create.js +5 -35
- package/es/modules/home/demo/edit.js +116 -157
- package/es/modules/home/demo/index.js +4 -36
- package/es/modules/home/demo/scene.js +5 -35
- package/es/modules/home/index.d.ts +2 -2
- package/es/modules/home/index.js +14 -31
- package/es/modules/home/styles/index.less +2 -1
- package/es/modules/home/types.d.ts +1 -5
- package/es/modules/searchPanel/components/attributableEvents.js +122 -47
- package/es/modules/searchPanel/components/globalAttribute.d.ts +2 -1
- package/es/modules/searchPanel/components/globalAttribute.js +1 -2
- package/es/modules/searchPanel/components/targetEvent.js +33 -26
- package/es/modules/searchPanel/index.d.ts +1 -1
- package/es/modules/searchPanel/index.js +102 -80
- package/es/modules/searchPanel/types.d.ts +26 -11
- package/es/modules/searchPanel/utils.d.ts +8 -5
- package/es/modules/searchPanel/utils.js +44 -101
- package/es/types.d.ts +28 -39
- package/package.json +3 -3
- 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
package/es/modules/home/index.js
CHANGED
|
@@ -7,23 +7,16 @@ 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
|
|
18
|
-
import InsightContent from '../content';
|
|
16
|
+
import AttributionContent from '../content';
|
|
19
17
|
var classPrefix = 'attribution-container';
|
|
20
18
|
var AttributionHome = function AttributionHome(props) {
|
|
21
19
|
var _props$defaultValue;
|
|
22
|
-
console.log('AttributionHome-props: ', props);
|
|
23
|
-
var _useContext = useContext(BizGlobalDataContext),
|
|
24
|
-
userPropList = _useContext.userPropList,
|
|
25
|
-
eventGroupList = _useContext.eventGroupList,
|
|
26
|
-
eventEnvList = _useContext.eventEnvList;
|
|
27
20
|
var _useState = useState(),
|
|
28
21
|
_useState2 = _slicedToArray(_useState, 2),
|
|
29
22
|
searchData = _useState2[0],
|
|
@@ -56,7 +49,7 @@ var AttributionHome = function AttributionHome(props) {
|
|
|
56
49
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
57
50
|
buttonDisable = _useState16[0],
|
|
58
51
|
setButtonDisable = _useState16[1];
|
|
59
|
-
var
|
|
52
|
+
var attributionRef = useRef(null);
|
|
60
53
|
useEffect(function () {
|
|
61
54
|
setPageLoading(true);
|
|
62
55
|
if (!props.defaultValue) {
|
|
@@ -69,16 +62,7 @@ var AttributionHome = function AttributionHome(props) {
|
|
|
69
62
|
if (!initData) {
|
|
70
63
|
initSearch();
|
|
71
64
|
} else {
|
|
72
|
-
|
|
73
|
-
initData = transferEventSearchData(initData, userPropList, eventGroupList, eventEnvList);
|
|
74
|
-
}
|
|
75
|
-
if (!initData.userGroup || !initData.targets) {
|
|
76
|
-
setSearchData(function (data) {
|
|
77
|
-
return _objectSpread(_objectSpread({}, data), initData);
|
|
78
|
-
});
|
|
79
|
-
} else {
|
|
80
|
-
setSearchData(_objectSpread({}, initData));
|
|
81
|
-
}
|
|
65
|
+
setSearchData(_objectSpread({}, initData));
|
|
82
66
|
}
|
|
83
67
|
}
|
|
84
68
|
setTimeout(function () {
|
|
@@ -96,13 +80,15 @@ var AttributionHome = function AttributionHome(props) {
|
|
|
96
80
|
setLoading(flag);
|
|
97
81
|
};
|
|
98
82
|
var onSave = function onSave() {
|
|
99
|
-
if (
|
|
100
|
-
|
|
83
|
+
if (attributionRef) {
|
|
84
|
+
attributionRef.current.onGetSearchData();
|
|
85
|
+
attributionRef.current.savePanel();
|
|
101
86
|
}
|
|
102
87
|
};
|
|
103
88
|
var onSaveAs = function onSaveAs() {
|
|
104
|
-
if (
|
|
105
|
-
|
|
89
|
+
if (attributionRef) {
|
|
90
|
+
attributionRef.current.onGetSearchData();
|
|
91
|
+
attributionRef.current.saveAsPanel();
|
|
106
92
|
}
|
|
107
93
|
};
|
|
108
94
|
if (pageLoading) {
|
|
@@ -120,12 +106,9 @@ var AttributionHome = function AttributionHome(props) {
|
|
|
120
106
|
buttonDisable: buttonDisable,
|
|
121
107
|
setButtonDisable: setButtonDisable,
|
|
122
108
|
includeToday: props.includeToday,
|
|
123
|
-
|
|
124
|
-
enableAddScene: !props.defaultValue || props.defaultValue.source === 'INSIGHT',
|
|
125
|
-
enableGenerateReport: props.enableGenerateReport,
|
|
109
|
+
enableAddScene: !props.defaultValue || props.defaultValue.source === 'attribution',
|
|
126
110
|
changeLoading: changeLoading,
|
|
127
|
-
afterEditTarget: props.afterEditTarget
|
|
128
|
-
onUserDrill: props.onUserDrill
|
|
111
|
+
afterEditTarget: props.afterEditTarget
|
|
129
112
|
}
|
|
130
113
|
}, panelId && /*#__PURE__*/React.createElement(EditTitle, {
|
|
131
114
|
title: title,
|
|
@@ -137,8 +120,8 @@ var AttributionHome = function AttributionHome(props) {
|
|
|
137
120
|
className: "".concat(classPrefix, "-header-title")
|
|
138
121
|
}, "\u5F52\u56E0\u5206\u6790"), /*#__PURE__*/React.createElement("div", {
|
|
139
122
|
className: "".concat(classPrefix, "-content ").concat(panelId ? classPrefix + '-content2' : '')
|
|
140
|
-
}, /*#__PURE__*/React.createElement(
|
|
141
|
-
ref:
|
|
123
|
+
}, /*#__PURE__*/React.createElement(AttributionContent, {
|
|
124
|
+
ref: attributionRef,
|
|
142
125
|
value: searchData,
|
|
143
126
|
onSearching: function onSearching(val) {
|
|
144
127
|
return setSearching(val);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export declare namespace InsightProps {
|
|
1
|
+
export declare namespace AttributionProps {
|
|
3
2
|
interface Props {
|
|
4
3
|
defaultValue?: Value;
|
|
5
4
|
includeToday?: boolean;
|
|
6
|
-
enableGenerateReport?: boolean;
|
|
7
5
|
afterEditTarget?: (type: string, value?: any) => void;
|
|
8
|
-
onUserDrill: (data: any, searchData: SearchValue) => void;
|
|
9
6
|
}
|
|
10
7
|
interface Value {
|
|
11
8
|
panelId?: number;
|
|
@@ -14,7 +11,6 @@ export declare namespace InsightProps {
|
|
|
14
11
|
name?: string;
|
|
15
12
|
id?: number;
|
|
16
13
|
data?: any;
|
|
17
|
-
chosen_data?: string[];
|
|
18
14
|
[props: string]: any;
|
|
19
15
|
}
|
|
20
16
|
}
|
|
@@ -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,
|
|
16
|
-
|
|
18
|
+
formData = props.formData,
|
|
19
|
+
eventIdList = props.eventIdList,
|
|
20
|
+
selectList = props.selectList,
|
|
17
21
|
onDelete = props.onDelete;
|
|
18
22
|
var _useContext = useContext(AttributableContext),
|
|
19
23
|
setButtonDisable = _useContext.setButtonDisable;
|
|
@@ -33,7 +37,7 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
33
37
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
34
38
|
count = _useState8[0],
|
|
35
39
|
setCount = _useState8[1];
|
|
36
|
-
var _useState9 = useState(
|
|
40
|
+
var _useState9 = useState(false),
|
|
37
41
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
38
42
|
isAdd = _useState10[0],
|
|
39
43
|
setIsAdd = _useState10[1];
|
|
@@ -44,58 +48,134 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
44
48
|
setEventId = _useState12[1];
|
|
45
49
|
var _useState13 = useState(),
|
|
46
50
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
minceAttr = _useState14[0],
|
|
52
|
+
setMinceAttr = _useState14[1];
|
|
53
|
+
var bizEventSelectorDefaultValue = {};
|
|
54
|
+
if (value && value.eventId && value.eventId != -100) {
|
|
55
|
+
bizEventSelectorDefaultValue = {
|
|
56
|
+
event: {
|
|
57
|
+
id: value.eventId,
|
|
58
|
+
name: value.eventName
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
var _useState15 = useState(),
|
|
63
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
64
|
+
bizAttributeSelectorValue = _useState16[0],
|
|
65
|
+
setBizAttributeSelectorValue = _useState16[1];
|
|
49
66
|
useEffect(function () {
|
|
50
67
|
if (value) {
|
|
51
68
|
var _value$filters;
|
|
69
|
+
setReasonData({
|
|
70
|
+
event: {
|
|
71
|
+
id: value.eventId,
|
|
72
|
+
name: value.eventName
|
|
73
|
+
}
|
|
74
|
+
});
|
|
52
75
|
setFilters(value.filters);
|
|
76
|
+
setMinceAttr(value.attributionSubdivision);
|
|
77
|
+
if (eventIdList && eventIdList.length >= 0) {
|
|
78
|
+
setEventId(eventIdList[0]);
|
|
79
|
+
}
|
|
80
|
+
if (value.attributionSubdivision && value.attributionSubdivision.conditions) {
|
|
81
|
+
setBizAttributeSelectorValue({
|
|
82
|
+
id: value.attributionSubdivision.conditions.attrId,
|
|
83
|
+
propCategory: value.attributionSubdivision.conditions.propCategory
|
|
84
|
+
});
|
|
85
|
+
setAttrSelectShow(true);
|
|
86
|
+
}
|
|
53
87
|
if ((_value$filters = value.filters) === null || _value$filters === void 0 ? void 0 : _value$filters.conditions) {
|
|
54
88
|
setCount(value.filters.conditions.length);
|
|
55
89
|
}
|
|
56
90
|
}
|
|
57
91
|
}, []);
|
|
58
92
|
useEffect(function () {
|
|
59
|
-
|
|
60
|
-
|
|
93
|
+
if (ReasonData) {
|
|
94
|
+
handleCount('add', attrSourceCount, setAttrSourceCount, count);
|
|
95
|
+
}
|
|
61
96
|
setTimeout(function () {
|
|
62
|
-
onChangeHandle(ReasonData, filters,
|
|
97
|
+
onChangeHandle(ReasonData, filters, minceAttr);
|
|
63
98
|
}, 0);
|
|
64
99
|
}, [count]);
|
|
100
|
+
var onEventDelete = function onEventDelete() {
|
|
101
|
+
if (formData && formData.sourceFilters.length <= 1) {
|
|
102
|
+
message.error('至少保留一个待归因事件');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (ReasonData) {
|
|
106
|
+
handleCount('delete', attrSourceCount, setAttrSourceCount);
|
|
107
|
+
handleCount('delete', mincePropCount, setMincePropCount);
|
|
108
|
+
}
|
|
109
|
+
onDelete();
|
|
110
|
+
};
|
|
111
|
+
var handleCount = function handleCount(type, _attrCount, _setAttrCount, count) {
|
|
112
|
+
if (ReasonData && ReasonData.event) {
|
|
113
|
+
var __attrCount = _.cloneDeep(_attrCount);
|
|
114
|
+
if (type === 'add' && count) {
|
|
115
|
+
__attrCount[ReasonData.event.id] = count;
|
|
116
|
+
} else {
|
|
117
|
+
delete __attrCount[ReasonData.event.id];
|
|
118
|
+
}
|
|
119
|
+
_setAttrCount(__attrCount);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
65
122
|
var onChangeFilters = function onChangeFilters(data) {
|
|
66
|
-
console.log('归因事件-2', data);
|
|
67
123
|
setFilters(data);
|
|
68
|
-
onChangeHandle(ReasonData, data,
|
|
124
|
+
onChangeHandle(ReasonData, data, minceAttr);
|
|
69
125
|
};
|
|
70
126
|
var onAdd = function onAdd() {
|
|
71
|
-
if (ReasonData
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
127
|
+
if (ReasonData === undefined && bizEventSelectorDefaultValue === undefined) {
|
|
128
|
+
message.error('请先选择待归因事件');
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (count >= 10) {
|
|
132
|
+
message.error('最多可添加10条属性筛选');
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
setIsAdd(true);
|
|
136
|
+
setTimeout(function () {
|
|
137
|
+
conditionRef.current.add();
|
|
138
|
+
}, 0);
|
|
139
|
+
};
|
|
140
|
+
var onMinceProp = function onMinceProp() {
|
|
141
|
+
if (ReasonData !== undefined || bizEventSelectorDefaultValue !== undefined) {
|
|
142
|
+
setAttrSelectShow(true);
|
|
143
|
+
setButtonDisable(true);
|
|
144
|
+
handleCount('add', mincePropCount, setMincePropCount, 1);
|
|
76
145
|
}
|
|
77
146
|
};
|
|
78
147
|
var onChangeReason = function onChangeReason(reason) {
|
|
79
|
-
var _reason$event;
|
|
80
|
-
console.log('归因事件-1', reason);
|
|
81
148
|
setReasonData(reason);
|
|
82
|
-
|
|
149
|
+
if (reason && reason.event) {
|
|
150
|
+
var _reason$event;
|
|
151
|
+
setEventId(reason === null || reason === void 0 ? void 0 : (_reason$event = reason.event) === null || _reason$event === void 0 ? void 0 : _reason$event.id);
|
|
152
|
+
}
|
|
83
153
|
var filterData = _.cloneDeep(filters);
|
|
84
|
-
onChangeHandle(reason, filterData,
|
|
154
|
+
onChangeHandle(reason, filterData, minceAttr);
|
|
85
155
|
};
|
|
86
156
|
var onChangeAttr = function onChangeAttr(attr) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
157
|
+
if (attr === undefined) {
|
|
158
|
+
handleCount('delete', mincePropCount, setMincePropCount);
|
|
159
|
+
} else {
|
|
160
|
+
setBizAttributeSelectorValue({
|
|
161
|
+
id: attr.id,
|
|
162
|
+
propCategory: attr.propCategory
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
var _minceAttr = attr === undefined ? undefined : {
|
|
166
|
+
relation: "and",
|
|
167
|
+
conditions: {
|
|
168
|
+
propCategory: attr.propCategory,
|
|
169
|
+
type: attr.type,
|
|
170
|
+
attrId: attr.id,
|
|
171
|
+
attrName: attr.name,
|
|
172
|
+
category: attr.category
|
|
173
|
+
}
|
|
94
174
|
};
|
|
95
|
-
|
|
96
|
-
onChangeHandle(ReasonData, filters,
|
|
175
|
+
setMinceAttr(_minceAttr);
|
|
176
|
+
onChangeHandle(ReasonData, filters, _minceAttr);
|
|
97
177
|
};
|
|
98
|
-
var onChangeHandle = function onChangeHandle(reason, filterData,
|
|
178
|
+
var onChangeHandle = function onChangeHandle(reason, filterData, minceAttr) {
|
|
99
179
|
if (props.onChange) {
|
|
100
180
|
var _reason$event2;
|
|
101
181
|
if (!reason || !reason.event || !((_reason$event2 = reason.event) === null || _reason$event2 === void 0 ? void 0 : _reason$event2.id)) return;
|
|
@@ -104,9 +184,8 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
104
184
|
eventId: event === null || event === void 0 ? void 0 : event.id,
|
|
105
185
|
eventName: (event === null || event === void 0 ? void 0 : event.alias) || (event === null || event === void 0 ? void 0 : event.name),
|
|
106
186
|
filters: filterData,
|
|
107
|
-
|
|
187
|
+
attributionSubdivision: minceAttr
|
|
108
188
|
};
|
|
109
|
-
console.log('待归因事件-变动-组装数据', data);
|
|
110
189
|
props.onChange(data);
|
|
111
190
|
}
|
|
112
191
|
};
|
|
@@ -114,19 +193,20 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
114
193
|
className: "attributable-events-box"
|
|
115
194
|
}, /*#__PURE__*/React.createElement("div", {
|
|
116
195
|
className: "select-and-attr"
|
|
117
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
118
|
-
className: "".concat(verify && ReasonData === undefined ? 'verify-error' : '')
|
|
119
196
|
}, /*#__PURE__*/React.createElement(BizEventSelector, {
|
|
120
|
-
|
|
121
|
-
|
|
197
|
+
showAllEvent: false,
|
|
198
|
+
showBuiltInTarget: false,
|
|
122
199
|
popupContainer: false,
|
|
123
200
|
defaultSelectAble: false,
|
|
124
|
-
onChange: onChangeReason
|
|
125
|
-
|
|
201
|
+
onChange: onChangeReason,
|
|
202
|
+
defaultValue: bizEventSelectorDefaultValue,
|
|
203
|
+
selectList: selectList
|
|
204
|
+
}), attrSelectShow && /*#__PURE__*/React.createElement(BizAttributeSelector, {
|
|
126
205
|
enableEventProp: true,
|
|
127
206
|
enableUserProp: true,
|
|
128
207
|
enableEnvProp: true,
|
|
129
208
|
eventIdList: [eventId],
|
|
209
|
+
value: bizAttributeSelectorValue,
|
|
130
210
|
enableDelete: true,
|
|
131
211
|
onChange: onChangeAttr,
|
|
132
212
|
onDelete: function onDelete() {
|
|
@@ -137,24 +217,19 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
137
217
|
className: "button-box"
|
|
138
218
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
139
219
|
type: "qingchu",
|
|
140
|
-
onClick:
|
|
220
|
+
onClick: onEventDelete
|
|
141
221
|
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
142
222
|
placement: "top",
|
|
143
223
|
title: '添加属性细分'
|
|
144
224
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
145
|
-
className: "".concat(attrSelectShow || ReasonData === undefined ? 'disable' : ''),
|
|
225
|
+
className: "".concat(attrSelectShow || ReasonData === undefined && bizEventSelectorDefaultValue === undefined ? 'disable' : ''),
|
|
146
226
|
type: "tianjia2",
|
|
147
|
-
onClick:
|
|
148
|
-
if (ReasonData !== undefined) {
|
|
149
|
-
setAttrSelectShow(true);
|
|
150
|
-
setButtonDisable(true);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
227
|
+
onClick: onMinceProp
|
|
153
228
|
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
154
229
|
placement: "top",
|
|
155
230
|
title: '添加属性筛选'
|
|
156
231
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
157
|
-
className: "".concat(count >= 10 || ReasonData === undefined ? 'disable' : ''),
|
|
232
|
+
className: "".concat(count >= 10 || ReasonData === undefined && bizEventSelectorDefaultValue === undefined ? 'disable' : ''),
|
|
158
233
|
type: "shaixuan",
|
|
159
234
|
onClick: function onClick() {
|
|
160
235
|
return onAdd();
|
|
@@ -26,7 +26,6 @@ var GlobalAttribute = function GlobalAttribute(props) {
|
|
|
26
26
|
setInit(false);
|
|
27
27
|
}, []);
|
|
28
28
|
useEffect(function () {
|
|
29
|
-
console.log('eventIdList', props.eventIdList);
|
|
30
29
|
if (init || props.eventIdList && props.eventIdList[0] === -100) return;
|
|
31
30
|
if (!props.value) {
|
|
32
31
|
conditionRef.current.setValue(props.value);
|
|
@@ -45,7 +44,7 @@ var GlobalAttribute = function GlobalAttribute(props) {
|
|
|
45
44
|
onChange: onChange,
|
|
46
45
|
onConditionsCount: setCount
|
|
47
46
|
}), count < max && /*#__PURE__*/React.createElement("div", {
|
|
48
|
-
className: "".concat(classPrefix, "-add ").concat(props.eventIdList
|
|
47
|
+
className: "".concat(classPrefix, "-add ").concat(props.eventIdList && props.eventIdList.length <= 0 ? 'disabled' : ''),
|
|
49
48
|
onClick: onAdd
|
|
50
49
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
51
50
|
className: "".concat(classPrefix, "-add-icon"),
|
|
@@ -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
|
-
|
|
14
|
+
eventIdList = props.eventIdList,
|
|
15
|
+
selectList = props.selectList;
|
|
16
16
|
var _useState = useState(),
|
|
17
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
18
|
targetData = _useState2[0],
|
|
@@ -34,26 +34,39 @@ 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
|
-
console.log('归因事件-2', data);
|
|
52
65
|
setFilters(data);
|
|
53
66
|
onChangeHandle(targetData, data);
|
|
54
67
|
};
|
|
55
68
|
var onAdd = function onAdd() {
|
|
56
|
-
if (targetData === undefined) {
|
|
69
|
+
if (targetData === undefined && bizEventSelectorDefaultValue === undefined) {
|
|
57
70
|
message.error('请先选择目标事件');
|
|
58
71
|
return;
|
|
59
72
|
}
|
|
@@ -67,25 +80,21 @@ var TargetEvent = function TargetEvent(props) {
|
|
|
67
80
|
}, 0);
|
|
68
81
|
};
|
|
69
82
|
var onChangeTarget = function onChangeTarget(target) {
|
|
70
|
-
var _target$event;
|
|
71
|
-
console.log('目标事件变更', target);
|
|
72
83
|
setTargetData(target);
|
|
73
|
-
|
|
84
|
+
if (target && target.event) {
|
|
85
|
+
var _target$event;
|
|
86
|
+
setEventId(target === null || target === void 0 ? void 0 : (_target$event = target.event) === null || _target$event === void 0 ? void 0 : _target$event.id);
|
|
87
|
+
}
|
|
74
88
|
var filterData = _.cloneDeep(filters);
|
|
75
89
|
onChangeHandle(target, filterData);
|
|
76
90
|
};
|
|
77
91
|
useEffect(function () {
|
|
78
|
-
console.log(1111111111, targetData);
|
|
79
|
-
}, [targetData]);
|
|
80
|
-
useEffect(function () {
|
|
81
|
-
console.log('判断提交按钮是否可点击-123', count);
|
|
82
92
|
setAttrTargetCount(count);
|
|
83
93
|
setTimeout(function () {
|
|
84
94
|
onChangeHandle(targetData, filters);
|
|
85
95
|
}, 0);
|
|
86
96
|
}, [count]);
|
|
87
97
|
var onChangeHandle = function onChangeHandle(reason, filterData) {
|
|
88
|
-
console.log('变动了', reason, filterData);
|
|
89
98
|
if (props.onChange) {
|
|
90
99
|
var _reason$event;
|
|
91
100
|
if (!reason || !reason.event || !((_reason$event = reason.event) === null || _reason$event === void 0 ? void 0 : _reason$event.id)) return;
|
|
@@ -102,15 +111,15 @@ var TargetEvent = function TargetEvent(props) {
|
|
|
102
111
|
className: "target-events-box"
|
|
103
112
|
}, /*#__PURE__*/React.createElement("div", {
|
|
104
113
|
className: "selector-content"
|
|
105
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
106
|
-
className: "".concat(verify && targetData === undefined ? 'verify-error' : '')
|
|
107
114
|
}, /*#__PURE__*/React.createElement(BizEventSelector, {
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
showAllEvent: false,
|
|
116
|
+
showBuiltInTarget: false,
|
|
110
117
|
popupContainer: false,
|
|
111
118
|
defaultSelectAble: false,
|
|
112
|
-
|
|
113
|
-
|
|
119
|
+
defaultValue: bizEventSelectorDefaultValue,
|
|
120
|
+
onChange: onChangeTarget,
|
|
121
|
+
selectList: selectList
|
|
122
|
+
}), /*#__PURE__*/React.createElement(Select, {
|
|
114
123
|
defaultValue: 1,
|
|
115
124
|
style: {
|
|
116
125
|
width: 88
|
|
@@ -129,14 +138,12 @@ var TargetEvent = function TargetEvent(props) {
|
|
|
129
138
|
placement: "top",
|
|
130
139
|
title: '添加属性筛选'
|
|
131
140
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
132
|
-
className: "".concat(count >= 5 || targetData === undefined ? 'disable' : ''),
|
|
141
|
+
className: "".concat(count >= 5 || targetData === undefined && bizEventSelectorDefaultValue === undefined ? 'disable' : ''),
|
|
133
142
|
type: "shaixuan",
|
|
134
143
|
onClick: function onClick() {
|
|
135
144
|
return onAdd();
|
|
136
145
|
}
|
|
137
|
-
}))),
|
|
138
|
-
className: "error-tips"
|
|
139
|
-
}, "\u8BF7\u9009\u62E9\u76EE\u6807\u4E8B\u4EF6"), /*#__PURE__*/React.createElement("div", null, (filters || isAdd) && /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
|
|
146
|
+
}))), /*#__PURE__*/React.createElement("div", null, (filters || isAdd) && /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
|
|
140
147
|
ref: conditionRef,
|
|
141
148
|
value: filters,
|
|
142
149
|
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;
|