@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
@@ -9,13 +9,20 @@ import BizEventSelector from '../../eventSelector';
9
9
  import RunTimesCondition from './runTimesCondition';
10
10
  import PeriodCondition from './periodCondition';
11
11
  import PropCondition from './propCondition';
12
+ import { DownOutlined } from '@ant-design/icons';
12
13
  import './styles/eventCondition.less';
13
14
  import { BizUserConditionContext, classPrefix } from '..';
15
+ import { Dropdown, notification, Space } from 'antd';
16
+ import TimeDimension from './timeDimension';
14
17
  import { Tooltip } from 'antd';
15
18
  import IconFont from '../../icon/iconFont';
19
+ import BizGlobalDataContext from '../../context';
16
20
  var EventCondition = function EventCondition(props) {
21
+ var _condition$timeDimens2, _condition$timeDimens3;
17
22
  var _useContext = useContext(BizUserConditionContext),
18
23
  isRealTime = _useContext.isRealTime;
24
+ var _useContext2 = useContext(BizGlobalDataContext),
25
+ currentUser = _useContext2.currentUser;
19
26
  var condition = props.condition,
20
27
  dataId = props.dataId;
21
28
  function onChange(data) {
@@ -50,7 +57,39 @@ var EventCondition = function EventCondition(props) {
50
57
  }]
51
58
  }));
52
59
  }
53
- return /*#__PURE__*/React.createElement("div", {
60
+ var onClick = function onClick(_ref) {
61
+ var key = _ref.key;
62
+ if (key === 'time dimension') {
63
+ var _condition$timeDimens;
64
+ var obj = {
65
+ frequencyValues: ['1'],
66
+ frequencyOperator: '>',
67
+ timeDimension: 1,
68
+ timeOperator: 'all',
69
+ timeValues: []
70
+ };
71
+ if (((_condition$timeDimens = condition.timeDimensions) === null || _condition$timeDimens === void 0 ? void 0 : _condition$timeDimens.length) < 3) {
72
+ condition.timeDimensions.push(obj);
73
+ } else {
74
+ notification.info({
75
+ message: '时间维度最多增加3条'
76
+ });
77
+ }
78
+ }
79
+ onChange(_objectSpread({}, condition));
80
+ };
81
+ var items = [{
82
+ label: '时间维度',
83
+ key: 'time dimension'
84
+ }];
85
+ function onTimeDimensionChange(condition) {
86
+ onChange(_objectSpread({}, condition));
87
+ }
88
+ function onTimeDimensionsDelete(index) {
89
+ condition.timeDimensions.splice(index, 1);
90
+ onChange(_objectSpread({}, condition));
91
+ }
92
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
54
93
  className: "".concat(classPrefix, "-event-condition")
55
94
  }, /*#__PURE__*/React.createElement("div", {
56
95
  className: "".concat(classPrefix, "-event-condition-left")
@@ -104,6 +143,48 @@ var EventCondition = function EventCondition(props) {
104
143
  onChange: onPeriodChange,
105
144
  isEvent: true,
106
145
  isRealTime: isRealTime
107
- })))));
146
+ }))))), (_condition$timeDimens2 = condition.timeDimensions) === null || _condition$timeDimens2 === void 0 ? void 0 : _condition$timeDimens2.map(function (_item, index) {
147
+ return /*#__PURE__*/React.createElement("div", {
148
+ style: {
149
+ margin: '10px 0 0 38px'
150
+ },
151
+ className: "".concat(classPrefix, "-item"),
152
+ key: index
153
+ }, /*#__PURE__*/React.createElement("div", {
154
+ style: {
155
+ display: 'flex',
156
+ alignItems: 'center'
157
+ }
158
+ }, /*#__PURE__*/React.createElement("div", {
159
+ className: "".concat(classPrefix, "-period-condition-label")
160
+ }, "\u65F6\u95F4\u7EF4\u5EA6"), /*#__PURE__*/React.createElement(TimeDimension, {
161
+ onChange: onTimeDimensionChange,
162
+ condition: condition,
163
+ index: index,
164
+ dataId: dataId
165
+ }), /*#__PURE__*/React.createElement("div", {
166
+ className: "biz-user-condition-item-delete",
167
+ onClick: function onClick() {
168
+ return onTimeDimensionsDelete(index);
169
+ }
170
+ }, /*#__PURE__*/React.createElement(IconFont, {
171
+ type: "qingchu"
172
+ }))));
173
+ }), ((_condition$timeDimens3 = condition.timeDimensions) === null || _condition$timeDimens3 === void 0 ? void 0 : _condition$timeDimens3.length) < 3 && ((currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 0 || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 2) ? /*#__PURE__*/React.createElement("div", {
174
+ style: {
175
+ margin: '2px 0 0 38px',
176
+ color: '#4075fd',
177
+ fontSize: '12px'
178
+ }
179
+ }, /*#__PURE__*/React.createElement(Dropdown, {
180
+ menu: {
181
+ items: items,
182
+ onClick: onClick
183
+ }
184
+ }, /*#__PURE__*/React.createElement("a", {
185
+ onClick: function onClick(e) {
186
+ return e.preventDefault();
187
+ }
188
+ }, /*#__PURE__*/React.createElement(Space, null, "\u9AD8\u7EA7\u7B5B\u9009", /*#__PURE__*/React.createElement(DownOutlined, null))))) : null);
108
189
  };
