@zgfe/business-lib 1.1.31-alpha.1 → 1.1.31-alpha.3
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/components/stringList.js +1 -0
- package/es/userCondition/conditions/businessCondition.js +53 -35
- package/es/userCondition/conditions/constants.d.ts +1 -0
- package/es/userCondition/conditions/constants.js +2 -1
- package/es/userCondition/conditions/dataAttribute.js +160 -23
- package/es/userCondition/conditions/timeDimension.js +75 -48
- package/es/userCondition/types.d.ts +1 -1
- package/package.json +3 -3
|
@@ -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, { useEffect, useState } from 'react';
|
|
13
|
+
import React, { useContext, useEffect, useState } from 'react';
|
|
14
14
|
import BizSelect from '../../select';
|
|
15
15
|
import { DownOutlined } from '@ant-design/icons';
|
|
16
16
|
import { Input, DatePicker, Dropdown, Space, notification } from 'antd';
|
|
@@ -18,17 +18,20 @@ 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';
|
|
25
25
|
import IconFont from '../../icon/iconFont';
|
|
26
|
+
import BizGlobalDataContext from '../../context';
|
|
26
27
|
var RangePicker = DatePicker.RangePicker;
|
|
27
28
|
var BusinessCondition = function BusinessCondition(props) {
|
|
28
29
|
var condition = props.condition,
|
|
29
30
|
dataId = props.dataId,
|
|
30
31
|
isEvent = props.isEvent,
|
|
31
32
|
label = props.label;
|
|
33
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
34
|
+
currentApp = _useContext.currentApp;
|
|
32
35
|
function onChange(data) {
|
|
33
36
|
props.onChange(dataId, data);
|
|
34
37
|
}
|
|
@@ -55,25 +58,18 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
55
58
|
key: 'service attribute'
|
|
56
59
|
}]);
|
|
57
60
|
}
|
|
58
|
-
var _useState = useState(
|
|
59
|
-
name: '≥',
|
|
60
|
-
value: 'ge'
|
|
61
|
-
}),
|
|
61
|
+
var _useState = useState(),
|
|
62
62
|
_useState2 = _slicedToArray(_useState, 2),
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
dataAttributeLabel = _useState2[0],
|
|
64
|
+
setDataAttributeLabel = _useState2[1];
|
|
65
65
|
var _useState3 = useState(),
|
|
66
66
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var _useState5 = useState(),
|
|
67
|
+
serviceAttribute = _useState4[0],
|
|
68
|
+
setServiceAttribute = _useState4[1];
|
|
69
|
+
var _useState5 = useState([]),
|
|
70
70
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var _useState7 = useState([]),
|
|
74
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
75
|
-
serviceAttributeList = _useState8[0],
|
|
76
|
-
setServiceAttributeList = _useState8[1];
|
|
71
|
+
serviceAttributeList = _useState6[0],
|
|
72
|
+
setServiceAttributeList = _useState6[1];
|
|
77
73
|
var options = [{
|
|
78
74
|
text: '最近',
|
|
79
75
|
value: 'relative'
|
|
@@ -94,7 +90,7 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
94
90
|
}]);
|
|
95
91
|
}
|
|
96
92
|
function queryServiceAttributeList() {
|
|
97
|
-
request(
|
|
93
|
+
request("/cep-console/api/v1/bizdata/type/list/".concat(currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId), {
|
|
98
94
|
headers: {
|
|
99
95
|
'Content-Type': 'application/json'
|
|
100
96
|
},
|
|
@@ -186,20 +182,22 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
186
182
|
}
|
|
187
183
|
}
|
|
188
184
|
var onOperateChange = function onOperateChange(operate) {
|
|
189
|
-
|
|
185
|
+
condition.runTimes.values = [condition.runTimes.values[0]];
|
|
190
186
|
onChange(_objectSpread(_objectSpread({}, condition), {}, {
|
|
191
187
|
runTimes: _objectSpread(_objectSpread({}, condition.runTimes), {}, {
|
|
192
|
-
operator: operate
|
|
188
|
+
operator: operate.value
|
|
193
189
|
})
|
|
194
190
|
}));
|
|
195
191
|
};
|
|
196
|
-
var
|
|
192
|
+
var onOperateInput0Change = function onOperateInput0Change(value) {
|
|
197
193
|
var newValue = value.target.value;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
194
|
+
condition.runTimes.values[0] = newValue;
|
|
195
|
+
onChange(_objectSpread({}, condition));
|
|
196
|
+
};
|
|
197
|
+
var onOperateInput1Change = function onOperateInput1Change(value) {
|
|
198
|
+
var newValue = value.target.value;
|
|
199
|
+
condition.runTimes.values[1] = newValue;
|
|
200
|
+
onChange(_objectSpread({}, condition));
|
|
203
201
|
};
|
|
204
202
|
var onClick = function onClick(_ref) {
|
|
205
203
|
var key = _ref.key;
|
|
@@ -301,27 +299,47 @@ var BusinessCondition = function BusinessCondition(props) {
|
|
|
301
299
|
className: "".concat(classPrefix, "-period-condition-operator")
|
|
302
300
|
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
303
301
|
className: "".concat(classPrefix, "-select-condition"),
|
|
304
|
-
options:
|
|
302
|
+
options: typeList['cont-num'],
|
|
305
303
|
labelField: "name",
|
|
306
304
|
keyField: "value",
|
|
307
305
|
overlayWidth: 80,
|
|
308
|
-
value:
|
|
306
|
+
value: {
|
|
307
|
+
value: condition.runTimes.operator,
|
|
308
|
+
name: condition.runTimes.operator
|
|
309
|
+
},
|
|
309
310
|
onChange: onOperateChange
|
|
310
311
|
})), /*#__PURE__*/React.createElement("div", {
|
|
311
312
|
className: "".concat(classPrefix, "-period-condition")
|
|
312
313
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
313
314
|
key: "relative-date",
|
|
314
315
|
className: "".concat(classPrefix, "-select-condition"),
|
|
315
|
-
type:
|
|
316
|
+
type: condition.runTimes.operator !== 'between' ? 'number' : '',
|
|
317
|
+
size: "middle",
|
|
318
|
+
value: condition.runTimes.values[0],
|
|
319
|
+
placeholder: condition.runTimes.operator !== 'between' ? '请输入' : '输入最小值',
|
|
320
|
+
style: {
|
|
321
|
+
width: 100
|
|
322
|
+
},
|
|
323
|
+
onChange: onOperateInput0Change,
|
|
324
|
+
suffix: condition.runTimes.operator !== 'between' ? '次' : null
|
|
325
|
+
})), condition.runTimes.operator === 'between' ? /*#__PURE__*/React.createElement("div", {
|
|
326
|
+
className: "".concat(classPrefix, "-period-condition"),
|
|
327
|
+
style: {
|
|
328
|
+
marginLeft: 10
|
|
329
|
+
}
|
|
330
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
331
|
+
key: "relative-date",
|
|
332
|
+
className: "".concat(classPrefix, "-select-condition"),
|
|
333
|
+
type: condition.runTimes.operator !== 'between' ? 'number' : '',
|
|
316
334
|
size: "middle",
|
|
317
|
-
|
|
318
|
-
value: condition.runTimes.values,
|
|
335
|
+
value: condition.runTimes.values[1],
|
|
319
336
|
style: {
|
|
320
|
-
width:
|
|
337
|
+
width: 100
|
|
321
338
|
},
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
339
|
+
placeholder: condition.runTimes.operator !== 'between' ? '请输入' : '输入最大值',
|
|
340
|
+
onChange: onOperateInput1Change,
|
|
341
|
+
suffix: condition.runTimes.operator !== 'between' ? '次' : null
|
|
342
|
+
})) : null), condition.timeDimensions.map(function (_item, index) {
|
|
325
343
|
return /*#__PURE__*/React.createElement("div", {
|
|
326
344
|
style: {
|
|
327
345
|
margin: '10px 0 0 65px'
|
|
@@ -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];
|
|
@@ -45,6 +60,10 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
45
60
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
46
61
|
searchValue = _useState10[0],
|
|
47
62
|
setSearchValue = _useState10[1];
|
|
63
|
+
var _useState11 = useState([]),
|
|
64
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
65
|
+
current = _useState12[0],
|
|
66
|
+
setCurrent = _useState12[1];
|
|
48
67
|
var _useContext = useContext(BizGlobalDataContext),
|
|
49
68
|
currentApp = _useContext.currentApp;
|
|
50
69
|
useEffect(function () {
|
|
@@ -53,6 +72,9 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
53
72
|
} else {
|
|
54
73
|
setBizDataAttrList(orderTypeList);
|
|
55
74
|
}
|
|
75
|
+
if (searchValue) {
|
|
76
|
+
console.log(66666, searchValue);
|
|
77
|
+
}
|
|
56
78
|
}, [searchValue]);
|
|
57
79
|
function queryAppList(type) {
|
|
58
80
|
request(type === 'master' ? '/cep-console/api/v1/cdp/orderAttribute/master' : '/cep-console/api/v1/cdp/orderAttribute/son', {
|
|
@@ -61,25 +83,88 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
61
83
|
},
|
|
62
84
|
method: 'post',
|
|
63
85
|
data: {
|
|
64
|
-
appId:
|
|
86
|
+
appId: 99677,
|
|
65
87
|
pageNum: 1,
|
|
66
88
|
pageSize: 9999
|
|
67
89
|
}
|
|
68
90
|
}).then(function (res) {
|
|
69
91
|
if (res.data) {
|
|
70
|
-
var
|
|
71
|
-
return {
|
|
92
|
+
var _list = res.data.map(function (item) {
|
|
93
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
72
94
|
name: item.name,
|
|
73
95
|
value: item.id,
|
|
74
96
|
columnName: item.columnName
|
|
75
|
-
};
|
|
97
|
+
});
|
|
76
98
|
});
|
|
77
|
-
setMasterList(
|
|
99
|
+
setMasterList(_list);
|
|
78
100
|
} else {
|
|
79
101
|
setMasterList([]);
|
|
80
102
|
}
|
|
81
103
|
}).catch(function () {
|
|
82
|
-
setMasterList([
|
|
104
|
+
setMasterList([{
|
|
105
|
+
id: 81,
|
|
106
|
+
value: 81,
|
|
107
|
+
appId: 99677,
|
|
108
|
+
name: '手机号',
|
|
109
|
+
propType: 1,
|
|
110
|
+
required: 0,
|
|
111
|
+
isOrderShow: 1,
|
|
112
|
+
isUserShow: 1,
|
|
113
|
+
columnName: 'cus4',
|
|
114
|
+
isDelete: null,
|
|
115
|
+
isUniqueOrder: '',
|
|
116
|
+
isUniqueUser: '',
|
|
117
|
+
isUniqueCreatedate: '',
|
|
118
|
+
isUniquePaydate: '',
|
|
119
|
+
orderRelationSon: '',
|
|
120
|
+
createDate: 1678431608000,
|
|
121
|
+
updateDateTime: null,
|
|
122
|
+
hidden: null,
|
|
123
|
+
attrOrder: 5,
|
|
124
|
+
requestHide: null
|
|
125
|
+
}, {
|
|
126
|
+
id: 82,
|
|
127
|
+
value: 82,
|
|
128
|
+
appId: 99677,
|
|
129
|
+
name: 'ID',
|
|
130
|
+
propType: 2,
|
|
131
|
+
required: 1,
|
|
132
|
+
isOrderShow: 1,
|
|
133
|
+
isUserShow: 1,
|
|
134
|
+
columnName: 'cus5',
|
|
135
|
+
isDelete: null,
|
|
136
|
+
isUniqueOrder: '',
|
|
137
|
+
isUniqueUser: '',
|
|
138
|
+
isUniqueCreatedate: 'Y',
|
|
139
|
+
isUniquePaydate: '',
|
|
140
|
+
orderRelationSon: '',
|
|
141
|
+
createDate: 1678431608000,
|
|
142
|
+
updateDateTime: 1678433665000,
|
|
143
|
+
hidden: null,
|
|
144
|
+
attrOrder: 6,
|
|
145
|
+
requestHide: null
|
|
146
|
+
}, {
|
|
147
|
+
id: 83,
|
|
148
|
+
value: 83,
|
|
149
|
+
appId: 99677,
|
|
150
|
+
name: '订单支付时间',
|
|
151
|
+
propType: 3,
|
|
152
|
+
required: 1,
|
|
153
|
+
isOrderShow: 1,
|
|
154
|
+
isUserShow: 1,
|
|
155
|
+
columnName: 'cus6',
|
|
156
|
+
isDelete: null,
|
|
157
|
+
isUniqueOrder: '',
|
|
158
|
+
isUniqueUser: '',
|
|
159
|
+
isUniqueCreatedate: '',
|
|
160
|
+
isUniquePaydate: 'Y',
|
|
161
|
+
orderRelationSon: '',
|
|
162
|
+
createDate: 1678431608000,
|
|
163
|
+
updateDateTime: 1678433668000,
|
|
164
|
+
hidden: null,
|
|
165
|
+
attrOrder: 7,
|
|
166
|
+
requestHide: null
|
|
167
|
+
}]);
|
|
83
168
|
});
|
|
84
169
|
}
|
|
85
170
|
function queryValueList(keyword, operate) {
|
|
@@ -100,13 +185,13 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
100
185
|
}
|
|
101
186
|
}).then(function (res) {
|
|
102
187
|
if (res.data) {
|
|
103
|
-
var
|
|
188
|
+
var _list2 = res.data.map(function (item) {
|
|
104
189
|
return {
|
|
105
190
|
name: operate.bizDataTypeId ? item : item.name,
|
|
106
191
|
value: operate.bizDataTypeId ? item : item.id
|
|
107
192
|
};
|
|
108
193
|
});
|
|
109
|
-
setParamsList(
|
|
194
|
+
setParamsList(_list2);
|
|
110
195
|
} else {
|
|
111
196
|
setParamsList([]);
|
|
112
197
|
}
|
|
@@ -125,12 +210,12 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
125
210
|
}
|
|
126
211
|
}).then(function (res) {
|
|
127
212
|
if (res.data) {
|
|
128
|
-
var
|
|
213
|
+
var _list3 = res.data.map(function (item) {
|
|
129
214
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
130
215
|
value: item.id
|
|
131
216
|
});
|
|
132
217
|
});
|
|
133
|
-
setBizDataAttrList(
|
|
218
|
+
setBizDataAttrList(_list3);
|
|
134
219
|
} else {
|
|
135
220
|
setBizDataAttrList([]);
|
|
136
221
|
}
|
|
@@ -168,11 +253,29 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
168
253
|
};
|
|
169
254
|
var onMasterListChange = function onMasterListChange(operate) {
|
|
170
255
|
if (!(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value)) {
|
|
256
|
+
switch (operate.propType) {
|
|
257
|
+
case 1:
|
|
258
|
+
setStringOperateList(typeList['cont-string']);
|
|
259
|
+
condition.attrs[index].attrType = 'cont-string';
|
|
260
|
+
queryValueList('', operate);
|
|
261
|
+
break;
|
|
262
|
+
case 2:
|
|
263
|
+
setStringOperateList(typeList['cont-num']);
|
|
264
|
+
condition.attrs[index].attrType = 'cont-num';
|
|
265
|
+
break;
|
|
266
|
+
default:
|
|
267
|
+
setStringOperateList(typeList['cont-date']);
|
|
268
|
+
condition.attrs[index].attrType = 'cont-date';
|
|
269
|
+
if (condition.attrs[index].attrType === 'cont-date') {
|
|
270
|
+
var endDate = moment().format('YYYY-MM-DD');
|
|
271
|
+
var startDate = moment().subtract(7, 'days').format('YYYY-MM-DD');
|
|
272
|
+
condition.attrs[index].params = [startDate, endDate];
|
|
273
|
+
}
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
condition.attrs[index].attrId = operate.id;
|
|
171
277
|
condition.attrs[index].attrName = operate.name;
|
|
172
278
|
condition.attrs[index].attrMaping = operate.columnName;
|
|
173
|
-
condition.attrs[index].attrId = operate.value;
|
|
174
|
-
condition.attrs[index].attrType = 'cont-string';
|
|
175
|
-
setStringOperateList(stringOperate);
|
|
176
279
|
} else {
|
|
177
280
|
switch (condition.attrs[index].attrType) {
|
|
178
281
|
case 'cont-string':
|
|
@@ -180,9 +283,9 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
180
283
|
condition.attrs[index].operator = operate.value;
|
|
181
284
|
condition.attrs[index].params = [];
|
|
182
285
|
if (condition.attrs[index].operator === 'absolute' && condition.attrs[index].attrType === 'cont-date') {
|
|
183
|
-
var
|
|
184
|
-
var
|
|
185
|
-
condition.attrs[index].params = [
|
|
286
|
+
var _endDate = moment().format('YYYY-MM-DD');
|
|
287
|
+
var _startDate = moment().subtract(7, 'days').format('YYYY-MM-DD');
|
|
288
|
+
condition.attrs[index].params = [_startDate, _endDate];
|
|
186
289
|
}
|
|
187
290
|
break;
|
|
188
291
|
default:
|
|
@@ -193,9 +296,16 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
193
296
|
onChange(_objectSpread({}, condition));
|
|
194
297
|
};
|
|
195
298
|
var onStringOperateChange = function onStringOperateChange(operate) {
|
|
299
|
+
if (condition.attrs[index].operator !== 'absolute') {
|
|
300
|
+
condition.attrs[index].params = [];
|
|
301
|
+
}
|
|
196
302
|
condition.attrs[index].operator = operate.value;
|
|
197
303
|
onChange(_objectSpread({}, condition));
|
|
198
304
|
};
|
|
305
|
+
var onComputeTypeOperateChange = function onComputeTypeOperateChange(operate) {
|
|
306
|
+
condition.attrs[index].computeType = operate.value;
|
|
307
|
+
onChange(_objectSpread({}, condition));
|
|
308
|
+
};
|
|
199
309
|
var onValue0Change = function onValue0Change(e) {
|
|
200
310
|
var value = e.target.value;
|
|
201
311
|
condition.attrs[index].params[0] = value;
|
|
@@ -208,12 +318,19 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
208
318
|
};
|
|
209
319
|
var onParamsChange = function onParamsChange(operate) {
|
|
210
320
|
var obj = operate.map(function (item) {
|
|
321
|
+
return {
|
|
322
|
+
name: item.name,
|
|
323
|
+
value: item.value
|
|
324
|
+
};
|
|
325
|
+
});
|
|
326
|
+
var params = operate.map(function (item) {
|
|
211
327
|
return item.value;
|
|
212
328
|
});
|
|
213
329
|
if (!(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value)) {
|
|
214
330
|
queryValueList(searchValue, {});
|
|
215
331
|
}
|
|
216
|
-
|
|
332
|
+
setCurrent(obj);
|
|
333
|
+
condition.attrs[index].params = params;
|
|
217
334
|
onChange(_objectSpread({}, condition));
|
|
218
335
|
};
|
|
219
336
|
function onDateChange(newData) {
|
|
@@ -245,16 +362,33 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
245
362
|
labelField: "name",
|
|
246
363
|
keyField: "value",
|
|
247
364
|
onChange: onMasterListChange
|
|
248
|
-
})),
|
|
365
|
+
})), !(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) && condition.attrs[index].attrType === 'cont-num' ? /*#__PURE__*/React.createElement("div", {
|
|
366
|
+
className: "".concat(classPrefix, "-period-condition-operator")
|
|
367
|
+
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
368
|
+
className: "".concat(classPrefix, "-select-condition"),
|
|
369
|
+
options: computeTypeList,
|
|
370
|
+
labelField: "name",
|
|
371
|
+
keyField: "value",
|
|
372
|
+
value: {
|
|
373
|
+
name: condition.attrs[index].computeType,
|
|
374
|
+
value: condition.attrs[index].computeType
|
|
375
|
+
},
|
|
376
|
+
overlayWidth: 120,
|
|
377
|
+
onChange: onComputeTypeOperateChange
|
|
378
|
+
})) : null, (serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) && condition.attrs[index].attrType === 'cont-num' || !(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) ? /*#__PURE__*/React.createElement("div", {
|
|
249
379
|
className: "".concat(classPrefix, "-period-condition-operator")
|
|
250
380
|
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
251
381
|
className: "".concat(classPrefix, "-select-condition"),
|
|
252
382
|
options: stringOperateList,
|
|
253
383
|
labelField: "name",
|
|
254
384
|
keyField: "value",
|
|
385
|
+
value: {
|
|
386
|
+
name: condition.attrs[index].operator,
|
|
387
|
+
value: condition.attrs[index].operator
|
|
388
|
+
},
|
|
255
389
|
overlayWidth: 120,
|
|
256
390
|
onChange: onStringOperateChange
|
|
257
|
-
})) : 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", {
|
|
391
|
+
})) : null, !(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) && 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", {
|
|
258
392
|
className: "".concat(classPrefix, "-period-condition-operator"),
|
|
259
393
|
style: {
|
|
260
394
|
width: '250px'
|
|
@@ -262,13 +396,14 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
262
396
|
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
263
397
|
className: "".concat(classPrefix, "-multi-select"),
|
|
264
398
|
multiple: true,
|
|
265
|
-
enableCreate: false,
|
|
266
399
|
size: "middle",
|
|
267
400
|
labelField: "name",
|
|
268
401
|
keyField: "value",
|
|
402
|
+
value: current,
|
|
269
403
|
options: paramsList,
|
|
270
404
|
onChange: onParamsChange,
|
|
271
|
-
onSearch: setSearchValue
|
|
405
|
+
onSearch: setSearchValue,
|
|
406
|
+
enableCreate: true
|
|
272
407
|
})) : null, condition.attrs[index].attrType === 'cont-num' || condition.attrs[index].attrType === 'cont-date' && condition.attrs[index].operator !== 'absolute' ? /*#__PURE__*/React.createElement("div", {
|
|
273
408
|
className: "".concat(classPrefix, "-period-condition")
|
|
274
409
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
@@ -277,6 +412,7 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
277
412
|
size: "middle",
|
|
278
413
|
type: condition.attrs[index].attrType === 'cont-date' ? 'number' : '',
|
|
279
414
|
placeholder: condition.attrs[index].operator === 'between' ? '输入最小值' : '请输入',
|
|
415
|
+
value: condition.attrs[index].params[0],
|
|
280
416
|
style: {
|
|
281
417
|
width: condition.attrs[index].operator === 'between' || condition.attrs[index].attrType === 'cont-date' && condition.attrs[index].operator ? 100 : 200
|
|
282
418
|
},
|
|
@@ -293,6 +429,7 @@ var DataAttribute = function DataAttribute(props) {
|
|
|
293
429
|
size: "middle",
|
|
294
430
|
type: condition.attrs[index].attrType === 'cont-date' ? 'number' : '',
|
|
295
431
|
placeholder: '输入最大值',
|
|
432
|
+
value: condition.attrs[index].params[1],
|
|
296
433
|
style: {
|
|
297
434
|
width: 100
|
|
298
435
|
},
|
|
@@ -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> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.1.31-alpha.
|
|
3
|
+
"version": "1.1.31-alpha.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"react": "^16.12.0 || ^17.0.0",
|
|
60
60
|
"yorkie": "^2.0.0"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
63
|
-
}
|
|
62
|
+
"gitHead": "b2e287ebcfeaa841e1f4e10bd9891e58f3223e95"
|
|
63
|
+
}
|