ls-pro-common 1.0.31 → 1.0.32

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.
@@ -18,7 +18,7 @@ var _excluded = ["type", "uploadable", "readonly", "allowClear", "title", "modal
18
18
  import React from "react";
19
19
  import { useMemo, useState, useEffect, useContext } from 'react';
20
20
  import { ProFormText, ProFormContext } from 'ls-pro-form';
21
- import { PlusOutlined, UploadOutlined } from '@ant-design/icons';
21
+ import { PlusOutlined, UploadOutlined, SearchOutlined } from '@ant-design/icons';
22
22
  import { httpGet, httpPost } from '../http';
23
23
  import { getCache, toGatewayUrl, showError, showWarn, showSuccess } from '../utils';
24
24
  var fileCenter = getCache('file-center-api') || '/zuul/petrel-file-center-api/';
@@ -54,6 +54,11 @@ function IconSelector(prop) {
54
54
  list = _useState10[0],
55
55
  setList = _useState10[1];
56
56
 
57
+ var _useState11 = useState(''),
58
+ _useState12 = _slicedToArray(_useState11, 2),
59
+ searchKey = _useState12[0],
60
+ setSearchKey = _useState12[1];
61
+
57
62
  var type = prop.type,
58
63
  _prop$uploadable = prop.uploadable,
59
64
  uploadable = _prop$uploadable === void 0 ? true : _prop$uploadable,
@@ -77,7 +82,7 @@ function IconSelector(prop) {
77
82
  }, [type]);
78
83
 
79
84
  var loadData = /*#__PURE__*/function () {
80
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(pageIndex) {
85
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(pageIndex, keys) {
81
86
  var url, param, result, rows;
82
87
  return _regeneratorRuntime.wrap(function _callee$(_context) {
83
88
  while (1) {
@@ -90,16 +95,21 @@ function IconSelector(prop) {
90
95
  "page.pn": pageIndex,
91
96
  "page.size": pageSize
92
97
  };
93
- _context.next = 4;
98
+
99
+ if (keys) {
100
+ param['search.mongoName_like'] = keys;
101
+ }
102
+
103
+ _context.next = 5;
94
104
  return httpGet(url, param);
95
105
 
96
- case 4:
106
+ case 5:
97
107
  result = _context.sent;
98
108
  rows = result.rows || [];
99
109
  setList(rows);
100
110
  setTotal(result.total || 0);
101
111
 
102
- case 8:
112
+ case 9:
103
113
  case "end":
104
114
  return _context.stop();
105
115
  }
@@ -107,15 +117,15 @@ function IconSelector(prop) {
107
117
  }, _callee);
108
118
  }));
109
119
 
110
- return function loadData(_x) {
120
+ return function loadData(_x, _x2) {
111
121
  return _ref.apply(this, arguments);
112
122
  };
113
123
  }();
114
124
 
115
125
  useEffect(function () {
116
126
  if (!visible) return;
117
- loadData(page);
118
- }, [visible, page]);
127
+ loadData(page, searchKey);
128
+ }, [visible, page, searchKey]);
119
129
  var totalPage = useMemo(function () {
120
130
  if (total === 0) return 1;
121
131
  return Math.ceil(total / pageSize);
@@ -155,7 +165,7 @@ function IconSelector(prop) {
155
165
  if (page !== totalPage) {
156
166
  setPage(totalPage);
157
167
  } else {
158
- loadData(totalPage);
168
+ loadData(totalPage, searchKey);
159
169
  }
160
170
  } else {
161
171
  showSuccess(result.flag.retMsg);
@@ -185,14 +195,33 @@ function IconSelector(prop) {
185
195
  }
186
196
  }) : /*#__PURE__*/React.createElement(PlusOutlined, {
187
197
  onClick: function onClick() {
188
- return setVisible(true);
198
+ var _rest$fieldProps;
199
+
200
+ if ((rest === null || rest === void 0 ? void 0 : rest.disabled) || (rest === null || rest === void 0 ? void 0 : (_rest$fieldProps = rest.fieldProps) === null || _rest$fieldProps === void 0 ? void 0 : _rest$fieldProps.disabled)) {
201
+ return;
202
+ }
203
+
204
+ setVisible(true);
189
205
  }
190
206
  })
191
207
  }, rest.fieldProps, {
192
208
  readOnly: readonly,
193
209
  allowClear: allowClear
194
210
  }))), /*#__PURE__*/React.createElement(_Modal, {
195
- title: title,
211
+ title: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, title), /*#__PURE__*/React.createElement("span", {
212
+ style: {
213
+ display: 'inline-block',
214
+ width: 230,
215
+ marginLeft: 30
216
+ }
217
+ }, /*#__PURE__*/React.createElement(_Input, {
218
+ suffix: /*#__PURE__*/React.createElement(SearchOutlined, null),
219
+ placeholder: "\u8F93\u5165\u56FE\u7247\u540D\u67E5\u8BE2",
220
+ onPressEnter: function onPressEnter(e) {
221
+ setPage(1);
222
+ setSearchKey(e.target.value || '');
223
+ }
224
+ }))),
196
225
  visible: visible,
