@zgfe/business-lib 1.2.38 → 1.2.40-heyh.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/AUMFormulaTarget/components/formula/util.d.ts +2 -1
- package/es/AUMFormulaTarget/components/formula/util.js +2 -2
- package/es/AUMFormulaTarget/components/formulaItem/index.js +3 -2
- package/es/AUMFormulaTarget/components/panel/cdpCshCondition.js +25 -32
- package/es/AUMFormulaTarget/components/panel/index.js +3 -2
- package/es/AUMFormulaTarget/components/panel/types.d.ts +1 -0
- package/es/attrConditions/components/operateList.js +19 -7
- package/es/attrConditions/utils/operates.d.ts +8 -0
- package/es/attrConditions/utils/operates.js +27 -7
- package/es/attributeSelector/listPanel.js +5 -3
- package/es/attributeSelector/util.js +1 -1
- package/es/constants/apis.d.ts +3 -0
- package/es/constants/apis.js +4 -1
- package/es/constants/common.d.ts +2 -2
- package/es/constants/common.js +43 -39
- package/es/context/index.d.ts +19 -5
- package/es/dataSetGroup/index.js +8 -16
- package/es/dataSetGroup/overlay.js +8 -5
- package/es/dataSetGroup/types.d.ts +1 -0
- package/es/demoWrapper/content.d.ts +2 -0
- package/es/demoWrapper/content.js +28 -11
- package/es/demoWrapper/demo/index.js +15 -2
- package/es/demoWrapper/index.js +78 -14
- package/es/eventSelector/index.js +3 -2
- package/es/eventSelector/listPanel.js +5 -4
- package/es/formulaTarget/components/formula/util.d.ts +2 -1
- package/es/formulaTarget/components/formula/util.js +2 -2
- package/es/formulaTarget/components/formulaItem/index.js +3 -2
- package/es/formulaTarget/components/panel/index.js +3 -2
- package/es/hooks/useBizStore.d.ts +8 -4
- package/es/hooks/useBizStore.js +129 -45
- package/es/hooks/useSubject.js +17 -4
- package/es/productCondition/conditions/cdpCshCondition.js +27 -27
- package/es/productCondition/conditions/textDesc.js +0 -3
- package/es/productCondition/index.js +3 -5
- package/es/productCondition/orConditions.js +0 -1
- package/es/productCondition/types.d.ts +4 -0
- package/es/targetConditionGroup/components/targetDimension.js +7 -5
- package/es/targetConditionGroup/data/operates.d.ts +1 -13
- package/es/targetConditionGroup/data/operates.js +10 -37
- package/es/targetConditionGroup/index.js +3 -2
- package/es/userCondition/conditionTypeList.js +4 -4
- package/es/userCondition/conditions/cdpCondition.js +21 -22
- package/es/userCondition/conditions/cdpCshCondition.js +31 -29
- package/es/userCondition/conditions/tagsCondition.js +4 -1
- package/es/userCondition/demo/index.js +1 -1
- package/es/userCondition/index.js +42 -53
- package/es/userCondition/types.d.ts +5 -0
- package/es/userGroup/index.js +0 -1
- package/es/userGroup/overlay.js +1 -3
- package/es/userGroup/styles/index.less +0 -1
- package/es/utils/util.d.ts +1 -0
- package/es/utils/util.js +9 -0
- package/package.json +2 -2
- package/es/demoWrapper/head.d.ts +0 -9
- package/es/demoWrapper/head.js +0 -67
package/es/hooks/useBizStore.js
CHANGED
|
@@ -1,69 +1,96 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
8
|
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
9
|
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
10
|
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
11
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import
|
|
13
|
+
import { useEffect, useState, useCallback } from 'react';
|
|
8
14
|
import { ajax } from '../utils';
|
|
9
15
|
import Apis from '../constants/apis';
|
|
16
|
+
import convertAttributeData from '../attributeSelector/util';
|
|
10
17
|
function useBizStore(_ref) {
|
|
11
18
|
var currentApp = _ref.currentApp;
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
userGroupList =
|
|
15
|
-
setUserGroupList =
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
tagList =
|
|
19
|
-
setTagList =
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
19
|
+
var _useState = useState([]),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
userGroupList = _useState2[0],
|
|
22
|
+
setUserGroupList = _useState2[1];
|
|
23
|
+
var _useState3 = useState([]),
|
|
24
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
25
|
+
tagList = _useState4[0],
|
|
26
|
+
setTagList = _useState4[1];
|
|
27
|
+
var _useState5 = useState(),
|
|
28
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
29
|
+
setTimer = _useState6[1];
|
|
30
|
+
var _useState7 = useState([]),
|
|
31
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
32
|
+
eventGroups = _useState8[0],
|
|
33
|
+
setEventGroups = _useState8[1];
|
|
34
|
+
var _useState9 = useState([]),
|
|
35
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
36
|
+
userProps = _useState10[0],
|
|
37
|
+
setUserProps = _useState10[1];
|
|
38
|
+
var _useState11 = useState([]),
|
|
39
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
40
|
+
envList = _useState12[0],
|
|
41
|
+
setEnvList = _useState12[1];
|
|
42
|
+
var _useState13 = useState(true),
|
|
43
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
44
|
+
loadEvent = _useState14[0],
|
|
45
|
+
setLoadEvent = _useState14[1];
|
|
46
|
+
var _useState15 = useState(true),
|
|
47
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
48
|
+
loadUsers = _useState16[0],
|
|
49
|
+
setLoadUsers = _useState16[1];
|
|
50
|
+
var _useState17 = useState(true),
|
|
51
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
52
|
+
loadEnv = _useState18[0],
|
|
53
|
+
setLoadEnv = _useState18[1];
|
|
54
|
+
var _useState19 = useState(true),
|
|
55
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
56
|
+
groupLoading = _useState20[0],
|
|
57
|
+
setGroupLoading = _useState20[1];
|
|
58
|
+
var _useState21 = useState(true),
|
|
59
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
60
|
+
tagLoading = _useState22[0],
|
|
61
|
+
setTagLoading = _useState22[1];
|
|
62
|
+
var _useState23 = useState({}),
|
|
63
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
64
|
+
store = _useState24[0],
|
|
65
|
+
setStore = _useState24[1];
|
|
66
|
+
var _useState25 = useState(false),
|
|
67
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
68
|
+
useBizStoreLoading = _useState26[0],
|
|
69
|
+
setUseBizStoreLoading = _useState26[1];
|
|
70
|
+
var queryGroups = useCallback(function () {
|
|
36
71
|
setGroupLoading(true);
|
|
37
|
-
groupController === null || groupController === void 0 ? void 0 : groupController.abort();
|
|
38
|
-
var controller = new AbortController();
|
|
39
|
-
var signal = controller.signal;
|
|
40
|
-
setGroupController(controller);
|
|
41
|
-
signal.addEventListener('abort', function () {
|
|
42
|
-
console.log('用户群请求已被取消');
|
|
43
|
-
});
|
|
44
72
|
ajax(Apis.queryUserGroup, {
|
|
45
73
|
method: 'post',
|
|
46
74
|
data: {
|
|
47
|
-
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.
|
|
75
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
48
76
|
platform: 0,
|
|
49
77
|
includeDefault: true,
|
|
50
78
|
includeToday: true
|
|
51
|
-
}
|
|
52
|
-
signal: signal
|
|
79
|
+
}
|
|
53
80
|
}).then(function (res) {
|
|
54
81
|
if (!res) return;
|
|
55
82
|
setUserGroupList(res.data);
|
|
56
83
|
}).finally(function () {
|
|
57
84
|
setGroupLoading(false);
|
|
58
85
|
});
|
|
59
|
-
}
|
|
60
|
-
|
|
86
|
+
}, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
|
|
87
|
+
var queryTags = useCallback(function () {
|
|
61
88
|
setTagLoading(true);
|
|
62
89
|
ajax(Apis.queryAllTags, {
|
|
63
90
|
method: 'post',
|
|
64
91
|
data: {
|
|
65
|
-
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.
|
|
66
|
-
platform:
|
|
92
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
93
|
+
platform: 0
|
|
67
94
|
}
|
|
68
95
|
}).then(function (res) {
|
|
69
96
|
if (!res) return;
|
|
@@ -71,20 +98,77 @@ function useBizStore(_ref) {
|
|
|
71
98
|
}).finally(function () {
|
|
72
99
|
setTagLoading(false);
|
|
73
100
|
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
101
|
+
}, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
|
|
102
|
+
var loadEvents = useCallback(function () {
|
|
103
|
+
setLoadEvent(true);
|
|
104
|
+
ajax('/zg/web/v2/data/queryEventMetasOfGroup', {
|
|
105
|
+
method: 'post',
|
|
106
|
+
data: {
|
|
107
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
108
|
+
platform: 0,
|
|
109
|
+
isAll: true
|
|
110
|
+
}
|
|
111
|
+
}).then(function (res) {
|
|
112
|
+
setEventGroups(res.data);
|
|
113
|
+
setLoadEvent(false);
|
|
114
|
+
});
|
|
115
|
+
}, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
|
|
116
|
+
var loadUserProps = useCallback(function () {
|
|
117
|
+
setLoadUsers(true);
|
|
118
|
+
ajax('/zg/web/v2/appusergroup/getUserPropMeta', {
|
|
119
|
+
method: 'post',
|
|
120
|
+
data: {
|
|
121
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
122
|
+
platform: 0
|
|
123
|
+
}
|
|
124
|
+
}).then(function (res) {
|
|
125
|
+
setUserProps(res.data);
|
|
126
|
+
setLoadUsers(false);
|
|
127
|
+
});
|
|
128
|
+
}, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
|
|
129
|
+
var loadEnvList = useCallback(function () {
|
|
130
|
+
setLoadEnv(true);
|
|
131
|
+
ajax('/zg/web/v2/appusergroup/getEventEnvData', {
|
|
132
|
+
method: 'post',
|
|
133
|
+
data: {
|
|
134
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
135
|
+
platform: 0
|
|
136
|
+
}
|
|
137
|
+
}).then(function (res) {
|
|
138
|
+
setEnvList(res.data.eventEnv);
|
|
139
|
+
setLoadEnv(false);
|
|
140
|
+
});
|
|
141
|
+
}, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
|
|
142
|
+
useEffect(function () {
|
|
143
|
+
if (loadEnv || loadEvent || loadUsers) return;
|
|
144
|
+
setStore(convertAttributeData({
|
|
145
|
+
eventList: eventGroups,
|
|
146
|
+
userPropList: userProps,
|
|
147
|
+
envPropList: envList
|
|
148
|
+
}));
|
|
149
|
+
}, [loadEvent, loadEnv, loadUsers, eventGroups, userProps, envList]);
|
|
150
|
+
useEffect(function () {
|
|
151
|
+
if (loadEvent || loadEnv || loadUsers || groupLoading || tagLoading) return;
|
|
152
|
+
setUseBizStoreLoading(false);
|
|
153
|
+
}, [loadEvent, loadEnv, loadUsers, groupLoading, tagLoading]);
|
|
154
|
+
useEffect(function () {
|
|
155
|
+
if (!currentApp || !currentApp.appId) return;
|
|
77
156
|
setTimer(function (pre) {
|
|
78
157
|
if (pre) {
|
|
79
158
|
clearTimeout(pre);
|
|
80
159
|
}
|
|
81
160
|
return setTimeout(function () {
|
|
161
|
+
setUseBizStoreLoading(true);
|
|
82
162
|
queryGroups();
|
|
83
163
|
queryTags();
|
|
164
|
+
loadUserProps();
|
|
165
|
+
loadEvents();
|
|
166
|
+
loadEnvList();
|
|
84
167
|
}, 300);
|
|
85
168
|
});
|
|
86
|
-
}, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.
|
|
87
|
-
return {
|
|
169
|
+
}, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
|
|
170
|
+
return _objectSpread({
|
|
171
|
+
useBizStoreLoading: useBizStoreLoading,
|
|
88
172
|
groupLoading: groupLoading,
|
|
89
173
|
userGroupList: userGroupList,
|
|
90
174
|
tagList: tagList,
|
|
@@ -93,6 +177,6 @@ function useBizStore(_ref) {
|
|
|
93
177
|
setTagList: setTagList,
|
|
94
178
|
queryTags: queryTags,
|
|
95
179
|
queryGroups: queryGroups
|
|
96
|
-
};
|
|
180
|
+
}, store);
|
|
97
181
|
}
|
|
98
182
|
export default useBizStore;
|
package/es/hooks/useSubject.js
CHANGED
|
@@ -4,9 +4,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
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
5
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import { useContext, useState } from 'react';
|
|
7
|
+
import { useContext, useState, useCallback, useEffect } from 'react';
|
|
8
8
|
import BizGlobalDataContext from '../context';
|
|
9
|
-
import useChanged from './useChanged';
|
|
10
9
|
import request from '../utils/ajax';
|
|
11
10
|
import Apis from '../constants/apis';
|
|
12
11
|
function useSubject() {
|
|
@@ -20,7 +19,10 @@ function useSubject() {
|
|
|
20
19
|
setLoading = _useState4[1];
|
|
21
20
|
var _useContext = useContext(BizGlobalDataContext),
|
|
22
21
|
currentApp = _useContext.currentApp;
|
|
23
|
-
|
|
22
|
+
var _useState5 = useState(),
|
|
23
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
24
|
+
setTimer = _useState6[1];
|
|
25
|
+
var queryData = useCallback(function () {
|
|
24
26
|
setLoading(true);
|
|
25
27
|
request(Apis.querySubjectList, {
|
|
26
28
|
method: 'post',
|
|
@@ -33,7 +35,18 @@ function useSubject() {
|
|
|
33
35
|
}).finally(function () {
|
|
34
36
|
setLoading(false);
|
|
35
37
|
});
|
|
36
|
-
}, currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId);
|
|
38
|
+
}, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
if (!currentApp || !currentApp.appId) return;
|
|
41
|
+
setTimer(function (pre) {
|
|
42
|
+
if (pre) {
|
|
43
|
+
clearTimeout(pre);
|
|
44
|
+
}
|
|
45
|
+
return setTimeout(function () {
|
|
46
|
+
queryData();
|
|
47
|
+
}, 300);
|
|
48
|
+
});
|
|
49
|
+
}, [currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId]);
|
|
37
50
|
return {
|
|
38
51
|
subjectList: subjectList,
|
|
39
52
|
loading: loading
|
|
@@ -21,20 +21,17 @@ import moment from 'moment';
|
|
|
21
21
|
import { BizUserConditionContext } from '..';
|
|
22
22
|
import request from '../../utils/ajax';
|
|
23
23
|
import Apis from '../../constants/apis';
|
|
24
|
-
import BizGlobalDataContext from '../../context';
|
|
25
24
|
var classPrefix = 'biz-user-condition-cdp-csh';
|
|
26
25
|
var CdpConditionItem = function CdpConditionItem(props) {
|
|
27
|
-
var _useContext = useContext(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_useContext2$datasetL = _useContext2.datasetList,
|
|
31
|
-
datasetList = _useContext2$datasetL === void 0 ? [] : _useContext2$datasetL;
|
|
26
|
+
var _useContext = useContext(BizUserConditionContext),
|
|
27
|
+
_useContext$datasetLi = _useContext.datasetList,
|
|
28
|
+
datasetList = _useContext$datasetLi === void 0 ? [] : _useContext$datasetLi;
|
|
32
29
|
var _useState = useState(function () {
|
|
33
30
|
if (props.value) {
|
|
34
|
-
return {
|
|
31
|
+
return _objectSpread(_objectSpread({}, props.value), {}, {
|
|
35
32
|
id: props.value.datasetId,
|
|
36
33
|
tableName: props.value.datasetTable
|
|
37
|
-
};
|
|
34
|
+
});
|
|
38
35
|
}
|
|
39
36
|
return;
|
|
40
37
|
}),
|
|
@@ -98,6 +95,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
98
95
|
datasetId = _props$value.datasetId,
|
|
99
96
|
datasetName = _props$value.datasetName,
|
|
100
97
|
datasetTable = _props$value.datasetTable,
|
|
98
|
+
metaDatasetId = _props$value.metaDatasetId,
|
|
101
99
|
fieldName = _props$value.fieldName,
|
|
102
100
|
fieldType = _props$value.fieldType,
|
|
103
101
|
webType = _props$value.webType,
|
|
@@ -108,8 +106,10 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
108
106
|
subCondition = _props$value.subCondition;
|
|
109
107
|
setDataset({
|
|
110
108
|
id: datasetId,
|
|
109
|
+
datasetId: datasetId,
|
|
111
110
|
tableName: datasetTable,
|
|
112
|
-
datasetName: datasetName
|
|
111
|
+
datasetName: datasetName,
|
|
112
|
+
metaDatasetId: metaDatasetId
|
|
113
113
|
});
|
|
114
114
|
setField({
|
|
115
115
|
name: fieldName,
|
|
@@ -122,8 +122,10 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
122
122
|
if (subCondition) {
|
|
123
123
|
setSubDataset({
|
|
124
124
|
id: subCondition.datasetId,
|
|
125
|
+
datasetId: subCondition.datasetId,
|
|
125
126
|
tableName: subCondition.datasetTable,
|
|
126
|
-
datasetName: subCondition.datasetName
|
|
127
|
+
datasetName: subCondition.datasetName,
|
|
128
|
+
metaDatasetId: subCondition.metaDatasetId
|
|
127
129
|
});
|
|
128
130
|
setSubField({
|
|
129
131
|
name: subCondition.fieldName,
|
|
@@ -150,7 +152,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
150
152
|
if (params || between) {
|
|
151
153
|
setFieldValue(operator === 'between' ? between : Array.isArray(params) ? params : [params]);
|
|
152
154
|
}
|
|
153
|
-
onDatasetChange(
|
|
155
|
+
onDatasetChange(datasetTable);
|
|
154
156
|
setTimeout(function () {
|
|
155
157
|
setIsFirst(false);
|
|
156
158
|
}, 0);
|
|
@@ -159,7 +161,8 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
159
161
|
if (isFirst) return;
|
|
160
162
|
if (!dataset) return;
|
|
161
163
|
var data = {
|
|
162
|
-
datasetId: dataset.
|
|
164
|
+
datasetId: dataset.datasetId,
|
|
165
|
+
metaDatasetId: dataset.metaDatasetId,
|
|
163
166
|
datasetName: dataset.datasetName,
|
|
164
167
|
datasetTable: dataset.tableName,
|
|
165
168
|
fieldName: field === null || field === void 0 ? void 0 : field.name,
|
|
@@ -203,18 +206,16 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
203
206
|
return PropType.DATE;
|
|
204
207
|
}
|
|
205
208
|
};
|
|
206
|
-
var onDatasetChange = function onDatasetChange(
|
|
207
|
-
if (!
|
|
209
|
+
var onDatasetChange = function onDatasetChange(tableName, isSub) {
|
|
210
|
+
if (!tableName) {
|
|
208
211
|
isSub ? setSubFieldList([]) : setFieldList([]);
|
|
209
212
|
return;
|
|
210
213
|
}
|
|
211
214
|
setLoading(true);
|
|
212
|
-
request(Apis.
|
|
213
|
-
method: '
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
platform: currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform,
|
|
217
|
-
datasetId: datasetId
|
|
215
|
+
request(Apis.queryTableInfo, {
|
|
216
|
+
method: 'get',
|
|
217
|
+
params: {
|
|
218
|
+
tableName: tableName
|
|
218
219
|
}
|
|
219
220
|
}).then(function (result) {
|
|
220
221
|
setLoading(false);
|
|
@@ -234,7 +235,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
234
235
|
});
|
|
235
236
|
setOperator(undefined);
|
|
236
237
|
setFieldValue([]);
|
|
237
|
-
onDatasetChange(data.
|
|
238
|
+
onDatasetChange(data.tableName);
|
|
238
239
|
};
|
|
239
240
|
var onSubTableChange = function onSubTableChange(data) {
|
|
240
241
|
setSubDataset(data);
|
|
@@ -242,7 +243,7 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
242
243
|
name: undefined
|
|
243
244
|
});
|
|
244
245
|
setSubOperator(undefined);
|
|
245
|
-
onDatasetChange(data.
|
|
246
|
+
onDatasetChange(data.tableName, true);
|
|
246
247
|
};
|
|
247
248
|
var onFieldChange = function onFieldChange(data) {
|
|
248
249
|
setField(data);
|
|
@@ -405,8 +406,8 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
405
406
|
className: "".concat(classPrefix, "-select-dataset"),
|
|
406
407
|
options: datasetList,
|
|
407
408
|
placeholder: "\u9009\u62E9\u660E\u7EC6\u8868",
|
|
408
|
-
labelField: "
|
|
409
|
-
keyField: "
|
|
409
|
+
labelField: "name",
|
|
410
|
+
keyField: "metaDatasetId",
|
|
410
411
|
value: subDataset,
|
|
411
412
|
onChange: function onChange(v) {
|
|
412
413
|
onSubTableChange(v);
|
|
@@ -470,8 +471,8 @@ var CdpConditionItem = function CdpConditionItem(props) {
|
|
|
470
471
|
className: "".concat(classPrefix, "-select-dataset"),
|
|
471
472
|
options: datasetList,
|
|
472
473
|
placeholder: "\u9009\u62E9\u660E\u7EC6\u8868",
|
|
473
|
-
labelField: "
|
|
474
|
-
keyField: "
|
|
474
|
+
labelField: "name",
|
|
475
|
+
keyField: "metaDatasetId",
|
|
475
476
|
value: dataset,
|
|
476
477
|
onChange: function onChange(v) {
|
|
477
478
|
return onTableChange(v);
|
|
@@ -507,7 +508,6 @@ var CdpCondition = function CdpCondition(props) {
|
|
|
507
508
|
}
|
|
508
509
|
}, []);
|
|
509
510
|
var onChangeCondition = function onChangeCondition(condition, index) {
|
|
510
|
-
console.log('onChangeCondition', condition, index);
|
|
511
511
|
var resData = _.cloneDeep(cdpConditions);
|
|
512
512
|
resData[index] = _objectSpread({}, condition);
|
|
513
513
|
onChange(dataId, resData);
|
|
@@ -25,7 +25,6 @@ var Text = function Text(props) {
|
|
|
25
25
|
return renderCshCdp(condition);
|
|
26
26
|
}
|
|
27
27
|
var data = condition;
|
|
28
|
-
console.log('condition-data', data);
|
|
29
28
|
if (data.eventId === undefined) {
|
|
30
29
|
return renderProps(data.attrs[0]);
|
|
31
30
|
}
|
|
@@ -56,7 +55,6 @@ var Text = function Text(props) {
|
|
|
56
55
|
}, label.before), period.operator === 'relative' ? /*#__PURE__*/React.createElement("span", null, "\u6700\u8FD1") : null, valuesDom);
|
|
57
56
|
}
|
|
58
57
|
function renderProps(attr) {
|
|
59
|
-
console.log('attr', attr);
|
|
60
58
|
return /*#__PURE__*/React.createElement("span", {
|
|
61
59
|
style: {
|
|
62
60
|
backgroundColor: '#effcff',
|
|
@@ -67,7 +65,6 @@ var Text = function Text(props) {
|
|
|
67
65
|
}, attr === null || attr === void 0 ? void 0 : attr.attrName), renderPropValues(attr));
|
|
68
66
|
}
|
|
69
67
|
function renderEvent(condition) {
|
|
70
|
-
console.log('condition-renderEvent', condition);
|
|
71
68
|
var event = findEvent(condition.eventId, eventGroupList !== null && eventGroupList !== void 0 ? eventGroupList : []);
|
|
72
69
|
var periodLabel = {};
|
|
73
70
|
if (condition.runPeriod.operator === 'join_time') {
|
|
@@ -96,7 +96,7 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
96
96
|
if (eventInfo.eventId) {
|
|
97
97
|
var dealDataset = dataset.filter(function (item) {
|
|
98
98
|
return eventInfo.dataSet && eventInfo.dataSet.find(function (v) {
|
|
99
|
-
return v.datasetId === item.
|
|
99
|
+
return v.datasetId === item.datasetId;
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
102
|
setDataset(dealDataset);
|
|
@@ -110,7 +110,6 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
110
110
|
orConditions: item
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
|
-
console.log('showList', showList);
|
|
114
113
|
setShowList(showList);
|
|
115
114
|
setDataList(showList);
|
|
116
115
|
}
|
|
@@ -155,11 +154,10 @@ var BizUserCondition = function BizUserCondition(props) {
|
|
|
155
154
|
props.onChange && props.onChange(newValue);
|
|
156
155
|
}
|
|
157
156
|
function getDatasetList() {
|
|
158
|
-
request(Apis.
|
|
157
|
+
request(Apis.queryMetaDatasetList, {
|
|
159
158
|
method: 'post',
|
|
160
159
|
data: {
|
|
161
|
-
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
|
|
162
|
-
platform: currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform
|
|
160
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
|
|
163
161
|
}
|
|
164
162
|
}).then(function (result) {
|
|
165
163
|
setDataset((result === null || result === void 0 ? void 0 : result.data) || []);
|
|
@@ -128,7 +128,6 @@ var OrConditions = function OrConditions(props) {
|
|
|
128
128
|
condition: condition
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
console.log('condition', condition);
|
|
132
131
|
if (condition.data_set_csh) {
|
|
133
132
|
conditionDom = /*#__PURE__*/React.createElement(CdpCshCondition, {
|
|
134
133
|
defaultValue: condition,
|
|
@@ -161,6 +161,8 @@ export declare namespace BizProductConditionT {
|
|
|
161
161
|
}
|
|
162
162
|
interface CdpDataSet {
|
|
163
163
|
id: number;
|
|
164
|
+
metaDatasetId: number;
|
|
165
|
+
datasetId: number;
|
|
164
166
|
datasetName: string;
|
|
165
167
|
tableName: string;
|
|
166
168
|
}
|
|
@@ -182,6 +184,7 @@ export declare namespace BizProductConditionT {
|
|
|
182
184
|
}
|
|
183
185
|
interface CdpCshConditionDetail {
|
|
184
186
|
datasetId?: number;
|
|
187
|
+
metaDatasetId: number;
|
|
185
188
|
datasetTable?: string;
|
|
186
189
|
datasetName?: string;
|
|
187
190
|
fieldName?: string;
|
|
@@ -192,6 +195,7 @@ export declare namespace BizProductConditionT {
|
|
|
192
195
|
paramType?: PropType;
|
|
193
196
|
subCondition?: {
|
|
194
197
|
datasetId?: number;
|
|
198
|
+
metaDatasetId?: number;
|
|
195
199
|
datasetTable?: string;
|
|
196
200
|
datasetName?: string;
|
|
197
201
|
fieldName?: string;
|
|
@@ -12,6 +12,10 @@ import BizGlobalDataContext from '../../context';
|
|
|
12
12
|
import SelectHandle from '../../select/handle';
|
|
13
13
|
import { normalOptions, attrOptions } from '../data/operates';
|
|
14
14
|
var BizTargetDimension = function BizTargetDimension(props) {
|
|
15
|
+
var _currentApp$type;
|
|
16
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
17
|
+
eventGroupList = _useContext.eventGroupList,
|
|
18
|
+
currentApp = _useContext.currentApp;
|
|
15
19
|
var _useState = useState(),
|
|
16
20
|
_useState2 = _slicedToArray(_useState, 2),
|
|
17
21
|
dimension = _useState2[0],
|
|
@@ -20,19 +24,17 @@ var BizTargetDimension = function BizTargetDimension(props) {
|
|
|
20
24
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
21
25
|
dimensionParent = _useState4[0],
|
|
22
26
|
setDimensionParent = _useState4[1];
|
|
23
|
-
var _useState5 = useState(props.normalOptions || normalOptions),
|
|
27
|
+
var _useState5 = useState(props.normalOptions || normalOptions((_currentApp$type = currentApp === null || currentApp === void 0 ? void 0 : currentApp.type) !== null && _currentApp$type !== void 0 ? _currentApp$type : 'user')),
|
|
24
28
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
25
29
|
options = _useState6[0],
|
|
26
30
|
setOptions = _useState6[1];
|
|
27
|
-
var _useContext = useContext(BizGlobalDataContext),
|
|
28
|
-
eventGroupList = _useContext.eventGroupList;
|
|
29
31
|
var _useState7 = useState(false),
|
|
30
32
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
31
33
|
visible = _useState8[0],
|
|
32
34
|
setVisible = _useState8[1];
|
|
33
35
|
useEffect(function () {
|
|
34
|
-
var _props$value;
|
|
35
|
-
var dimensionOption = props.normalOptions || normalOptions;
|
|
36
|
+
var _currentApp$type2, _props$value;
|
|
37
|
+
var dimensionOption = props.normalOptions || normalOptions((_currentApp$type2 = currentApp === null || currentApp === void 0 ? void 0 : currentApp.type) !== null && _currentApp$type2 !== void 0 ? _currentApp$type2 : 'user');
|
|
36
38
|
if (props.eventId && props.isExtend) {
|
|
37
39
|
dimensionOption = getAttrOption(props.eventId, dimensionOption);
|
|
38
40
|
}
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
name: string;
|
|
3
|
-
value: string;
|
|
4
|
-
children?: undefined;
|
|
5
|
-
} | {
|
|
6
|
-
name: string;
|
|
7
|
-
value: string;
|
|
8
|
-
children: {
|
|
9
|
-
name: string;
|
|
10
|
-
value: string;
|
|
11
|
-
}[];
|
|
12
|
-
})[];
|
|
13
|
-
export declare const normalOptions: {
|
|
1
|
+
export declare const normalOptions: (type: 'user' | 'custom' | 'product' | undefined) => {
|
|
14
2
|
label: string;
|
|
15
3
|
value: string;
|
|
16
4
|
}[];
|
|
@@ -1,42 +1,15 @@
|
|
|
1
|
-
export var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
name: '次数',
|
|
6
|
-
value: 'times'
|
|
7
|
-
}, {
|
|
8
|
-
name: '活跃比',
|
|
9
|
-
value: 'active_ratio'
|
|
10
|
-
}, {
|
|
11
|
-
name: '人均次数',
|
|
12
|
-
value: 'per'
|
|
13
|
-
}, {
|
|
14
|
-
name: '金额',
|
|
15
|
-
value: 'money',
|
|
16
|
-
children: [{
|
|
17
|
-
name: '总和',
|
|
18
|
-
value: 'sum'
|
|
1
|
+
export var normalOptions = function normalOptions(type) {
|
|
2
|
+
return [{
|
|
3
|
+
label: "".concat(type === 'user' ? '人数' : '主体数'),
|
|
4
|
+
value: 'number'
|
|
19
5
|
}, {
|
|
20
|
-
|
|
21
|
-
value: '
|
|
6
|
+
label: '次数',
|
|
7
|
+
value: 'times'
|
|
22
8
|
}, {
|
|
23
|
-
|
|
24
|
-
value: '
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
value: 'median'
|
|
28
|
-
}]
|
|
29
|
-
}];
|
|
30
|
-
export var normalOptions = [{
|
|
31
|
-
label: '人数',
|
|
32
|
-
value: 'number'
|
|
33
|
-
}, {
|
|
34
|
-
label: '次数',
|
|
35
|
-
value: 'times'
|
|
36
|
-
}, {
|
|
37
|
-
label: '人均次数',
|
|
38
|
-
value: 'per'
|
|
39
|
-
}];
|
|
9
|
+
label: "".concat(type === 'user' ? '人均次数' : '主体平均次数'),
|
|
10
|
+
value: 'per'
|
|
11
|
+
}];
|
|
12
|
+
};
|
|
40
13
|
export var attrOptions = [{
|
|
41
14
|
label: '总和',
|
|
42
15
|
value: 'sum'
|
|
@@ -29,7 +29,8 @@ var BizTargetCondition = function BizTargetCondition(props) {
|
|
|
29
29
|
setTargetData = _useState2[1];
|
|
30
30
|
var _useContext = useContext(BizGlobalDataContext),
|
|
31
31
|
_useContext$eventGrou = _useContext.eventGroupList,
|
|
32
|
-
eventGroupList = _useContext$eventGrou === void 0 ? [] : _useContext$eventGrou
|
|
32
|
+
eventGroupList = _useContext$eventGrou === void 0 ? [] : _useContext$eventGrou,
|
|
33
|
+
currentApp = _useContext.currentApp;
|
|
33
34
|
var _useState3 = useState({
|
|
34
35
|
analysisIndex: 'number'
|
|
35
36
|
}),
|
|
@@ -127,7 +128,7 @@ var BizTargetCondition = function BizTargetCondition(props) {
|
|
|
127
128
|
eventList: []
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
|
-
BuiltinIndicators.eventList.forEach(function (item) {
|
|
131
|
+
BuiltinIndicators(currentApp === null || currentApp === void 0 ? void 0 : currentApp.type).eventList.forEach(function (item) {
|
|
131
132
|
if (item.id === data.eventId) {
|
|
132
133
|
target.value.event = _objectSpread({}, item);
|
|
133
134
|
hasEvent = true;
|