109
190
  export default EventCondition;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { AllConditionBasePropsI, BizUserConditionT } from '../../types';
3
+ import '../styles/periodCondition.less';
4
+ export interface RunPeriodConditionPropsI extends AllConditionBasePropsI<any> {
5
+ onChange: (condition: any) => void;
6
+ isEvent?: boolean;
7
+ dataId: number;
8
+ condition: BizUserConditionT.BusinessCondition;
9
+ }
10
+ declare const RunPeriodCondition: React.FC<RunPeriodConditionPropsI>;
11
+ export default RunPeriodCondition;
@@ -0,0 +1,142 @@
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
+ import React from 'react';
8
+ import { Input, DatePicker } from 'antd';
9
+ import moment from 'moment';
10
+ import '../styles/periodCondition.less';
11
+ import { classPrefix } from '../..';
12
+ import { operatorMap } from '../constants';
13
+ import BizSelect from '../../../select';
14
+ import RunTimesCondition from './runTimesCondition';
15
+ var RangePicker = DatePicker.RangePicker;
16
+ var RunPeriodCondition = function RunPeriodCondition(props) {
17
+ var onChange = props.onChange,
18
+ condition = props.condition,
19
+ isEvent = props.isEvent;
20
+ var options = [{
21
+ text: '最近',
22
+ value: 'relative'
23
+ }, {
24
+ text: '任意时间',
25
+ value: 'unlimited_time'
26
+ }, {
27
+ text: '固定时段',
28
+ value: 'absolute'
29
+ }];
30
+ if (isEvent) {
31
+ options = options.concat([{
32
+ text: '任意时间',
33
+ value: 'unlimited_time'
34
+ }, {
35
+ text: '新增后*',
36
+ value: 'join_time'
37
+ }]);
38
+ }
39
+ function onOperatorChange(option) {
40
+ var newData = {
41
+ operator: option.value
42
+ };
43
+ if (newData.operator === 'absolute') {
44
+ var endDate = moment().format('YYYY-MM-DD');
45
+ var startDate = moment().subtract(7, 'days').format('YYYY-MM-DD');
46
+ newData.values = [startDate, endDate];
47
+ }
48
+ if (newData.operator === 'relative') {
49
+ newData.values = [30, '0'];
50
+ }
51
+ if (newData.operator === 'unlimited_time') {
52
+ newData.values = [30, '0'];
53
+ }
54
+ if (newData.operator === 'join_time') {
55
+ newData.values = [3, '0'];
56
+ }
57
+ onChange(_objectSpread(_objectSpread({}, condition), {}, {
58
+ runPeriod: newData
59
+ }));
60
+ }
61
+ function onDateChange(newData) {
62
+ if (condition.runPeriod.operator === 'absolute') {
63
+ var dateRange = newData;
64
+ var newValues = dateRange.map(function (date) {
65
+ return date.format('YYYY-MM-DD');
66
+ });
67
+ onChange(_objectSpread(_objectSpread({}, condition), {}, {
68
+ runPeriod: _objectSpread(_objectSpread({}, condition.runPeriod), {}, {
69
+ values: newValues
70
+ })
71
+ }));
72
+ } else if (condition.runPeriod.operator === 'relative' || condition.runPeriod.operator === 'join_time') {
73
+ var newValue = newData.target.value;
74
+ onChange(_objectSpread(_objectSpread({}, condition), {}, {
75
+ runPeriod: _objectSpread(_objectSpread({}, condition.runPeriod), {}, {
76
+ values: [Number(newValue), '0']
77
+ })
78
+ }));
79
+ }
80
+ }
81
+ function renderValues() {
82
+ var _condition$runPeriod = condition.runPeriod,
83
+ operator = _condition$runPeriod.operator,
84
+ values = _condition$runPeriod.values;
85
+ if (operator === 'relative' || operator === 'join_time') {
86
+ return /*#__PURE__*/React.createElement(Input, {
87
+ key: "relative-date",
88
+ className: "".concat(classPrefix, "-select-condition"),
89
+ type: "number",
90
+ placeholder: "\u8BF7\u8F93\u5165",
91
+ value: values[0],
92
+ size: "middle",
93
+ onChange: onDateChange,
94
+ style: {
95
+ width: 80
96
+ },
97
+ suffix: "\u5929"
98
+ });
99
+ }
100
+ if (operator === 'absolute') {
101
+ return /*#__PURE__*/React.createElement(RangePicker, {
102
+ size: "middle",
103
+ defaultValue: [moment(values[0]), moment(values[1])],
104
+ onChange: onDateChange,
105
+ allowClear: false
106
+ });
107
+ }
108
+ }
109
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
110
+ className: "".concat(classPrefix, "-period-condition")
111
+ }, /*#__PURE__*/React.createElement("div", {
112
+ className: "".concat(classPrefix, "-period-condition-operator")
113
+ }, /*#__PURE__*/React.createElement(BizSelect, {
114
+ dropdownExtra: isEvent ? /*#__PURE__*/React.createElement("div", {
115
+ style: {
116
+ lineHeight: '29px'
117
+ }
118
+ }, "*\u7528\u6237\u65B0\u589E\u6570\u636E\u4E3A\u6BCF\u65E5\u51CC\u6668\u751F\u6210") : null,
119
+ overlayWidth: isEvent ? 210 : 114,
120
+ options: options,
121
+ labelField: "text",
122
+ keyField: "value",
123
+ size: "middle",
124
+ value: {
125
+ value: condition.runPeriod.operator,
126
+ text: operatorMap[condition.runPeriod.operator]
127
+ },
128
+ onChange: onOperatorChange
129
+ })), /*#__PURE__*/React.createElement("div", {
130
+ className: "".concat(classPrefix, "-period-condition-values")
131
+ }, renderValues()), /*#__PURE__*/React.createElement("div", {
132
+ className: "".concat(classPrefix, "-period-condition-values")
133
+ }, /*#__PURE__*/React.createElement(RunTimesCondition, {
134
+ dataId: props.dataId,
135
+ condition: condition,
136
+ onChange: onChange
137
+ }))));
138
+ };
139
+ RunPeriodCondition.defaultProps = {
140
+ isEvent: false
141
+ };
142
+ export default RunPeriodCondition;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { AllConditionBasePropsI, BizUserConditionT } from '../../types';
3
+ import '../styles/periodCondition.less';
4
+ export interface RunTimesConditionPropsI extends AllConditionBasePropsI<any> {
5
+ onChange: (condition: any) => void;
6
+ isEvent?: boolean;
7
+ index?: number;
8
+ condition: BizUserConditionT.BusinessCondition;
9
+ }
10
+ declare const RunTimesCondition: React.FC<RunTimesConditionPropsI>;
11
+ export default RunTimesCondition;
@@ -0,0 +1,112 @@
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, { useEffect, useState } from 'react';
14
+ import { Input } from 'antd';
15
+ import '../styles/periodCondition.less';
16
+ import { classPrefix } from '../..';
17
+ import BizSelect from '../../../select';
18
+ import { typeList } from '../../../attrConditions/utils/operates';
19
+ var RunTimesCondition = function RunTimesCondition(props) {
20
+ var onChange = props.onChange,
21
+ index = props.index,
22
+ condition = props.condition;
23
+ var _useState = useState(''),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ operator = _useState2[0],
26
+ setOperator = _useState2[1];
27
+ useEffect(function () {
28
+ if (index !== undefined) {
29
+ setOperator(condition === null || condition === void 0 ? void 0 : condition.timeDimensions[index].frequencyOperator);
30
+ } else {
31
+ setOperator(condition === null || condition === void 0 ? void 0 : condition.runTimes.operator);
32
+ }
33
+ }, [index]);
34
+ var onOperateChange = function onOperateChange(operate) {
35
+ if (index !== undefined) {
36
+ condition.timeDimensions[index].frequencyOperator = operate.value;
37
+ condition.timeDimensions[index].frequencyValues = [condition.timeDimensions[index].frequencyValues[0]];
38
+ onChange(_objectSpread({}, condition));
39
+ } else {
40
+ condition.runTimes.values = [Number(condition.runTimes.values[0])];
41
+ condition.runTimes.operator = operate.value;
42
+ onChange(_objectSpread({}, condition));
43
+ }
44
+ setOperator(operate.value);
45
+ };
46
+ var onOperateInput0Change = function onOperateInput0Change(value) {
47
+ var newValue = value.target.value;
48
+ if (index !== undefined) {
49
+ condition.timeDimensions[index].frequencyValues[0] = Number(newValue);
50
+ } else {
51
+ condition.runTimes.values[0] = Number(newValue);
52
+ }
53
+ onChange(_objectSpread({}, condition));
54
+ };
55
+ var onOperateInput1Change = function onOperateInput1Change(value) {
56
+ var newValue = value.target.value;
57
+ if (index !== undefined) {
58
+ condition.timeDimensions[index].frequencyValues[1] = newValue;
59
+ } else {
60
+ condition.runTimes.values[1] = newValue;
61
+ }
62
+ onChange(_objectSpread({}, condition));
63
+ };
64
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
65
+ className: "".concat(classPrefix, "-period-condition")
66
+ }, /*#__PURE__*/React.createElement("div", {
67
+ className: "".concat(classPrefix, "-period-condition-operator")
68
+ }, /*#__PURE__*/React.createElement(BizSelect, {
69
+ className: "".concat(classPrefix, "-select-condition"),
70
+ options: typeList['cont-num'],
71
+ labelField: "name",
72
+ keyField: "value",
73
+ overlayWidth: 80,
74
+ value: {
75
+ value: operator,
76
+ name: operator
77
+ },
78
+ onChange: onOperateChange
79
+ })), /*#__PURE__*/React.createElement("div", {
80
+ className: "".concat(classPrefix, "-period-condition")
81
+ }, /*#__PURE__*/React.createElement(Input, {
82
+ key: "relative-date",
83
+ className: "".concat(classPrefix, "-select-condition"),
84
+ type: operator !== 'between' ? 'number' : '',
85
+ size: "middle",
86
+ value: index !== undefined ? condition === null || condition === void 0 ? void 0 : condition.timeDimensions[index].frequencyValues[0] : condition === null || condition === void 0 ? void 0 : condition.runTimes.values[0],
87
+ placeholder: operator !== 'between' ? '请输入' : '输入最小值',
88
+ style: {
89
+ width: 100
90
+ },
91
+ onChange: onOperateInput0Change,
92
+ suffix: operator !== 'between' ? '次' : null
93
+ })), operator === 'between' ? /*#__PURE__*/React.createElement("div", {
94
+ className: "".concat(classPrefix, "-period-condition"),
95
+ style: {
96
+ marginLeft: 10
97
+ }
98
+ }, /*#__PURE__*/React.createElement(Input, {
99
+ key: "relative-date",
100
+ className: "".concat(classPrefix, "-select-condition"),
101
+ type: operator !== 'between' ? 'number' : '',
102
+ size: "middle",
103
+ value: index !== undefined ? condition === null || condition === void 0 ? void 0 : condition.timeDimensions[index].frequencyValues[1] : condition === null || condition === void 0 ? void 0 : condition.runTimes.values[1],
104
+ style: {
105
+ width: 100
106
+ },
107
+ placeholder: operator !== 'between' ? '请输入' : '输入最大值',
108
+ onChange: onOperateInput1Change,
109
+ suffix: operator !== 'between' ? '次' : null
110
+ })) : null));
111
+ };
112
+ export default RunTimesCondition;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { BizUserConditionT } from '../types';
3
3
  import './styles/textDesc.less';
