@zgfe/business-lib 1.1.31-alpha.0 → 1.1.31-alpha.2
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/userCondition/conditions/businessCondition.js +63 -46
- package/es/userCondition/conditions/constants.d.ts +1 -0
- package/es/userCondition/conditions/constants.js +2 -1
- package/es/userCondition/conditions/dataAttribute.js +36 -20
- package/es/userCondition/conditions/eventCondition.js +2 -2
- package/es/userCondition/conditions/timeDimension.js +75 -48
- package/es/userCondition/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ import moment from 'moment';
|
|
|
18
18
|
import request from '../../utils/ajax';
|
|
19
19
|
import './styles/periodCondition.less';
|
|
20
20
|
import { classPrefix } from '..';
|
|
21
|
-
import {
|
|
21
|
+
import { typeList } from '../../attrConditions/utils/operates';
|
|
22
22
|
import { operatorMap } from './constants';
|
|
23
23
|
import TimeDimension from './timeDimension';
|
|
24
24
|
import DataAttribute from './dataAttribute';
|
|
@@ -37,40 +37,36 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
37
37
|
queryServiceAttributeList();
|
|
38
38
|
}
|
|
39
39
|
}, []);
|
|
40
|
-
var items = [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
var items = [];
|
|
41
|
+
if (condition.timeDimensions.length < 3) {
|
|
42
|
+
items = items.concat([{
|
|
43
|
+
label: '时间维度',
|
|
44
|
+
key: 'time dimension'
|
|
45
|
+
}]);
|
|
46
|
+
}
|
|
47
|
+
if (label === '订单数据' && condition.attrs.length < 6) {
|
|
45
48
|
items = items.concat([{
|
|
46
49
|
label: '订单属性',
|
|
47
50
|
key: 'order attribute'
|
|
48
51
|
}]);
|
|
49
|
-
} else {
|
|
52
|
+
} else if (label === '业务数据' && condition.attrs.length < 6) {
|
|
50
53
|
items = items.concat([{
|
|
51
54
|
label: '业务属性',
|
|
52
55
|
key: 'service attribute'
|
|
53
56
|
}]);
|
|
54
57
|
}
|
|
55
|
-
var _useState = useState(
|
|
56
|
-
name: '≥',
|
|
57
|
-
value: 'ge'
|
|
58
|
-
}),
|
|
58
|
+
var _useState = useState(),
|
|
59
59
|
_useState2 = _slicedToArray(_useState, 2),
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
dataAttributeLabel = _useState2[0],
|
|
61
|
+
setDataAttributeLabel = _useState2[1];
|
|
62
62
|
var _useState3 = useState(),
|
|
63
63
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
var _useState5 = useState(),
|
|
64
|
+
serviceAttribute = _useState4[0],
|
|
65
|
+
setServiceAttribute = _useState4[1];
|
|
66
|
+
var _useState5 = useState([]),
|
|
67
67
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var _useState7 = useState([]),
|
|
71
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
72
|
-
serviceAttributeList = _useState8[0],
|
|
73
|
-
setServiceAttributeList = _useState8[1];
|
|
68
|
+
serviceAttributeList = _useState6[0],
|
|
69
|
+
setServiceAttributeList = _useState6[1];
|
|
74
70
|
var options = [{
|
|
75
71
|
text: '最近',
|
|
76
72
|
value: 'relative'
|
|
@@ -91,10 +87,9 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
91
87
|
}]);
|
|
92
88
|
}
|
|
93
89
|
function queryServiceAttributeList() {
|
|
94
|
-
request('
|
|
90
|
+
request('/cep-console/api/v1/bizdata/type/list', {
|
|
95
91
|
headers: {
|
|
96
|
-
'Content-Type': 'application/json'
|
|
97
|
-
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIwIiwiY29tcGFueUlkIjoyLCJleHAiOjE2Nzg3MTYwMzAsImlhdCI6MTY3ODY3MjgzMCwidXNlcklkIjowfQ.betSVs513b-6v8x_ErbS8xhROemLiOmx3CtqUq_R4k0'
|
|
92
|
+
'Content-Type': 'application/json'
|
|
98
93
|
},
|
|
99
94
|
method: 'get'
|
|
100
95
|
}).then(function (res) {
|
|
@@ -184,20 +179,22 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
184
179
|
}
|
|
185
180
|
}
|
|
186
181
|
var onOperateChange = function onOperateChange(operate) {
|
|
187
|
-
|
|
182
|
+
condition.runTimes.values = [condition.runTimes.values[0]];
|
|
188
183
|
onChange(_objectSpread(_objectSpread({}, condition), {}, {
|
|
189
184
|
runTimes: _objectSpread(_objectSpread({}, condition.runTimes), {}, {
|
|
190
|
-
operator: operate
|
|
185
|
+
operator: operate.value
|
|
191
186
|
})
|
|
192
187
|
}));
|
|
193
188
|
};
|
|
194
|
-
var
|
|
189
|
+
var onOperateInput0Change = function onOperateInput0Change(value) {
|
|
195
190
|
var newValue = value.target.value;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
191
|
+
condition.runTimes.values[0] = newValue;
|
|
192
|
+
onChange(_objectSpread({}, condition));
|
|
193
|
+
};
|
|
194
|
+
var onOperateInput1Change = function onOperateInput1Change(value) {
|
|
195
|
+
var newValue = value.target.value;
|
|
196
|
+
condition.runTimes.values[1] = newValue;
|
|
197
|
+
onChange(_objectSpread({}, condition));
|
|
201
198
|
};
|
|
202
199
|
var onClick = function onClick(_ref) {
|
|
203
200
|
var key = _ref.key;
|
|
@@ -216,7 +213,7 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
216
213
|
timeOperator: 'all',
|
|
217
214
|
timeValues: []
|
|
218
215
|
};
|
|
219
|
-
if (condition.timeDimensions.length
|
|
216
|
+
if (condition.timeDimensions.length !== 3) {
|
|
220
217
|
condition.timeDimensions.push(obj);
|
|
221
218
|
} else {
|
|
222
219
|
notification.info({
|
|
@@ -299,27 +296,47 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
299
296
|
className: "".concat(classPrefix, "-period-condition-operator")
|
|
300
297
|
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
301
298
|
className: "".concat(classPrefix, "-select-condition"),
|
|
302
|
-
options:
|
|
299
|
+
options: typeList['cont-num'],
|
|
303
300
|
labelField: "name",
|
|
304
301
|
keyField: "value",
|
|
305
302
|
overlayWidth: 80,
|
|
306
|
-
value:
|
|
303
|
+
value: {
|
|
304
|
+
value: condition.runTimes.operator,
|
|
305
|
+
name: condition.runTimes.operator
|
|
306
|
+
},
|
|
307
307
|
onChange: onOperateChange
|
|
308
308
|
})), /*#__PURE__*/React.createElement("div", {
|
|
309
309
|
className: "".concat(classPrefix, "-period-condition")
|
|
310
310
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
311
311
|
key: "relative-date",
|
|
312
312
|
className: "".concat(classPrefix, "-select-condition"),
|
|
313
|
-
type:
|
|
313
|
+
type: condition.runTimes.operator !== 'between' ? 'number' : '',
|
|
314
|
+
size: "middle",
|
|
315
|
+
value: condition.runTimes.values[0],
|
|
316
|
+
placeholder: condition.runTimes.operator !== 'between' ? '请输入' : '输入最小值',
|
|
317
|
+
style: {
|
|
318
|
+
width: 100
|
|
319
|
+
},
|
|
320
|
+
onChange: onOperateInput0Change,
|
|
321
|
+
suffix: condition.runTimes.operator !== 'between' ? '次' : null
|
|
322
|
+
})), condition.runTimes.operator === 'between' ? /*#__PURE__*/React.createElement("div", {
|
|
323
|
+
className: "".concat(classPrefix, "-period-condition"),
|
|
324
|
+
style: {
|
|
325
|
+
marginLeft: 10
|
|
326
|
+
}
|
|
327
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
328
|
+
key: "relative-date",
|
|
329
|
+
className: "".concat(classPrefix, "-select-condition"),
|
|
330
|
+
type: condition.runTimes.operator !== 'between' ? 'number' : '',
|
|
314
331
|
size: "middle",
|
|
315
|
-
|
|
316
|
-
value: condition.runTimes.values,
|
|
332
|
+
value: condition.runTimes.values[1],
|
|
317
333
|
style: {
|
|
318
|
-
width:
|
|
334
|
+
width: 100
|
|
319
335
|
},
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
336
|
+
placeholder: condition.runTimes.operator !== 'between' ? '请输入' : '输入最大值',
|
|
337
|
+
onChange: onOperateInput1Change,
|
|
338
|
+
suffix: condition.runTimes.operator !== 'between' ? '次' : null
|
|
339
|
+
})) : null), condition.timeDimensions.map(function (_item, index) {
|
|
323
340
|
return /*#__PURE__*/React.createElement("div", {
|
|
324
341
|
style: {
|
|
325
342
|
margin: '10px 0 0 65px'
|
|
@@ -372,13 +389,13 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
372
389
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
373
390
|
type: "qingchu"
|
|
374
391
|
}))));
|
|
375
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
392
|
+
}), condition.timeDimensions.length !== 3 || condition.attrs.length !== 6 ? /*#__PURE__*/React.createElement("div", {
|
|
376
393
|
style: {
|
|
377
394
|
margin: '2px 0 0 65px',
|
|
378
395
|
color: '#4075fd',
|
|
379
396
|
fontSize: '12px'
|
|
380
397
|
}
|
|
381
|
-
},
|
|
398
|
+
}, /*#__PURE__*/React.createElement(Dropdown, {
|
|
382
399
|
menu: {
|
|
383
400
|
items: items,
|
|
384
401
|
onClick: onClick
|
|
@@ -387,7 +404,7 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
387
404
|
onClick: function onClick(e) {
|
|
388
405
|
return e.preventDefault();
|
|
389
406
|
}
|
|
390
|
-
}, /*#__PURE__*/React.createElement(Space, null, "\u9AD8\u7EA7\u7B5B\u9009", /*#__PURE__*/React.createElement(DownOutlined, null)))) : null)
|
|
407
|
+
}, /*#__PURE__*/React.createElement(Space, null, "\u9AD8\u7EA7\u7B5B\u9009", /*#__PURE__*/React.createElement(DownOutlined, null))))) : null);
|
|
391
408
|
};
|
|
392
409
|
BusinessCondition.defaultProps = {
|
|
393
410
|
isEvent: false,
|
|
@@ -25,11 +25,26 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
25
25
|
index = props.index,
|
|
26
26
|
serviceAttrType = props.serviceAttrType,
|
|
27
27
|
onChange = props.onChange;
|
|
28
|
-
var
|
|
28
|
+
var list = [];
|
|
29
|
+
var operateList = [];
|
|
30
|
+
switch (condition.attrs[index].attrType) {
|
|
31
|
+
case 'cont-string':
|
|
32
|
+
list = typeList['cont-string'];
|
|
33
|
+
operateList = stringOperate;
|
|
34
|
+
break;
|
|
35
|
+
case 'cont-num':
|
|
36
|
+
list = computeTypeList;
|
|
37
|
+
operateList = typeList['cont-num'];
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
list = typeList['cont-date'];
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
var _useState = useState((serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) ? list : []),
|
|
29
44
|
_useState2 = _slicedToArray(_useState, 2),
|
|
30
45
|
masterList = _useState2[0],
|
|
31
46
|
setMasterList = _useState2[1];
|
|
32
|
-
var _useState3 = useState(
|
|
47
|
+
var _useState3 = useState(operateList),
|
|
33
48
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
34
49
|
stringOperateList = _useState4[0],
|
|
35
50
|
setStringOperateList = _useState4[1];
|
|
@@ -55,27 +70,26 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
55
70
|
}
|
|
56
71
|
}, [searchValue]);
|
|
57
72
|
function queryAppList(type) {
|
|
58
|
-
request(type === 'master' ? '
|
|
73
|
+
request(type === 'master' ? '/cep-console/api/v1/cdp/orderAttribute/master' : '/cep-console/api/v1/cdp/orderAttribute/son', {
|
|
59
74
|
headers: {
|
|
60
|
-
'Content-Type': 'application/json'
|
|
61
|
-
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIwIiwiY29tcGFueUlkIjoyLCJleHAiOjE2Nzg3MTYwMzAsImlhdCI6MTY3ODY3MjgzMCwidXNlcklkIjowfQ.betSVs513b-6v8x_ErbS8xhROemLiOmx3CtqUq_R4k0'
|
|
75
|
+
'Content-Type': 'application/json'
|
|
62
76
|
},
|
|
63
77
|
method: 'post',
|
|
64
78
|
data: {
|
|
65
|
-
appId:
|
|
79
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
66
80
|
pageNum: 1,
|
|
67
81
|
pageSize: 9999
|
|
68
82
|
}
|
|
69
83
|
}).then(function (res) {
|
|
70
84
|
if (res.data) {
|
|
71
|
-
var
|
|
85
|
+
var _list = res.data.map(function (item) {
|
|
72
86
|
return {
|
|
73
87
|
name: item.name,
|
|
74
88
|
value: item.id,
|
|
75
89
|
columnName: item.columnName
|
|
76
90
|
};
|
|
77
91
|
});
|
|
78
|
-
setMasterList(
|
|
92
|
+
setMasterList(_list);
|
|
79
93
|
} else {
|
|
80
94
|
setMasterList([]);
|
|
81
95
|
}
|
|
@@ -84,10 +98,9 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
84
98
|
});
|
|
85
99
|
}
|
|
86
100
|
function queryValueList(keyword, operate) {
|
|
87
|
-
request('
|
|
101
|
+
request('/cep-console/api/v1/es/data/attr/value', {
|
|
88
102
|
headers: {
|
|
89
|
-
'Content-Type': 'application/json'
|
|
90
|
-
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIwIiwiY29tcGFueUlkIjoyLCJleHAiOjE2Nzg3MTYwMzAsImlhdCI6MTY3ODY3MjgzMCwidXNlcklkIjowfQ.betSVs513b-6v8x_ErbS8xhROemLiOmx3CtqUq_R4k0'
|
|
103
|
+
'Content-Type': 'application/json'
|
|
91
104
|
},
|
|
92
105
|
method: 'post',
|
|
93
106
|
data: {
|
|
@@ -102,13 +115,13 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
102
115
|
}
|
|
103
116
|
}).then(function (res) {
|
|
104
117
|
if (res.data) {
|
|
105
|
-
var
|
|
118
|
+
var _list2 = res.data.map(function (item) {
|
|
106
119
|
return {
|
|
107
120
|
name: operate.bizDataTypeId ? item : item.name,
|
|
108
121
|
value: operate.bizDataTypeId ? item : item.id
|
|
109
122
|
};
|
|
110
123
|
});
|
|
111
|
-
setParamsList(
|
|
124
|
+
setParamsList(_list2);
|
|
112
125
|
} else {
|
|
113
126
|
setParamsList([]);
|
|
114
127
|
}
|
|
@@ -117,10 +130,9 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
117
130
|
});
|
|
118
131
|
}
|
|
119
132
|
function queryBizDataAttrList(bizDataTypeId) {
|
|
120
|
-
request('
|
|
133
|
+
request('/cep-console/api/v1/bizdata/attr/list', {
|
|
121
134
|
headers: {
|
|
122
|
-
'Content-Type': 'application/json'
|
|
123
|
-
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIwIiwiY29tcGFueUlkIjoyLCJleHAiOjE2Nzg3MTYwMzAsImlhdCI6MTY3ODY3MjgzMCwidXNlcklkIjowfQ.betSVs513b-6v8x_ErbS8xhROemLiOmx3CtqUq_R4k0'
|
|
135
|
+
'Content-Type': 'application/json'
|
|
124
136
|
},
|
|
125
137
|
method: 'post',
|
|
126
138
|
data: {
|
|
@@ -128,12 +140,12 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
128
140
|
}
|
|
129
141
|
}).then(function (res) {
|
|
130
142
|
if (res.data) {
|
|
131
|
-
var
|
|
143
|
+
var _list3 = res.data.map(function (item) {
|
|
132
144
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
133
145
|
value: item.id
|
|
134
146
|
});
|
|
135
147
|
});
|
|
136
|
-
setBizDataAttrList(
|
|
148
|
+
setBizDataAttrList(_list3);
|
|
137
149
|
} else {
|
|
138
150
|
setBizDataAttrList([]);
|
|
139
151
|
}
|
|
@@ -171,9 +183,7 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
171
183
|
};
|
|
172
184
|
var onMasterListChange = function onMasterListChange(operate) {
|
|
173
185
|
if (!(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value)) {
|
|
174
|
-
condition.attrs[index].attrName = operate.name;
|
|
175
186
|
condition.attrs[index].attrMaping = operate.columnName;
|
|
176
|
-
condition.attrs[index].attrId = operate.value;
|
|
177
187
|
condition.attrs[index].attrType = 'cont-string';
|
|
178
188
|
setStringOperateList(stringOperate);
|
|
179
189
|
} else {
|
|
@@ -255,6 +265,10 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
255
265
|
options: stringOperateList,
|
|
256
266
|
labelField: "name",
|
|
257
267
|
keyField: "value",
|
|
268
|
+
value: {
|
|
269
|
+
name: condition.attrs[index].operator,
|
|
270
|
+
value: condition.attrs[index].operator
|
|
271
|
+
},
|
|
258
272
|
overlayWidth: 120,
|
|
259
273
|
onChange: onStringOperateChange
|
|
260
274
|
})) : null, !(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) || condition.attrs[index].attrType === 'cont-string' && condition.attrs[index].operator !== 'is null' && condition.attrs[index].operator !== 'is not null' ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -280,6 +294,7 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
280
294
|
size: "middle",
|
|
281
295
|
type: condition.attrs[index].attrType === 'cont-date' ? 'number' : '',
|
|
282
296
|
placeholder: condition.attrs[index].operator === 'between' ? '输入最小值' : '请输入',
|
|
297
|
+
value: condition.attrs[index].params[0],
|
|
283
298
|
style: {
|
|
284
299
|
width: condition.attrs[index].operator === 'between' || condition.attrs[index].attrType === 'cont-date' && condition.attrs[index].operator ? 100 : 200
|
|
285
300
|
},
|
|
@@ -296,6 +311,7 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
296
311
|
size: "middle",
|
|
297
312
|
type: condition.attrs[index].attrType === 'cont-date' ? 'number' : '',
|
|
298
313
|
placeholder: '输入最大值',
|
|
314
|
+
value: condition.attrs[index].params[1],
|
|
299
315
|
style: {
|
|
300
316
|
width: 100
|
|
301
317
|
},
|
|
@@ -164,7 +164,7 @@ var EventCondition = function EventCondition(props) {
|
|
|
164
164
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
165
165
|
type: "qingchu"
|
|
166
166
|
}))));
|
|
167
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
167
|
+
}), condition.timeDimensions.length < 3 ? /*#__PURE__*/React.createElement("div", {
|
|
168
168
|
style: {
|
|
169
169
|
margin: '2px 0 0 38px',
|
|
170
170
|
color: '#4075fd',
|
|
@@ -179,6 +179,6 @@ var EventCondition = function EventCondition(props) {
|
|
|
179
179
|
onClick: function onClick(e) {
|
|
180
180
|
return e.preventDefault();
|
|
181
181
|
}
|
|
182
|
-
}, /*#__PURE__*/React.createElement(Space, null, "\u9AD8\u7EA7\u7B5B\u9009", /*#__PURE__*/React.createElement(DownOutlined, null))))));
|
|
182
|
+
}, /*#__PURE__*/React.createElement(Space, null, "\u9AD8\u7EA7\u7B5B\u9009", /*#__PURE__*/React.createElement(DownOutlined, null))))) : null);
|
|
183
183
|
};
|
|
184
184
|
export default EventCondition;
|
|
@@ -11,31 +11,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
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
13
|
import React, { useState } from 'react';
|
|
14
|
-
import { Input
|
|
15
|
-
import { InfoCircleOutlined } from '@ant-design/icons';
|
|
14
|
+
import { Input } from 'antd';
|
|
16
15
|
import BizSelect from '../../select';
|
|
17
16
|
import './styles/runTimesCondition.less';
|
|
18
17
|
import { classPrefix } from '..';
|
|
19
|
-
import { timeDimensionType, skyTimeOperatorType, weekTimeOperatorType, monthTimeOperatorType, timeValuesType, weekValuesType, monthValuesType } from '../../attrConditions/utils/operates';
|
|
20
|
-
var options = [{
|
|
21
|
-
value: '>',
|
|
22
|
-
text: '>'
|
|
23
|
-
}, {
|
|
24
|
-
value: '=',
|
|
25
|
-
text: '='
|
|
26
|
-
}, {
|
|
27
|
-
value: '<',
|
|
28
|
-
text: '<'
|
|
29
|
-
}, {
|
|
30
|
-
value: '>=',
|
|
31
|
-
text: '≥'
|
|
32
|
-
}, {
|
|
33
|
-
value: '<=',
|
|
34
|
-
text: '≤'
|
|
35
|
-
}, {
|
|
36
|
-
value: 'not equal',
|
|
37
|
-
text: '≠'
|
|
38
|
-
}];
|
|
18
|
+
import { timeDimensionType, skyTimeOperatorType, weekTimeOperatorType, monthTimeOperatorType, timeValuesType, weekValuesType, monthValuesType, typeList } from '../../attrConditions/utils/operates';
|
|
39
19
|
var TimeDimension = function TimeDimension(props) {
|
|
40
20
|
var condition = props.condition,
|
|
41
21
|
index = props.index,
|
|
@@ -45,23 +25,44 @@ var TimeDimension = function TimeDimension(props) {
|
|
|
45
25
|
value: 1
|
|
46
26
|
}),
|
|
47
27
|
_useState2 = _slicedToArray(_useState, 2),
|
|
48
|
-
timeDimensionTypeList = _useState2[0],
|
|
49
28
|
setTimeDimensionTypeList = _useState2[1];
|
|
50
|
-
var
|
|
29
|
+
var list = [];
|
|
30
|
+
var valuesList = [];
|
|
31
|
+
switch (condition.timeDimensions[index].timeDimension) {
|
|
32
|
+
case 1:
|
|
33
|
+
list = skyTimeOperatorType;
|
|
34
|
+
valuesList = timeValuesType;
|
|
35
|
+
break;
|
|
36
|
+
case 2:
|
|
37
|
+
list = weekTimeOperatorType;
|
|
38
|
+
valuesList = weekValuesType;
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
list = monthTimeOperatorType;
|
|
42
|
+
valuesList = monthValuesType;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
var _useState3 = useState(list),
|
|
51
46
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
52
47
|
timeOperatorTypeList = _useState4[0],
|
|
53
48
|
setTimeOperatorTypeList = _useState4[1];
|
|
54
|
-
var _useState5 = useState(
|
|
49
|
+
var _useState5 = useState(valuesList),
|
|
55
50
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
56
51
|
timeValuesTypeList = _useState6[0],
|
|
57
52
|
setTimeValuesTypeList = _useState6[1];
|
|
58
53
|
function onOperatorChange(data) {
|
|
59
54
|
condition.timeDimensions[index].frequencyOperator = data.value;
|
|
55
|
+
condition.timeDimensions[index].frequencyValues = [condition.timeDimensions[index].frequencyValues[0]];
|
|
56
|
+
onChange(_objectSpread({}, condition));
|
|
57
|
+
}
|
|
58
|
+
function onValue0Change(e) {
|
|
59
|
+
var value = e.target.value;
|
|
60
|
+
condition.timeDimensions[index].frequencyValues[0] = value;
|
|
60
61
|
onChange(_objectSpread({}, condition));
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function onValue1Change(e) {
|
|
63
64
|
var value = e.target.value;
|
|
64
|
-
condition.timeDimensions[index].frequencyValues = value;
|
|
65
|
+
condition.timeDimensions[index].frequencyValues[1] = value;
|
|
65
66
|
onChange(_objectSpread({}, condition));
|
|
66
67
|
}
|
|
67
68
|
var onTimeDimensionTypeChange = function onTimeDimensionTypeChange(operate) {
|
|
@@ -84,7 +85,7 @@ var TimeDimension = function TimeDimension(props) {
|
|
|
84
85
|
onChange(_objectSpread({}, condition));
|
|
85
86
|
};
|
|
86
87
|
var onTimeOperatorTypeChange = function onTimeOperatorTypeChange(operate) {
|
|
87
|
-
condition.timeDimensions[index].timeValues = [];
|
|
88
|
+
condition.timeDimensions[index].timeValues = [condition.timeDimensions[index].timeValues[0]];
|
|
88
89
|
condition.timeDimensions[index].timeOperator = operate.value;
|
|
89
90
|
onChange(_objectSpread({}, condition));
|
|
90
91
|
};
|
|
@@ -106,7 +107,10 @@ var TimeDimension = function TimeDimension(props) {
|
|
|
106
107
|
labelField: "name",
|
|
107
108
|
keyField: "value",
|
|
108
109
|
overlayWidth: 80,
|
|
109
|
-
value:
|
|
110
|
+
value: {
|
|
111
|
+
name: condition.timeDimensions[index].timeDimension,
|
|
112
|
+
value: condition.timeDimensions[index].timeDimension
|
|
113
|
+
},
|
|
110
114
|
onChange: onTimeDimensionTypeChange
|
|
111
115
|
})), /*#__PURE__*/React.createElement("div", {
|
|
112
116
|
className: "".concat(classPrefix, "-period-condition-operator")
|
|
@@ -116,7 +120,10 @@ var TimeDimension = function TimeDimension(props) {
|
|
|
116
120
|
labelField: "name",
|
|
117
121
|
keyField: "value",
|
|
118
122
|
overlayWidth: 120,
|
|
119
|
-
value:
|
|
123
|
+
value: {
|
|
124
|
+
name: condition.timeDimensions[index].timeOperator,
|
|
125
|
+
value: condition.timeDimensions[index].timeOperator
|
|
126
|
+
},
|
|
120
127
|
onChange: onTimeOperatorTypeChange
|
|
121
128
|
})), condition.timeDimensions[index].timeOperator === 'in' || condition.timeDimensions[index].timeOperator === 'between' ? /*#__PURE__*/React.createElement("div", {
|
|
122
129
|
className: "".concat(classPrefix, "-period-condition-operator")
|
|
@@ -126,6 +133,10 @@ var TimeDimension = function TimeDimension(props) {
|
|
|
126
133
|
labelField: "name",
|
|
127
134
|
keyField: "value",
|
|
128
135
|
overlayWidth: 120,
|
|
136
|
+
value: {
|
|
137
|
+
name: condition.timeDimensions[index].timeValues[0],
|
|
138
|
+
value: condition.timeDimensions[index].timeValues[0]
|
|
139
|
+
},
|
|
129
140
|
onChange: onTimeValuesType0Change
|
|
130
141
|
})) : null, condition.timeDimensions[index].timeOperator === 'between' ? /*#__PURE__*/React.createElement("div", {
|
|
131
142
|
className: "".concat(classPrefix, "-period-condition-operator")
|
|
@@ -135,39 +146,55 @@ var TimeDimension = function TimeDimension(props) {
|
|
|
135
146
|
labelField: "name",
|
|
136
147
|
keyField: "value",
|
|
137
148
|
overlayWidth: 120,
|
|
149
|
+
value: {
|
|
150
|
+
name: condition.timeDimensions[index].timeValues[1],
|
|
151
|
+
value: condition.timeDimensions[index].timeValues[1]
|
|
152
|
+
},
|
|
138
153
|
onChange: onTimeValuesType1Change
|
|
139
154
|
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
140
|
-
className: "".concat(classPrefix, "-
|
|
155
|
+
className: "".concat(classPrefix, "-period-condition-operator")
|
|
141
156
|
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
142
|
-
options:
|
|
143
|
-
labelField: "
|
|
157
|
+
options: typeList['cont-num'],
|
|
158
|
+
labelField: "name",
|
|
159
|
+
overlayWidth: 100,
|
|
144
160
|
keyField: "value",
|
|
145
161
|
value: {
|
|
146
162
|
value: condition.timeDimensions[index].frequencyOperator,
|
|
147
|
-
|
|
163
|
+
name: condition.timeDimensions[index].frequencyOperator
|
|
148
164
|
},
|
|
149
165
|
size: "middle",
|
|
150
166
|
onChange: onOperatorChange
|
|
151
167
|
})), /*#__PURE__*/React.createElement("div", {
|
|
152
|
-
className: "".concat(classPrefix, "-
|
|
168
|
+
className: "".concat(classPrefix, "-period-condition")
|
|
153
169
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
154
170
|
key: "relative-date",
|
|
155
171
|
className: "".concat(classPrefix, "-select-condition"),
|
|
156
|
-
type:
|
|
172
|
+
type: condition.timeDimensions[index].frequencyOperator !== 'between' ? 'number' : '',
|
|
157
173
|
size: "middle",
|
|
158
|
-
|
|
159
|
-
|
|
174
|
+
value: condition.timeDimensions[index].frequencyValues[0],
|
|
175
|
+
placeholder: condition.timeDimensions[index].frequencyOperator !== 'between' ? '请输入' : '输入最小值',
|
|
160
176
|
style: {
|
|
161
|
-
width:
|
|
177
|
+
width: 100
|
|
162
178
|
},
|
|
163
|
-
onChange:
|
|
164
|
-
suffix:
|
|
165
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
166
|
-
className: "".concat(classPrefix, "-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
179
|
+
onChange: onValue0Change,
|
|
180
|
+
suffix: condition.timeDimensions[index].frequencyOperator !== 'between' ? '次' : null
|
|
181
|
+
})), condition.timeDimensions[index].frequencyOperator === 'between' ? /*#__PURE__*/React.createElement("div", {
|
|
182
|
+
className: "".concat(classPrefix, "-period-condition"),
|
|
183
|
+
style: {
|
|
184
|
+
marginLeft: 10
|
|
185
|
+
}
|
|
186
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
187
|
+
key: "relative-date",
|
|
188
|
+
className: "".concat(classPrefix, "-select-condition"),
|
|
189
|
+
type: condition.timeDimensions[index].frequencyOperator !== 'between' ? 'number' : '',
|
|
190
|
+
size: "middle",
|
|
191
|
+
placeholder: condition.timeDimensions[index].frequencyOperator !== 'between' ? '请输入' : '输入最大值',
|
|
192
|
+
value: condition.timeDimensions[index].frequencyValues[1],
|
|
193
|
+
style: {
|
|
194
|
+
width: 100
|
|
195
|
+
},
|
|
196
|
+
onChange: onValue1Change,
|
|
197
|
+
suffix: condition.timeDimensions[index].frequencyOperator !== 'between' ? '次' : null
|
|
198
|
+
})) : null));
|
|
172
199
|
};
|
|
173
200
|
export default TimeDimension;
|
|
@@ -8,7 +8,7 @@ export interface RunPeriodI {
|
|
|
8
8
|
values: string[];
|
|
9
9
|
}
|
|
10
10
|
export interface RunTimesI {
|
|
11
|
-
operator: '>' | '=' | '<' | '>=' | '<=' | '>=' | 'not equal';
|
|
11
|
+
operator: '>' | '=' | '<' | '>=' | '<=' | '>=' | 'not equal' | 'between';
|
|
12
12
|
values: string[];
|
|
13
13
|
}
|
|
14
14
|
export interface AllConditionBasePropsI<T> {
|