@zgfe/business-lib 1.1.34-alpha.10 → 1.1.34-alpha.12

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,7 +128,6 @@ var StringList = function StringList(props) {
128
128
  };
129
129
  }();
130
130
  var onChange = function onChange(data) {
131
- console.log(8888, data);
132
131
  var resData = data.map(function (item) {
133
132
  return item.value;
134
133
  });
@@ -109,7 +109,23 @@ var BusinessCondition = function BusinessCondition(props) {
109
109
  setServiceAttributeList([]);
110
110
  }
111
111
  }).catch(function () {
112
- setServiceAttributeList([]);
112
+ setServiceAttributeList([{
113
+ value: 25,
114
+ uniqueKey: null,
115
+ name: '444'
116
+ }, {
117
+ value: 28,
118
+ uniqueKey: null,
119
+ name: 'sql导入'
120
+ }, {
121
+ value: 27,
122
+ uniqueKey: null,
123
+ name: 'test0322'
124
+ }, {
125
+ value: 26,
126
+ uniqueKey: null,
127
+ name: '业务数据测试1'
128
+ }]);
113
129
  });
114
130
  }
115
131
  function onOperatorChange(option) {
@@ -235,8 +251,14 @@ var BusinessCondition = function BusinessCondition(props) {
235
251
  attrType: '',
236
252
  category: ''
237
253
  };
254
+ var params = {
255
+ masterList: [],
256
+ bizDataAttrList: [],
257
+ paramsList: []
258
+ };
238
259
  if (condition.attrs.length < 6) {
239
260
  condition.attrs.push(_obj);
261
+ condition.paramsList.push(params);
240
262
  } else {
241
263
  notification.info({
242
264
  message: '事件属性最多增加6条'
@@ -57,23 +57,29 @@ var DataAttribute = function DataAttribute(props) {
57
57
  _useState8 = _slicedToArray(_useState7, 2),
58
58
  bizDataAttrList = _useState8[0],
59
59
  setBizDataAttrList = _useState8[1];
60
- var _useState9 = useState(''),
60
+ var _useState9 = useState(0),
61
61
  _useState10 = _slicedToArray(_useState9, 2),
62
- searchValue = _useState10[0],
63
- setSearchValue = _useState10[1];
62
+ timer = _useState10[0],
63
+ setTimer = _useState10[1];
64
+ var _useState11 = useState(''),
65
+ _useState12 = _slicedToArray(_useState11, 2),
66
+ searchValue = _useState12[0],
67
+ setSearchValue = _useState12[1];
64
68
  var obj = (_condition$attrs$inde = condition.attrs[index]) === null || _condition$attrs$inde === void 0 ? void 0 : _condition$attrs$inde.params.map(function (item) {
65
69
  return {
66
70
  name: item,
67
71
  value: item
68
72
  };
69
73
  });
70
- var _useState11 = useState(obj ? obj : []),
71
- _useState12 = _slicedToArray(_useState11, 2),
72
- current = _useState12[0],
73
- setCurrent = _useState12[1];
74
+ var _useState13 = useState(obj ? obj : []),
75
+ _useState14 = _slicedToArray(_useState13, 2),
76
+ current = _useState14[0],
77
+ setCurrent = _useState14[1];
74
78
  var _useContext = useContext(BizGlobalDataContext),
75
79
  currentApp = _useContext.currentApp;
76
- useEffect(function () {}, [searchValue]);
80
+ useEffect(function () {
81
+ queryValueList(searchValue, {});
82
+ }, [searchValue]);
77
83
  useEffect(function () {
78
84
  if (condition === null || condition === void 0 ? void 0 : condition.typeId) {
79
85
  queryBizDataAttrList(condition === null || condition === void 0 ? void 0 : condition.typeId);
@@ -114,39 +120,48 @@ var DataAttribute = function DataAttribute(props) {
114
120
  onChange(_objectSpread({}, condition));
115
121
  }
116
122
  function queryValueList(keyword, operate) {
117
- request('/cep-console/api/v1/es/data/attr/value', {
118
- headers: {
119
- 'Content-Type': 'application/json'
120
- },
121
- method: 'post',
122
- data: {
123
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
124
- attrId: condition.attrs[index].attrId,
125
- dataTypeId: operate.bizDataTypeId ? operate.bizDataTypeId : condition.attrs[index].orderType === 'master' ? 1 : 2,
126
- keyword: keyword,
127
- pageNum: 1,
128
- pageSize: 20,
129
- attrName: operate.name,
130
- eventId: 0
131
- }
132
- }).then(function (res) {
133
- if (res.data) {
134
- var _list2 = res.data.map(function (item) {
135
- return {
136
- name: operate.bizDataTypeId ? item : item.name,
137
- value: operate.bizDataTypeId ? item : item.id
123
+ var fetch = function fetch() {
124
+ request('/cep-console/api/v1/es/data/attr/value', {
125
+ headers: {
126
+ 'Content-Type': 'application/json'
127
+ },
128
+ method: 'post',
129
+ data: {
130
+ appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
131
+ attrId: condition.attrs[index].attrId,
132
+ dataTypeId: operate.bizDataTypeId ? operate.bizDataTypeId : condition.attrs[index].orderType === 'master' ? 1 : 2,
133
+ keyword: keyword,
134
+ pageNum: 1,
135
+ pageSize: 20,
136
+ attrName: operate.name,
137
+ eventId: 0
138
+ }
139
+ }).then(function (res) {
140
+ if (res.data) {
141
+ var isString = function isString(val) {
142
+ return typeof val === 'string';
138
143
  };
139
- });
140
- condition.paramsList[index].paramsList = _list2;
141
- setParamsList(_list2);
142
- } else {
144
+ var _list2 = res.data.map(function (item) {
145
+ return {
146
+ name: !isString(item) ? JSON.stringify(item) : item,
147
+ value: !isString(item) ? JSON.stringify(item) : item
148
+ };
149
+ });
150
+ condition.paramsList[index].paramsList = _list2;
151
+ setParamsList(_list2);
152
+ } else {
153
+ setParamsList([]);
154
+ condition.paramsList[index].paramsList = [];
155
+ }
156
+ }).catch(function () {
143
157
  setParamsList([]);
144
158
  condition.paramsList[index].paramsList = [];
145
- }
146
- }).catch(function () {
147
- setParamsList([]);
148
- condition.paramsList[index].paramsList = [];
149
- });
159
+ });
160
+ };
161
+ if (timer) clearTimeout(timer);
162
+ setTimer(setTimeout(function () {
163
+ fetch();
164
+ }, 400));
150
165
  onChange(_objectSpread({}, condition));
151
166
  }
152
167
  function queryBizDataAttrList(bizDataTypeId) {
@@ -173,7 +188,43 @@ var DataAttribute = function DataAttribute(props) {
173
188
  }
174
189
  }).catch(function () {
175
190
  condition.paramsList[index].bizDataAttrList = [];
176
- setBizDataAttrList([]);
191
+ setBizDataAttrList([{
192
+ id: 98,
193
+ value: 98,
194
+ bizDataTypeId: 28,
195
+ name: 'ID',
196
+ propType: 2,
197
+ isRequired: 1,
198
+ isShow: 1,
199
+ isCreateTimeData: '',
200
+ isUniqueData: 'Y',
201
+ isUniqueUser: '',
202
+ attrOrder: 1
203
+ }, {
204
+ id: 100,
205
+ value: 100,
206
+ bizDataTypeId: 28,
207
+ name: '姓名',
208
+ propType: 1,
209
+ isRequired: 1,
210
+ isShow: 1,
211
+ isCreateTimeData: '',
212
+ isUniqueData: '',
213
+ isUniqueUser: '',
214
+ attrOrder: 3
215
+ }, {
216
+ id: 101,
217
+ value: 101,
218
+ bizDataTypeId: 28,
219
+ name: '创建时间',
220
+ propType: 3,
221
+ isRequired: 1,
222
+ isShow: 1,
223
+ isCreateTimeData: 'Y',
224
+ isUniqueData: '',
225
+ isUniqueUser: '',
226
+ attrOrder: 4
227
+ }]);
177
228
  });
178
229
  onChange(_objectSpread({}, condition));
179
230
  }
@@ -308,7 +359,7 @@ var DataAttribute = function DataAttribute(props) {
308
359
  className: "".concat(classPrefix, "-period-condition-operator")
309
360
  }, /*#__PURE__*/React.createElement(BizSelect, {
310
361
  className: "".concat(classPrefix, "-select-condition"),
311
- options: (bizDataAttrList.length > 0 ? bizDataAttrList : condition === null || condition === void 0 ? void 0 : (_condition$paramsList = condition.paramsList[index]) === null || _condition$paramsList === void 0 ? void 0 : _condition$paramsList.bizDataAttrList) || [],
362
+ options: bizDataAttrList.length > 0 ? bizDataAttrList : condition === null || condition === void 0 ? void 0 : (_condition$paramsList = condition.paramsList[index]) === null || _condition$paramsList === void 0 ? void 0 : _condition$paramsList.bizDataAttrList,
312
363
  labelField: "name",
313
364
  keyField: "value",
314
365
  value: {
@@ -321,7 +372,7 @@ var DataAttribute = function DataAttribute(props) {
321
372
  className: "".concat(classPrefix, "-period-condition-operator")
322
373
  }, /*#__PURE__*/React.createElement(BizSelect, {
323
374
  className: "".concat(classPrefix, "-select-condition"),
324
- options: (masterList.length > 0 ? masterList : condition === null || condition === void 0 ? void 0 : (_condition$paramsList2 = condition.paramsList[index]) === null || _condition$paramsList2 === void 0 ? void 0 : _condition$paramsList2.masterList) || [],
375
+ options: masterList.length > 0 ? masterList : condition === null || condition === void 0 ? void 0 : (_condition$paramsList2 = condition.paramsList[index]) === null || _condition$paramsList2 === void 0 ? void 0 : _condition$paramsList2.masterList,
325
376
  value: {
326
377
  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,
327
378
  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
@@ -365,12 +416,13 @@ var DataAttribute = function DataAttribute(props) {
365
416
  multiple: true,
366
417
  size: "middle",
367
418
  labelField: "name",
368
- options: (paramsList.length > 0 ? paramsList : condition === null || condition === void 0 ? void 0 : (_condition$paramsList3 = condition.paramsList[index]) === null || _condition$paramsList3 === void 0 ? void 0 : _condition$paramsList3.paramsList) || [],
369
419
  keyField: "value",
420
+ options: paramsList.length > 0 ? paramsList : condition === null || condition === void 0 ? void 0 : (_condition$paramsList3 = condition.paramsList[index]) === null || _condition$paramsList3 === void 0 ? void 0 : _condition$paramsList3.paramsList,
370
421
  value: current,
371
422
  onChange: onParamsChange,
372
423
  onSearch: setSearchValue,
373
- enableCreate: true
424
+ enableCreate: true,
425
+ enableSearch: true
374
426
  })) : null, condition.attrs[index].attrType === 'cont-num' || condition.attrs[index].attrType === 'cont-date' && condition.attrs[index].operator !== 'absolute' ? /*#__PURE__*/React.createElement("div", {
375
427
  className: "".concat(classPrefix, "-period-condition")
376
428
  }, /*#__PURE__*/React.createElement(Input, {
@@ -77,11 +77,7 @@ export function buildCondition(type) {
77
77
  values: [1]
78
78
  },
79
79
  attrs: [],
80
- paramsList: [{
81
- masterList: [],
82
- bizDataAttrList: [],
83
- paramsList: []
84
- }],
80
+ paramsList: [],
85
81
  timeDimensions: [],
86
82
  runPeriod: {
87
83
  operator: 'relative',
@@ -96,11 +92,7 @@ export function buildCondition(type) {
96
92
  values: [1]
97
93
  },
98
94
  attrs: [],
99
- paramsList: [{
100
- masterList: [],
101
- bizDataAttrList: [],
102
- paramsList: []
103
- }],
95
+ paramsList: [],
104
96
  timeDimensions: [],
105
97
  runPeriod: {
106
98
  operator: 'relative',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.34-alpha.10",
3
+ "version": "1.1.34-alpha.12",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",