@zgfe/business-lib 1.1.35 → 1.1.36

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.
Files changed (37) hide show
  1. package/es/assets/styles/resetAntd.less +36 -12
  2. package/es/attrConditions/utils/operates.d.ts +50 -0
  3. package/es/attrConditions/utils/operates.js +126 -0
  4. package/es/constants/apis.d.ts +5 -0
  5. package/es/constants/apis.js +6 -1
  6. package/es/context/index.d.ts +2 -0
  7. package/es/userCondition/conditionTypeList.js +27 -7
  8. package/es/userCondition/conditions/business/operatorCondition.d.ts +11 -0
  9. package/es/userCondition/conditions/business/operatorCondition.js +181 -0
  10. package/es/userCondition/conditions/business/paramsCondition.d.ts +9 -0
  11. package/es/userCondition/conditions/business/paramsCondition.js +79 -0
  12. package/es/userCondition/conditions/businessCondition.d.ts +5 -0
  13. package/es/userCondition/conditions/businessCondition.js +252 -0
  14. package/es/userCondition/conditions/cdpCondition.js +1 -1
  15. package/es/userCondition/conditions/constants.d.ts +1 -0
  16. package/es/userCondition/conditions/constants.js +2 -1
  17. package/es/userCondition/conditions/dataAttribute.d.ts +10 -0
  18. package/es/userCondition/conditions/dataAttribute.js +251 -0
  19. package/es/userCondition/conditions/eventCondition.js +83 -2
  20. package/es/userCondition/conditions/order/runPeriodCondition.d.ts +11 -0
  21. package/es/userCondition/conditions/order/runPeriodCondition.js +142 -0
  22. package/es/userCondition/conditions/order/runTimesCondition.d.ts +11 -0
  23. package/es/userCondition/conditions/order/runTimesCondition.js +112 -0
  24. package/es/userCondition/conditions/textDesc.d.ts +1 -1
  25. package/es/userCondition/conditions/textDesc.js +160 -2
  26. package/es/userCondition/conditions/timeDimension.d.ts +10 -0
  27. package/es/userCondition/conditions/timeDimension.js +150 -0
  28. package/es/userCondition/demo/business.d.ts +3 -0
  29. package/es/userCondition/demo/business.js +71 -0
  30. package/es/userCondition/index.js +14 -2
  31. package/es/userCondition/orConditions.js +22 -2
  32. package/es/userCondition/types.d.ts +71 -5
  33. package/es/userCondition/types.js +8 -1
  34. package/es/userCondition/util.d.ts +1 -1
  35. package/es/userCondition/util.js +33 -0
  36. package/es/utils/ajax.js +1 -0
  37. package/package.json +2 -2
@@ -16,8 +16,12 @@
16
16
  border-color: @primary-color!important;
17
17
  }
18
18
 
19
- &.ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(.ant-input-affix-wrapper-borderless):not(.ant-input-affix-wrapper-focused).ant-input-affix-wrapper,
20
- &.ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(.ant-input-affix-wrapper-borderless):not(.ant-input-affix-wrapper-focused).ant-input-affix-wrapper:hover {
19
+ &.ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(
20
+ .ant-input-affix-wrapper-borderless
21
+ ):not(.ant-input-affix-wrapper-focused).ant-input-affix-wrapper,
22
+ &.ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(
23
+ .ant-input-affix-wrapper-borderless
24
+ ):not(.ant-input-affix-wrapper-focused).ant-input-affix-wrapper:hover {
21
25
  background-color: @background-color-base!important;
22
26
  }
23
27
  }
@@ -31,8 +35,12 @@
31
35
  }
32
36
  }
33
37
 
34
- .ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(.ant-input-affix-wrapper-borderless).ant-input-affix-wrapper,
35
- .ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(.ant-input-affix-wrapper-borderless).ant-input-affix-wrapper:hover {
38
+ .ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(
39
+ .ant-input-affix-wrapper-borderless
40
+ ).ant-input-affix-wrapper,
41
+ .ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(
42
+ .ant-input-affix-wrapper-borderless
43
+ ).ant-input-affix-wrapper:hover {
36
44
  border-color: @error-color!important;
37
45
  }
38
46
  // 输入框
@@ -62,7 +70,9 @@
62
70
  background-color: @background-color-base!important;
63
71
  }
