@zgfe/modules-attribution 1.0.2-alpha.3 → 1.0.2-alpha.5

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.
@@ -1,5 +1,6 @@
1
1
  .table-list {
2
2
  margin-top: 25px;
3
+ margin-bottom: 40px;
3
4
  &-empty-tips {
4
5
  margin-top: 112px;
5
6
  text-align: center;
@@ -39,17 +39,21 @@ var AttributableEvents = function AttributableEvents(props) {
39
39
  setCount = _useState8[1];
40
40
  var _useState9 = useState(false),
41
41
  _useState10 = _slicedToArray(_useState9, 2),
42
- isAdd = _useState10[0],
43
- setIsAdd = _useState10[1];
44
- var conditionRef = useRef(null);
45
- var _useState11 = useState(-1),
42
+ countLoading = _useState10[0],
43
+ setCountLoading = _useState10[1];
44
+ var _useState11 = useState(false),
46
45
  _useState12 = _slicedToArray(_useState11, 2),
47
- eventId = _useState12[0],
48
- setEventId = _useState12[1];
49
- var _useState13 = useState(),
46
+ isAdd = _useState12[0],
47
+ setIsAdd = _useState12[1];
48
+ var conditionRef = useRef(null);
49
+ var _useState13 = useState(-1),
50
50
  _useState14 = _slicedToArray(_useState13, 2),
51
- minceAttr = _useState14[0],
52
- setMinceAttr = _useState14[1];
51
+ eventId = _useState14[0],
52
+ setEventId = _useState14[1];
53
+ var _useState15 = useState(),
54
+ _useState16 = _slicedToArray(_useState15, 2),
55
+ minceAttr = _useState16[0],
56
+ setMinceAttr = _useState16[1];
53
57
  var bizEventSelectorDefaultValue = {};
54
58
  if (value && value.eventId && value.eventId != -100) {
55
59
  bizEventSelectorDefaultValue = {
@@ -59,10 +63,10 @@ var AttributableEvents = function AttributableEvents(props) {
59
63
  }
60
64
  };
61
65
  }
62
- var _useState15 = useState(),
63
- _useState16 = _slicedToArray(_useState15, 2),
64
- bizAttributeSelectorValue = _useState16[0],
65
- setBizAttributeSelectorValue = _useState16[1];
66
+ var _useState17 = useState(),
67
+ _useState18 = _slicedToArray(_useState17, 2),
68
+ bizAttributeSelectorValue = _useState18[0],
69
+ setBizAttributeSelectorValue = _useState18[1];
66
70
  useEffect(function () {
67
71
  if (value) {
68
72
  var _value$filters;
@@ -92,12 +96,10 @@ var AttributableEvents = function AttributableEvents(props) {
92
96
  }
93
97
  }, []);
94
98
  useEffect(function () {
99
+ setCountLoading(false);
95
100
  if (ReasonData) {
96
101
  handleCount('add', attrSourceCount, setAttrSourceCount, count);
97
102
  }
98
- setTimeout(function () {
99
- onChangeHandle(ReasonData, filters, minceAttr);
100
- }, 0);
101
103
  }, [count]);
102
104
  var onEventDelete = function onEventDelete() {
103
105
  if (formData && formData.sourceFilters.length <= 1) {
@@ -139,6 +141,10 @@ var AttributableEvents = function AttributableEvents(props) {
139
141
  message.error('最多可添加5条属性筛选');
140
142
  return;
141
143
  }
144
+ if (countLoading) {
145
+ return;
146
+ }
147
+ setCountLoading(true);
142
148
  setIsAdd(true);
143
149
  setTimeout(function () {
144
150
  conditionRef.current.add();
@@ -210,10 +216,10 @@ var AttributableEvents = function AttributableEvents(props) {
210
216
  props.onChange(data);
211
217
  }
212
218
  };
213
- var _useState17 = useState(null),
214
- _useState18 = _slicedToArray(_useState17, 2),
215
- notClickable = _useState18[0],
216
- setNotClickable = _useState18[1];
219
+ var _useState19 = useState(null),
220
+ _useState20 = _slicedToArray(_useState19, 2),
221
+ notClickable = _useState20[0],
222
+ setNotClickable = _useState20[1];
217
223
  useEffect(function () {
218
224
  var _ReasonData$event;
219
225
  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) {
@@ -66,7 +66,6 @@ var TargetEvent = function TargetEvent(props) {
66
66
  };
67
67
  var onAdd = function onAdd() {
68
68
  var _targetData$event;
69
- console.log('添加筛选', targetData, bizEventSelectorDefaultValue);
70
69
  if ((targetData === null || targetData === void 0 ? void 0 : (_targetData$event = targetData.event) === null || _targetData$event === void 0 ? void 0 : _targetData$event.id) === -100 && Object.keys(bizEventSelectorDefaultValue).length <= 0) {
71
70
  message.error('请先选择目标事件');
72
71
  return;
@@ -93,9 +92,6 @@ var TargetEvent = function TargetEvent(props) {
93
92
  };
94
93
  useEffect(function () {
95
94
  setAttrTargetCount(count);
96
- setTimeout(function () {
97
- onChangeHandle(targetData, filters);
98
- }, 0);
99
95
  }, [count]);
100
96
  var onChangeHandle = function onChangeHandle(reason, filterData) {
101
97
  if (props.onChange) {
@@ -280,7 +280,7 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
280
280
  message: '请选择分析模型'
281
281
  }]
282
282
  }, /*#__PURE__*/React.createElement(Select, {
283
- className: "attributionType",
283
+ className: "attribution-type",
284
284
  placeholder: "\u8BF7\u9009\u62E9",
285
285
  style: {
286
286
  width: 208
@@ -293,16 +293,28 @@ var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
293
293
  }),
294
294
  options: [{
295
295
  value: 1,
296
- label: '首次触点归因'
296
+ label: /*#__PURE__*/React.createElement(Tooltip, {
297
+ placement: "right",
298
+ title: "\u5B8C\u6210\u76EE\u6807\u4E8B\u4EF6\u7684\u300C\u5F85\u5F52\u56E0\u4E8B\u4EF6\u300D\u4E2D\uFF0C\u7B2C\u4E00\u4E2A\u300C\u5F85\u5F52\u56E0\u4E8B\u4EF6\u300D\u8D21\u732E\u4E3A100%"
299
+ }, "\u9996\u6B21\u89E6\u70B9\u5F52\u56E0")
297
300
  }, {
298
301
  value: 2,
299
- label: '末次触点归因'
302
+ label: /*#__PURE__*/React.createElement(Tooltip, {
303
+ placement: "right",
304
+ title: "\u5B8C\u6210\u76EE\u6807\u4E8B\u4EF6\u7684\u300C\u5F85\u5F52\u56E0\u4E8B\u4EF6\u300D\u4E2D\uFF0C\u6700\u540E\u4E00\u4E2A\u300C\u5F85\u5F52\u56E0\u4E8B\u4EF6\u300D\u8D21\u732E\u4E3A100%"
305
+ }, "\u672B\u6B21\u89E6\u70B9\u5F52\u56E0")
300
306
  }, {
301
307
  value: 3,
302
- label: '线性归因'
308
+ label: /*#__PURE__*/React.createElement(Tooltip, {
309
+ placement: "right",
310
+ title: "\u5B8C\u6210\u76EE\u6807\u4E8B\u4EF6\u7684\u300C\u5F85\u5F52\u56E0\u4E8B\u4EF6\u300D\u4E2D\uFF0C\u6240\u6709\u300C\u5F85\u5F52\u56E0\u4E8B\u4EF6\u300D\u5E73\u5747\u5206\u914D\u8D21\u732E"
311
+ }, "\u7EBF\u6027\u5F52\u56E0")
303
312
  }, {
304
313
  value: 4,
305
- label: '位置归因'
314
+ label: /*#__PURE__*/React.createElement(Tooltip, {
315
+ placement: "right",
316
+ title: "\u5B8C\u6210\u76EE\u6807\u4E8B\u4EF6\u7684\u300C\u5F85\u5F52\u56E0\u4E8B\u4EF6\u300D\u4E2D\uFF0C\u9996\u4F4D\u548C\u672B\u4F4D\u300C\u5F85\u5F52\u56E0\u4E8B\u4EF6\u300D\u5404\u83B740%\u8D21\u732E\uFF0C\u5176\u4F59\u300C\u5F85\u5F52\u56E0\u4E8B\u4EF6\u300D\u5E73\u520620%\u8D21\u732E"
317
+ }, "\u4F4D\u7F6E\u5F52\u56E0")
306
318
  }]
307
319
  })), /*#__PURE__*/React.createElement("p", {
308
320
  className: "p"
@@ -1,16 +1,16 @@
1
1
  @import '~@zgfe/business-lib/es/assets/styles/inner.less';
2
2
 
3
3
  .form-box {
4
- .xiangxia{
5
- font-size: 14px!important;
4
+ .xiangxia {
5
+ font-size: 14px !important;
6
6
  }
7
- &-form-item{
7
+ &-form-item {
8
8
  margin-bottom: 16px;
9
- .attr-box-show{
10
- margin-top: 12px;
9
+ .attr-box-show {
10
+ margin: 12px 0px;
11
11
  }
12
12
  }
13
-
13
+
14
14
  &-bottom-form-title {
15
15
  margin-top: 34px;
16
16
  margin-bottom: 16px;
@@ -33,7 +33,7 @@
33
33
  color: #9aa1a9;
34
34
  }
35
35
  }
36
- .attributionType {
36
+ .attribution-type {
37
37
  margin-right: 24px;
38
38
  }
39
39
  .windowCnt {
@@ -106,8 +106,8 @@
106
106
  }
107
107
  }
108
108
 
109
- .global-attr{
110
- margin-bottom: 0!important;
109
+ .global-attr {
110
+ margin-bottom: 0 !important;
111
111
  }
112
112
 
113
113
  .biz-condition-item-input {
@@ -119,8 +119,8 @@
119
119
  }
120
120
  .attributable-events-box {
121
121
  .select-and-attr {
122
- margin-bottom: 12px;
123
122
  display: flex;
123
+ margin-bottom: 12px;
124
124
  .ant-dropdown-trigger {
125
125
  width: 208px;
126
126
  margin-right: 16px;
@@ -207,3 +207,6 @@
207
207
  color: #fb5547;
208
208
  }
209
209
  }
210
+ .attribution-type-options {
211
+
212
+ }
@@ -39,50 +39,43 @@ var judgeAttrInEvents = function judgeAttrInEvents(elds, attrId, eventGroupList)
39
39
  return flag;
40
40
  };
41
41
  export function operableOrNotHandle(data, attrSourceCount, attrTargetCount, mincePropCount, attrGlobalCount) {
42
- var flag = false;
43
- data.attributionType === undefined ? flag = true : null;
44
- if (subsetHandle(data, 'sourceFilters', attrSourceCount, mincePropCount)) flag = true;
45
- if (subsetHandle(data, 'targetFilters', attrTargetCount)) flag = true;
46
- if (attrGlobalCount && data.globalFilters === undefined) flag = true;
47
- if (data.globalFilters && conditionsHandle('globalFilters', data.globalFilters, attrGlobalCount, 0)) {
48
- flag = true;
49
- }
50
- return flag;
42
+ var flagList = [];
43
+ if (data.attributionType === undefined) return true;
44
+ subsetHandle(flagList, data, 'sourceFilters', attrSourceCount, mincePropCount);
45
+ subsetHandle(flagList, data, 'targetFilters', attrTargetCount);
46
+ if (attrGlobalCount && data.globalFilters === undefined) return true;
47
+ data.globalFilters && conditionsHandle('globalFilters', data.globalFilters, attrGlobalCount, 0, flagList);
48
+ return flagList.indexOf(true) !== -1;
51
49
  }
52
- var subsetHandle = function subsetHandle(data, type, count, mincePropCount) {
53
- var flag = false;
50
+ var subsetHandle = function subsetHandle(flagList, data, type, count, mincePropCount) {
54
51
  data[type].map(function (item) {
55
- item === undefined ? flag = true : null;
52
+ item === undefined ? flagList.push(true) : null;
56
53
  if (item !== undefined) {
57
- var _item$filters;
58
- (item === null || item === void 0 ? void 0 : item.eventId) === -100 ? flag = true : null;
54
+ (item === null || item === void 0 ? void 0 : item.eventId) === -100 ? flagList.push(true) : null;
59
55
  if (type === 'targetFilters') {
60
- item.filters === undefined && count != 0 ? flag = true : null;
56
+ item.filters === undefined && count != 0 ? flagList.push(true) : null;
61
57
  } else {
62
- item.filters === undefined && Object.keys(count).length > 0 && count[item.eventId] !== undefined ? flag = true : null;
58
+ item.filters === undefined && Object.keys(count).length > 0 && count[item.eventId] !== undefined ? flagList.push(true) : null;
63
59
  if (mincePropCount != undefined) {
64
- item.attributionSubdivision === undefined && Object.keys(mincePropCount).length > 0 && mincePropCount[item.eventId] !== undefined ? flag = true : null;
60
+ item.attributionSubdivision === undefined && Object.keys(mincePropCount).length > 0 && mincePropCount[item.eventId] !== undefined ? flagList.push(true) : null;
65
61
  }
66
62
  }
67
- if ((item === null || item === void 0 ? void 0 : item.filters) && ((_item$filters = item.filters) === null || _item$filters === void 0 ? void 0 : _item$filters.conditions.length) > 0) {
68
- flag = conditionsHandle(type, item.filters, count, item.eventId);
69
- }
63
+ (item === null || item === void 0 ? void 0 : item.filters) && conditionsHandle(type, item.filters, count, item.eventId, flagList);
70
64
  }
71
65
  });
72
- return flag;
73
66
  };
74
- var conditionsHandle = function conditionsHandle(type, data, count, eventId) {
75
- var flag = false;
76
- data.conditions.map(function (_item) {
77
- if (_item.operator !== 'is null' && _item.operator !== 'is not null') {
78
- var _item$values;
79
- _item.values && ((_item$values = _item.values) === null || _item$values === void 0 ? void 0 : _item$values.length) <= 0 ? flag = true : null;
80
- }
81
- });
67
+ var conditionsHandle = function conditionsHandle(type, data, count, eventId, flagList) {
68
+ if (data.conditions.length > 0) {
69
+ data.conditions.map(function (_item) {
70
+ if (_item.operator !== 'is null' && _item.operator !== 'is not null') {
71
+ var _item$values;
72
+ _item.values && (((_item$values = _item.values) === null || _item$values === void 0 ? void 0 : _item$values.length) <= 0 || _item.values[0] === '') ? flagList.push(true) : null;
73
+ }
74
+ });
75
+ }
82
76
  if (type === 'targetFilters' || type === 'globalFilters') {
83
- data.conditions.length != count ? flag = true : null;
77
+ data.conditions.length != count ? flagList.push(true) : null;
84
78
  } else {
85
- data.conditions.length != count[eventId] ? flag = true : null;
79
+ count[eventId] && data.conditions.length != count[eventId] ? flagList.push(true) : null;
86
80
  }
87
- return flag;
88
81
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-attribution",
3
- "version": "1.0.2-alpha.3",
3
+ "version": "1.0.2-alpha.5",
4
4
  "module": "es/index.js",
5
5
  "typings": "es/index.d.ts",
6
6
  "files": [
@@ -37,7 +37,7 @@
37
37
  "@types/lodash": "^4.14.191",
38
38
  "@umijs/fabric": "^2.8.1",
39
39
  "@umijs/test": "^3.0.5",
40
- "@zgfe/business-lib": "1.1.41-attribution.16",
40
+ "@zgfe/business-lib": "1.1.41-attribution.17",
41
41
  "antd": "^4.22.6",
42
42
  "dumi": "^1.1.0",
43
43
  "echarts": "^5.3.2",
@@ -50,5 +50,5 @@
50
50
  "react": "^16.12.0 || ^17.0.0",
51
51
  "yorkie": "^2.0.0"
52
52
  },
53
- "gitHead": "1f756584bf9a984a8017f88908113edf14ee5286"
53
+ "gitHead": "c3b7a19eae94d358b04dfd7d40f6b01ed9d74d80"
54
54
  }