@zgfe/business-lib 1.1.34-alpha.2 → 1.1.34-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.
@@ -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() {
@@ -58,7 +58,7 @@ var BusinessCondition = function BusinessCondition(props) {
58
58
  key: 'service attribute'
59
59
  }]);
60
60
  }
61
- var _useState = useState(),
61
+ var _useState = useState(condition.typeId ? '业务属性' : '订单属性'),
62
62
  _useState2 = _slicedToArray(_useState, 2),
63
63
  dataAttributeLabel = _useState2[0],
64
64
  setDataAttributeLabel = _useState2[1];
@@ -228,8 +228,8 @@ var BusinessCondition = function BusinessCondition(props) {
228
228
  attrId: 0,
229
229
  attrName: '',
230
230
  operator: '',
231
- params: [''],
232
- computeType: 'origin',
231
+ params: [],
232
+ computeType: '',
233
233
  attrType: '',
234
234
  category: ''
235
235
  };
@@ -258,7 +258,7 @@ var BusinessCondition = function BusinessCondition(props) {
258
258
  onChange(_objectSpread({}, condition));
259
259
  }
260
260
  function onServiceAttributeChange(operate) {
261
- condition.typeId = operate === null || operate === void 0 ? void 0 : operate.bizDataTypeId;
261
+ condition.typeId = operate === null || operate === void 0 ? void 0 : operate.value;
262
262
  onChange(_objectSpread({}, condition));
263
263
  setServiceAttribute(operate);
264
264
  }
@@ -271,6 +271,10 @@ var BusinessCondition = function BusinessCondition(props) {
271
271
  options: serviceAttributeList,
272
272
  labelField: "name",
273
273
  keyField: "value",
274
+ value: {
275
+ name: condition.typeId,
276
+ value: condition.typeId
277
+ },
274
278
  overlayWidth: 120,
275
279
  onChange: onServiceAttributeChange
276
280
  })) : null, label === '订单数据' ? /*#__PURE__*/React.createElement("div", {
@@ -394,7 +398,7 @@ var BusinessCondition = function BusinessCondition(props) {
394
398
  }, /*#__PURE__*/React.createElement(IconFont, {
395
399
  type: "qingchu"
396
400
  }))));
397
- }), condition.timeDimensions.length !== 3 || condition.attrs.length !== 6 ? /*#__PURE__*/React.createElement("div", {
401
+ }), condition.typeId && label === '业务数据' || label === '订单数据' ? /*#__PURE__*/React.createElement("div", null, condition.timeDimensions.length !== 3 || condition.attrs.length !== 6 ? /*#__PURE__*/React.createElement("div", {
398
402
  style: {
399
403
  margin: '2px 0 0 65px',
400
404
  color: '#4075fd',
@@ -409,7 +413,7 @@ var BusinessCondition = function BusinessCondition(props) {
409
413
  onClick: function onClick(e) {
410
414
  return e.preventDefault();
411
415
  }
412
- }, /*#__PURE__*/React.createElement(Space, null, "\u9AD8\u7EA7\u7B5B\u9009", /*#__PURE__*/React.createElement(DownOutlined, null))))) : null);
416
+ }, /*#__PURE__*/React.createElement(Space, null, "\u9AD8\u7EA7\u7B5B\u9009", /*#__PURE__*/React.createElement(DownOutlined, null))))) : null) : null);
413
417
  };
414
418
  BusinessCondition.defaultProps = {
415
419
  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'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.34-alpha.2",
3
+ "version": "1.1.34-alpha.4",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",