@zgfe/business-lib 1.1.34-alpha.11 → 1.1.34-alpha.13

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
  });
@@ -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) {
@@ -365,12 +380,13 @@ var DataAttribute = function DataAttribute(props) {
365
380
  multiple: true,
366
381
  size: "middle",
367
382
  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
383
  keyField: "value",
384
+ 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
385
  value: current,
371
386
  onChange: onParamsChange,
372
387
  onSearch: setSearchValue,
373
- enableCreate: true
388
+ enableCreate: true,
389
+ enableSearch: true
374
390
  })) : null, condition.attrs[index].attrType === 'cont-num' || condition.attrs[index].attrType === 'cont-date' && condition.attrs[index].operator !== 'absolute' ? /*#__PURE__*/React.createElement("div", {
375
391
  className: "".concat(classPrefix, "-period-condition")
376
392
  }, /*#__PURE__*/React.createElement(Input, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.34-alpha.11",
3
+ "version": "1.1.34-alpha.13",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",