@zgfe/business-lib 1.1.31-alpha.1 → 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.
@@ -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 { numberOperate } from '../../attrConditions/utils/operates';
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';
@@ -55,25 +55,18 @@ var BusinessCondition = function BusinessCondition(props) {
55
55
  key: 'service attribute'
56
56
  }]);
57
57
  }
58
- var _useState = useState({
59
- name: '≥',
60
- value: 'ge'
61
- }),
58
+ var _useState = useState(),
62
59
  _useState2 = _slicedToArray(_useState, 2),
63
- operator = _useState2[0],
64
- setOperator = _useState2[1];
60
+ dataAttributeLabel = _useState2[0],
61
+ setDataAttributeLabel = _useState2[1];
65
62
  var _useState3 = useState(),
66
63
  _useState4 = _slicedToArray(_useState3, 2),
67
- dataAttributeLabel = _useState4[0],
68
- setDataAttributeLabel = _useState4[1];
69
- var _useState5 = useState(),
64
+ serviceAttribute = _useState4[0],
65
+ setServiceAttribute = _useState4[1];
66
+ var _useState5 = useState([]),
70
67
  _useState6 = _slicedToArray(_useState5, 2),
71
- serviceAttribute = _useState6[0],
72
- setServiceAttribute = _useState6[1];
73
- var _useState7 = useState([]),
74
- _useState8 = _slicedToArray(_useState7, 2),
75
- serviceAttributeList = _useState8[0],
76
- setServiceAttributeList = _useState8[1];
68
+ serviceAttributeList = _useState6[0],
69
+ setServiceAttributeList = _useState6[1];
77
70
  var options = [{
78
71
  text: '最近',
79
72
  value: 'relative'
@@ -186,20 +179,22 @@ var BusinessCondition = function BusinessCondition(props) {
186
179
  }
187
180
  }
188
181
  var onOperateChange = function onOperateChange(operate) {
189
- setOperator(operate);
182
+ condition.runTimes.values = [condition.runTimes.values[0]];
190
183
  onChange(_objectSpread(_objectSpread({}, condition), {}, {
191
184
  runTimes: _objectSpread(_objectSpread({}, condition.runTimes), {}, {
192
- operator: operate
185
+ operator: operate.value
193
186
  })
194
187
  }));
195
188
  };
196
- var onOperateInputChange = function onOperateInputChange(value) {
189
+ var onOperateInput0Change = function onOperateInput0Change(value) {
197
190
  var newValue = value.target.value;
198
- onChange(_objectSpread(_objectSpread({}, condition), {}, {
199
- runTimes: _objectSpread(_objectSpread({}, condition.runTimes), {}, {
200
- values: [newValue]
201
- })
202
- }));
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));
203
198
  };