64
72
 
65
- .ant-select:not(.ant-select-customize-input):not(.ant-pagination-size-changer):not(.ant-select-status-error)
73
+ .ant-select:not(.ant-select-customize-input):not(.ant-pagination-size-changer):not(
74
+ .ant-select-status-error
75
+ )
66
76
  .ant-select-selector {
67
77
  background: #fafafb;
68
78
  border-color: rgba(0, 0, 0, 0);
@@ -229,7 +239,9 @@
229
239
  /*日期hover*/
230
240
  &:hover {
231
241
  &:not(.ant-picker-cell-in-view) .ant-picker-cell-inner,
232
- &:not(.ant-picker-cell-selected):not(.ant-picker-cell-range-start):not(.ant-picker-cell-range-end):not(.ant-picker-cell-range-hover-start):not(.ant-picker-cell-range-hover-end)
242
+ &:not(.ant-picker-cell-selected):not(.ant-picker-cell-range-start):not(
243
+ .ant-picker-cell-range-end
244
+ ):not(.ant-picker-cell-range-hover-start):not(.ant-picker-cell-range-hover-end)
233
245
  .ant-picker-cell-inner {
234
246
  background-color: transparent !important;
235
247
  border: 1px solid @primary-color!important;
@@ -239,9 +251,13 @@
239
251
 
240
252
  /*选中的日期范围*/
241
253
  /* 日期范围的起始时间radius */
242
- .ant-picker-cell-in-view.ant-picker-cell-range-start:not(.ant-picker-cell-range-start-single):not(.ant-picker-cell-range-end)
254
+ .ant-picker-cell-in-view.ant-picker-cell-range-start:not(.ant-picker-cell-range-start-single):not(
255
+ .ant-picker-cell-range-end
256
+ )
243
257
  .ant-picker-cell-inner,
244
- .ant-picker-cell-in-view.ant-picker-cell-range-end:not(.ant-picker-cell-range-end-single):not(.ant-picker-cell-range-start)
258
+ .ant-picker-cell-in-view.ant-picker-cell-range-end:not(.ant-picker-cell-range-end-single):not(
259
+ .ant-picker-cell-range-start
260
+ )
245
261
  .ant-picker-cell-inner {
246
262
  border-radius: 50% !important;
247
263
  }
@@ -272,8 +288,12 @@
272
288
  .ant-picker-cell-in-view.ant-picker-cell-in-range.ant-picker-cell-range-hover::before,
273
289
  .ant-picker-cell-in-view.ant-picker-cell-range-start.ant-picker-cell-range-hover::before,
274
290
  .ant-picker-cell-in-view.ant-picker-cell-range-end.ant-picker-cell-range-hover::before,
275
- .ant-picker-cell-in-view.ant-picker-cell-range-start:not(.ant-picker-cell-range-start-single).ant-picker-cell-range-hover-start::before,
276
- .ant-picker-cell-in-view.ant-picker-cell-range-end:not(.ant-picker-cell-range-end-single).ant-picker-cell-range-hover-end::before,
291
+ .ant-picker-cell-in-view.ant-picker-cell-range-start:not(
292
+ .ant-picker-cell-range-start-single
293
+ ).ant-picker-cell-range-hover-start::before,
294
+ .ant-picker-cell-in-view.ant-picker-cell-range-end:not(
295
+ .ant-picker-cell-range-end-single
296
+ ).ant-picker-cell-range-hover-end::before,
277
297
  .ant-picker-panel
278
298
  > :not(.ant-picker-date-panel)
279
299
  .ant-picker-cell-in-view.ant-picker-cell-in-range.ant-picker-cell-range-hover-start::before,
@@ -296,8 +316,12 @@
296
316
  }
297
317
  }
298
318
  }
