@zgfe/business-lib 1.1.34-alpha.3 → 1.1.34-alpha.5

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.
@@ -10,6 +10,7 @@ export interface UserInfo {
10
10
  username: string;
11
11
  email: string;
12
12
  companyId: number;
13
+ serviceType: number;
13
14
  companyName: string;
14
15
  }
15
16
  export interface Menu {
@@ -16,7 +16,8 @@ var ConditionTypeList = function ConditionTypeList(props) {
16
16
  cdpTip = _useContext.cdpTip;
17
17
  var _useContext2 = useContext(BizGlobalDataContext),
18
18
  menuNameMap = _useContext2.menuNameMap,
19
- system = _useContext2.system;
19
+ currentUser = _useContext2.currentUser;
20
+ console.log(666636, menuNameMap, useContext(BizGlobalDataContext));
20
21
  if (!show || textMode) return null;
21
22
  return /*#__PURE__*/React.createElement("div", {
22
23
  className: "biz-user-condition-type-list"
@@ -70,7 +71,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
70
71
  title: cdpTip
71
72
  }, /*#__PURE__*/React.createElement(IconFont, {
72
73
  type: "tishiicon"
73
- })) : null)) : null, system && system === 'CEP' ? /*#__PURE__*/React.createElement("li", {
74
+ })) : null)) : null, (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 0 || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 2 ? /*#__PURE__*/React.createElement("li", {
74
75
  className: "condition-type",
75
76
  key: "business",
76
77
  onClick: function onClick() {
@@ -78,7 +79,7 @@ var ConditionTypeList = function ConditionTypeList(props) {
78
79
  }
79
80
  }, /*#__PURE__*/React.createElement(Space, {
80
81
  key: "business"
81
- }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u4E1A\u52A1\u6570\u636E"))) : null, system && system === 'CEP' ? /*#__PURE__*/React.createElement("li", {
82
+ }, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("span", null, "\u4E1A\u52A1\u6570\u636E"))) : null, (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 0 || (currentUser === null || currentUser === void 0 ? void 0 : currentUser.serviceType) === 2 ? /*#__PURE__*/React.createElement("li", {
82
83
  className: "condition-type",
83
84
  key: "order",
84
85
  onClick: function onClick() {
@@ -26,6 +26,7 @@ import IconFont from '../../icon/iconFont';
26
26
  import BizGlobalDataContext from '../../context';
27
27
  var RangePicker = DatePicker.RangePicker;
28
28
  var BusinessCondition = function BusinessCondition(props) {
29
+ var _condition$timeDimens, _condition$timeDimens3, _condition$timeDimens4, _condition$attrs;
29
30
  var condition = props.condition,
30
31
  dataId = props.dataId,
31
32
  isEvent = props.isEvent,
@@ -41,7 +42,7 @@ var BusinessCondition = function BusinessCondition(props) {
41
42
  }
42
43
  }, []);
43
44
  var items = [];
44
- if (condition.timeDimensions.length < 3) {
45
+ if (((_condition$timeDimens = condition.timeDimensions) === null || _condition$timeDimens === void 0 ? void 0 : _condition$timeDimens.length) < 3) {
45
46
  items = items.concat([{
46
47
  label: '时间维度',
47
48
  key: 'time dimension'
@@ -58,7 +59,7 @@ var BusinessCondition = function BusinessCondition(props) {
58
59
  key: 'service attribute'
59
60
  }]);
60
61
  }
61
- var _useState = useState(),
62
+ var _useState = useState(condition.typeId ? '业务属性' : '订单属性'),
62
63
  _useState2 = _slicedToArray(_useState, 2),
63
64
  dataAttributeLabel = _useState2[0],
64
65
  setDataAttributeLabel = _useState2[1];
@@ -209,6 +210,7 @@ var BusinessCondition = function BusinessCondition(props) {
209
210
  setDataAttributeLabel((_labelProps$ = labelProps[0]) === null || _labelProps$ === void 0 ? void 0 : _labelProps$.label);
210
211
  }
211
212
  if (key === 'time dimension') {
213
+ var _condition$timeDimens2;
212
214
  var obj = {
213
215
  frequencyValues: ['1'],
214
216
  frequencyOperator: '>',
@@ -216,7 +218,7 @@ var BusinessCondition = function BusinessCondition(props) {
216
218
  timeOperator: 'all',
217
219
  timeValues: []
218
220
  };
219
- if (condition.timeDimensions.length !== 3) {
221
+ if (((_condition$timeDimens2 = condition.timeDimensions) === null || _condition$timeDimens2 === void 0 ? void 0 : _condition$timeDimens2.length) !== 3) {
220
222
  condition.timeDimensions.push(obj);
221
223
  } else {
222
224
  notification.info({
@@ -228,8 +230,8 @@ var BusinessCondition = function BusinessCondition(props) {
228
230
  attrId: 0,
229
231
  attrName: '',
230
232
  operator: '',
231
- params: [''],
232
- computeType: 'origin',
233
+ params: [],
234
+ computeType: '',
233
235
  attrType: '',
234
236
  category: ''
235
237
  };
@@ -271,6 +273,10 @@ var BusinessCondition = function BusinessCondition(props) {
271
273
  options: serviceAttributeList,
272
274
  labelField: "name",
273
275
  keyField: "value",
276
+ value: {
277
+ name: condition.typeId,
278
+ value: condition.typeId
279
+ },
274
280
  overlayWidth: 120,
275
281
  onChange: onServiceAttributeChange
276
282
  })) : null, label === '订单数据' ? /*#__PURE__*/React.createElement("div", {
@@ -341,7 +347,7 @@ var BusinessCondition = function BusinessCondition(props) {
341
347
  placeholder: condition.runTimes.operator !== 'between' ? '请输入' : '输入最大值',
342
348
  onChange: onOperateInput1Change,
343
349
  suffix: condition.runTimes.operator !== 'between' ? '次' : null
344
- })) : null), condition.timeDimensions.map(function (_item, index) {
350
+ })) : null), (_condition$timeDimens3 = condition.timeDimensions) === null || _condition$timeDimens3 === void 0 ? void 0 : _condition$timeDimens3.map(function (_item, index) {
345
351
  return /*#__PURE__*/React.createElement("div", {
346
352
  style: {
347
353
  margin: '10px 0 0 65px'
@@ -394,7 +400,7 @@ var BusinessCondition = function BusinessCondition(props) {
394
400
  }, /*#__PURE__*/React.createElement(IconFont, {
395
401
  type: "qingchu"
396
402
  }))));
397
- }), condition.timeDimensions.length !== 3 || condition.attrs.length !== 6 ? /*#__PURE__*/React.createElement("div", {
403
+ }), condition.typeId && label === '业务数据' || label === '订单数据' ? /*#__PURE__*/React.createElement("div", null, ((_condition$timeDimens4 = condition.timeDimensions) === null || _condition$timeDimens4 === void 0 ? void 0 : _condition$timeDimens4.length) !== 3 || ((_condition$attrs = condition.attrs) === null || _condition$attrs === void 0 ? void 0 : _condition$attrs.length) !== 6 ? /*#__PURE__*/React.createElement("div", {
398
404
  style: {
399
405
  margin: '2px 0 0 65px',
400
406
  color: '#4075fd',
@@ -409,7 +415,7 @@ var BusinessCondition = function BusinessCondition(props) {
409
415
  onClick: function onClick(e) {
410
416
  return e.preventDefault();
411
417
  }
412
- }, /*#__PURE__*/React.createElement(Space, null, "\u9AD8\u7EA7\u7B5B\u9009", /*#__PURE__*/React.createElement(DownOutlined, null))))) : null);
418
+ }, /*#__PURE__*/React.createElement(Space, null, "\u9AD8\u7EA7\u7B5B\u9009", /*#__PURE__*/React.createElement(DownOutlined, null))))) : null) : null);
413
419
  };
