@zgfe/business-lib 1.1.31-alpha.2 → 1.1.31-alpha.4

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.
@@ -128,6 +128,7 @@ var StringList = function StringList(props) {
128
128
  };
129
129
  }();
130
130
  var onChange = function onChange(data) {
131
+ console.log(8888, data);
131
132
  var resData = data.map(function (item) {
132
133
  return item.value;
133
134
  });
@@ -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';
@@ -23,12 +23,15 @@ 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
  }
@@ -87,7 +90,7 @@ var BusinessCondition = function BusinessCondition(props) {
87
90
  }]);
88
91
  }
89
92
  function queryServiceAttributeList() {
90
- request('/cep-console/api/v1/bizdata/type/list', {
93
+ request("/cep-console/api/v1/bizdata/type/list/".concat(currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId), {
91
94
  headers: {
92
95
  'Content-Type': 'application/json'
93
96
  },
@@ -60,6 +60,10 @@ var DataAttribute = function DataAttribute(props) {
60
60
  _useState10 = _slicedToArray(_useState9, 2),
61
61
  searchValue = _useState10[0],
62
62
  setSearchValue = _useState10[1];
63
+ var _useState11 = useState([]),
64
+ _useState12 = _slicedToArray(_useState11, 2),
65
+ current = _useState12[0],
66
+ setCurrent = _useState12[1];
63
67
  var _useContext = useContext(BizGlobalDataContext),
64
68
  currentApp = _useContext.currentApp;
65
69
  useEffect(function () {
@@ -68,6 +72,9 @@ var DataAttribute = function DataAttribute(props) {
68
72
  } else {
69
73
  setBizDataAttrList(orderTypeList);
70
74
  }
75
+ if (searchValue) {
76
+ console.log(66666, searchValue);
77
+ }
71
78
  }, [searchValue]);
72
79
  function queryAppList(type) {
73
80
  request(type === 'master' ? '/cep-console/api/v1/cdp/orderAttribute/master' : '/cep-console/api/v1/cdp/orderAttribute/son', {
@@ -83,18 +90,81 @@ var DataAttribute = function DataAttribute(props) {
83
90
  }).then(function (res) {
84
91
  if (res.data) {
85
92
  var _list = res.data.map(function (item) {
86
- return {
93
+ return _objectSpread(_objectSpread({}, item), {}, {
87
94
  name: item.name,
88
95
  value: item.id,
89
96
  columnName: item.columnName
90
- };
97
+ });
91
98
  });
92
99
  setMasterList(_list);
93
100
  } else {
94
101
  setMasterList([]);
95
102
  }
96
103
  }).catch(function () {
97
- 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
+ }]);
98
168
  });
99
169
  }
100
170
  function queryValueList(keyword, operate) {
@@ -158,6 +228,7 @@ var DataAttribute = function DataAttribute(props) {
158
228
  condition.attrs[index].category = 'custom';
159
229
  condition.attrs[index].attrId = operate.id;
160
230
  condition.attrs[index].attrName = operate.name;
231
+ condition.typeId = operate === null || operate === void 0 ? void 0 : operate.bizDataTypeId;
161
232
  switch (operate.propType) {
162
233
  case 1:
163
234
  setMasterList(typeList['cont-string']);
@@ -183,9 +254,29 @@ var DataAttribute = function DataAttribute(props) {
183
254
  };
184
255
  var onMasterListChange = function onMasterListChange(operate) {
185
256
  if (!(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value)) {
257
+ switch (operate.propType) {
258
+ case 1:
259
+ setStringOperateList(typeList['cont-string']);
260
+ condition.attrs[index].attrType = 'cont-string';
261
+ queryValueList('', operate);
262
+ break;
263
+ case 2:
264
+ setStringOperateList(typeList['cont-num']);
265
+ condition.attrs[index].attrType = 'cont-num';
266
+ break;
267
+ default:
268
+ setStringOperateList(typeList['cont-date']);
269
+ condition.attrs[index].attrType = 'cont-date';
270
+ if (condition.attrs[index].attrType === 'cont-date') {
271
+ var endDate = moment().format('YYYY-MM-DD');
272
+ var startDate = moment().subtract(7, 'days').format('YYYY-MM-DD');
273
+ condition.attrs[index].params = [startDate, endDate];
274
+ }
275
+ break;
276
+ }
277
+ condition.attrs[index].attrId = operate.id;
278
+ condition.attrs[index].attrName = operate.name;
186
279
  condition.attrs[index].attrMaping = operate.columnName;
187
- condition.attrs[index].attrType = 'cont-string';
188
- setStringOperateList(stringOperate);
189
280
  } else {
190
281
  switch (condition.attrs[index].attrType) {
191
282
  case 'cont-string':
@@ -193,9 +284,9 @@ var DataAttribute = function DataAttribute(props) {
193
284
  condition.attrs[index].operator = operate.value;
194
285
  condition.attrs[index].params = [];
195
286
  if (condition.attrs[index].operator === 'absolute' && condition.attrs[index].attrType === 'cont-date') {
196
- var endDate = moment().format('YYYY-MM-DD');
197
- var startDate = moment().subtract(7, 'days').format('YYYY-MM-DD');
198
- condition.attrs[index].params = [startDate, endDate];
287
+ var _endDate = moment().format('YYYY-MM-DD');
288
+ var _startDate = moment().subtract(7, 'days').format('YYYY-MM-DD');
289
+ condition.attrs[index].params = [_startDate, _endDate];
199
290
  }
200
291
  break;
201
292
  default:
@@ -206,9 +297,16 @@ var DataAttribute = function DataAttribute(props) {
206
297
  onChange(_objectSpread({}, condition));
207
298
  };
208
299
  var onStringOperateChange = function onStringOperateChange(operate) {
300
+ if (condition.attrs[index].operator !== 'absolute') {
301
+ condition.attrs[index].params = [];
302
+ }
209
303
  condition.attrs[index].operator = operate.value;
210
304
  onChange(_objectSpread({}, condition));
211
305
  };
306
+ var onComputeTypeOperateChange = function onComputeTypeOperateChange(operate) {
307
+ condition.attrs[index].computeType = operate.value;
308
+ onChange(_objectSpread({}, condition));
309
+ };
212
310
  var onValue0Change = function onValue0Change(e) {
213
311
  var value = e.target.value;
214
312
  condition.attrs[index].params[0] = value;
@@ -221,12 +319,19 @@ var DataAttribute = function DataAttribute(props) {
221
319
  };
222
320
  var onParamsChange = function onParamsChange(operate) {
223
321
  var obj = operate.map(function (item) {
322
+ return {
323
+ name: item.name,
324
+ value: item.value
325
+ };
326
+ });
327
+ var params = operate.map(function (item) {
224
328
  return item.value;
225
329
  });
226
330
  if (!(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value)) {
227
331
  queryValueList(searchValue, {});
228
332
  }
229
- condition.attrs[index].params = obj;
333
+ setCurrent(obj);
334
+ condition.attrs[index].params = params;
230
335
  onChange(_objectSpread({}, condition));
231
336
  };
232
337
  function onDateChange(newData) {
@@ -258,7 +363,20 @@ var DataAttribute = function DataAttribute(props) {
258
363
  labelField: "name",
259
364
  keyField: "value",
260
365
  onChange: onMasterListChange
261
- })), condition.attrs[index].attrType !== 'cont-string' && condition.attrs[index].attrType !== 'cont-date' ? /*#__PURE__*/React.createElement("div", {
366
+ })), !(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value) && condition.attrs[index].attrType === 'cont-num' ? /*#__PURE__*/React.createElement("div", {
367
+ className: "".concat(classPrefix, "-period-condition-operator")
368
+ }, /*#__PURE__*/React.createElement(BizSelect, {
369
+ className: "".concat(classPrefix, "-select-condition"),
370
+ options: computeTypeList,
371
+ labelField: "name",
372
+ keyField: "value",
373
+ value: {
374
+ name: condition.attrs[index].computeType,
375
+ value: condition.attrs[index].computeType
376
+ },
377
+ overlayWidth: 120,
378
+ onChange: onComputeTypeOperateChange
379
+ })) : 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", {
262
380
  className: "".concat(classPrefix, "-period-condition-operator")
263
381
  }, /*#__PURE__*/React.createElement(BizSelect, {
264
382
  className: "".concat(classPrefix, "-select-condition"),
@@ -271,7 +389,7 @@ var DataAttribute = function DataAttribute(props) {
271
389
  },
272
390
  overlayWidth: 120,
273
391
  onChange: onStringOperateChange
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", {
392
+ })) : 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", {
275
393
  className: "".concat(classPrefix, "-period-condition-operator"),
276
394
  style: {
277
395
  width: '250px'
@@ -279,13 +397,14 @@ var DataAttribute = function DataAttribute(props) {
279
397
  }, /*#__PURE__*/React.createElement(BizSelect, {
280
398
  className: "".concat(classPrefix, "-multi-select"),
281
399
  multiple: true,
282
- enableCreate: false,
283
400
  size: "middle",
284
401
  labelField: "name",
285
402
  keyField: "value",
403
+ value: current,
286
404
  options: paramsList,
287
405
  onChange: onParamsChange,
288
- onSearch: setSearchValue
406
+ onSearch: setSearchValue,
407
+ enableCreate: true
289
408
  })) : null, condition.attrs[index].attrType === 'cont-num' || condition.attrs[index].attrType === 'cont-date' && condition.attrs[index].operator !== 'absolute' ? /*#__PURE__*/React.createElement("div", {
290
409
  className: "".concat(classPrefix, "-period-condition")
291
410
  }, /*#__PURE__*/React.createElement(Input, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.31-alpha.2",
3
+ "version": "1.1.31-alpha.4",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -60,4 +60,4 @@
60
60
  "yorkie": "^2.0.0"
61
61
  },
62
62
  "gitHead": "b2e287ebcfeaa841e1f4e10bd9891e58f3223e95"
63
- }
63
+ }