204
199
  var onClick = function onClick(_ref) {
205
200
  var key = _ref.key;
@@ -301,27 +296,47 @@ var BusinessCondition = function BusinessCondition(props) {
301
296
  className: "".concat(classPrefix, "-period-condition-operator")
302
297
  }, /*#__PURE__*/React.createElement(BizSelect, {
303
298
  className: "".concat(classPrefix, "-select-condition"),
304
- options: numberOperate,
299
+ options: typeList['cont-num'],
305
300
  labelField: "name",
306
301
  keyField: "value",
307
302
  overlayWidth: 80,
308
- value: operator,
303
+ value: {
304
+ value: condition.runTimes.operator,
305
+ name: condition.runTimes.operator
306
+ },
309
307
  onChange: onOperateChange
310
308
  })), /*#__PURE__*/React.createElement("div", {
311
309
  className: "".concat(classPrefix, "-period-condition")
312
310
  }, /*#__PURE__*/React.createElement(Input, {
313
311
  key: "relative-date",
314
312
  className: "".concat(classPrefix, "-select-condition"),
315
- type: "number",
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' : '',
316
331
  size: "middle",
317
- placeholder: "\u8BF7\u8F93\u5165",
318
- value: condition.runTimes.values,
332
+ value: condition.runTimes.values[1],
319
333
  style: {
320
- width: 80
334
+ width: 100
321
335
  },
322
- onChange: onOperateInputChange,
323
- suffix: "\u6B21"
324
- }))), condition.timeDimensions.map(function (_item, index) {
336
+ placeholder: condition.runTimes.operator !== 'between' ? '请输入' : '输入最大值',
337
+ onChange: onOperateInput1Change,
338
+ suffix: condition.runTimes.operator !== 'between' ? '次' : null
339
+ })) : null), condition.timeDimensions.map(function (_item, index) {
325
340
  return /*#__PURE__*/React.createElement("div", {
326
341
  style: {
327
342
  margin: '10px 0 0 65px'
@@ -22,6 +22,7 @@ export declare const operatorMap: {
22
22
  gt: string;
23
23
  ge: string;
24
24
  le: string;
25
+ between: string;
25
26
  };
26
27
  export declare const durationHandler: {
27
28
  [key: string]: any;
@@ -21,7 +21,8 @@ export var operatorMap = {
21
21
  lt: '<',
22
22
  gt: '>',
23
23
  ge: '≥',
24
- le: '≤'
24
+ le: '≤',
25
+ between: '区间'
25
26
  };
26
27
  export var durationHandler = {
27
28
  1: {
@@ -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 _useState = useState([]),
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];
@@ -61,20 +76,20 @@ var DataAttribute = function DataAttribute(props) {
61
76
  },
62
77
  method: 'post',
63
78
  data: {
64
- appId: 1,
79
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
65
80
  pageNum: 1,
66
81
  pageSize: 9999
67
82
  }
68
83
  }).then(function (res) {
69
84
  if (res.data) {
70
- var list = res.data.map(function (item) {
85
+ var _list = res.data.map(function (item) {
71
86
  return {
72
87
  name: item.name,
73
88
  value: item.id,
74
89
  columnName: item.columnName
75
90
  };
76
91
  });
77
- setMasterList(list);
92
+ setMasterList(_list);
78
93
  } else {
79
94
  setMasterList([]);
80
95
  }
@@ -100,13 +115,13 @@ var DataAttribute = function DataAttribute(props) {
100
115
  }
101
116
  }).then(function (res) {
102
117
  if (res.data) {
103
- var list = res.data.map(function (item) {
118
+ var _list2 = res.data.map(function (item) {
104
119
  return {
105
120
  name: operate.bizDataTypeId ? item : item.name,
106
121
  value: operate.bizDataTypeId ? item : item.id
107
122
  };
108
123
  });
109
- setParamsList(list);
124
+ setParamsList(_list2);
110
125
  } else {
111
126
  setParamsList([]);
112
127
  }
@@ -125,12 +140,12 @@ var DataAttribute = function DataAttribute(props) {
125
140
  }
126
141
  }).then(function (res) {
127
142
  if (res.data) {
128
- var list = res.data.map(function (item) {
143
+ var _list3 = res.data.map(function (item) {
129
144
  return _objectSpread(_objectSpread({}, item), {}, {
130
145
  value: item.id
131
146
  });
132
147
  });
133
- setBizDataAttrList(list);
148
+ setBizDataAttrList(_list3);
134
149
  } else {
135
150
  setBizDataAttrList([]);
136
151
  }
@@ -168,9 +183,7 @@ var DataAttribute = function DataAttribute(props) {
168
183
  };
169
184
  var onMasterListChange = function onMasterListChange(operate) {
170
185
  if (!(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value)) {
171
- condition.attrs[index].attrName = operate.name;
172
186
  condition.attrs[index].attrMaping = operate.columnName;
173
- condition.attrs[index].attrId = operate.value;
174
187
  condition.attrs[index].attrType = 'cont-string';
175
188
  setStringOperateList(stringOperate);
176
189
  } else {
@@ -252,6 +265,10 @@ var DataAttribute = function DataAttribute(props) {
252
265
  options: stringOperateList,
253
266
  labelField: "name",
254
267
  keyField: "value",
268
+ value: {
269
+ name: condition.attrs[index].operator,
270
+ value: condition.attrs[index].operator
271
+ },
255
272
  overlayWidth: 120,
256
273
  onChange: onStringOperateChange
257
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", {
@@ -277,6 +294,7 @@ var DataAttribute = function DataAttribute(props) {
277
294
  size: "middle",
278
295
  type: condition.attrs[index].attrType === 'cont-date' ? 'number' : '',
279
296
  placeholder: condition.attrs[index].operator === 'between' ? '输入最小值' : '请输入',
297
+ value: condition.attrs[index].params[0],
280
298
  style: {
281
299
  width: condition.attrs[index].operator === 'between' || condition.attrs[index].attrType === 'cont-date' && condition.attrs[index].operator ? 100 : 200
282
300
  },
@@ -293,6 +311,7 @@ var DataAttribute = function DataAttribute(props) {
293
311
  size: "middle",
294
312
  type: condition.attrs[index].attrType === 'cont-date' ? 'number' : '',
295
313
  placeholder: '输入最大值',
314
+ value: condition.attrs[index].params[1],
296
315
  style: {
297
316
  width: 100
298
317
  },
@@ -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, Tooltip, Space } from 'antd';
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 _useState3 = useState(skyTimeOperatorType),
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(timeValuesType),
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 onValueChange(e) {
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: timeDimensionTypeList,
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: timeOperatorTypeList[0],
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, "-runtimes-condition-operator")
155
+ className: "".concat(classPrefix, "-period-condition-operator")
141
156
  }, /*#__PURE__*/React.createElement(BizSelect, {
142
- options: options,
143
- labelField: "text",
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
- text: condition.timeDimensions[index].frequencyOperator === 'not equal' ? '≠' : condition.timeDimensions[index].frequencyOperator
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, "-runtimes-condition-value")
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: "number",
172
+ type: condition.timeDimensions[index].frequencyOperator !== 'between' ? 'number' : '',
157
173
  size: "middle",
158
- placeholder: "\u8BF7\u8F93\u5165",
159
- value: condition.timeDimensions[index].frequencyValues,
174
+ value: condition.timeDimensions[index].frequencyValues[0],
175
+ placeholder: condition.timeDimensions[index].frequencyOperator !== 'between' ? '请输入' : '输入最小值',
160
176
  style: {
161
- width: 80
177
+ width: 100
162
178
  },
163
- onChange: onValueChange,
164
- suffix: "\u6B21"
165
- })), /*#__PURE__*/React.createElement("div", {
166
- className: "".concat(classPrefix, "-runtimes-condition-unit")
167
- }, /*#__PURE__*/React.createElement(Space, null, "\u6B21", /*#__PURE__*/React.createElement(Tooltip, {
168
- title: "\u89E6\u53D1\u6B21\u6570\u4E3A0\u7B49\u540C\u4E8E\u6CA1\u6709\u89E6\u53D1"
169
- }, /*#__PURE__*/React.createElement("span", {
170
- className: "".concat(classPrefix, "-runtimes-tip")
171
- }, /*#__PURE__*/React.createElement(InfoCircleOutlined, null)))))));
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.1",
3
+ "version": "1.1.31-alpha.2",
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": "052bb4383bf8d91fc74db8c6285d8d220306e776"
63
- }
62
+ "gitHead": "b2e287ebcfeaa841e1f4e10bd9891e58f3223e95"
63
+ }