414
420
  BusinessCondition.defaultProps = {
415
421
  isEvent: false,
@@ -21,9 +21,9 @@ import BizGlobalDataContext from '../../context';
21
21
  import { DatePicker, Input } from 'antd';
22
22
  var RangePicker = DatePicker.RangePicker;
23
23
  var DataAttribute = function DataAttribute(props) {
24
+ var _condition$attrs$inde;
24
25
  var condition = props.condition,
25
26
  index = props.index,
26
- serviceAttrType = props.serviceAttrType,
27
27
  onChange = props.onChange;
28
28
  var list = [];
29
29
  var operateList = [];
@@ -38,9 +38,10 @@ var DataAttribute = function DataAttribute(props) {
38
38
  break;
39
39
  default:
40
40
  list = typeList['cont-date'];
41
+ operateList = typeList['cont-date'];
41
42
  break;
42
43
  }
43
- var _useState = useState((serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) ? list : []),
44
+ var _useState = useState((condition === null || condition === void 0 ? void 0 : condition.typeId) ? list : []),
44
45
  _useState2 = _slicedToArray(_useState, 2),
45
46
  masterList = _useState2[0],
46
47
  setMasterList = _useState2[1];
@@ -60,22 +61,26 @@ var DataAttribute = function DataAttribute(props) {
60
61
  _useState10 = _slicedToArray(_useState9, 2),
61
62
  searchValue = _useState10[0],
62
63
  setSearchValue = _useState10[1];
63
- var _useState11 = useState([]),
64
+ var obj = (_condition$attrs$inde = condition.attrs[index]) === null || _condition$attrs$inde === void 0 ? void 0 : _condition$attrs$inde.params.map(function (item) {
65
+ return {
66
+ name: item,
67
+ value: item
68
+ };
69
+ });
70
+ var _useState11 = useState(obj ? obj : []),
64
71
  _useState12 = _slicedToArray(_useState11, 2),
65
72
  current = _useState12[0],
66
73
  setCurrent = _useState12[1];
67
74
  var _useContext = useContext(BizGlobalDataContext),
68
75
  currentApp = _useContext.currentApp;
76
+ useEffect(function () {}, [searchValue]);
69
77
  useEffect(function () {
70
- if (serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) {
71
- queryBizDataAttrList(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value);
78
+ if (condition === null || condition === void 0 ? void 0 : condition.typeId) {
79
+ queryBizDataAttrList(condition === null || condition === void 0 ? void 0 : condition.typeId);
72
80
  } else {
73
81
  setBizDataAttrList(orderTypeList);
74
82
  }
75
- if (searchValue) {
76
- console.log(66666, searchValue);
77
- }
78
- }, [searchValue]);
83
+ }, [condition === null || condition === void 0 ? void 0 : condition.typeId]);
79
84
  function queryAppList(type) {
80
85
  request(type === 'master' ? '/cep-console/api/v1/cdp/orderAttribute/master' : '/cep-console/api/v1/cdp/orderAttribute/son', {
81
86
  headers: {
@@ -101,70 +106,7 @@ var DataAttribute = function DataAttribute(props) {
101
106
  setMasterList([]);
102
107
  }
103
108
  }).catch(function () {
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
- }]);
109
+ setMasterList([]);
168
110
  });
169
111
  }