4
4
  export interface TextProps {
5
- condition: BizUserConditionT.ActiveCondition | BizUserConditionT.AddCondition | BizUserConditionT.PropCondition | BizUserConditionT.EventCondition | BizUserConditionT.TagsCondition | BizUserConditionT.CdpCondition;
5
+ condition: BizUserConditionT.ActiveCondition | BizUserConditionT.AddCondition | BizUserConditionT.PropCondition | BizUserConditionT.EventCondition | BizUserConditionT.TagsCondition | BizUserConditionT.CdpCondition | BizUserConditionT.OrderCondition | BizUserConditionT.BusinessCondition;
6
6
  showOrDesc: boolean;
7
7
  }
8
8
  declare const Text: React.FC<TextProps>;
@@ -13,6 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import _ from 'lodash';
14
14
  import React, { useContext, useMemo } from 'react';
15
15
  import { BizUserConditionContext, classPrefix } from '..';
16
+ import { monthTimeOperatorType, monthValuesType, skyTimeOperatorType, timeDimensionType, timeValuesType, typeList, weekTimeOperatorType, weekValuesType, orderTypeList, computeTypeList, stringOperate } from '../../attrConditions/utils/operates';
16
17
  import BizGlobalDataContext from '../../context';
17
18
  import { findEvent, findPropAndEnv, buildSelectLayer } from '../util';