197
226
  width: modalWidth,
198
227
  destroyOnClose: true,
@@ -236,9 +265,13 @@ function IconSelector(prop) {
236
265
  }
237
266
  }, "\u4E0B\u4E00\u9875"), /*#__PURE__*/React.createElement(_Button, {
238
267
  onClick: function onClick() {
239
- return loadData(page);
268
+ return loadData(page, searchKey);
240
269
  }
241
270
  }, "\u5237\u65B0"))
271
+ }, /*#__PURE__*/React.createElement("div", {
272
+ style: {
273
+ minHeight: '120px'
274
+ }
242
275
  }, list.map(function (o) {
243
276
  return /*#__PURE__*/React.createElement(_Card, {
244
277
  hoverable: true,
@@ -268,7 +301,8 @@ function IconSelector(prop) {
268
301
  formRef.current.setFieldsValue(val);
269
302
  setImgUrl(toGatewayUrl(o.mongoUrl));
270
303
  setVisible(false);
271
- }
304
+ },
305
+ key: o.id
272
306
  }, /*#__PURE__*/React.createElement("div", {
273
307
  style: {
274
308
  height: 80
@@ -287,7 +321,7 @@ function IconSelector(prop) {
287
321
  overflow: 'hidden'
288
322
  }
289
323
  }, o.mongoName));
290
- })));
324
+ }))));
291
325
  }
292
326
 
293
327
  export default IconSelector;
@@ -2,21 +2,43 @@
2
2
  import type { InputProps } from 'antd';
3
3
  import type { ProFormItemProps } from 'ls-pro-form';
4
4
  export declare type InputTableProps = ProFormItemProps<InputProps> & {
5
+ /**@name 弹框选择表格列配置 */
5
6
  columns: any[];
7
+ /**@name 调用后端API地址 */
6
8
  url: string;
9
+ /**@name 弹框表格高度,默认400 */
7
10
  tableHeight?: number;
11
+ /**@name 弹框表格宽度,默认650*/
8
12
  tableWidth?: number;
13
+ /**@name 是否支持多选 */
9
14
  multiple?: boolean;
15
+ /**@name 表单项name, 跟 form.item 的 name一致 */
10
16
  name: string;
17
+ /**@name 返回的值字段,表格中valueField配置的字段时返回给name */
11
18
  valueField: string;
19
+ /**@name 返回输入框显示的字段,textField字段值返回给textName */
12
20
  textField?: string;
21
+ /**@name 用于接收textField返回的值 */
13
22
  textName?: string;
23
+ /** @name 表格的其它配置 */
14
24
  tableConfig?: any;
25
+ /**@name 表单label宽度,默认70 */
15
26
  labelWidth?: number;
27
+ /**@name 是否2.0接口 */
16
28
  isV2?: boolean;
29
+ /**@name 是否支持跨页选择 */
17
30
  keepSelect?: boolean;
18
- onSelectChange?: (item: any) => void;
31
+ /**@name 回车事件查询关键字 */
32
+ searchField?: string;
33
+ /**@name 填充其它表单项目配置 */
34
+ fillMap?: Record<string, string>;
35
+ /**@name 输入后检查数据的触发方式,默认为entry回车触发 */
36
+ triggerCheck?: 'entry' | 'blur';
37
+ /**@name 选择行事件 */
38
+ onSelectChange?: (item: any, formRef?: any) => void;
39
+ /**@name 加载之前事件,param为查询条件对象,可以通过此方法调整 */
19
40
  beforeLoad?: (param: any) => void;
41
+ /**@name 加载之后事件,row为接口返回数据,可以通过此方法调整 */
20
42
  afterLoad?: (rows: any[]) => void;
21
43
  };
22
44
  declare function InputTable(prop: InputTableProps): JSX.Element;
