@zgfe/modules-attribution 1.0.1-alpha.14 → 1.0.1-alpha.16
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 +2 -6
- 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 +4 -34
- 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 +2 -6
- 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,14 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
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 _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; }
|
|
6
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
8
2
|
import { DemoWrapper, setGlobalConfig } from '@zgfe/business-lib';
|
|
9
3
|
import { AttributionHome } from '@zgfe/modules-attribution';
|
|
10
4
|
import { requestConfig } from '../../../utils/ajaxConfig';
|
|
11
|
-
import { Button } from 'antd';
|
|
12
5
|
var defaultValue = {
|
|
13
6
|
source: 'SCENE',
|
|
14
7
|
data: {
|
|
@@ -35,40 +28,17 @@ var defaultValue = {
|
|
|
35
28
|
chosen_data: []
|
|
36
29
|
};
|
|
37
30
|
export default (function () {
|
|
38
|
-
var _useState = useState(false),
|
|
39
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
40
|
-
isDetail = _useState2[0],
|
|
41
|
-
setIsDetail = _useState2[1];
|
|
42
|
-
var _useState3 = useState(),
|
|
43
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
44
|
-
detailParams = _useState4[0],
|
|
45
|
-
setDetailParams = _useState4[1];
|
|
46
|
-
var _useState5 = useState(defaultValue),
|
|
47
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
48
|
-
searchParams = _useState6[0],
|
|
49
|
-
setSearchParams = _useState6[1];
|
|
50
31
|
useEffect(function () {
|
|
51
32
|
setGlobalConfig(requestConfig);
|
|
52
33
|
}, []);
|
|
53
34
|
var afterEditTarget = function afterEditTarget(type, data) {
|
|
54
35
|
console.log("".concat(type, "\u56DE\u8C03"), data);
|
|
55
36
|
};
|
|
56
|
-
var onUserDrill = function onUserDrill(data, searchData) {
|
|
57
|
-
console.log('onUserDrill:', data, searchData);
|
|
58
|
-
setIsDetail(true);
|
|
59
|
-
setSearchParams(searchData);
|
|
60
|
-
setDetailParams(data);
|
|
61
|
-
};
|
|
62
37
|
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
63
38
|
needMeta: true,
|
|
64
39
|
defaultApp: 21
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
}, "\u8FD4\u56DE")) : /*#__PURE__*/React.createElement(AttributionHome, {
|
|
70
|
-
defaultValue: searchParams,
|
|
71
|
-
afterEditTarget: afterEditTarget,
|
|
72
|
-
onUserDrill: onUserDrill
|
|
40
|
+
}, /*#__PURE__*/React.createElement(AttributionHome, {
|
|
41
|
+
defaultValue: defaultValue,
|
|
42
|
+
afterEditTarget: afterEditTarget
|
|
73
43
|
}));
|
|
74
44
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './styles/index.less';
|
|
3
|
-
import {
|
|
4
|
-
declare const AttributionHome: React.FC<
|
|
3
|
+
import { AttributionProps } from './types';
|
|
4
|
+
declare const AttributionHome: React.FC<AttributionProps.Props>;
|
|
5
5
|
export default AttributionHome;
|
package/es/modules/home/index.js
CHANGED
|
@@ -17,7 +17,6 @@ import InsightContent from '../content';
|
|
|
17
17
|
var classPrefix = 'attribution-container';
|
|
18
18
|
var AttributionHome = function AttributionHome(props) {
|
|
19
19
|
var _props$defaultValue;
|
|
20
|
-
console.log('AttributionHome-props: ', props);
|
|
21
20
|
var _useState = useState(),
|
|
22
21
|
_useState2 = _slicedToArray(_useState, 2),
|
|
23
22
|
searchData = _useState2[0],
|
|
@@ -109,12 +108,9 @@ var AttributionHome = function AttributionHome(props) {
|
|
|
109
108
|
buttonDisable: buttonDisable,
|
|
110
109
|
setButtonDisable: setButtonDisable,
|
|
111
110
|
includeToday: props.includeToday,
|
|
112
|
-
|
|
113
|
-
enableAddScene: !props.defaultValue || props.defaultValue.source === 'INSIGHT',
|
|
114
|
-
enableGenerateReport: props.enableGenerateReport,
|
|
111
|
+
enableAddScene: !props.defaultValue || props.defaultValue.source === 'attribution',
|
|
115
112
|
changeLoading: changeLoading,
|
|
116
|
-
afterEditTarget: props.afterEditTarget
|
|
117
|
-
onUserDrill: props.onUserDrill
|
|
113
|
+
afterEditTarget: props.afterEditTarget
|
|
118
114
|
}
|
|
119
115
|
}, panelId && /*#__PURE__*/React.createElement(EditTitle, {
|
|
120
116
|
title: title,
|
|
@@ -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
|
}
|
|
@@ -16,7 +16,6 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
16
16
|
attrSourceCount = props.attrSourceCount,
|
|
17
17
|
setAttrSourceCount = props.setAttrSourceCount,
|
|
18
18
|
formData = props.formData,
|
|
19
|
-
showOverview = props.showOverview,
|
|
20
19
|
eventIdList = props.eventIdList,
|
|
21
20
|
onDelete = props.onDelete;
|
|
22
21
|
var _useContext = useContext(AttributableContext),
|
|
@@ -33,9 +32,6 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
33
32
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
34
33
|
filters = _useState6[0],
|
|
35
34
|
setFilters = _useState6[1];
|
|
36
|
-
useEffect(function () {
|
|
37
|
-
console.log('初始化-filters', filters);
|
|
38
|
-
}, [filters]);
|
|
39
35
|
var _useState7 = useState(0),
|
|
40
36
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
41
37
|
count = _useState8[0],
|
|
@@ -51,9 +47,9 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
51
47
|
setEventId = _useState12[1];
|
|
52
48
|
var _useState13 = useState(),
|
|
53
49
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var bizEventSelectorDefaultValue;
|
|
50
|
+
minceAttr = _useState14[0],
|
|
51
|
+
setMinceAttr = _useState14[1];
|
|
52
|
+
var bizEventSelectorDefaultValue = {};
|
|
57
53
|
if (value && value.eventId && value.eventId != -100) {
|
|
58
54
|
bizEventSelectorDefaultValue = {
|
|
59
55
|
event: {
|
|
@@ -67,7 +63,6 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
67
63
|
bizAttributeSelectorValue = _useState16[0],
|
|
68
64
|
setBizAttributeSelectorValue = _useState16[1];
|
|
69
65
|
useEffect(function () {
|
|
70
|
-
console.log('初始化-1236', value, mincePropCount);
|
|
71
66
|
if (value) {
|
|
72
67
|
var _value$filters;
|
|
73
68
|
setReasonData({
|
|
@@ -77,7 +72,7 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
77
72
|
}
|
|
78
73
|
});
|
|
79
74
|
setFilters(value.filters);
|
|
80
|
-
|
|
75
|
+
setMinceAttr(value.propfilters);
|
|
81
76
|
if (eventIdList && eventIdList.length >= 0) {
|
|
82
77
|
setEventId(eventIdList[0]);
|
|
83
78
|
}
|
|
@@ -94,12 +89,11 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
94
89
|
}
|
|
95
90
|
}, []);
|
|
96
91
|
useEffect(function () {
|
|
97
|
-
console.log('判断提交按钮是否可点击-123', ReasonData, count);
|
|
98
92
|
if (ReasonData) {
|
|
99
93
|
handleCount('add', attrSourceCount, setAttrSourceCount, count);
|
|
100
94
|
}
|
|
101
95
|
setTimeout(function () {
|
|
102
|
-
onChangeHandle(ReasonData, filters,
|
|
96
|
+
onChangeHandle(ReasonData, filters, minceAttr);
|
|
103
97
|
}, 0);
|
|
104
98
|
}, [count]);
|
|
105
99
|
var onEventDelete = function onEventDelete() {
|
|
@@ -114,7 +108,7 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
114
108
|
onDelete();
|
|
115
109
|
};
|
|
116
110
|
var handleCount = function handleCount(type, _attrCount, _setAttrCount, count) {
|
|
117
|
-
if (ReasonData) {
|
|
111
|
+
if (ReasonData && ReasonData.event) {
|
|
118
112
|
var __attrCount = _.cloneDeep(_attrCount);
|
|
119
113
|
if (type === 'add' && count) {
|
|
120
114
|
__attrCount[ReasonData.event.id] = count;
|
|
@@ -125,9 +119,8 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
125
119
|
}
|
|
126
120
|
};
|
|
127
121
|
var onChangeFilters = function onChangeFilters(data) {
|
|
128
|
-
console.log('归因事件-2', data);
|
|
129
122
|
setFilters(data);
|
|
130
|
-
onChangeHandle(ReasonData, data,
|
|
123
|
+
onChangeHandle(ReasonData, data, minceAttr);
|
|
131
124
|
};
|
|
132
125
|
var onAdd = function onAdd() {
|
|
133
126
|
if (ReasonData === undefined && bizEventSelectorDefaultValue === undefined) {
|
|
@@ -151,15 +144,15 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
151
144
|
}
|
|
152
145
|
};
|
|
153
146
|
var onChangeReason = function onChangeReason(reason) {
|
|
154
|
-
var _reason$event;
|
|
155
|
-
console.log('归因事件-1', reason);
|
|
156
147
|
setReasonData(reason);
|
|
157
|
-
|
|
148
|
+
if (reason && reason.event) {
|
|
149
|
+
var _reason$event;
|
|
150
|
+
setEventId(reason === null || reason === void 0 ? void 0 : (_reason$event = reason.event) === null || _reason$event === void 0 ? void 0 : _reason$event.id);
|
|
151
|
+
}
|
|
158
152
|
var filterData = _.cloneDeep(filters);
|
|
159
|
-
onChangeHandle(reason, filterData,
|
|
153
|
+
onChangeHandle(reason, filterData, minceAttr);
|
|
160
154
|
};
|
|
161
155
|
var onChangeAttr = function onChangeAttr(attr) {
|
|
162
|
-
console.log('归因事件-3', attr);
|
|
163
156
|
if (attr === undefined) {
|
|
164
157
|
handleCount('delete', mincePropCount, setMincePropCount);
|
|
165
158
|
} else {
|
|
@@ -168,18 +161,17 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
168
161
|
propCategory: attr.propCategory
|
|
169
162
|
});
|
|
170
163
|
}
|
|
171
|
-
var
|
|
164
|
+
var _minceAttr = attr === undefined ? undefined : {
|
|
172
165
|
propCategory: attr.propCategory,
|
|
173
166
|
type: attr.type,
|
|
174
167
|
attrId: attr.id,
|
|
175
168
|
attrName: attr.name,
|
|
176
169
|
category: attr.category
|
|
177
170
|
};
|
|
178
|
-
|
|
179
|
-
onChangeHandle(ReasonData, filters,
|
|
171
|
+
setMinceAttr(_minceAttr);
|
|
172
|
+
onChangeHandle(ReasonData, filters, _minceAttr);
|
|
180
173
|
};
|
|
181
|
-
var onChangeHandle = function onChangeHandle(reason, filterData,
|
|
182
|
-
console.log('为啥呢?', reason, filterData, aloneAttr);
|
|
174
|
+
var onChangeHandle = function onChangeHandle(reason, filterData, minceAttr) {
|
|
183
175
|
if (props.onChange) {
|
|
184
176
|
var _reason$event2;
|
|
185
177
|
if (!reason || !reason.event || !((_reason$event2 = reason.event) === null || _reason$event2 === void 0 ? void 0 : _reason$event2.id)) return;
|
|
@@ -188,9 +180,8 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
188
180
|
eventId: event === null || event === void 0 ? void 0 : event.id,
|
|
189
181
|
eventName: (event === null || event === void 0 ? void 0 : event.alias) || (event === null || event === void 0 ? void 0 : event.name),
|
|
190
182
|
filters: filterData,
|
|
191
|
-
propfilters:
|
|
183
|
+
propfilters: minceAttr
|
|
192
184
|
};
|
|
193
|
-
console.log('待归因事件-变动-组装数据', data);
|
|
194
185
|
props.onChange(data);
|
|
195
186
|
}
|
|
196
187
|
};
|
|
@@ -200,7 +191,6 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
200
191
|
className: "select-and-attr"
|
|
201
192
|
}, /*#__PURE__*/React.createElement(BizEventSelector, {
|
|
202
193
|
showBuiltInTarget: true,
|
|
203
|
-
showAllEvent: showOverview,
|
|
204
194
|
popupContainer: false,
|
|
205
195
|
defaultSelectAble: false,
|
|
206
196
|
onChange: onChangeReason,
|
|
@@ -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);
|
|
@@ -11,7 +11,6 @@ import { Select, Tooltip, message } from 'antd';
|
|
|
11
11
|
var TargetEvent = function TargetEvent(props) {
|
|
12
12
|
var value = props.value,
|
|
13
13
|
setAttrTargetCount = props.setAttrTargetCount,
|
|
14
|
-
showOverview = props.showOverview,
|
|
15
14
|
eventIdList = props.eventIdList;
|
|
16
15
|
var _useState = useState(),
|
|
17
16
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -34,7 +33,7 @@ var TargetEvent = function TargetEvent(props) {
|
|
|
34
33
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
35
34
|
eventId = _useState10[0],
|
|
36
35
|
setEventId = _useState10[1];
|
|
37
|
-
var bizEventSelectorDefaultValue;
|
|
36
|
+
var bizEventSelectorDefaultValue = {};
|
|
38
37
|
if (value && value.eventId && value.eventId != -100) {
|
|
39
38
|
bizEventSelectorDefaultValue = {
|
|
40
39
|
event: {
|
|
@@ -62,7 +61,6 @@ var TargetEvent = function TargetEvent(props) {
|
|
|
62
61
|
}
|
|
63
62
|
}, []);
|
|
64
63
|
var onChangeFilters = function onChangeFilters(data) {
|
|
65
|
-
console.log('归因事件-2', data);
|
|
66
64
|
setFilters(data);
|
|
67
65
|
onChangeHandle(targetData, data);
|
|
68
66
|
};
|
|
@@ -81,25 +79,21 @@ var TargetEvent = function TargetEvent(props) {
|
|
|
81
79
|
}, 0);
|
|
82
80
|
};
|
|
83
81
|
var onChangeTarget = function onChangeTarget(target) {
|
|
84
|
-
var _target$event;
|
|
85
|
-
console.log('目标事件变更', target);
|
|
86
82
|
setTargetData(target);
|
|
87
|
-
|
|
83
|
+
if (target && target.event) {
|
|
84
|
+
var _target$event;
|
|
85
|
+
setEventId(target === null || target === void 0 ? void 0 : (_target$event = target.event) === null || _target$event === void 0 ? void 0 : _target$event.id);
|
|
86
|
+
}
|
|
88
87
|
var filterData = _.cloneDeep(filters);
|
|
89
88
|
onChangeHandle(target, filterData);
|
|
90
89
|
};
|
|
91
90
|
useEffect(function () {
|
|
92
|
-
console.log(1111111111, targetData);
|
|
93
|
-
}, [targetData]);
|
|
94
|
-
useEffect(function () {
|
|
95
|
-
console.log('判断提交按钮是否可点击-123', count);
|
|
96
91
|
setAttrTargetCount(count);
|
|
97
92
|
setTimeout(function () {
|
|
98
93
|
onChangeHandle(targetData, filters);
|
|
99
94
|
}, 0);
|
|
100
95
|
}, [count]);
|
|
101
96
|
var onChangeHandle = function onChangeHandle(reason, filterData) {
|
|
102
|
-
console.log('变动了', reason, filterData);
|
|
103
97
|
if (props.onChange) {
|
|
104
98
|
var _reason$event;
|
|
105
99
|
if (!reason || !reason.event || !((_reason$event = reason.event) === null || _reason$event === void 0 ? void 0 : _reason$event.id)) return;
|
|
@@ -118,7 +112,6 @@ var TargetEvent = function TargetEvent(props) {
|
|
|
118
112
|
className: "selector-content"
|
|
119
113
|
}, /*#__PURE__*/React.createElement(BizEventSelector, {
|
|
120
114
|
showBuiltInTarget: true,
|
|
121
|
-
showAllEvent: showOverview,
|
|
122
115
|
popupContainer: false,
|
|
123
116
|
defaultSelectAble: false,
|
|
124
117
|
defaultValue: bizEventSelectorDefaultValue,
|
|
@@ -14,7 +14,7 @@ import SearchContent from './components/index';
|
|
|
14
14
|
import GlobalAttribute from './components/globalAttribute';
|
|
15
15
|
import './styles/index.less';
|
|
16
16
|
import _ from 'lodash';
|
|
17
|
-
import { targetChangeCallback, submitButtonDisableHandle
|
|
17
|
+
import { targetChangeCallback, submitButtonDisableHandle } from './utils';
|
|
18
18
|
import { initTarget } from '../../constants/initData';
|
|
19
19
|
import { searchFields } from '../../constants/fields';
|
|
20
20
|
import { AttributableContext } from '../../types';
|
|
@@ -66,13 +66,9 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
66
66
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
67
67
|
mincePropCount = _useState18[0],
|
|
68
68
|
setMincePropCount = _useState18[1];
|
|
69
|
-
useEffect(function () {
|
|
70
|
-
console.log('判断提交按钮是否可点击-1234444', mincePropCount);
|
|
71
|
-
}, [mincePropCount]);
|
|
72
69
|
useEffect(function () {
|
|
73
70
|
if (defaultValue) {
|
|
74
71
|
var data = defaultValue;
|
|
75
|
-
console.log('初始化', data);
|
|
76
72
|
setFormData(data);
|
|
77
73
|
var eList = [];
|
|
78
74
|
defaultValue.targetFilters.forEach(function (target) {
|
|
@@ -80,7 +76,6 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
80
76
|
eList.push(target.eventId);
|
|
81
77
|
}
|
|
82
78
|
});
|
|
83
|
-
console.log('初始化11', eList);
|
|
84
79
|
setEventIdList(eList);
|
|
85
80
|
if (defaultValue.windowType !== undefined) {
|
|
86
81
|
setOtherEvent(defaultValue.otherEvent);
|
|
@@ -104,7 +99,7 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
104
99
|
setLoading(false);
|
|
105
100
|
}, []);
|
|
106
101
|
var onChange = function onChange(_changedValues, allValues) {
|
|
107
|
-
console.log(
|
|
102
|
+
console.log('筛选值发生改变', _changedValues, allValues);
|
|
108
103
|
setFormData(allValues);
|
|
109
104
|
var data = _.cloneDeep(allValues);
|
|
110
105
|
if (_changedValues.targetFilters) {
|
|
@@ -119,28 +114,18 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
119
114
|
data.targetFilters = initTarget;
|
|
120
115
|
eList = [-100];
|
|
121
116
|
}
|
|
122
|
-
console.log('999', eList);
|
|
123
117
|
setEventIdList(eList);
|
|
124
118
|
var targetData = targetChangeCallback(data, eList, eventGroupList);
|
|
125
119
|
form.setFieldsValue(targetData);
|
|
126
120
|
}
|
|
127
121
|
setButtonDisable(submitButtonDisableHandle(allValues, attrSourceCount, attrTargetCount, mincePropCount));
|
|
128
122
|
};
|
|
129
|
-
var attrChange = function attrChange(e) {
|
|
130
|
-
var reason = form.getFieldValue('reason');
|
|
131
|
-
console.log('细分属性变化:', e, reason);
|
|
132
|
-
};
|
|
133
123
|
var onFinish = function onFinish(isFetchRequest) {
|
|
134
124
|
form.validateFields().then(function (res) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
res.windowType = windowType === 1 ? 'day' : windowTypeUnit;
|
|
140
|
-
var finalData = removeEmptyValue(res);
|
|
141
|
-
console.log(123123, finalData);
|
|
142
|
-
props.onChange(finalData, isFetchRequest);
|
|
143
|
-
}
|
|
125
|
+
res.otherEvent = otherEvent;
|
|
126
|
+
res.windowCnt = windowCnt;
|
|
127
|
+
res.windowType = windowType === 1 ? 'day' : windowTypeUnit;
|
|
128
|
+
props.onChange(res, isFetchRequest);
|
|
144
129
|
}).catch(function (e) {
|
|
145
130
|
console.log('表单检验失败', e);
|
|
146
131
|
});
|
|
@@ -217,10 +202,7 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
217
202
|
}), /*#__PURE__*/React.createElement(SearchContent, {
|
|
218
203
|
type: item.type,
|
|
219
204
|
key: field.key,
|
|
220
|
-
attrChange: attrChange,
|
|
221
|
-
enableDelete: fields.length > 1,
|
|
222
205
|
eventIdList: eventIdList,
|
|
223
|
-
allValues: formData,
|
|
224
206
|
onDelete: function onDelete() {
|
|
225
207
|
return remove(index);
|
|
226
208
|
},
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { SearchValueProps, FiltersProps } from '../../types';
|
|
1
2
|
export declare namespace SearchPanelTypes {
|
|
2
3
|
interface Props {
|
|
3
|
-
defaultValue?:
|
|
4
|
-
onChange: (values:
|
|
4
|
+
defaultValue?: SearchValueProps;
|
|
5
|
+
onChange: (values: SearchValueProps, isFetchRequest: boolean) => void;
|
|
5
6
|
}
|
|
6
7
|
interface FieldProp {
|
|
7
8
|
key: string;
|
|
@@ -10,21 +11,16 @@ export declare namespace SearchPanelTypes {
|
|
|
10
11
|
label: string;
|
|
11
12
|
max: number;
|
|
12
13
|
addLabel: string;
|
|
13
|
-
options?: any[];
|
|
14
14
|
tips?: string;
|
|
15
15
|
required?: boolean;
|
|
16
16
|
}
|
|
17
17
|
interface PanelProp {
|
|
18
18
|
type: string;
|
|
19
|
-
value?:
|
|
20
|
-
allValues?: any;
|
|
21
|
-
enableDelete: boolean;
|
|
19
|
+
value?: FiltersProps;
|
|
22
20
|
eventIdList?: number[];
|
|
23
|
-
|
|
24
|
-
onChange?: (data: any) => void;
|
|
21
|
+
onChange?: (data: FiltersProps) => void;
|
|
25
22
|
onDelete: () => void;
|
|
26
|
-
|
|
27
|
-
formData: any;
|
|
23
|
+
formData: SearchValueProps;
|
|
28
24
|
setAttrTargetCount: Function;
|
|
29
25
|
setAttrSourceCount: Function;
|
|
30
26
|
attrSourceCount: {
|
|
@@ -39,4 +35,11 @@ export declare namespace SearchPanelTypes {
|
|
|
39
35
|
id?: number;
|
|
40
36
|
propCategory?: string;
|
|
41
37
|
}
|
|
38
|
+
interface targetDataProp {
|
|
39
|
+
event?: {
|
|
40
|
+
id: number;
|
|
41
|
+
name: string;
|
|
42
|
+
alias?: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
42
45
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function submitButtonDisableHandle(data: SearchData, attrSourceCount: {
|
|
1
|
+
import { SearchValueProps } from '../../types';
|
|
2
|
+
import { EventSelectTypes } from '@zgfe/business-lib/es/eventSelector/types';
|
|
3
|
+
export declare function targetChangeCallback(data: SearchValueProps, eList: number[], eventGroupList: EventSelectTypes.Value[]): SearchValueProps;
|
|
4
|
+
export declare function submitButtonDisableHandle(data: SearchValueProps, attrSourceCount: {
|
|
6
5
|
[x: number]: number;
|
|
7
6
|
}, attrTargetCount: number, mincePropCount: {
|
|
8
7
|
[x: number]: number;
|
|
@@ -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
|
};
|