18
19
  import { durationHandler, operatorMap } from './constants';
@@ -49,6 +50,12 @@ var Text = function Text(props) {
49
50
  if (data.eventId === undefined) {
50
51
  return renderProps(data.attrs[0], 'user');
51
52
  }
53
+ if (String(data.eventId) === '-13') {
54
+ return renderOrder(data);
55
+ }
56
+ if (String(data.eventId) === '-14') {
57
+ return renderBusiness(data);
58
+ }
52
59
  if (data.eventId) {
53
60
  return renderEvent(data);
54
61
  }
@@ -103,6 +110,7 @@ var Text = function Text(props) {
103
110
  }
104
111
  var period = renderPeriod(periodLabel, condition.runPeriod, true);
105
112
  var runtimes = renderRuntimes(condition.runTimes);
113
+ var timeDimensions = renderTimeDimensions(condition.timeDimensions);
106
114
  var attrs = renderAttrs(event, condition.attrs);
107
115
  return /*#__PURE__*/React.createElement("span", {
108
116
  style: {
@@ -111,11 +119,91 @@ var Text = function Text(props) {
111
119
  }
112
120
  }, period, /*#__PURE__*/React.createElement("span", {
113
121
  className: "".concat(classPrefix, "-text-desc-value")
114
- }, event.alias || event.name), attrs, runtimes);
122
+ }, event.alias || event.name), attrs, timeDimensions, runtimes);
123
+ }
124
+ function renderOrder(condition) {
125
+ var periodLabel = {};
126
+ if (condition.runPeriod.operator === 'join_time') {
127
+ periodLabel.before = '在新增后';
128
+ periodLabel.after = '天内';
129
+ }
130
+ if (condition.runPeriod.operator === 'relative' || condition.runPeriod.operator === 'absolute') {
131
+ periodLabel.before = '在';
132
+ }
133
+ var period = renderPeriod(periodLabel, condition.runPeriod, true);
134
+ var frequencyValues = renderFrequencyValues(condition.runTimes.values, condition.runTimes.operator, '次数');
135
+ var timeDimensions = renderTimeDimensions(condition.timeDimensions);
136
+ var property = renderProperty(condition.attrs, '订单属性');
137
+ return /*#__PURE__*/React.createElement("span", {
138
+ style: {
139
+ backgroundColor: '#fffeeb',
140
+ padding: '6px 7px'
141
+ }
142
+ }, "\u8BA2\u5355\u6570\u636E ", period, timeDimensions, property, frequencyValues);
143
+ }
144
+ function renderBusiness(condition) {
145
+ var periodLabel = {};
146
+ if (condition.runPeriod.operator === 'join_time') {
147
+ periodLabel.before = '在新增后';
148
+ periodLabel.after = '天内';
149
+ }
150
+ if (condition.runPeriod.operator === 'relative' || condition.runPeriod.operator === 'absolute') {
151
+ periodLabel.before = '在';
152
+ }
153
+ var period = renderPeriod(periodLabel, condition.runPeriod, true);
154
+ var frequencyValues = renderFrequencyValues(condition.runTimes.values, condition.runTimes.operator, '次数');
155
+ var timeDimensions = renderTimeDimensions(condition.timeDimensions);
156
+ var property = renderProperty(condition.attrs, '业务属性');
157
+ return /*#__PURE__*/React.createElement("span", {
158
+ style: {
159
+ backgroundColor: '#fffeeb',
160
+ padding: '6px 7px'
161
+ }
162
+ }, condition.typeName, period, timeDimensions, property, frequencyValues);
163
+ }
164
+ function renderProperty(attrs, label) {
165
+ var attrsDom = [];
166
+ attrs === null || attrs === void 0 ? void 0 : attrs.forEach(function (item, i) {
167
+ var attrTypeList = [];
168
+ var operateList = [];
169
+ switch (item.attrType) {
170
+ case 'cont-string':
171
+ attrTypeList = typeList['cont-string'];
172
+ operateList = stringOperate;
173
+ break;
174
+ case 'cont-num':
175
+ attrTypeList = computeTypeList;
176
+ operateList = typeList['cont-num'];
177
+ break;
178
+ default:
179
+ attrTypeList = typeList['cont-date'];
180
+ operateList = typeList['cont-date'];
181
+ break;
182
+ }
183
+ var orderType = orderTypeList.filter(function (v) {
184
+ return v.value === item.orderType;
185
+ });
186
+ var attrType = attrTypeList.filter(function (v) {
187
+ return v.value === (item.attrType === 'cont-num' ? item.computeType : item.operator);
188
+ });
189
+ var operator = operateList.filter(function (v) {
190
+ return v.value === item.computeType;
191
+ });
192
+ var frequencyValues = renderFrequencyValues(item.params, item.operator, item.attrType === 'cont-date' && item.operator !== 'absolute' ? '天数' : item.operator === 'absolute' ? '日期' : '');
193
+ if (label) {
194
+ var _orderType$, _attrType$, _operator$;
195
+ var dom = /*#__PURE__*/React.createElement("span", {
196
+ key: i
197
+ }, /*#__PURE__*/React.createElement("span", null, (_orderType$ = orderType[0]) === null || _orderType$ === void 0 ? void 0 : _orderType$.name), /*#__PURE__*/React.createElement("span", null, item.attrName), /*#__PURE__*/React.createElement("span", null, (_attrType$ = attrType[0]) === null || _attrType$ === void 0 ? void 0 : _attrType$.name), /*#__PURE__*/React.createElement("span", null, (_operator$ = operator[0]) === null || _operator$ === void 0 ? void 0 : _operator$.name), /*#__PURE__*/React.createElement("span", null, frequencyValues), i !== attrs.length - 1 ? ',' : '');
198
+ attrsDom.push(dom);
199
+ }
200
+ });
201
+ if (!attrsDom.length) return null;
202
+ return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, "\uFF08"), label, ":", attrsDom, /*#__PURE__*/React.createElement("span", null, "\uFF09"));
115
203
  }