@@ -10,14 +10,15 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
11
11
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
12
12
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
13
- var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps"],
13
+ var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "triggerCheck"],
14
14
  _excluded2 = ["current", "pageSize"];
15
15
  import React from "react";
16
- import { useRef, useState, useEffect, useContext } from 'react';
16
+ import { useRef, useState, useEffect, useContext, useMemo } from 'react';
17
17
  import ProTable from 'ls-pro-table';
18
18
  import { ProFormText, ProFormContext } from 'ls-pro-form';
19
19
  import { MoreOutlined } from '@ant-design/icons';
20
20
  import { httpGet } from '../http';
21
+ import { showWarn } from '../utils';
21
22
 
22
23
  function InputTable(prop) {
23
24
  //@ts-ignore
@@ -67,9 +68,37 @@ function InputTable(prop) {
67
68
  _prop$keepSelect = prop.keepSelect,
68
69
  keepSelect = _prop$keepSelect === void 0 ? false : _prop$keepSelect,
69
70
  fieldProps = prop.fieldProps,
70
- rest = _objectWithoutProperties(prop, _excluded);
71
+ searchField = prop.searchField,
72
+ fillMap = prop.fillMap,
73
+ _prop$triggerCheck = prop.triggerCheck,
74
+ triggerCheck = _prop$triggerCheck === void 0 ? 'entry' : _prop$triggerCheck,
75
+ rest = _objectWithoutProperties(prop, _excluded); //显示输入框绑定的name,如果不设置textName,设置为$name__text
71
76
 
72
- var textNameProp = textName || name + '__text';
77
+
78
+ var textNameProp = useMemo(function () {
79
+ return textName || name + '__text';
80
+ }, [textName, name]); // 输入框回车时,调用查询参数字段
81
+
82
+ var searchKey = useMemo(function () {
83
+ if (searchField) return searchField;
84
+ var col; //先取显示字段
85
+
86
+ if (textField) {
87
+ col = columns.find(function (o) {
88
+ return o.dataIndex === textField || o.key === textField;
89
+ });
90
+ } //取不到时取值字段
91
+
92
+
93
+ if (!col) {
94
+ col = columns.find(function (o) {
95
+ return o.dataIndex === valueField || o.key === valueField;
96
+ });
97
+ }
98
+
99
+ if (col) return col.searchField || col.dataIndex;
100
+ return textField || valueField;
101
+ }, [columns, searchField, valueField, textField]);
73
102
 
74
103
  var loadData = /*#__PURE__*/function () {
75
104
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
@@ -119,7 +148,7 @@ function InputTable(prop) {
119
148
 
120
149
  return _context.abrupt("return", {
121
150
  data: rows,
122
- total: result.total || 0,
151
+ total: Number(result.total || 0),
123
152
  success: true
124
153
  });
125
154
 
@@ -145,7 +174,112 @@ function InputTable(prop) {
145
174
  formValue[textNameProp] = formValue[name];
146
175
  formRef === null || formRef === void 0 ? void 0 : formRef.current.setFieldsValue(_objectSpread({}, formValue));
147
176
  }
148
- }, []);
177
+ }, []); // 处理返回数据
178
+
179
+ var handleValue = function handleValue(row) {
180
+ var _formRef$current2, _formRef$current3;
181
+
182
+ var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.getFieldsValue();
183
+ var txt; //支持多选
184
+
185
+ if (Array.isArray(row)) {
186
+ //返回值
187
+ formValue[name] = row.map(function (o) {
188
+ return o[valueField];
189
+ }).join(','); //显示值
190
+
191
+ txt = row.map(function (o) {
192
+ return o[textField || valueField];
193
+ }).join(','); //处理填充其它字段
194
+
195
+ if (fillMap) {
196
+ var _loop = function _loop(key) {
197
+ formValue[key] = row.map(function (o) {
198
+ return o[fillMap[key]];
199
+ }).join(',');
200
+ };
201
+
202
+ for (var key in fillMap) {
203
+ _loop(key);
204
+ }
205
+ }
206
+ } else {
207
+ formValue[name] = row[valueField] || '';
208
+ txt = row[textField || valueField] || '';
209
+
210
+ if (fillMap) {
211
+ for (var _key in fillMap) {
212
+ formValue[_key] = row[fillMap[_key]] || '';
213
+ }
214
+ }
215
+ }
216
+
217
+ formValue[textNameProp] = txt;
218
+ setText(txt);
219
+ setVisible(false);
220
+ (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : _formRef$current3.setFieldsValue(_objectSpread({}, formValue));
221
+ onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange(row, formRef);
222
+ }; // 可输入时,回车或失去焦点调接口查询数据
223
+
224
+
225
+ var onQuery = function onQuery(e) {
226
+ if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled) || readonly) return;
227
+ var val = e.target.value;
228
+
229
+ if (val) {
230
+ var param = {
231
+ current: 1,
232
+ pageSize: 10
233
+ };
234
+ param[searchKey] = val;
235
+ loadData(param).then(function (result) {
236
+ var rows = result.data || [];
237
+
238
+ if (!rows.length) {
239
+ handleValue({});
240
+ showWarn("".concat(val, "\u67E5\u627E\u4E0D\u5230\u5BF9\u5E94\u7684\u8BB0\u5F55\uFF01"));
241
+ } else if (multiple) {
242
+ handleValue(rows);
243
+ } else {
244
+ handleValue(rows[0]);
245
+ }
246
+ });
247
+ e.stopPropagation();
248
+ e.preventDefault();
249
+ }
250
+ }; //直接输入不回车,value 和 text 为同一个值
251
+
252
+
253
+ var onInput = function onInput(e) {
254
+ var _formRef$current4;
255
+
256
+ var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : _formRef$current4.getFieldsValue();
257
+ var val = e.target.value;
258
+ formValue[name] = val;
259
+ formValue[textNameProp] = val;
260
+ setText(val);
261
+ formRef.current.setFieldsValue(_objectSpread({}, formValue));
262
+ }; // 当表单重置或点clear时,处理值
263
+
264
+
265
+ var clearValue = function clearValue(e) {
266
+ if (!e.target.value) {
267
+ var _formRef$current5;
268
+
269
+ setText('');
270
+ var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 ? void 0 : _formRef$current5.getFieldsValue();
271
+ formValue[name] = '';
272
+ formValue[textNameProp] = ''; // 不处理,其它表单自己清空
273
+ // if (fillMap) {
274
+ // for (let key in fillMap) {
275
+ // formValue[key] = '';
276
+ // }
277
+ // }
278
+
279
+ formRef.current.setFieldsValue(_objectSpread({}, formValue));
280
+ }
281
+ };
282
+
149
283
  var tableDom = /*#__PURE__*/React.createElement(ProTable, _extends({
150
284
  columns: columns,
151
285
  request: loadData,
@@ -176,36 +310,14 @@ function InputTable(prop) {
176
310
  onRow: function onRow(record) {
177
311
  return {
178
312
  onDoubleClick: function onDoubleClick() {
179
- var _formRef$current2, _formRef$current3;
180
-
181
- var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.getFieldsValue();
182
- formValue[name] = record[valueField];
183
- var txt = record[textField || valueField];
184
- formValue[textNameProp] = txt;
185
- setText(txt);
186
- (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : _formRef$current3.setFieldsValue(_objectSpread({}, formValue));
187
- setVisible(false);
188
- onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange(record);
313
+ handleValue(record);
189
314
  }
190
315
  };
191
316
  },
192
317
  toolBarRender: function toolBarRender() {
193
318
  return [/*#__PURE__*/React.createElement(_Button, {
194
319
  onClick: function onClick() {
195
- var _formRef$current4, _formRef$current5;
196
-
197
- var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : _formRef$current4.getFieldsValue();
198
- formValue[name] = selectedRows.map(function (o) {
199
- return o[valueField];
200
- }).join(',');
201
- var txt = selectedRows.map(function (o) {
202
- return o[textField || valueField];
203
- }).join(',');
204
- formValue[textNameProp] = txt;
205
- setText(txt);
206
- (_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 ? void 0 : _formRef$current5.setFieldsValue(_objectSpread({}, formValue));
207
- onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange(selectedRows);
208
- setVisible(false);
320
+ handleValue(selectedRows);
209
321
  }
210
322
  }, "\u786E\u8BA4")];
211
323
  },
@@ -234,31 +346,25 @@ function InputTable(prop) {
234
346
  onVisibleChange: setVisible
235
347
  }, /*#__PURE__*/React.createElement(MoreOutlined, {
236
348
  onClick: function onClick(e) {
349
+ if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
237
350
  setVisible(true);
238
351
  e.stopPropagation && e.stopPropagation();
239
352
  }
240
353
  })),
241
354
  onClick: function onClick() {
242
- if (readonly) return;
355
+ if (!readonly) return;
243
356
  setVisible(true);
244
357
  },
245
- onInput: function onInput(e) {
246
- var _formRef$current6;
247
-
248
- var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : _formRef$current6.getFieldsValue();
249
- var val = e.target.value;
250
- formValue[name] = val;
251
- formValue[textNameProp] = val;
252
- formRef.current.setFieldsValue(_objectSpread({}, formValue));
358
+ onInput: onInput,
359
+ onChange: clearValue,
360
+ onPressEnter: function onPressEnter(e) {
361
+ if (triggerCheck === 'entry') {
362
+ onQuery(e);
363
+ }
253
364
  },
254
- onChange: function onChange(e) {
255
- if (!e.target.value) {
256
- var _formRef$current7;
257
-
258
- var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current7 = formRef.current) === null || _formRef$current7 === void 0 ? void 0 : _formRef$current7.getFieldsValue();
259
- formValue[name] = '';
260
- formValue[textNameProp] = '';
261
- formRef.current.setFieldsValue(_objectSpread({}, formValue));
365
+ onBlur: function onBlur(e) {
366
+ if (triggerCheck === 'blur') {
367
+ onQuery(e);
262
368
  }
263
369
  },
264
370
  readOnly: readonly,
@@ -278,36 +384,26 @@ function InputTable(prop) {
278
384
  onVisibleChange: setVisible
279
385
  }, /*#__PURE__*/React.createElement(MoreOutlined, {
280
386
  onClick: function onClick(e) {
387
+ if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
281
388
  setVisible(true);
282
- e.stopPropagation && e.stopPropagation();
283
389
  }
284
390
  })),
285
391
  onClick: function onClick() {
286
- if (readonly) return;
392
+ if (!readonly) return;
287
393
  setVisible(true);
288
394
  },
289
- onInput: function onInput(e) {
290
- var _formRef$current8;
291
-
292
- var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current8 = formRef.current) === null || _formRef$current8 === void 0 ? void 0 : _formRef$current8.getFieldsValue();
293
- var val = e.target.value;
294
- formValue[name] = val;
295
- formValue[textNameProp] = val;
296
- setText(val);
297
- formRef.current.setFieldsValue(_objectSpread({}, formValue));
395
+ onInput: onInput,
396
+ onPressEnter: function onPressEnter(e) {
397
+ if (triggerCheck === 'entry') {
398
+ onQuery(e);
399
+ }
298
400
  },
299
- onChange: function onChange(e) {
300
- //用于清除当前组件值
301
- if (!e.target.value) {
302
- var _formRef$current9;
303
-
304
- setText('');
305
- var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current9 = formRef.current) === null || _formRef$current9 === void 0 ? void 0 : _formRef$current9.getFieldsValue();
306
- formValue[name] = '';
307
- formValue[textNameProp] = '';
308
- formRef.current.setFieldsValue(_objectSpread({}, formValue));
401
+ onBlur: function onBlur(e) {
402
+ if (triggerCheck === 'blur') {
403
+ onQuery(e);
309
404
  }
310
405
  },
406
+ onChange: clearValue,
311
407
  readOnly: readonly,
312
408
  value: text,
313
409
  allowClear: allowClear
@@ -85,6 +85,11 @@ function IconSelector(prop) {
85
85
  list = _useState10[0],
86
86
  setList = _useState10[1];
87
87
 
88
+ var _useState11 = (0, _react.useState)(''),
89
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
90
+ searchKey = _useState12[0],
91
+ setSearchKey = _useState12[1];
92
+
88
93
  var type = prop.type,
89
94
  _prop$uploadable = prop.uploadable,
90
95
  uploadable = _prop$uploadable === void 0 ? true : _prop$uploadable,
@@ -107,7 +112,7 @@ function IconSelector(prop) {
107
112
  }, [type]);
108
113
 
109
114
  var loadData = /*#__PURE__*/function () {
110
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(pageIndex) {
115
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(pageIndex, keys) {
111
116
  var url, param, result, rows;
112
117
  return _regenerator.default.wrap(function _callee$(_context) {
113
118
  while (1) {
@@ -120,16 +125,21 @@ function IconSelector(prop) {
120
125
  "page.pn": pageIndex,
121
126
  "page.size": pageSize
122
127
  };
123
- _context.next = 4;
128
+
129
+ if (keys) {
130
+ param['search.mongoName_like'] = keys;
131
+ }
132
+
133
+ _context.next = 5;
124
134
  return (0, _http.httpGet)(url, param);
125
135
 
126
- case 4:
136
+ case 5:
127
137
  result = _context.sent;
128
138
  rows = result.rows || [];
129
139
  setList(rows);
130
140
  setTotal(result.total || 0);
131
141
 
132
- case 8:
142
+ case 9:
133
143
  case "end":
134
144
  return _context.stop();
135
145
  }
@@ -137,15 +147,15 @@ function IconSelector(prop) {
137
147
  }, _callee);
138
148
  }));
139
149
 
140
- return function loadData(_x) {
150
+ return function loadData(_x, _x2) {
141
151
  return _ref.apply(this, arguments);
142
152
  };
143
153
  }();
144
154
 
145
155
  (0, _react.useEffect)(function () {
146
156
  if (!visible) return;
147
- loadData(page);
148
- }, [visible, page]);
157
+ loadData(page, searchKey);
158
+ }, [visible, page, searchKey]);
149
159
  var totalPage = (0, _react.useMemo)(function () {
150
160
  if (total === 0) return 1;
151
161
  return Math.ceil(total / pageSize);
@@ -185,7 +195,7 @@ function IconSelector(prop) {
185
195
  if (page !== totalPage) {
186
196
  setPage(totalPage);
187
197
  } else {
188
- loadData(totalPage);
198
+ loadData(totalPage, searchKey);
189
199
  }
190
200
  } else {
191
201
  (0, _utils.showSuccess)(result.flag.retMsg);
@@ -215,14 +225,33 @@ function IconSelector(prop) {
215
225
  }
216
226
  }) : /*#__PURE__*/_react.default.createElement(_icons.PlusOutlined, {
217
227
  onClick: function onClick() {
218
- return setVisible(true);
228
+ var _rest$fieldProps;
229
+
230
+ if ((rest === null || rest === void 0 ? void 0 : rest.disabled) || (rest === null || rest === void 0 ? void 0 : (_rest$fieldProps = rest.fieldProps) === null || _rest$fieldProps === void 0 ? void 0 : _rest$fieldProps.disabled)) {
231
+ return;
232
+ }
233
+
234
+ setVisible(true);
219
235
  }
220
236
  })
221
237
  }, rest.fieldProps, {
222
238
  readOnly: readonly,
223
239
  allowClear: allowClear
224
240
  }))), /*#__PURE__*/_react.default.createElement(_modal.default, {
225
- title: title,
241
+ title: /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("span", null, title), /*#__PURE__*/_react.default.createElement("span", {
242
+ style: {
243
+ display: 'inline-block',
244
+ width: 230,
245
+ marginLeft: 30
246
+ }
247
+ }, /*#__PURE__*/_react.default.createElement(_input.default, {
248
+ suffix: /*#__PURE__*/_react.default.createElement(_icons.SearchOutlined, null),
249
+ placeholder: "\u8F93\u5165\u56FE\u7247\u540D\u67E5\u8BE2",
250
+ onPressEnter: function onPressEnter(e) {
251
+ setPage(1);
252
+ setSearchKey(e.target.value || '');
253
+ }
254
+ }))),
226
255
  visible: visible,
227
256
  width: modalWidth,
228
257
  destroyOnClose: true,
@@ -266,9 +295,13 @@ function IconSelector(prop) {
266
295
  }
267
296
  }, "\u4E0B\u4E00\u9875"), /*#__PURE__*/_react.default.createElement(_button.default, {
268
297
  onClick: function onClick() {
269
- return loadData(page);
298
+ return loadData(page, searchKey);
270
299
  }
271
300
  }, "\u5237\u65B0"))
301
+ }, /*#__PURE__*/_react.default.createElement("div", {
302
+ style: {
303
+ minHeight: '120px'
304
+ }
272
305
  }, list.map(function (o) {
273
306
  return /*#__PURE__*/_react.default.createElement(_card.default, {
274
307
  hoverable: true,
@@ -296,7 +329,8 @@ function IconSelector(prop) {
296
329
  formRef.current.setFieldsValue(val);
297
330
  setImgUrl((0, _utils.toGatewayUrl)(o.mongoUrl));
298
331
  setVisible(false);
299
- }
332
+ },
333
+ key: o.id
300
334
  }, /*#__PURE__*/_react.default.createElement("div", {
301
335
  style: {
302
336
  height: 80
@@ -315,7 +349,7 @@ function IconSelector(prop) {
315
349
  overflow: 'hidden'
316
350
  }
317
351
  }, o.mongoName));
318
- })));
352
+ }))));
319
353
  }
320
354
 
321
355
  var _default = IconSelector;