@zgfe/modules-attribution 1.0.1-alpha.8 → 1.0.2-alpha.0
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 +12 -5
- package/es/components/tableList/index.d.ts +2 -2
- package/es/components/tableList/index.js +12 -3
- package/es/components/tableList/styles/index.less +9 -1
- package/es/components/title/index.js +6 -5
- 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/images/empty.png +0 -0
- package/es/modules/content/index.d.ts +3 -3
- package/es/modules/content/index.js +42 -44
- 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 +61 -105
- package/es/modules/home/demo/index.js +4 -36
- package/es/modules/home/demo/scene.js +4 -34
- package/es/modules/home/index.d.ts +2 -2
- package/es/modules/home/index.js +13 -17
- 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 +117 -54
- package/es/modules/searchPanel/components/globalAttribute.d.ts +3 -1
- package/es/modules/searchPanel/components/globalAttribute.js +8 -4
- package/es/modules/searchPanel/components/targetEvent.js +28 -21
- package/es/modules/searchPanel/index.d.ts +1 -1
- package/es/modules/searchPanel/index.js +120 -78
- package/es/modules/searchPanel/types.d.ts +24 -10
- package/es/modules/searchPanel/utils.d.ts +8 -5
- package/es/modules/searchPanel/utils.js +51 -102
- package/es/types.d.ts +29 -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
|
@@ -1,51 +1,19 @@
|
|
|
1
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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
1
|
import { DemoWrapper, setGlobalConfig } from '@zgfe/business-lib';
|
|
8
|
-
import React, { useEffect
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
9
3
|
import { AttributionHome } from '@zgfe/modules-attribution';
|
|
10
4
|
import './styles/index.less';
|
|
11
5
|
import { requestConfig } from '../../../utils/ajaxConfig';
|
|
12
|
-
import { Button } from 'antd';
|
|
13
6
|
export default (function () {
|
|
14
|
-
var _useState = useState(false),
|
|
15
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
-
isDetail = _useState2[0],
|
|
17
|
-
setIsDetail = _useState2[1];
|
|
18
|
-
var _useState3 = useState(),
|
|
19
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
20
|
-
detailParams = _useState4[0],
|
|
21
|
-
setDetailParams = _useState4[1];
|
|
22
|
-
var _useState5 = useState(),
|
|
23
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
24
|
-
searchParams = _useState6[0],
|
|
25
|
-
setSearchParams = _useState6[1];
|
|
26
7
|
useEffect(function () {
|
|
27
8
|
setGlobalConfig(requestConfig);
|
|
28
9
|
}, []);
|
|
29
10
|
var afterEditTarget = function afterEditTarget(type, data) {
|
|
30
11
|
console.log("".concat(type, "\u56DE\u8C03"), data);
|
|
31
12
|
};
|
|
32
|
-
var onUserDrill = function onUserDrill(data, searchData) {
|
|
33
|
-
console.log('onUserDrill:', data, searchData);
|
|
34
|
-
setIsDetail(true);
|
|
35
|
-
setSearchParams(searchData);
|
|
36
|
-
setDetailParams(data);
|
|
37
|
-
};
|
|
38
13
|
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
39
14
|
needMeta: true,
|
|
40
|
-
defaultApp:
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
return setIsDetail(false);
|
|
44
|
-
}
|
|
45
|
-
}, "\u8FD4\u56DE")) : /*#__PURE__*/React.createElement(AttributionHome, {
|
|
46
|
-
defaultValue: searchParams,
|
|
47
|
-
enableGenerateReport: true,
|
|
48
|
-
afterEditTarget: afterEditTarget,
|
|
49
|
-
onUserDrill: onUserDrill
|
|
15
|
+
defaultApp: 328
|
|
16
|
+
}, /*#__PURE__*/React.createElement(AttributionHome, {
|
|
17
|
+
afterEditTarget: afterEditTarget
|
|
50
18
|
}));
|
|
51
19
|
});
|
|
@@ -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
|
@@ -13,11 +13,10 @@ import './styles/index.less';
|
|
|
13
13
|
import { AttributableContext } from '../../types';
|
|
14
14
|
import EditTitle from '../../components/title';
|
|
15
15
|
import { getInitDate, initTarget } from '../../constants/initData';
|
|
16
|
-
import
|
|
16
|
+
import AttributionContent 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],
|
|
@@ -50,7 +49,7 @@ var AttributionHome = function AttributionHome(props) {
|
|
|
50
49
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
51
50
|
buttonDisable = _useState16[0],
|
|
52
51
|
setButtonDisable = _useState16[1];
|
|
53
|
-
var
|
|
52
|
+
var attributionRef = useRef(null);
|
|
54
53
|
useEffect(function () {
|
|
55
54
|
setPageLoading(true);
|
|
56
55
|
if (!props.defaultValue) {
|
|
@@ -63,9 +62,7 @@ var AttributionHome = function AttributionHome(props) {
|
|
|
63
62
|
if (!initData) {
|
|
64
63
|
initSearch();
|
|
65
64
|
} else {
|
|
66
|
-
setSearchData(_objectSpread(
|
|
67
|
-
targetFilters: [initData.targetFilters]
|
|
68
|
-
}));
|
|
65
|
+
setSearchData(_objectSpread({}, initData));
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
68
|
setTimeout(function () {
|
|
@@ -83,13 +80,15 @@ var AttributionHome = function AttributionHome(props) {
|
|
|
83
80
|
setLoading(flag);
|
|
84
81
|
};
|
|
85
82
|
var onSave = function onSave() {
|
|
86
|
-
if (
|
|
87
|
-
|
|
83
|
+
if (attributionRef) {
|
|
84
|
+
attributionRef.current.onGetSearchData();
|
|
85
|
+
attributionRef.current.savePanel();
|
|
88
86
|
}
|
|
89
87
|
};
|
|
90
88
|
var onSaveAs = function onSaveAs() {
|
|
91
|
-
if (
|
|
92
|
-
|
|
89
|
+
if (attributionRef) {
|
|
90
|
+
attributionRef.current.onGetSearchData();
|
|
91
|
+
attributionRef.current.saveAsPanel();
|
|
93
92
|
}
|
|
94
93
|
};
|
|
95
94
|
if (pageLoading) {
|
|
@@ -107,12 +106,9 @@ var AttributionHome = function AttributionHome(props) {
|
|
|
107
106
|
buttonDisable: buttonDisable,
|
|
108
107
|
setButtonDisable: setButtonDisable,
|
|
109
108
|
includeToday: props.includeToday,
|
|
110
|
-
|
|
111
|
-
enableAddScene: !props.defaultValue || props.defaultValue.source === 'INSIGHT',
|
|
112
|
-
enableGenerateReport: props.enableGenerateReport,
|
|
109
|
+
enableAddScene: !props.defaultValue || props.defaultValue.source === 'attribution',
|
|
113
110
|
changeLoading: changeLoading,
|
|
114
|
-
afterEditTarget: props.afterEditTarget
|
|
115
|
-
onUserDrill: props.onUserDrill
|
|
111
|
+
afterEditTarget: props.afterEditTarget
|
|
116
112
|
}
|
|
117
113
|
}, panelId && /*#__PURE__*/React.createElement(EditTitle, {
|
|
118
114
|
title: title,
|
|
@@ -124,8 +120,8 @@ var AttributionHome = function AttributionHome(props) {
|
|
|
124
120
|
className: "".concat(classPrefix, "-header-title")
|
|
125
121
|
}, "\u5F52\u56E0\u5206\u6790"), /*#__PURE__*/React.createElement("div", {
|
|
126
122
|
className: "".concat(classPrefix, "-content ").concat(panelId ? classPrefix + '-content2' : '')
|
|
127
|
-
}, /*#__PURE__*/React.createElement(
|
|
128
|
-
ref:
|
|
123
|
+
}, /*#__PURE__*/React.createElement(AttributionContent, {
|
|
124
|
+
ref: attributionRef,
|
|
129
125
|
value: searchData,
|
|
130
126
|
onSearching: function onSearching(val) {
|
|
131
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
|
}
|
|
@@ -11,8 +11,11 @@ import _ from 'lodash';
|
|
|
11
11
|
import { Tooltip, message } from 'antd';
|
|
12
12
|
var AttributableEvents = function AttributableEvents(props) {
|
|
13
13
|
var value = props.value,
|
|
14
|
+
setMincePropCount = props.setMincePropCount,
|
|
15
|
+
mincePropCount = props.mincePropCount,
|
|
16
|
+
attrSourceCount = props.attrSourceCount,
|
|
14
17
|
setAttrSourceCount = props.setAttrSourceCount,
|
|
15
|
-
|
|
18
|
+
formData = props.formData,
|
|
16
19
|
eventIdList = props.eventIdList,
|
|
17
20
|
onDelete = props.onDelete;
|
|
18
21
|
var _useContext = useContext(AttributableContext),
|
|
@@ -29,9 +32,6 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
29
32
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
30
33
|
filters = _useState6[0],
|
|
31
34
|
setFilters = _useState6[1];
|
|
32
|
-
useEffect(function () {
|
|
33
|
-
console.log('初始化-filters', filters);
|
|
34
|
-
}, [filters]);
|
|
35
35
|
var _useState7 = useState(0),
|
|
36
36
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
37
37
|
count = _useState8[0],
|
|
@@ -47,10 +47,10 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
47
47
|
setEventId = _useState12[1];
|
|
48
48
|
var _useState13 = useState(),
|
|
49
49
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var bizEventSelectorDefaultValue;
|
|
53
|
-
if (value.eventId && value.eventId != -100) {
|
|
50
|
+
minceAttr = _useState14[0],
|
|
51
|
+
setMinceAttr = _useState14[1];
|
|
52
|
+
var bizEventSelectorDefaultValue = {};
|
|
53
|
+
if (value && value.eventId && value.eventId != -100) {
|
|
54
54
|
bizEventSelectorDefaultValue = {
|
|
55
55
|
event: {
|
|
56
56
|
id: value.eventId,
|
|
@@ -63,17 +63,25 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
63
63
|
bizAttributeSelectorValue = _useState16[0],
|
|
64
64
|
setBizAttributeSelectorValue = _useState16[1];
|
|
65
65
|
useEffect(function () {
|
|
66
|
-
console.log('初始化-123', value);
|
|
67
66
|
if (value) {
|
|
68
67
|
var _value$filters;
|
|
68
|
+
setReasonData({
|
|
69
|
+
event: {
|
|
70
|
+
id: value.eventId,
|
|
71
|
+
name: value.eventName
|
|
72
|
+
}
|
|
73
|
+
});
|
|
69
74
|
setFilters(value.filters);
|
|
75
|
+
setMinceAttr(value.attributionSubdivision);
|
|
70
76
|
if (eventIdList && eventIdList.length >= 0) {
|
|
71
77
|
setEventId(eventIdList[0]);
|
|
72
78
|
}
|
|
73
|
-
if (value.
|
|
79
|
+
if (value.attributionSubdivision && value.attributionSubdivision.conditions) {
|
|
74
80
|
setBizAttributeSelectorValue({
|
|
75
|
-
id: value.
|
|
76
|
-
propCategory: value.
|
|
81
|
+
id: value.attributionSubdivision.conditions.attrId,
|
|
82
|
+
propCategory: value.attributionSubdivision.conditions.propCategory,
|
|
83
|
+
name: value.attributionSubdivision.conditions.attrName,
|
|
84
|
+
category: value.attributionSubdivision.conditions.category
|
|
77
85
|
});
|
|
78
86
|
setAttrSelectShow(true);
|
|
79
87
|
}
|
|
@@ -83,24 +91,46 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
83
91
|
}
|
|
84
92
|
}, []);
|
|
85
93
|
useEffect(function () {
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
if (ReasonData) {
|
|
95
|
+
handleCount('add', attrSourceCount, setAttrSourceCount, count);
|
|
96
|
+
}
|
|
88
97
|
setTimeout(function () {
|
|
89
|
-
onChangeHandle(ReasonData, filters,
|
|
98
|
+
onChangeHandle(ReasonData, filters, minceAttr);
|
|
90
99
|
}, 0);
|
|
91
100
|
}, [count]);
|
|
101
|
+
var onEventDelete = function onEventDelete() {
|
|
102
|
+
if (formData && formData.sourceFilters.length <= 1) {
|
|
103
|
+
message.error('至少保留一个待归因事件');
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (ReasonData) {
|
|
107
|
+
handleCount('delete', attrSourceCount, setAttrSourceCount);
|
|
108
|
+
handleCount('delete', mincePropCount, setMincePropCount);
|
|
109
|
+
}
|
|
110
|
+
onDelete();
|
|
111
|
+
};
|
|
112
|
+
var handleCount = function handleCount(type, _attrCount, _setAttrCount, count) {
|
|
113
|
+
if (ReasonData && ReasonData.event) {
|
|
114
|
+
var __attrCount = _.cloneDeep(_attrCount);
|
|
115
|
+
if (type === 'add' && count) {
|
|
116
|
+
__attrCount[ReasonData.event.id] = count;
|
|
117
|
+
} else {
|
|
118
|
+
delete __attrCount[ReasonData.event.id];
|
|
119
|
+
}
|
|
120
|
+
_setAttrCount(__attrCount);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
92
123
|
var onChangeFilters = function onChangeFilters(data) {
|
|
93
|
-
console.log('归因事件-2', data);
|
|
94
124
|
setFilters(data);
|
|
95
|
-
onChangeHandle(ReasonData, data,
|
|
125
|
+
onChangeHandle(ReasonData, data, minceAttr);
|
|
96
126
|
};
|
|
97
127
|
var onAdd = function onAdd() {
|
|
98
|
-
if (
|
|
128
|
+
if (notClickable) {
|
|
99
129
|
message.error('请先选择待归因事件');
|
|
100
130
|
return;
|
|
101
131
|
}
|
|
102
|
-
if (count >=
|
|
103
|
-
message.error('最多可添加
|
|
132
|
+
if (count >= 5) {
|
|
133
|
+
message.error('最多可添加5条属性筛选');
|
|
104
134
|
return;
|
|
105
135
|
}
|
|
106
136
|
setIsAdd(true);
|
|
@@ -108,31 +138,55 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
108
138
|
conditionRef.current.add();
|
|
109
139
|
}, 0);
|
|
110
140
|
};
|
|
141
|
+
var onMinceProp = function onMinceProp() {
|
|
142
|
+
if (notClickable) {
|
|
143
|
+
message.error('请先选择待归因事件');
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (attrSelectShow) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
setAttrSelectShow(true);
|
|
150
|
+
setButtonDisable(true);
|
|
151
|
+
handleCount('add', mincePropCount, setMincePropCount, 1);
|
|
152
|
+
};
|
|
111
153
|
var onChangeReason = function onChangeReason(reason) {
|
|
112
|
-
var _reason$event;
|
|
113
|
-
console.log('归因事件-1', reason);
|
|
114
154
|
setReasonData(reason);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
155
|
+
if (reason && reason.event) {
|
|
156
|
+
var _reason$event;
|
|
157
|
+
setEventId(reason === null || reason === void 0 ? void 0 : (_reason$event = reason.event) === null || _reason$event === void 0 ? void 0 : _reason$event.id);
|
|
158
|
+
}
|
|
159
|
+
setFilters(undefined);
|
|
160
|
+
setBizAttributeSelectorValue(undefined);
|
|
161
|
+
setIsAdd(false);
|
|
162
|
+
setCount(0);
|
|
163
|
+
onChangeHandle(reason, undefined, undefined);
|
|
118
164
|
};
|
|
119
165
|
var onChangeAttr = function onChangeAttr(attr) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
166
|
+
if (attr === undefined) {
|
|
167
|
+
handleCount('delete', mincePropCount, setMincePropCount);
|
|
168
|
+
} else {
|
|
169
|
+
setBizAttributeSelectorValue({
|
|
170
|
+
id: attr.id,
|
|
171
|
+
propCategory: attr.propCategory,
|
|
172
|
+
name: attr.name,
|
|
173
|
+
category: attr.category
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
var _minceAttr = attr === undefined ? undefined : {
|
|
177
|
+
relation: "and",
|
|
178
|
+
conditions: {
|
|
179
|
+
propCategory: attr.propCategory,
|
|
180
|
+
type: attr.type,
|
|
181
|
+
attrId: attr.id,
|
|
182
|
+
attrName: attr.name,
|
|
183
|
+
category: attr.category
|
|
184
|
+
}
|
|
131
185
|
};
|
|
132
|
-
|
|
133
|
-
onChangeHandle(ReasonData, filters,
|
|
186
|
+
setMinceAttr(_minceAttr);
|
|
187
|
+
onChangeHandle(ReasonData, filters, _minceAttr);
|
|
134
188
|
};
|
|
135
|
-
var onChangeHandle = function onChangeHandle(reason, filterData,
|
|
189
|
+
var onChangeHandle = function onChangeHandle(reason, filterData, minceAttr) {
|
|
136
190
|
if (props.onChange) {
|
|
137
191
|
var _reason$event2;
|
|
138
192
|
if (!reason || !reason.event || !((_reason$event2 = reason.event) === null || _reason$event2 === void 0 ? void 0 : _reason$event2.id)) return;
|
|
@@ -141,23 +195,36 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
141
195
|
eventId: event === null || event === void 0 ? void 0 : event.id,
|
|
142
196
|
eventName: (event === null || event === void 0 ? void 0 : event.alias) || (event === null || event === void 0 ? void 0 : event.name),
|
|
143
197
|
filters: filterData,
|
|
144
|
-
|
|
198
|
+
attributionSubdivision: minceAttr
|
|
145
199
|
};
|
|
146
|
-
console.log('待归因事件-变动-组装数据', data);
|
|
147
200
|
props.onChange(data);
|
|
148
201
|
}
|
|
149
202
|
};
|
|
203
|
+
var _useState17 = useState(null),
|
|
204
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
205
|
+
notClickable = _useState18[0],
|
|
206
|
+
setNotClickable = _useState18[1];
|
|
207
|
+
useEffect(function () {
|
|
208
|
+
var _ReasonData$event;
|
|
209
|
+
if (ReasonData === undefined || (ReasonData === null || ReasonData === void 0 ? void 0 : (_ReasonData$event = ReasonData.event) === null || _ReasonData$event === void 0 ? void 0 : _ReasonData$event.id) === -100 && Object.keys(bizEventSelectorDefaultValue).length <= 0) {
|
|
210
|
+
setNotClickable(true);
|
|
211
|
+
} else {
|
|
212
|
+
setNotClickable(false);
|
|
213
|
+
}
|
|
214
|
+
}, [ReasonData]);
|
|
150
215
|
return /*#__PURE__*/React.createElement("div", {
|
|
151
216
|
className: "attributable-events-box"
|
|
152
217
|
}, /*#__PURE__*/React.createElement("div", {
|
|
153
218
|
className: "select-and-attr"
|
|
154
219
|
}, /*#__PURE__*/React.createElement(BizEventSelector, {
|
|
155
|
-
|
|
156
|
-
|
|
220
|
+
showAllEvent: false,
|
|
221
|
+
showBuiltInTarget: false,
|
|
157
222
|
popupContainer: false,
|
|
158
223
|
defaultSelectAble: false,
|
|
159
224
|
onChange: onChangeReason,
|
|
160
|
-
defaultValue: bizEventSelectorDefaultValue
|
|
225
|
+
defaultValue: bizEventSelectorDefaultValue,
|
|
226
|
+
selectList: eventIdList,
|
|
227
|
+
placeholder: "\u8BF7\u9009\u62E9\u4E8B\u4EF6"
|
|
161
228
|
}), attrSelectShow && /*#__PURE__*/React.createElement(BizAttributeSelector, {
|
|
162
229
|
enableEventProp: true,
|
|
163
230
|
enableUserProp: true,
|
|
@@ -172,26 +239,21 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
172
239
|
}
|
|
173
240
|
}), /*#__PURE__*/React.createElement("div", {
|
|
174
241
|
className: "button-box"
|
|
175
|
-
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
242
|
+
}, notClickable === false && /*#__PURE__*/React.createElement(IconFont, {
|
|
176
243
|
type: "qingchu",
|
|
177
|
-
onClick:
|
|
244
|
+
onClick: onEventDelete
|
|
178
245
|
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
179
246
|
placement: "top",
|
|
180
247
|
title: '添加属性细分'
|
|
181
248
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
182
|
-
className: "".concat(attrSelectShow ||
|
|
249
|
+
className: "".concat(attrSelectShow || notClickable ? 'disable' : ''),
|
|
183
250
|
type: "tianjia2",
|
|
184
|
-
onClick:
|
|
185
|
-
if (ReasonData !== undefined || bizEventSelectorDefaultValue !== undefined) {
|
|
186
|
-
setAttrSelectShow(true);
|
|
187
|
-
setButtonDisable(true);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
251
|
+
onClick: onMinceProp
|
|
190
252
|
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
191
253
|
placement: "top",
|
|
192
254
|
title: '添加属性筛选'
|
|
193
255
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
194
|
-
className: "".concat(count >=
|
|
256
|
+
className: "".concat(count >= 5 || notClickable ? 'disable' : ''),
|
|
195
257
|
type: "shaixuan",
|
|
196
258
|
onClick: function onClick() {
|
|
197
259
|
return onAdd();
|
|
@@ -199,6 +261,7 @@ var AttributableEvents = function AttributableEvents(props) {
|
|
|
199
261
|
})))), /*#__PURE__*/React.createElement("div", null, (filters || isAdd) && /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
|
|
200
262
|
ref: conditionRef,
|
|
201
263
|
value: filters,
|
|
264
|
+
onlyAnd: true,
|
|
202
265
|
enableEventProp: true,
|
|
203
266
|
enableDelete: true,
|
|
204
267
|
eventIdList: [eventId],
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { AttrConditionTypes } from '@zgfe/business-lib';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
declare const GlobalAttribute: React.FC<{
|
|
3
|
-
value?:
|
|
4
|
+
value?: AttrConditionTypes.GroupValue;
|
|
4
5
|
max?: number;
|
|
5
6
|
eventIdList?: number[];
|
|
7
|
+
setAttrGlobalCount: Function;
|
|
6
8
|
onChange?: (val: any) => void;
|
|
7
9
|
}>;
|
|
8
10
|
export default GlobalAttribute;
|
|
@@ -9,7 +9,8 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
9
9
|
var GlobalAttribute = function GlobalAttribute(props) {
|
|
10
10
|
var classPrefix = 'mi-left-form';
|
|
11
11
|
var max = props.max,
|
|
12
|
-
onChange = props.onChange
|
|
12
|
+
onChange = props.onChange,
|
|
13
|
+
setAttrGlobalCount = props.setAttrGlobalCount;
|
|
13
14
|
var conditionRef = useRef(null);
|
|
14
15
|
var _useState = useState(0),
|
|
15
16
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -26,26 +27,29 @@ var GlobalAttribute = function GlobalAttribute(props) {
|
|
|
26
27
|
setInit(false);
|
|
27
28
|
}, []);
|
|
28
29
|
useEffect(function () {
|
|
29
|
-
console.log('eventIdList', props.eventIdList);
|
|
30
30
|
if (init || props.eventIdList && props.eventIdList[0] === -100) return;
|
|
31
31
|
if (!props.value) {
|
|
32
32
|
conditionRef.current.setValue(props.value);
|
|
33
33
|
}
|
|
34
|
-
}, [props.eventIdList]);
|
|
34
|
+
}, [props.eventIdList, props.value]);
|
|
35
35
|
var onAdd = function onAdd() {
|
|
36
36
|
if (props.eventIdList[0] === -100) return;
|
|
37
37
|
conditionRef.current.add();
|
|
38
38
|
};
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
setAttrGlobalCount(count);
|
|
41
|
+
}, [count]);
|
|
39
42
|
return /*#__PURE__*/React.createElement("div", null, props.eventIdList && props.eventIdList[0] === -100 ? '' : /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
|
|
40
43
|
ref: conditionRef,
|
|
41
44
|
value: props.value,
|
|
45
|
+
onlyAnd: true,
|
|
42
46
|
enableEventProp: true,
|
|
43
47
|
enableDelete: true,
|
|
44
48
|
eventIdList: props.eventIdList,
|
|
45
49
|
onChange: onChange,
|
|
46
50
|
onConditionsCount: setCount
|
|
47
51
|
}), count < max && /*#__PURE__*/React.createElement("div", {
|
|
48
|
-
className: "".concat(classPrefix, "-add ").concat(props.eventIdList
|
|
52
|
+
className: "".concat(classPrefix, "-add ").concat(props.eventIdList && props.eventIdList.length <= 0 ? 'disabled' : ''),
|
|
49
53
|
onClick: onAdd
|
|
50
54
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
51
55
|
className: "".concat(classPrefix, "-add-icon"),
|