299
- .ant-picker-cell-in-view.ant-picker-cell-range-start:not(.ant-picker-cell-range-start-single)::before,
300
- .ant-picker-cell-in-view.ant-picker-cell-range-end:not(.ant-picker-cell-range-end-single)::before {
319
+ .ant-picker-cell-in-view.ant-picker-cell-range-start:not(
320
+ .ant-picker-cell-range-start-single
321
+ )::before,
322
+ .ant-picker-cell-in-view.ant-picker-cell-range-end:not(
323
+ .ant-picker-cell-range-end-single
324
+ )::before {
301
325
  background: @primary-color-hover !important;
302
326
  }
303
327
  }
@@ -6,6 +6,56 @@ export declare const numberOperate: {
6
6
  name: string;
7
7
  value: string;
8
8
  }[];
9
+ export declare const computeTypeList: {
10
+ value: string;
11
+ name: string;
12
+ }[];
13
+ export declare const typeList: {
14
+ 'cont-string': {
15
+ name: string;
16
+ value: string;
17
+ }[];
18
+ 'cont-date': {
19
+ name: string;
20
+ value: string;
21
+ }[];
22
+ 'cont-num': {
23
+ name: string;
24
+ value: string;
25
+ }[];
26
+ };
27
+ export declare const timeDimensionType: {
28
+ name: string;
29
+ value: number;
30
+ }[];
31
+ export declare const orderTypeList: {
32
+ name: string;
33
+ value: string;
34
+ }[];
35
+ export declare const skyTimeOperatorType: {
36
+ name: string;
37
+ value: string;
38
+ }[];
39
+ export declare const weekTimeOperatorType: {
40
+ name: string;
41
+ value: string;
42
+ }[];
43
+ export declare const monthTimeOperatorType: {
44
+ name: string;
45
+ value: string;
46
+ }[];
47
+ export declare const timeValuesType: {
48
+ name: string;
49
+ value: any;
50
+ }[];
51
+ export declare const weekValuesType: {
52
+ name: string;
53
+ value: number;
54
+ }[];
55
+ export declare const monthValuesType: {
56
+ name: string;
57
+ value: any;
58
+ }[];
9
59
  export declare const dateOperate: {
10
60
  name: string;
11
61
  value: string;
@@ -1,3 +1,4 @@
1
+ var _Array$from, _Array$from2;
1
2
  export var stringOperate = [{
2
3
  name: '是',
3
4
  value: 'equal'
@@ -48,6 +49,131 @@ export var numberOperate = [{
48
49
  name: '≠',
49
50
  value: 'not equal'
50
51
  }];
52
+ export var computeTypeList = [{
53
+ value: 'origin',
54
+ name: '原值'
55
+ }, {
56
+ value: 'max',
57
+ name: '最大值'
58
+ }, {
59
+ value: 'min',
60
+ name: '最小值'
61
+ }, {
62
+ value: 'sum',
63
+ name: '累计值'
64
+ }, {
65
+ value: 'avg',
66
+ name: '平均值'
67
+ }];
68
+ export var typeList = {
69
+ 'cont-string': stringOperate,
70
+ 'cont-date': [{
71
+ name: '最近',
72
+ value: 'relative'
73
+ }, {
74
+ name: '最近区间',
75
+ value: 'relativeInterval'
76
+ }, {
77
+ name: '未来',
78
+ value: 'future'
79
+ }, {
80
+ name: '未来区间',
81
+ value: 'futureInterval'
82
+ }, {
83
+ name: '固定时段',
84
+ value: 'absolute'
85
+ }],
86
+ 'cont-num': [{
87
+ name: '>',
88
+ value: '>'
89
+ }, {
90
+ name: '=',
91
+ value: '='
92
+ }, {
93
+ name: '<',
94
+ value: '<'
95
+ }, {
96
+ name: '>=',
97
+ value: '>='
98
+ }, {
99
+ name: '<=',
100
+ value: '<='
101
+ }, {
102
+ name: '≠',
103
+ value: 'not equal'
104
+ }, {
105
+ name: '区间',
106
+ value: 'between'
107
+ }]
108
+ };
109
+ export var timeDimensionType = [{
110
+ name: '每天',
111
+ value: 1
112
+ }, {
113
+ name: '每周',
114
+ value: 2
115
+ }, {
116
+ name: '每月',
117
+ value: 3
118
+ }];
119
+ export var orderTypeList = [{
120
+ name: '主订单',
121
+ value: 'master'
122
+ }, {
123
+ name: '子订单',
124
+ value: 'son'
125
+ }];
126
+ export var skyTimeOperatorType = [{
127
+ name: '整天',
128
+ value: 'all'
129
+ }, {
130
+ name: '在',
131
+ value: 'in'
132
+ }, {
133
+ name: '在区间',
134
+ value: 'between'
135
+ }];
136
+ export var weekTimeOperatorType = [{
137
+ name: '整周',
138
+ value: 'all'
139
+ }, {
140
+ name: '在',
141
+ value: 'in'
142
+ }, {
143
+ name: '在区间',
144
+ value: 'between'
145
+ }];
146
+ export var monthTimeOperatorType = [{
147
+ name: '整月',
148
+ value: 'all'
149
+ }, {
150
+ name: '在',
151
+ value: 'in'
152
+ }, {
153
+ name: '在区间',
154
+ value: 'between'
155
+ }];
156
+ var arr1 = new Array(24).keys();
157
+ export var timeValuesType = (_Array$from = Array.from(arr1)) === null || _Array$from === void 0 ? void 0 : _Array$from.map(function (item) {
158
+ return {
159
+ name: item + '时',
160
+ value: item
161
+ };
162
+ });
163
+ var arr2 = ['一', '二', '三', '四', '五', '六', '日'];
164
+ export var weekValuesType = arr2.map(function (item, index) {
165
+ return {
166
+ name: '周' + item,
167
+ value: index + 1
168
+ };
169
+ });
170
+ var arr3 = new Array(31).keys();
171
+ export var monthValuesType = (_Array$from2 = Array.from(arr3)) === null || _Array$from2 === void 0 ? void 0 : _Array$from2.map(function (item) {
172
+ return {
173
+ name: item + 1 + '号',
174
+ value: item + 1
175
+ };
176
+ });
51
177
  export var dateOperate = [{
52
178
  name: '最近',
53
179
  value: 'relative'
@@ -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;
@@ -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;
@@ -10,6 +10,7 @@ export interface UserInfo {
10
10
  username: string;
11
11
  email: string;
12
12
  companyId: number;
13
+ serviceType: number;
13
14
  companyName: string;
14
15
  }
15
16
  export interface Menu {
@@ -38,6 +39,7 @@ export interface GlobalContextProps {
38
39
  router?: any;
39
40
  routes?: any;
40
41
  envs?: Record<string, any>;
42
+ system?: string;
41
43
  }
42
44
  declare const BizGlobalDataContext: import("react").Context<GlobalContextProps>;
43
45
  export default BizGlobalDataContext;
@@ -13,9 +13,13 @@ var ConditionTypeList = function ConditionTypeList(props) {
13
13
  textMode = _useContext.textMode,
14
14
  openTagCondition = _useContext.openTagCondition,
15
15
  openCdpCondition = _useContext.openCdpCondition,
16
+ openBusinessDataCondition = _useContext.openBusinessDataCondition,
17
+ openOrderDataCondition = _useContext.openOrderDataCondition,
18
+ openCondition = _useContext.openCondition,
16
19
  cdpTip = _useContext.cdpTip;
17
20
  var _useContext2 = useContext(BizGlobalDataContext),
18
- menuNameMap = _useContext2.menuNameMap;
21
+ menuNameMap = _useContext2.menuNameMap,
22
+ currentUser = _useContext2.currentUser;
19
23
  if (!show || textMode) return null;
20
24
  return /*#__PURE__*/React.createElement("div", {
21
25
  className: "biz-user-condition-type-list"
@@ -23,7 +27,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
23
27
  className: "biz-user-condition-type-label"
24
28
  }, label) : null, /*#__PURE__*/React.createElement("ul", {
25
29
  className: "biz-user-condition-type-container"
26
- }, /*#__PURE__*/React.createElement("li", {
30
+ }, openCondition ? /*#__PURE__*/React.createElement("li", {
27
31
  className: "condition-type",
28
32
  key: "event",
29
33
  onClick: function onClick() {
@@ -31,7 +35,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
31
35
  }
32
36
  }, /*#__PURE__*/React.createElement(Space, {
33
37
  key: "event"
34
- }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u505A\u8FC7\uFF08\u6CA1\u505A\u8FC7\uFF09\u2026"))), /*#__PURE__*/React.createElement("li", {
38
+ }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u505A\u8FC7\uFF08\u6CA1\u505A\u8FC7\uFF09\u2026"))) : null, openCondition ? /*#__PURE__*/React.createElement("li", {
35
39
  className: "condition-type",
36
40
  key: "add",
37
41
  onClick: function onClick() {
@@ -39,7 +43,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
39
43
  }
40
44
  }, /*#__PURE__*/React.createElement(Space, {
41
45
  key: "add"
42
- }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u65B0\u589E\u4E8E"))), /*#__PURE__*/React.createElement("li", {
46
+ }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u65B0\u589E\u4E8E"))) : null, openCondition ? /*#__PURE__*/React.createElement("li", {
43
47
  className: "condition-type",
44
48
  key: "active",
45
49
  onClick: function onClick() {
@@ -47,7 +51,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
47
51
  }
48
52
  }, /*#__PURE__*/React.createElement(Space, {
49
53
  key: "active"
50
- }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u6D3B\u8DC3\u4E8E"))), /*#__PURE__*/React.createElement("li", {
54
+ }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u6D3B\u8DC3\u4E8E"))) : null, openCondition ? /*#__PURE__*/React.createElement("li", {
51
55
  className: "condition-type",
52
56
  key: "prop",
53
57
  onClick: function onClick() {
@@ -55,7 +59,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
55
59
  }
56
60
  }, /*#__PURE__*/React.createElement(Space, {
57
61
  key: "prop"
58
- }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u5C5E\u6027\u6EE1\u8DB3"))), openTagCondition && (!menuNameMap || menuNameMap['userTags']) ? /*#__PURE__*/React.createElement("li", {
62
+ }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u7528\u6237\u5C5E\u6027\u6EE1\u8DB3"))) : null, openTagCondition && (!menuNameMap || menuNameMap['userTags']) ? /*#__PURE__*/React.createElement("li", {
59
63
  className: "condition-type",
60
64
  onClick: function onClick() {
61
65
  return onAdd('tag');
@@ -69,7 +73,23 @@ var ConditionTypeList = function ConditionTypeList(props) {
69
73
  title: cdpTip
70
74
  }, /*#__PURE__*/React.createElement(IconFont, {
71
75
  type: "tishiicon"
72
- })) : null)) : null));
76
+ })) : null)) : null, openBusinessDataCondition || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 0 || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 2 ? /*#__PURE__*/React.createElement("li", {
77
+ className: "condition-type",
78
+ key: "business",
79
+ onClick: function onClick() {
80
+ return onAdd('business');
81
+ }
82
+ }, /*#__PURE__*/React.createElement(Space, {
83
+ key: "business"
84
+ }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u4E1A\u52A1\u6570\u636E"))) : null, openOrderDataCondition || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 0 || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 2 ? /*#__PURE__*/React.createElement("li", {
85
+ className: "condition-type",
86
+ key: "order",
87
+ onClick: function onClick() {
88
+ return onAdd('order');
89
+ }
90
+ }, /*#__PURE__*/React.createElement(Space, {
91
+ key: "order"
92
+ }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u8BA2\u5355\u6570\u636E"))) : null));
73
93
  };
74
94
  ConditionTypeList.defaultProps = {
75
95
  show: true
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import '../styles/runTimesCondition.less';
3
+ export interface OperatorConditionPropsI {
4
+ condition: any;
5
+ index: number;
6
+ stringOperateList: any;
7
+ queryValueObj: any;
8
+ onChange: (condition: any) => void;
9
+ }
10
+ declare const OperatorCondition: React.FC<OperatorConditionPropsI>;
11
+ export default OperatorCondition;
@@ -0,0 +1,181 @@
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); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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."); }
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); }
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
+ 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
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import React, { useContext, useEffect, useState } from 'react';
14
+ import BizSelect from '../../../select';
15
+ import '../styles/runTimesCondition.less';
16
+ import { classPrefix } from '../..';
17
+ import { computeTypeList } from '../../../attrConditions/utils/operates';
18
+ import request from '../../../utils/ajax';
19
+ import BizGlobalDataContext from '../../../context';
20
+ import Apis from '../../../constants/apis';
21
+ var OperatorCondition = function OperatorCondition(props) {
22
+ var _condition$attrs$inde, _condition$attrs$inde2, _condition$paramsList;
23
+ var condition = props.condition,
24
+ index = props.index,
25
+ stringOperateList = props.stringOperateList,
26
+ queryValueObj = props.queryValueObj,
27
+ onChange = props.onChange;
28
+ var _useState = useState([]),
29
+ _useState2 = _slicedToArray(_useState, 2),
30
+ paramsList = _useState2[0],
31
+ setParamsList = _useState2[1];
32
+ var _useState3 = useState(0),
33
+ _useState4 = _slicedToArray(_useState3, 2),
34
+ timer = _useState4[0],
35
+ setTimer = _useState4[1];
36
+ var _useState5 = useState(''),
37
+ _useState6 = _slicedToArray(_useState5, 2),
38
+ searchValue = _useState6[0],
39
+ setSearchValue = _useState6[1];
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) {
41
+ return {
42
+ name: item,
43
+ value: item
44
+ };
45
+ });
46
+ var _useState7 = useState(obj ? obj : []),
47
+ _useState8 = _slicedToArray(_useState7, 2),
48
+ current = _useState8[0],
49
+ setCurrent = _useState8[1];
50
+ var _useContext = useContext(BizGlobalDataContext),
51
+ currentApp = _useContext.currentApp;
52
+ useEffect(function () {
53
+ queryValueList(searchValue, {});
54
+ }, [searchValue]);
55
+ useEffect(function () {
56
+ var _queryValueObj$operat;
57
+ if (queryValueObj === null || queryValueObj === void 0 ? void 0 : (_queryValueObj$operat = queryValueObj.operate) === null || _queryValueObj$operat === void 0 ? void 0 : _queryValueObj$operat.id) {
58
+ queryValueList(queryValueObj.keyword, queryValueObj.operate);
59
+ }
60
+ }, [queryValueObj]);
61
+ function queryValueList(keyword, operate) {
62
+ var fetch = function fetch() {
63
+ request(Apis.dataAttrValue, {
64
+ method: 'post',
65
+ data: {
66
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
67
+ attrId: condition.attrs[index].attrId,
68
+ dataTypeId: operate.bizDataTypeId ? operate.bizDataTypeId : condition.attrs[index].orderType === 'master' ? 1 : 2,
69
+ keyword: keyword,
70
+ pageNum: 1,
71
+ pageSize: 20,
72
+ attrName: operate.name,
73
+ eventId: 0
74
+ }
75
+ }).then(function (res) {
76
+ if (res.data) {
77
+ var _res$data;
78
+ var isString = function isString(val) {
79
+ return typeof val === 'string';
80
+ };
81
+ var list = (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.map(function (item) {
82
+ return {
83
+ name: !isString(item) ? JSON.stringify(item) : item,
84
+ value: !isString(item) ? JSON.stringify(item) : item
85
+ };
86
+ });
87
+ condition.paramsList[index].paramsList = list;
88
+ setParamsList(list);
89
+ } else {
90
+ setParamsList([]);
91
+ condition.paramsList[index].paramsList = [];
92
+ }
93
+ }).catch(function () {
94
+ setParamsList([]);
95
+ condition.paramsList[index].paramsList = [];
96
+ });
97
+ };
98
+ if (timer) clearTimeout(timer);
99
+ setTimer(setTimeout(function () {
100
+ fetch();
101
+ }, 400));
102
+ onChange(_objectSpread({}, condition));
103
+ }
104
+ var onStringOperateChange = function onStringOperateChange(operate) {
105
+ if (condition.attrs[index].operator !== 'absolute') {
106
+ condition.attrs[index].params = [];
107
+ }
108
+ condition.attrs[index].operator = operate.value;
109
+ onChange(_objectSpread({}, condition));
110
+ };
111
+ var onComputeTypeOperateChange = function onComputeTypeOperateChange(operate) {
112
+ condition.attrs[index].computeType = operate.value;
113
+ onChange(_objectSpread({}, condition));
114
+ };
115
+ var onParamsChange = function onParamsChange(operate) {
116
+ if (operate.length > 0) {
117
+ var _obj = operate === null || operate === void 0 ? void 0 : operate.map(function (item) {
118
+ return {
119
+ name: item.name,
120
+ value: item.value
121
+ };
122
+ });
123
+ var params = operate === null || operate === void 0 ? void 0 : operate.map(function (item) {
124
+ return item.value;
125
+ });
126
+ if (!(condition === null || condition === void 0 ? void 0 : condition.typeId)) {
127
+ queryValueList(searchValue, {});
128
+ }
129
+ setCurrent(_obj);
130
+ condition.attrs[index].params = params;
131
+ onChange(_objectSpread({}, condition));
132
+ }
133
+ };
134
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
135
+ className: "".concat(classPrefix, "-runtimes-condition")
136
+ }, !(condition === null || condition === void 0 ? void 0 : condition.typeId) && condition.attrs[index].attrType === 'cont-num' ? /*#__PURE__*/React.createElement("div", {
137
+ className: "".concat(classPrefix, "-period-condition-operator")
138
+ }, /*#__PURE__*/React.createElement(BizSelect, {
139
+ className: "".concat(classPrefix, "-select-condition"),
140
+ options: computeTypeList,
141
+ labelField: "name",
142
+ keyField: "value",
143
+ value: {
144
+ name: condition.attrs[index].computeType,
145
+ value: condition.attrs[index].computeType
146
+ },
147
+ overlayWidth: 120,
148
+ onChange: onComputeTypeOperateChange
149
+ })) : null, (condition === null || condition === void 0 ? void 0 : condition.typeId) && condition.attrs[index].attrType === 'cont-num' || !(condition === null || condition === void 0 ? void 0 : condition.typeId) ? /*#__PURE__*/React.createElement("div", {
150
+ className: "".concat(classPrefix, "-period-condition-operator")
151
+ }, /*#__PURE__*/React.createElement(BizSelect, {
152
+ className: "".concat(classPrefix, "-select-condition"),
153
+ options: stringOperateList,
154
+ labelField: "name",
155
+ keyField: "value",
156
+ value: {
157
+ name: condition.attrs[index].operator,
158
+ value: condition.attrs[index].operator
159
+ },
160
+ overlayWidth: 120,
161
+ onChange: onStringOperateChange
162
+ })) : null, !(condition === null || condition === void 0 ? void 0 : condition.typeId) && condition.attrs[index].attrType === 'cont-string' || condition.attrs[index].attrType === 'cont-string' && condition.attrs[index].operator !== 'is null' && condition.attrs[index].operator !== 'is not null' ? /*#__PURE__*/React.createElement("div", {
163
+ className: "".concat(classPrefix, "-period-condition-operator"),
164
+ style: {
165
+ width: '250px'
166
+ }
167
+ }, /*#__PURE__*/React.createElement(BizSelect, {
168
+ className: "".concat(classPrefix, "-multi-select"),
169
+ multiple: true,
170
+ size: "middle",
171
+ labelField: "name",
172
+ keyField: "value",
173
+ options: paramsList.length > 0 ? paramsList : condition === null || condition === void 0 ? void 0 : (_condition$paramsList = condition.paramsList[index]) === null || _condition$paramsList === void 0 ? void 0 : _condition$paramsList.paramsList,
174
+ value: current,
175
+ onChange: onParamsChange,
176
+ onSearch: setSearchValue,
177
+ enableCreate: true,
178
+ enableSearch: true
179
+ })) : null));
180
+ };
181
+ export default OperatorCondition;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import '../styles/runTimesCondition.less';
3
+ export interface ParamsConditionPropsI {
4
+ condition: any;
5
+ index: number;
6
+ onChange: (condition: any) => void;
7
+ }
8
+ declare const ParamsCondition: React.FC<ParamsConditionPropsI>;
9
+ export default ParamsCondition;