@zgfe/business-lib 1.1.31-alpha.2 → 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.
@@ -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', {
@@ -76,25 +83,88 @@ var DataAttribute = function DataAttribute(props) {
76
83
  },
77
84
  method: 'post',
78
85
  data: {
79
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
86
+ appId: 99677,
80
87
  pageNum: 1,
81
88
  pageSize: 9999
82
89
  }
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) {
@@ -183,9 +253,29 @@ var DataAttribute = function DataAttribute(props) {
183
253
  };
184
254
  var onMasterListChange = function onMasterListChange(operate) {
185
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;
277
+ condition.attrs[index].attrName = operate.name;
186
278
  condition.attrs[index].attrMaping = operate.columnName;
187
- condition.attrs[index].attrType = 'cont-string';
188
- setStringOperateList(stringOperate);
189
279
  } else {
190
280
  switch (condition.attrs[index].attrType) {
191
281
  case 'cont-string':
@@ -193,9 +283,9 @@ var DataAttribute = function DataAttribute(props) {
193
283
  condition.attrs[index].operator = operate.value;
194
284
  condition.attrs[index].params = [];
195
285
  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];
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];
199
289
  }
200
290
  break;
201
291
  default:
@@ -206,9 +296,16 @@ var DataAttribute = function DataAttribute(props) {
206
296
  onChange(_objectSpread({}, condition));
207
297
  };
208
298
  var onStringOperateChange = function onStringOperateChange(operate) {
299
+ if (condition.attrs[index].operator !== 'absolute') {
300
+ condition.attrs[index].params = [];
301
+ }
209
302
  condition.attrs[index].operator = operate.value;
210
303
  onChange(_objectSpread({}, condition));
211
304
  };
305
+ var onComputeTypeOperateChange = function onComputeTypeOperateChange(operate) {
306
+ condition.attrs[index].computeType = operate.value;
307
+ onChange(_objectSpread({}, condition));
308
+ };
212
309
  var onValue0Change = function onValue0Change(e) {
213
310
  var value = e.target.value;
214
311
  condition.attrs[index].params[0] = value;
@@ -221,12 +318,19 @@ var DataAttribute = function DataAttribute(props) {
221
318
  };
222
319
  var onParamsChange = function onParamsChange(operate) {
223
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) {
224
327
  return item.value;
225
328
  });
226
329
  if (!(serviceAttrType === null || serviceAttrType === void 0 ? void 0 : serviceAttrType.value)) {
227
330
  queryValueList(searchValue, {});
228
331
  }
229
- condition.attrs[index].params = obj;
332
+ setCurrent(obj);
333
+ condition.attrs[index].params = params;
230
334
  onChange(_objectSpread({}, condition));
231
335
  };
232
336
  function onDateChange(newData) {
@@ -258,7 +362,20 @@ var DataAttribute = function DataAttribute(props) {
258
362
  labelField: "name",
259
363
  keyField: "value",
260
364
  onChange: onMasterListChange
261
- })), condition.attrs[index].attrType !== 'cont-string' && condition.attrs[index].attrType !== 'cont-date' ? /*#__PURE__*/React.createElement("div", {
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", {
262
379
  className: "".concat(classPrefix, "-period-condition-operator")
263
380
  }, /*#__PURE__*/React.createElement(BizSelect, {
264
381
  className: "".concat(classPrefix, "-select-condition"),
@@ -271,7 +388,7 @@ var DataAttribute = function DataAttribute(props) {
271
388
  },
272
389
  overlayWidth: 120,
273
390
  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", {
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", {
275
392
  className: "".concat(classPrefix, "-period-condition-operator"),
276
393
  style: {
277
394
  width: '250px'
@@ -279,13 +396,14 @@ var DataAttribute = function DataAttribute(props) {
279
396
  }, /*#__PURE__*/React.createElement(BizSelect, {
280
397
  className: "".concat(classPrefix, "-multi-select"),
281
398
  multiple: true,
282
- enableCreate: false,
283
399
  size: "middle",
284
400
  labelField: "name",
285
401
  keyField: "value",
402
+ value: current,
286
403
  options: paramsList,
287
404
  onChange: onParamsChange,
288
- onSearch: setSearchValue
405
+ onSearch: setSearchValue,
406
+ enableCreate: true
289
407
  })) : null, condition.attrs[index].attrType === 'cont-num' || condition.attrs[index].attrType === 'cont-date' && condition.attrs[index].operator !== 'absolute' ? /*#__PURE__*/React.createElement("div", {
290
408
  className: "".concat(classPrefix, "-period-condition")
291
409
  }, /*#__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.3",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",