170
112
  function queryValueList(keyword, operate) {
@@ -224,7 +166,7 @@ var DataAttribute = function DataAttribute(props) {
224
166
  });
225
167
  }
226
168
  var onOrderTypeListChange = function onOrderTypeListChange(operate) {
227
- if (serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) {
169
+ if (condition === null || condition === void 0 ? void 0 : condition.typeId) {
228
170
  condition.attrs[index].category = 'custom';
229
171
  condition.attrs[index].attrId = operate.id;
230
172
  condition.attrs[index].attrName = operate.name;
@@ -252,7 +194,7 @@ var DataAttribute = function DataAttribute(props) {
252
194
  onChange(_objectSpread({}, condition));
253
195
  };
254
196
  var onMasterListChange = function onMasterListChange(operate) {
255
- if (!(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value)) {
197
+ if (!(condition === null || condition === void 0 ? void 0 : condition.typeId)) {
256
198
  switch (operate.propType) {
257
199
  case 1:
258
200
  setStringOperateList(typeList['cont-string']);
@@ -274,13 +216,16 @@ var DataAttribute = function DataAttribute(props) {
274
216
  break;
275
217
  }
276
218
  condition.attrs[index].attrId = operate.id;
219
+ condition.attrs[index].computeType = 'origin';
277
220
  condition.attrs[index].attrName = operate.name;
278
221
  condition.attrs[index].attrMaping = operate.columnName;
222
+ condition.attrs[index].operator = '';
279
223
  } else {
280
224
  switch (condition.attrs[index].attrType) {
281
225
  case 'cont-string':
282
226
  case 'cont-date':
283
227
  condition.attrs[index].operator = operate.value;
228
+ condition.attrs[index].computeType = 'origin';
284
229
  condition.attrs[index].params = [];
285
230
  if (condition.attrs[index].operator === 'absolute' && condition.attrs[index].attrType === 'cont-date') {
286
231
  var _endDate = moment().format('YYYY-MM-DD');
@@ -326,7 +271,7 @@ var DataAttribute = function DataAttribute(props) {
326
271
  var params = operate.map(function (item) {
327
272
  return item.value;
328
273
  });
329
- if (!(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value)) {
274
+ if (!(condition === null || condition === void 0 ? void 0 : condition.typeId)) {
330
275
  queryValueList(searchValue, {});
331
276
  }
332
277
  setCurrent(obj);
@@ -352,6 +297,10 @@ var DataAttribute = function DataAttribute(props) {
352
297
  options: bizDataAttrList,
353
298
  labelField: "name",
354
299
  keyField: "value",
300
+ value: {
301
+ name: condition.typeId ? condition.attrs[index].attrName : condition.attrs[index].orderType,
302
+ value: condition.typeId ? condition.attrs[index].attrId : condition.attrs[index].orderType
303
+ },
355
304
  overlayWidth: 120,
356
305
  onChange: onOrderTypeListChange
357
306
  })), /*#__PURE__*/React.createElement("div", {
@@ -359,10 +308,14 @@ var DataAttribute = function DataAttribute(props) {
359
308
  }, /*#__PURE__*/React.createElement(BizSelect, {
360
309
  className: "".concat(classPrefix, "-select-condition"),
361
310
  options: masterList,
311
+ value: {
312
+ name: condition.typeId ? condition.attrs[index].attrType === 'cont-string' || condition.attrs[index].attrType === 'cont-date' ? condition.attrs[index].operator : condition.attrs[index].computeType : condition.attrs[index].attrName,
313
+ value: condition.typeId ? condition.attrs[index].attrType === 'cont-string' || condition.attrs[index].attrType === 'cont-date' ? condition.attrs[index].operator : condition.attrs[index].computeType : condition.attrs[index].attrId
314
+ },
362
315
  labelField: "name",
363
316
  keyField: "value",
364
317
  onChange: onMasterListChange
365
- })), !(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) && condition.attrs[index].attrType === 'cont-num' ? /*#__PURE__*/React.createElement("div", {
318
+ })), !(condition === null || condition === void 0 ? void 0 : condition.typeId) && condition.attrs[index].attrType === 'cont-num' ? /*#__PURE__*/React.createElement("div", {
366
319
  className: "".concat(classPrefix, "-period-condition-operator")
367
320
  }, /*#__PURE__*/React.createElement(BizSelect, {
368
321
  className: "".concat(classPrefix, "-select-condition"),
@@ -375,7 +328,7 @@ var DataAttribute = function DataAttribute(props) {
375
328
  },
376
329
  overlayWidth: 120,
377
330
  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", {
331
+ })) : null, (condition === null || condition === void 0 ? void 0 : condition.typeId) && condition.attrs[index].attrType === 'cont-num' || !(condition === null || condition === void 0 ? void 0 : condition.typeId) ? /*#__PURE__*/React.createElement("div", {
379
332
  className: "".concat(classPrefix, "-period-condition-operator")
380
333
  }, /*#__PURE__*/React.createElement(BizSelect, {
381
334
  className: "".concat(classPrefix, "-select-condition"),
@@ -388,7 +341,7 @@ var DataAttribute = function DataAttribute(props) {
388
341
  },
389
342
  overlayWidth: 120,
390
343
  onChange: onStringOperateChange
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", {
344
+ })) : null, !(condition === null || condition === void 0 ? void 0 : condition.typeId) && condition.attrs[index].attrType === 'cont-string' || condition.attrs[index].attrType === 'cont-string' && condition.attrs[index].operator !== 'is null' && condition.attrs[index].operator !== 'is not null' ? /*#__PURE__*/React.createElement("div", {
392
345
  className: "".concat(classPrefix, "-period-condition-operator"),
393
346
  style: {
394
347
  width: '250px'
@@ -17,6 +17,7 @@ import TimeDimension from './timeDimension';
17
17
  import { Tooltip } from 'antd';
18
18
  import IconFont from '../../icon/iconFont';
19
19
  var EventCondition = function EventCondition(props) {
20
+ var _condition$timeDimens2, _condition$timeDimens3;
20
21
  var _useContext = useContext(BizUserConditionContext),
21
22
  isRealTime = _useContext.isRealTime;
22
23
  var condition = props.condition,
@@ -56,6 +57,7 @@ var EventCondition = function EventCondition(props) {
56
57
  var onClick = function onClick(_ref) {
57
58
  var key = _ref.key;
58
59
  if (key === 'time dimension') {
60
+ var _condition$timeDimens;
59
61
  var obj = {
60
62
  frequencyValues: ['1'],
61
63
  frequencyOperator: '>',
@@ -63,7 +65,7 @@ var EventCondition = function EventCondition(props) {
63
65
  timeOperator: 'all',
64
66
  timeValues: []
65
67
  };
66
- if (condition.timeDimensions.length < 3) {
68
+ if (((_condition$timeDimens = condition.timeDimensions) === null || _condition$timeDimens === void 0 ? void 0 : _condition$timeDimens.length) < 3) {
67
69
  condition.timeDimensions.push(obj);
68
70
  } else {
69
71
  notification.info({
@@ -138,7 +140,7 @@ var EventCondition = function EventCondition(props) {
138
140
  onChange: onPeriodChange,
139
141
  isEvent: true,
140
142
  isRealTime: isRealTime
141
- }))))), condition.timeDimensions.map(function (_item, index) {
143
+ }))))), (_condition$timeDimens2 = condition.timeDimensions) === null || _condition$timeDimens2 === void 0 ? void 0 : _condition$timeDimens2.map(function (_item, index) {
142
144
  return /*#__PURE__*/React.createElement("div", {
143
145
  style: {
144
146
  margin: '10px 0 0 38px'
@@ -164,7 +166,7 @@ var EventCondition = function EventCondition(props) {
164
166
  }, /*#__PURE__*/React.createElement(IconFont, {
165
167
  type: "qingchu"
166
168
  }))));
167
- }), condition.timeDimensions.length < 3 ? /*#__PURE__*/React.createElement("div", {
169
+ }), ((_condition$timeDimens3 = condition.timeDimensions) === null || _condition$timeDimens3 === void 0 ? void 0 : _condition$timeDimens3.length) < 3 ? /*#__PURE__*/React.createElement("div", {
168
170
  style: {
169
171
  margin: '2px 0 0 38px',
170
172
  color: '#4075fd',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.34-alpha.3",
3
+ "version": "1.1.34-alpha.5",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",