116
204
  function renderAttrs(event, attrs) {
117
205
  var attrsDom = [];
118
- attrs.forEach(function (attr, i) {
206
+ attrs === null || attrs === void 0 ? void 0 : attrs.forEach(function (attr, i) {
119
207
  var index = event.attrList.findIndex(function (item) {
120
208
  return item.id === attr.attrId;
121
209
  });
@@ -145,6 +233,76 @@ var Text = function Text(props) {
145
233
  className: "".concat(classPrefix, "-text-desc-value")
146
234
  }, runTimes.values[0]));
147
235
  }
236
+ function renderFrequencyValues(frequencyValues, frequencyOperator, frequency) {
237
+ var _frequencyOperatorLis;
238
+ var frequencyValuesDom = [];
239
+ var frequencyOperatorList = typeList['cont-num'].filter(function (v) {
240
+ return v.value === frequencyOperator;
241
+ });
242
+ frequencyValues === null || frequencyValues === void 0 ? void 0 : frequencyValues.forEach(function (item, i) {
243
+ var dom = /*#__PURE__*/React.createElement("span", {
244
+ key: i
245
+ }, /*#__PURE__*/React.createElement("span", null, item, i !== frequencyValues.length - 1 ? '到' : ''));
246
+ frequencyValuesDom.push(dom);
247
+ });
248
+ return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", {
249
+ className: "".concat(classPrefix, "-text-desc-value")
250
+ }, frequency), /*#__PURE__*/React.createElement("span", {
251
+ className: "".concat(classPrefix, "-text-desc-value")
252
+ }, (_frequencyOperatorLis = frequencyOperatorList[0]) === null || _frequencyOperatorLis === void 0 ? void 0 : _frequencyOperatorLis.name), /*#__PURE__*/React.createElement("span", {
253
+ className: "".concat(classPrefix, "-text-desc-value")
254
+ }, frequencyValuesDom));
255
+ }
256
+ function renderTimeDimensions(timeDimensions) {
257
+ var timeDimensionsDom = [];
258
+ timeDimensions === null || timeDimensions === void 0 ? void 0 : timeDimensions.forEach(function (item, i) {
259
+ var _label$, _operatorTypeList$;
260
+ var label = [];
261
+ var list = [];
262
+ var valuesList = [];
263
+ switch (item.timeDimension) {
264
+ case 1:
265
+ list = skyTimeOperatorType;
266
+ valuesList = timeValuesType;
267
+ break;
268
+ case 2:
269
+ list = weekTimeOperatorType;
270
+ valuesList = weekValuesType;
271
+ break;
272
+ default:
273
+ list = monthTimeOperatorType;
274
+ valuesList = monthValuesType;
275
+ break;
276
+ }
277
+ label = timeDimensionType.filter(function (v) {
278
+ return v.value === item.timeDimension;
279
+ });
280
+ var operatorTypeList = list.filter(function (v) {
281
+ return v.value === item.timeOperator;
282
+ });
283
+ var itemTimeValuesDom = [];
284
+ if (item.timeValues.length > 0) {
285
+ var _item$timeValues;
286
+ (_item$timeValues = item.timeValues) === null || _item$timeValues === void 0 ? void 0 : _item$timeValues.forEach(function (_v, vIndex) {
287
+ var _valuesTypeList$;
288
+ var valuesTypeList = valuesList.filter(function (v) {
289
+ return v.value === _v;
290
+ });
291
+ var dom = /*#__PURE__*/React.createElement("span", {
292
+ key: vIndex
293
+ }, /*#__PURE__*/React.createElement("span", null, (_valuesTypeList$ = valuesTypeList[0]) === null || _valuesTypeList$ === void 0 ? void 0 : _valuesTypeList$.name, vIndex !== item.timeValues.length - 1 ? '到' : ''));
294
+ itemTimeValuesDom.push(dom);
295
+ });
296
+ }
297
+ var frequencyValues = renderFrequencyValues(item.frequencyValues, item.frequencyOperator, '次数');
298
+ var dom = /*#__PURE__*/React.createElement("span", {
299
+ key: i
300
+ }, /*#__PURE__*/React.createElement("span", null, (_label$ = label[0]) === null || _label$ === void 0 ? void 0 : _label$.name, (_operatorTypeList$ = operatorTypeList[0]) === null || _operatorTypeList$ === void 0 ? void 0 : _operatorTypeList$.name, itemTimeValuesDom, frequencyValues, i !== timeDimensions.length - 1 ? ',' : ''));
301
+ timeDimensionsDom.push(dom);
302
+ });
303
+ if (!timeDimensionsDom.length) return null;
304
+ return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("span", null, "\uFF08"), "\u65F6\u95F4\u7EF4\u5EA6: ", timeDimensionsDom, /*#__PURE__*/React.createElement("span", null, "\uFF09"));
305
+ }
148
306
  function renderTags(condition) {
149
307
  var labels = condition.labels;
150
308
  return /*#__PURE__*/React.createElement("span", {
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import './styles/runTimesCondition.less';
3
+ export interface TimeDimensionPropsI {
4
+ condition: any;
5
+ index: number;
6
+ dataId: number;
7
+ onChange: (condition: any) => void;
8
+ }
9
+ declare const TimeDimension: React.FC<TimeDimensionPropsI>;
10
+ export default TimeDimension;