@zgfe/business-lib 1.1.34-alpha.17 → 1.1.34-alpha.19
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/attrConditions/demo/group.js +3 -2
- package/es/attrConditions/index.d.ts +3 -1
- package/es/attrConditions/index.js +23 -19
- package/es/attrConditions/types.d.ts +1 -1
- package/es/attributeSelector/types.d.ts +2 -0
- package/es/attributeSelector/util.js +5 -1
- package/es/constants/apis.d.ts +5 -0
- package/es/constants/apis.js +6 -1
- package/es/context/index.d.ts +3 -1
- package/es/demoWrapper/content.js +2 -0
- package/es/dialog/index.js +1 -1
- package/es/socket/index.d.ts +5 -3
- package/es/socket/index.js +23 -10
- package/es/userCondition/conditions/business/operatorCondition.js +8 -6
- package/es/userCondition/conditions/business/paramsCondition.js +1 -1
- package/es/userCondition/conditions/businessCondition.js +12 -13
- package/es/userCondition/conditions/dataAttribute.js +28 -20
- package/es/userCondition/conditions/order/runTimesCondition.js +12 -8
- package/es/utils/ajax.js +0 -1
- package/package.json +60 -60
|
@@ -7,11 +7,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
7
7
|
import React, { useRef, useState } from 'react';
|
|
8
8
|
import { BizConditionGroup, DemoWrapper } from '@zgfe/business-lib';
|
|
9
9
|
import { Button } from 'antd';
|
|
10
|
+
import { OperateTypes } from '../types';
|
|
10
11
|
var conditions = [{
|
|
11
12
|
propCategory: 'userProp',
|
|
12
13
|
attrId: 0,
|
|
13
14
|
type: 2,
|
|
14
|
-
operator:
|
|
15
|
+
operator: OperateTypes.GT,
|
|
15
16
|
values: ['25200', '1'],
|
|
16
17
|
attrName: 'duration',
|
|
17
18
|
category: 'fixed',
|
|
@@ -19,7 +20,7 @@ var conditions = [{
|
|
|
19
20
|
}, {
|
|
20
21
|
propCategory: 'eventProp',
|
|
21
22
|
type: 1,
|
|
22
|
-
operator:
|
|
23
|
+
operator: OperateTypes.Equal,
|
|
23
24
|
values: ['Safari', 'Apple WebKit'],
|
|
24
25
|
attrId: 30183426
|
|
25
26
|
}];
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { AttributeSelect } from '../attributeSelector/types';
|
|
2
3
|
import './styles/index.less';
|
|
3
|
-
import { AttrConditionTypes } from './types';
|
|
4
|
+
import { AttrConditionTypes, OperateTypes } from './types';
|
|
4
5
|
export declare const classPrefix = "biz-condition-item";
|
|
6
|
+
export declare function getCondition(attr: AttributeSelect.Value, operate: OperateTypes, values: string[]): AttrConditionTypes.ItemValue | undefined;
|
|
5
7
|
declare const BizConditionItem: React.FC<AttrConditionTypes.ItemProp>;
|
|
6
8
|
export default BizConditionItem;
|
|
@@ -12,6 +12,28 @@ import BizOperateList from './components/operateList';
|
|
|
12
12
|
import ValuesList from './components/valuesList';
|
|
13
13
|
import { Skeleton } from 'antd';
|
|
14
14
|
export var classPrefix = 'biz-condition-item';
|
|
15
|
+
export function getCondition(attr, operate, values) {
|
|
16
|
+
if (!attr) return;
|
|
17
|
+
var responseData = {
|
|
18
|
+
attrId: attr.id,
|
|
19
|
+
propCategory: attr.propCategory,
|
|
20
|
+
type: attr.type,
|
|
21
|
+
operator: operate,
|
|
22
|
+
values: values || [],
|
|
23
|
+
dimensionSub: attr.dimensionSub,
|
|
24
|
+
label: attr.label
|
|
25
|
+
};
|
|
26
|
+
if (attr.propCategory === PropCategory.EventProp) {
|
|
27
|
+
responseData.attrName = attr.label;
|
|
28
|
+
} else {
|
|
29
|
+
responseData.attrName = attr.name;
|
|
30
|
+
responseData.category = attr.category;
|
|
31
|
+
if (attr.propCategory === PropCategory.UserProp && attr.subtype) {
|
|
32
|
+
responseData.subtype = attr.subtype;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return responseData;
|
|
36
|
+
}
|
|
15
37
|
var BizConditionItem = function BizConditionItem(props) {
|
|
16
38
|
var _props$defaultValue, _props$value, _props$defaultValue2, _props$value2;
|
|
17
39
|
var defaultValue = props.defaultValue,
|
|
@@ -79,25 +101,7 @@ var BizConditionItem = function BizConditionItem(props) {
|
|
|
79
101
|
useEffect(function () {
|
|
80
102
|
if (props.onChange) {
|
|
81
103
|
if (!attr) return;
|
|
82
|
-
|
|
83
|
-
attrId: attr.id,
|
|
84
|
-
propCategory: attr.propCategory,
|
|
85
|
-
type: attr.type,
|
|
86
|
-
operator: operate,
|
|
87
|
-
values: values || [],
|
|
88
|
-
dimensionSub: attr.dimensionSub,
|
|
89
|
-
label: attr.alias || attr.label
|
|
90
|
-
};
|
|
91
|
-
if (attr.propCategory === PropCategory.EventProp) {
|
|
92
|
-
responseData.attrName = attr.label;
|
|
93
|
-
} else {
|
|
94
|
-
responseData.attrName = attr.name;
|
|
95
|
-
responseData.category = attr.category;
|
|
96
|
-
if (attr.propCategory === PropCategory.UserProp && attr.subtype) {
|
|
97
|
-
responseData.subtype = attr.subtype;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
props.onChange(responseData);
|
|
104
|
+
props.onChange(getCondition(attr, operate, values));
|
|
101
105
|
}
|
|
102
106
|
}, [attr, operate, values]);
|
|
103
107
|
var onChangeAttr = function onChangeAttr(attrData) {
|
|
@@ -18,7 +18,7 @@ export declare namespace AttrConditionTypes {
|
|
|
18
18
|
propCategory?: 'userProp' | 'eventProp' | 'envProp';
|
|
19
19
|
category?: 'fixed' | 'custom';
|
|
20
20
|
dimensionSub?: string;
|
|
21
|
-
operator?:
|
|
21
|
+
operator?: OperateTypes;
|
|
22
22
|
values?: string[];
|
|
23
23
|
}
|
|
24
24
|
interface GroupValue {
|
|
@@ -63,6 +63,8 @@ export interface PropGroups {
|
|
|
63
63
|
eventGroupList?: EventGroup[];
|
|
64
64
|
userPropList?: UserProp[];
|
|
65
65
|
envPropList?: EnvProp[];
|
|
66
|
+
eventNameMap?: Record<string, AnalysisEvent>;
|
|
67
|
+
eventIdMap?: Record<number, AnalysisEvent>;
|
|
66
68
|
}
|
|
67
69
|
export declare namespace AttributeSelect {
|
|
68
70
|
type Value = EventProp | UserProp | EnvProp | null;
|
|
@@ -3,7 +3,9 @@ export default function convertAttributeData(store) {
|
|
|
3
3
|
var res = {
|
|
4
4
|
envPropList: [],
|
|
5
5
|
eventGroupList: [],
|
|
6
|
-
userPropList: []
|
|
6
|
+
userPropList: [],
|
|
7
|
+
eventNameMap: {},
|
|
8
|
+
eventIdMap: {}
|
|
7
9
|
};
|
|
8
10
|
(_store$eventList = store.eventList) === null || _store$eventList === void 0 ? void 0 : _store$eventList.forEach(function (group_) {
|
|
9
11
|
var _res$eventGroupList;
|
|
@@ -39,6 +41,8 @@ export default function convertAttributeData(store) {
|
|
|
39
41
|
eventHidden: e.event_hidden,
|
|
40
42
|
marked: Boolean(e.mark_type)
|
|
41
43
|
};
|
|
44
|
+
res.eventNameMap[event.name] = event;
|
|
45
|
+
res.eventIdMap[event.id] = event;
|
|
42
46
|
if (event.marked) {
|
|
43
47
|
markList.push(event);
|
|
44
48
|
} else {
|
package/es/constants/apis.d.ts
CHANGED
|
@@ -8,5 +8,10 @@ declare const Apis: {
|
|
|
8
8
|
queryDatasetList: string;
|
|
9
9
|
queryDatasetDetail: string;
|
|
10
10
|
getSocketToken: string;
|
|
11
|
+
bizDataTypeList: string;
|
|
12
|
+
orderAttributeMaster: string;
|
|
13
|
+
orderAttributeSon: string;
|
|
14
|
+
bizDataAttrList: string;
|
|
15
|
+
dataAttrValue: string;
|
|
11
16
|
};
|
|
12
17
|
export default Apis;
|
package/es/constants/apis.js
CHANGED
|
@@ -7,6 +7,11 @@ var Apis = {
|
|
|
7
7
|
queryPanelGroup: '/apppanel/panels.jsp',
|
|
8
8
|
queryDatasetList: '/zg/web/cdp/inner/dataset/list',
|
|
9
9
|
queryDatasetDetail: '/zg/web/cdp/inner/dataset/detail',
|
|
10
|
-
getSocketToken: '/zg/web/v2/tracking/view/websocket/token'
|
|
10
|
+
getSocketToken: '/zg/web/v2/tracking/view/websocket/token',
|
|
11
|
+
bizDataTypeList: '/cep-console/api/v1/bizdata/type/list',
|
|
12
|
+
orderAttributeMaster: '/cep-console/api/v1/cdp/orderAttribute/master',
|
|
13
|
+
orderAttributeSon: '/cep-console/api/v1/cdp/orderAttribute/son',
|
|
14
|
+
bizDataAttrList: '/cep-console/api/v1/bizdata/attr/list',
|
|
15
|
+
dataAttrValue: '/cep-console/api/v1/es/data/attr/value'
|
|
11
16
|
};
|
|
12
17
|
export default Apis;
|
package/es/context/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { EventGroup, UserProp, EnvProp } from '../attributeSelector/types';
|
|
2
|
+
import { EventGroup, UserProp, EnvProp, AnalysisEvent } from '../attributeSelector/types';
|
|
3
3
|
export interface AppInfoProps {
|
|
4
4
|
appId?: string | number;
|
|
5
5
|
platform?: string | number;
|
|
@@ -25,6 +25,8 @@ export interface Menu {
|
|
|
25
25
|
export interface GlobalContextProps {
|
|
26
26
|
userGroupList?: Array<any>;
|
|
27
27
|
eventGroupList?: EventGroup[];
|
|
28
|
+
eventNameMap?: Record<string, AnalysisEvent>;
|
|
29
|
+
eventIdMap?: Record<number, AnalysisEvent>;
|
|
28
30
|
userPropList?: UserProp[];
|
|
29
31
|
eventEnvList?: EnvProp[];
|
|
30
32
|
menuNameMap?: {
|
|
@@ -175,6 +175,8 @@ var DemoContent = function DemoContent(_ref3) {
|
|
|
175
175
|
eventGroupList: store === null || store === void 0 ? void 0 : store.eventGroupList,
|
|
176
176
|
userPropList: store === null || store === void 0 ? void 0 : store.userPropList,
|
|
177
177
|
eventEnvList: store === null || store === void 0 ? void 0 : store.envPropList,
|
|
178
|
+
eventIdMap: store === null || store === void 0 ? void 0 : store.eventIdMap,
|
|
179
|
+
eventNameMap: store === null || store === void 0 ? void 0 : store.eventNameMap,
|
|
178
180
|
userGroupList: userGroups
|
|
179
181
|
}
|
|
180
182
|
}, children));
|
package/es/dialog/index.js
CHANGED
package/es/socket/index.d.ts
CHANGED
|
@@ -8,11 +8,12 @@ declare class SocketClient {
|
|
|
8
8
|
private showLog;
|
|
9
9
|
private pingTimer?;
|
|
10
10
|
private appkey?;
|
|
11
|
+
private token?;
|
|
11
12
|
constructor(url: string, appkey: string, params?: Record<string, any>);
|
|
12
13
|
emit(event: string, payload?: SocketClientTypes.Message['data']['payload']): void;
|
|
13
14
|
on<T>(type: SocketClientTypes.EventType | string, handle: (data?: T) => void): void;
|
|
14
|
-
onConnected(handle: () => void): void;
|
|
15
|
-
onDisconnected(handle: () => void): void;
|
|
15
|
+
onConnected(handle: (data?: any) => void): void;
|
|
16
|
+
onDisconnected(handle: (data?: any) => void): void;
|
|
16
17
|
onError(handle: (data?: Error) => void): void;
|
|
17
18
|
private _onError;
|
|
18
19
|
private _onClose;
|
|
@@ -21,11 +22,12 @@ declare class SocketClient {
|
|
|
21
22
|
private ping;
|
|
22
23
|
removeAllListeners(): void;
|
|
23
24
|
removeListener(event: string, handle?: (data?: any) => void): void;
|
|
24
|
-
private
|
|
25
|
+
private _getToken;
|
|
25
26
|
open(url?: string, params?: Record<string, any>): void;
|
|
26
27
|
close(): void;
|
|
27
28
|
destroy(): void;
|
|
28
29
|
private log;
|
|
29
30
|
openLog(open: boolean): void;
|
|
31
|
+
getToken(): string | undefined;
|
|
30
32
|
}
|
|
31
33
|
export default SocketClient;
|
package/es/socket/index.js
CHANGED
|
@@ -29,6 +29,7 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
29
29
|
this.showLog = false;
|
|
30
30
|
this.pingTimer = void 0;
|
|
31
31
|
this.appkey = void 0;
|
|
32
|
+
this.token = void 0;
|
|
32
33
|
this.appkey = appkey;
|
|
33
34
|
this.url = url;
|
|
34
35
|
this.params = params;
|
|
@@ -122,7 +123,7 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
122
123
|
_this = this;
|
|
123
124
|
this.log('info', 'socket连接成功', event);
|
|
124
125
|
(_this$listeners$conne = this.listeners['connected']) === null || _this$listeners$conne === void 0 ? void 0 : _this$listeners$conne.forEach(function (handle) {
|
|
125
|
-
handle.call(undefined);
|
|
126
|
+
handle.call(undefined, _this.token);
|
|
126
127
|
});
|
|
127
128
|
this.log('info', 'clear catch', this.catch);
|
|
128
129
|
this.catch.forEach(function (_ref) {
|
|
@@ -137,7 +138,7 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
137
138
|
}, {
|
|
138
139
|
key: "onMessage",
|
|
139
140
|
value: function onMessage(event) {
|
|
140
|
-
var _this$listeners$Socke, _this$listeners$Socke2, _this$listeners$Socke3;
|
|
141
|
+
var _this$listeners$Socke, _this$listeners$Socke2, _this$listeners$Socke3, _this$listeners$unkno;
|
|
141
142
|
var res = JSON.parse(event.data);
|
|
142
143
|
if (res.code) {
|
|
143
144
|
switch (Number(res.code)) {
|
|
@@ -158,6 +159,10 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
158
159
|
break;
|
|
159
160
|
case SocketClientTypes.ResponseCode.paramError:
|
|
160
161
|
this._onError(new Error('参数缺失或错误'));
|
|
162
|
+
default:
|
|
163
|
+
(_this$listeners$unkno = this.listeners['unknownCode']) === null || _this$listeners$unkno === void 0 ? void 0 : _this$listeners$unkno.forEach(function (handle) {
|
|
164
|
+
handle.call(undefined, res);
|
|
165
|
+
});
|
|
161
166
|
}
|
|
162
167
|
} else if (res.type === SocketClientTypes.RequestType.pong) {
|
|
163
168
|
return;
|
|
@@ -191,7 +196,8 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
191
196
|
value: function removeListener(event, handle) {
|
|
192
197
|
var _this3 = this;
|
|
193
198
|
if (handle) {
|
|
194
|
-
|
|
199
|
+
var _this$listeners$event;
|
|
200
|
+
(_this$listeners$event = this.listeners[event]) === null || _this$listeners$event === void 0 ? void 0 : _this$listeners$event.forEach(function (item, i) {
|
|
195
201
|
if (item === handle) {
|
|
196
202
|
_this3.listeners[event].splice(i, 1);
|
|
197
203
|
}
|
|
@@ -201,9 +207,9 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
201
207
|
}
|
|
202
208
|
}
|
|
203
209
|
}, {
|
|
204
|
-
key: "
|
|
210
|
+
key: "_getToken",
|
|
205
211
|
value: function () {
|
|
206
|
-
var
|
|
212
|
+
var _getToken2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
207
213
|
var res;
|
|
208
214
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
209
215
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -224,21 +230,23 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
224
230
|
}
|
|
225
231
|
}, _callee, this);
|
|
226
232
|
}));
|
|
227
|
-
function
|
|
228
|
-
return
|
|
233
|
+
function _getToken() {
|
|
234
|
+
return _getToken2.apply(this, arguments);
|
|
229
235
|
}
|
|
230
|
-
return
|
|
236
|
+
return _getToken;
|
|
231
237
|
}()
|
|
232
238
|
}, {
|
|
233
239
|
key: "open",
|
|
234
240
|
value: function open(url, params) {
|
|
235
241
|
var _this4 = this;
|
|
236
|
-
this.
|
|
242
|
+
this._getToken().then(function (token) {
|
|
237
243
|
_this4.params = params || _this4.params;
|
|
244
|
+
_this4.token = token;
|
|
238
245
|
if (_this4.client) _this4.close();
|
|
239
246
|
var paramUrl = ["socketToken=".concat(token)];
|
|
240
247
|
if (_this4.params) {
|
|
241
|
-
|
|
248
|
+
var _Object$keys;
|
|
249
|
+
(_Object$keys = Object.keys(_this4.params || {})) === null || _Object$keys === void 0 ? void 0 : _Object$keys.forEach(function (key) {
|
|
242
250
|
if (_.isObject(_this4.params[key]) || _.isArray(_this4.params[key])) {
|
|
243
251
|
paramUrl.push("".concat(key, "=").concat(JSON.stringify(_this4.params[key])));
|
|
244
252
|
} else {
|
|
@@ -285,6 +293,11 @@ var SocketClient = /*#__PURE__*/function () {
|
|
|
285
293
|
value: function openLog(open) {
|
|
286
294
|
this.showLog = open;
|
|
287
295
|
}
|
|
296
|
+
}, {
|
|
297
|
+
key: "getToken",
|
|
298
|
+
value: function getToken() {
|
|
299
|
+
return this.token;
|
|
300
|
+
}
|
|
288
301
|
}]);
|
|
289
302
|
return SocketClient;
|
|
290
303
|
}();
|
|
@@ -17,8 +17,9 @@ import { classPrefix } from '../..';
|
|
|
17
17
|
import { computeTypeList } from '../../../attrConditions/utils/operates';
|
|
18
18
|
import request from '../../../utils/ajax';
|
|
19
19
|
import BizGlobalDataContext from '../../../context';
|
|
20
|
+
import Apis from '../../../constants/apis';
|
|
20
21
|
var OperatorCondition = function OperatorCondition(props) {
|
|
21
|
-
var _condition$attrs$inde, _condition$paramsList;
|
|
22
|
+
var _condition$attrs$inde, _condition$attrs$inde2, _condition$paramsList;
|
|
22
23
|
var condition = props.condition,
|
|
23
24
|
index = props.index,
|
|
24
25
|
stringOperateList = props.stringOperateList,
|
|
@@ -36,7 +37,7 @@ var OperatorCondition = function OperatorCondition(props) {
|
|
|
36
37
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
37
38
|
searchValue = _useState6[0],
|
|
38
39
|
setSearchValue = _useState6[1];
|
|
39
|
-
var obj = (_condition$attrs$inde = condition.attrs[index]) === null || _condition$attrs$inde === void 0 ? void 0 : _condition$attrs$inde.params.map(function (item) {
|
|
40
|
+
var obj = (_condition$attrs$inde = condition.attrs[index]) === null || _condition$attrs$inde === void 0 ? void 0 : (_condition$attrs$inde2 = _condition$attrs$inde.params) === null || _condition$attrs$inde2 === void 0 ? void 0 : _condition$attrs$inde2.map(function (item) {
|
|
40
41
|
return {
|
|
41
42
|
name: item,
|
|
42
43
|
value: item
|
|
@@ -59,7 +60,7 @@ var OperatorCondition = function OperatorCondition(props) {
|
|
|
59
60
|
}, [queryValueObj]);
|
|
60
61
|
function queryValueList(keyword, operate) {
|
|
61
62
|
var fetch = function fetch() {
|
|
62
|
-
request(
|
|
63
|
+
request(Apis.dataAttrValue, {
|
|
63
64
|
method: 'post',
|
|
64
65
|
data: {
|
|
65
66
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
@@ -73,10 +74,11 @@ var OperatorCondition = function OperatorCondition(props) {
|
|
|
73
74
|
}
|
|
74
75
|
}).then(function (res) {
|
|
75
76
|
if (res.data) {
|
|
77
|
+
var _res$data;
|
|
76
78
|
var isString = function isString(val) {
|
|
77
79
|
return typeof val === 'string';
|
|
78
80
|
};
|
|
79
|
-
var list = res.data.map(function (item) {
|
|
81
|
+
var list = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.map(function (item) {
|
|
80
82
|
return {
|
|
81
83
|
name: !isString(item) ? JSON.stringify(item) : item,
|
|
82
84
|
value: !isString(item) ? JSON.stringify(item) : item
|
|
@@ -112,13 +114,13 @@ var OperatorCondition = function OperatorCondition(props) {
|
|
|
112
114
|
};
|
|
113
115
|
var onParamsChange = function onParamsChange(operate) {
|
|
114
116
|
if (operate.length > 0) {
|
|
115
|
-
var _obj = operate.map(function (item) {
|
|
117
|
+
var _obj = operate === null || operate === void 0 ? void 0 : operate.map(function (item) {
|
|
116
118
|
return {
|
|
117
119
|
name: item.name,
|
|
118
120
|
value: item.value
|
|
119
121
|
};
|
|
120
122
|
});
|
|
121
|
-
var params = operate.map(function (item) {
|
|
123
|
+
var params = operate === null || operate === void 0 ? void 0 : operate.map(function (item) {
|
|
122
124
|
return item.value;
|
|
123
125
|
});
|
|
124
126
|
if (!(condition === null || condition === void 0 ? void 0 : condition.typeId)) {
|
|
@@ -27,7 +27,7 @@ var ParamsCondition = function ParamsCondition(props) {
|
|
|
27
27
|
function onDateChange(newData) {
|
|
28
28
|
if (condition.attrs[index].operator === 'absolute') {
|
|
29
29
|
var dateRange = newData;
|
|
30
|
-
var newValues = dateRange.map(function (date) {
|
|
30
|
+
var newValues = dateRange === null || dateRange === void 0 ? void 0 : dateRange.map(function (date) {
|
|
31
31
|
return date.format('YYYY-MM-DD');
|
|
32
32
|
});
|
|
33
33
|
condition.attrs[index].params = newValues;
|
|
@@ -22,8 +22,9 @@ import DataAttribute from './dataAttribute';
|
|
|
22
22
|
import IconFont from '../../icon/iconFont';
|
|
23
23
|
import BizGlobalDataContext from '../../context';
|
|
24
24
|
import RunPeriodCondition from './order/runPeriodCondition';
|
|
25
|
+
import Apis from '../../constants/apis';
|
|
25
26
|
var BusinessCondition = function BusinessCondition(props) {
|
|
26
|
-
var _condition$timeDimens, _condition$timeDimens3, _condition$timeDimens4, _condition$
|
|
27
|
+
var _condition$timeDimens, _condition$timeDimens3, _condition$attrs, _condition$timeDimens4, _condition$attrs2;
|
|
27
28
|
var condition = props.condition,
|
|
28
29
|
dataId = props.dataId,
|
|
29
30
|
label = props.label;
|
|
@@ -68,14 +69,12 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
68
69
|
serviceAttributeList = _useState6[0],
|
|
69
70
|
setServiceAttributeList = _useState6[1];
|
|
70
71
|
function queryServiceAttributeList() {
|
|
71
|
-
request("/
|
|
72
|
-
headers: {
|
|
73
|
-
'Content-Type': 'application/json'
|
|
74
|
-
},
|
|
72
|
+
request(Apis.bizDataTypeList + "/".concat(currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId), {
|
|
75
73
|
method: 'get'
|
|
76
74
|
}).then(function (res) {
|
|
77
75
|
if (res.data) {
|
|
78
|
-
var
|
|
76
|
+
var _res$data;
|
|
77
|
+
var list = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.map(function (item) {
|
|
79
78
|
return {
|
|
80
79
|
name: item.typeName,
|
|
81
80
|
value: item.id
|
|
@@ -203,10 +202,10 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
203
202
|
onClick: function onClick() {
|
|
204
203
|
return onTimeDimensionsDelete(index);
|
|
205
204
|
}
|
|
206
|
-
},
|
|
205
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
207
206
|
type: "qingchu"
|
|
208
|
-
})
|
|
209
|
-
}), condition.attrs.map(function (_item, index) {
|
|
207
|
+
}))));
|
|
208
|
+
}), (_condition$attrs = condition.attrs) === null || _condition$attrs === void 0 ? void 0 : _condition$attrs.map(function (_item, index) {
|
|
210
209
|
return /*#__PURE__*/React.createElement("div", {
|
|
211
210
|
style: {
|
|
212
211
|
margin: '10px 0 0 65px'
|
|
@@ -230,10 +229,10 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
230
229
|
onClick: function onClick() {
|
|
231
230
|
return onAttrsDelete(index);
|
|
232
231
|
}
|
|
233
|
-
},
|
|
232
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
234
233
|
type: "qingchu"
|
|
235
|
-
})
|
|
236
|
-
}), condition.typeId && label === '业务数据' || label === '订单数据' ? /*#__PURE__*/React.createElement("div", null, ((_condition$timeDimens4 = condition.timeDimensions) === null || _condition$timeDimens4 === void 0 ? void 0 : _condition$timeDimens4.length) !== 3 || ((_condition$
|
|
234
|
+
}))));
|
|
235
|
+
}), condition.typeId && label === '业务数据' || label === '订单数据' ? /*#__PURE__*/React.createElement("div", null, ((_condition$timeDimens4 = condition.timeDimensions) === null || _condition$timeDimens4 === void 0 ? void 0 : _condition$timeDimens4.length) !== 3 || ((_condition$attrs2 = condition.attrs) === null || _condition$attrs2 === void 0 ? void 0 : _condition$attrs2.length) !== 6 ? /*#__PURE__*/React.createElement("div", {
|
|
237
236
|
style: {
|
|
238
237
|
margin: '2px 0 0 65px',
|
|
239
238
|
color: '#4075fd',
|
|
@@ -248,6 +247,6 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
248
247
|
onClick: function onClick(e) {
|
|
249
248
|
return e.preventDefault();
|
|
250
249
|
}
|
|
251
|
-
},
|
|
250
|
+
}, /*#__PURE__*/React.createElement(Space, null, "\u9AD8\u7EA7\u7B5B\u9009 ", /*#__PURE__*/React.createElement(DownOutlined, null))))) : null) : null);
|
|
252
251
|
};
|
|
253
252
|
export default BusinessCondition;
|
|
@@ -20,6 +20,7 @@ import request from '../../utils/ajax';
|
|
|
20
20
|
import BizGlobalDataContext from '../../context';
|
|
21
21
|
import ParamsCondition from './business/paramsCondition';
|
|
22
22
|
import OperatorCondition from './business/operatorCondition';
|
|
23
|
+
import Apis from '../../constants/apis';
|
|
23
24
|
var DataAttribute = function DataAttribute(props) {
|
|
24
25
|
var _condition$paramsList, _condition$paramsList2;
|
|
25
26
|
var condition = props.condition,
|
|
@@ -67,7 +68,7 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
67
68
|
}
|
|
68
69
|
}, [condition === null || condition === void 0 ? void 0 : condition.typeId]);
|
|
69
70
|
function queryAppList(type) {
|
|
70
|
-
request(type === 'master' ?
|
|
71
|
+
request(type === 'master' ? Apis.orderAttributeMaster : Apis.orderAttributeSon, {
|
|
71
72
|
method: 'post',
|
|
72
73
|
data: {
|
|
73
74
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
@@ -76,11 +77,10 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
76
77
|
}
|
|
77
78
|
}).then(function (res) {
|
|
78
79
|
if (res.data) {
|
|
79
|
-
var
|
|
80
|
+
var _res$data;
|
|
81
|
+
var _list = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.map(function (item) {
|
|
80
82
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
81
|
-
|
|
82
|
-
value: item.id,
|
|
83
|
-
columnName: item.columnName
|
|
83
|
+
value: item.id
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
86
|
setMasterList(_list);
|
|
@@ -96,14 +96,15 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
96
96
|
onChange(_objectSpread({}, condition));
|
|
97
97
|
}
|
|
98
98
|
function queryBizDataAttrList(bizDataTypeId) {
|
|
99
|
-
request(
|
|
99
|
+
request(Apis.bizDataAttrList, {
|
|
100
100
|
method: 'post',
|
|
101
101
|
data: {
|
|
102
102
|
bizDataTypeId: bizDataTypeId
|
|
103
103
|
}
|
|
104
104
|
}).then(function (res) {
|
|
105
105
|
if (res.data) {
|
|
106
|
-
var
|
|
106
|
+
var _res$data2;
|
|
107
|
+
var _list2 = (_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.map(function (item) {
|
|
107
108
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
108
109
|
value: item.id
|
|
109
110
|
});
|
|
@@ -122,9 +123,11 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
122
123
|
}
|
|
123
124
|
var onOrderTypeListChange = function onOrderTypeListChange(operate) {
|
|
124
125
|
if (condition === null || condition === void 0 ? void 0 : condition.typeId) {
|
|
125
|
-
condition.attrs[index]
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
condition.attrs[index] = _objectSpread(_objectSpread({}, condition.attrs[index]), {}, {
|
|
127
|
+
category: 'custom',
|
|
128
|
+
attrId: operate.id,
|
|
129
|
+
attrName: operate.name
|
|
130
|
+
});
|
|
128
131
|
switch (operate.propType) {
|
|
129
132
|
case 1:
|
|
130
133
|
setMasterList(typeList['cont-string']);
|
|
@@ -152,6 +155,7 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
152
155
|
onChange(_objectSpread({}, condition));
|
|
153
156
|
};
|
|
154
157
|
var onMasterListChange = function onMasterListChange(operate) {
|
|
158
|
+
condition.attrs[index].params = [];
|
|
155
159
|
if (!(condition === null || condition === void 0 ? void 0 : condition.typeId)) {
|
|
156
160
|
switch (operate.propType) {
|
|
157
161
|
case 1:
|
|
@@ -176,18 +180,22 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
176
180
|
}
|
|
177
181
|
break;
|
|
178
182
|
}
|
|
179
|
-
condition.attrs[index]
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
condition.attrs[index] = _objectSpread(_objectSpread({}, condition.attrs[index]), {}, {
|
|
184
|
+
attrId: operate.id,
|
|
185
|
+
computeType: 'origin',
|
|
186
|
+
attrName: operate.name,
|
|
187
|
+
attrMaping: operate.columnName,
|
|
188
|
+
operator: ''
|
|
189
|
+
});
|
|
184
190
|
} else {
|
|
185
191
|
switch (condition.attrs[index].attrType) {
|
|
186
192
|
case 'cont-string':
|
|
187
193
|
case 'cont-date':
|
|
188
|
-
condition.attrs[index]
|
|
189
|
-
|
|
190
|
-
|
|
194
|
+
condition.attrs[index] = _objectSpread(_objectSpread({}, condition.attrs[index]), {}, {
|
|
195
|
+
operator: operate.value,
|
|
196
|
+
computeType: 'origin',
|
|
197
|
+
params: []
|
|
198
|
+
});
|
|
191
199
|
if (condition.attrs[index].operator === 'absolute' && condition.attrs[index].attrType === 'cont-date') {
|
|
192
200
|
var _endDate = moment().format('YYYY-MM-DD');
|
|
193
201
|
var _startDate = moment().subtract(7, 'days').format('YYYY-MM-DD');
|
|
@@ -201,7 +209,7 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
201
209
|
}
|
|
202
210
|
onChange(_objectSpread({}, condition));
|
|
203
211
|
};
|
|
204
|
-
return /*#__PURE__*/React.createElement("div",
|
|
212
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
205
213
|
className: "".concat(classPrefix, "-runtimes-condition")
|
|
206
214
|
}, /*#__PURE__*/React.createElement("div", {
|
|
207
215
|
className: "".concat(classPrefix, "-period-condition-operator")
|
|
@@ -238,6 +246,6 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
238
246
|
index: index,
|
|
239
247
|
condition: condition,
|
|
240
248
|
onChange: onChange
|
|
241
|
-
}))
|
|
249
|
+
}));
|
|
242
250
|
};
|
|
243
251
|
export default DataAttribute;
|
|
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
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; }
|
|
11
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; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import React, { useState } from 'react';
|
|
13
|
+
import React, { useEffect, useState } from 'react';
|
|
14
14
|
import { Input } from 'antd';
|
|
15
15
|
import '../styles/periodCondition.less';
|
|
16
16
|
import { classPrefix } from '../..';
|
|
@@ -20,10 +20,17 @@ var RunTimesCondition = function RunTimesCondition(props) {
|
|
|
20
20
|
var onChange = props.onChange,
|
|
21
21
|
index = props.index,
|
|
22
22
|
condition = props.condition;
|
|
23
|
-
var _useState = useState(
|
|
23
|
+
var _useState = useState(''),
|
|
24
24
|
_useState2 = _slicedToArray(_useState, 2),
|
|
25
25
|
operator = _useState2[0],
|
|
26
26
|
setOperator = _useState2[1];
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
if (index !== undefined) {
|
|
29
|
+
setOperator(condition === null || condition === void 0 ? void 0 : condition.timeDimensions[index].frequencyOperator);
|
|
30
|
+
} else {
|
|
31
|
+
setOperator(condition === null || condition === void 0 ? void 0 : condition.runTimes.operator);
|
|
32
|
+
}
|
|
33
|
+
}, [index]);
|
|
27
34
|
var onOperateChange = function onOperateChange(operate) {
|
|
28
35
|
if (index !== undefined) {
|
|
29
36
|
condition.timeDimensions[index].frequencyOperator = operate.value;
|
|
@@ -31,13 +38,10 @@ var RunTimesCondition = function RunTimesCondition(props) {
|
|
|
31
38
|
onChange(_objectSpread({}, condition));
|
|
32
39
|
} else {
|
|
33
40
|
condition.runTimes.values = [Number(condition.runTimes.values[0])];
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
operator: operate.value
|
|
37
|
-
})
|
|
38
|
-
}));
|
|
41
|
+
condition.runTimes.operator = operate.value;
|
|
42
|
+
onChange(_objectSpread({}, condition));
|
|
39
43
|
}
|
|
40
|
-
setOperator(
|
|
44
|
+
setOperator(operate.value);
|
|
41
45
|
};
|
|
42
46
|
var onOperateInput0Change = function onOperateInput0Change(value) {
|
|
43
47
|
var newValue = value.target.value;
|
package/es/utils/ajax.js
CHANGED
|
@@ -62,7 +62,6 @@ function responseErrorHandler(url, apiResult, errorTitle, notifyType) {
|
|
|
62
62
|
if (new RegExp("".concat(ResponseStatus.success, "$")).test(apiResult.code)) {
|
|
63
63
|
flag = true;
|
|
64
64
|
} else if (new RegExp("".concat(ResponseStatus.notLogin)).test(apiResult.code)) {
|
|
65
|
-
flag = true;
|
|
66
65
|
message = '账户未登录或登录已失效';
|
|
67
66
|
} else if (new RegExp("".concat(ResponseStatus.noPermission)).test(apiResult.code)) {
|
|
68
67
|
window.location.href = '/webapp/app/noPermission';
|
package/package.json
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
"name": "@zgfe/business-lib",
|
|
3
|
+
"version": "1.1.34-alpha.19",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"start": "dumi dev",
|
|
6
|
+
"docs:build": "dumi build",
|
|
7
|
+
"docs:deploy": "gh-pages -d docs-dist",
|
|
8
|
+
"build": "father-build",
|
|
9
|
+
"deploy": "npm run docs:build && npm run docs:deploy",
|
|
10
|
+
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
|
|
11
|
+
"test": "umi-test",
|
|
12
|
+
"test:coverage": "umi-test --coverage",
|
|
13
|
+
"prepublishOnly": "npm run build",
|
|
14
|
+
"pub": "lerna publish"
|
|
15
|
+
},
|
|
16
|
+
"module": "es/index.js",
|
|
17
|
+
"typings": "es/index.d.ts",
|
|
18
|
+
"gitHooks": {
|
|
19
|
+
"pre-commit": "lint-staged"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"es"
|
|
23
|
+
],
|
|
24
|
+
"lint-staged": {
|
|
25
|
+
"*.{js,jsx,less,md,json}": [
|
|
26
|
+
"prettier --write"
|
|
23
27
|
],
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"react": "^16.12.0 || ^17.0.0",
|
|
60
|
-
"yorkie": "^2.0.0"
|
|
61
|
-
},
|
|
62
|
-
"gitHead": "b2e287ebcfeaa841e1f4e10bd9891e58f3223e95"
|
|
28
|
+
"*.ts?(x)": [
|
|
29
|
+
"prettier --parser=typescript --write"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@types/js-cookie": "^3.0.2",
|
|
34
|
+
"@types/qs": "^6.9.7",
|
|
35
|
+
"axios": "^0.26.1",
|
|
36
|
+
"babel-plugin-import": "^1.13.3",
|
|
37
|
+
"echarts": "^5.3.2",
|
|
38
|
+
"echarts-for-react": "^3.0.2",
|
|
39
|
+
"js-cookie": "^3.0.1",
|
|
40
|
+
"lerna": "^4.0.0",
|
|
41
|
+
"rc-virtual-list": "^3.4.8",
|
|
42
|
+
"react-infinite-scroll-component": "^6.1.0",
|
|
43
|
+
"umi-request": "^1.4.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@testing-library/jest-dom": "^5.15.1",
|
|
47
|
+
"@testing-library/react": "^12.1.2",
|
|
48
|
+
"@types/jest": "^27.0.3",
|
|
49
|
+
"@types/lodash": "^4.14.182",
|
|
50
|
+
"@umijs/fabric": "^2.8.1",
|
|
51
|
+
"@umijs/test": "^3.0.5",
|
|
52
|
+
"antd": "^4.22.8",
|
|
53
|
+
"dumi": "^1.1.0",
|
|
54
|
+
"father-build": "^1.17.2",
|
|
55
|
+
"gh-pages": "^3.0.0",
|
|
56
|
+
"lint-staged": "^10.0.7",
|
|
57
|
+
"lodash": "^4.17.21",
|
|
58
|
+
"prettier": "^2.2.1",
|
|
59
|
+
"react": "^16.12.0 || ^17.0.0",
|
|
60
|
+
"yorkie": "^2.0.0"
|
|
61
|
+
},
|
|
62
|
+
"gitHead": "b2e287ebcfeaa841e1f4e10bd9891e58f3223e95"
|
|
63
63
|
}
|