@quansitech/antd-admin 1.2.6 → 1.2.7

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.
@@ -33,11 +33,13 @@ import { TabsContext } from "./TabsContext";
33
33
  export default function (props) {
34
34
  var request = /*#__PURE__*/function () {
35
35
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params, sort, filter) {
36
+ var _formRef$current;
36
37
  var data, res, _props;
37
38
  return _regeneratorRuntime().wrap(function _callee$(_context) {
38
39
  while (1) switch (_context.prev = _context.next) {
39
40
  case 0:
40
- data = _objectSpread(_objectSpread(_objectSpread({}, params), filter), {}, {
41
+ setLoading(true);
42
+ data = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.getFieldsValue()), params), filter), {}, {
41
43
  sort: sort
42
44
  }); // 兼容 key:value 的写法
43
45
  Object.keys(data).forEach(function (key) {
@@ -58,7 +60,7 @@ export default function (props) {
58
60
  setEditableValues([]);
59
61
  setSelectedRows([]);
60
62
  if (modalContext.inModal) {
61
- _context.next = 9;
63
+ _context.next = 10;
62
64
  break;
63
65
  }
64
66
  // 如果不在 modal 中,则使用 routerNavigateTo
@@ -85,16 +87,16 @@ export default function (props) {
85
87
  }
86
88
  });
87
89
  return _context.abrupt("return");
88
- case 9:
89
- _context.prev = 9;
90
- _context.next = 12;
90
+ case 10:
91
+ _context.prev = 10;
92
+ _context.next = 13;
91
93
  return http.get(searchUrl, {
92
94
  params: data,
93
95
  headers: {
94
96
  'X-Table-Search': '1'
95
97
  }
96
98
  });
97
- case 12:
99
+ case 13:
98
100
  res = _context.sent;
99
101
  _props = res.data;
100
102
  setToolActions(_props.actions);
@@ -107,15 +109,15 @@ export default function (props) {
107
109
  data: res.data.dataSource || [],
108
110
  success: true
109
111
  });
110
- case 21:
111
- _context.prev = 21;
112
+ case 22:
113
+ _context.prev = 22;
112
114
  setLoading(false);
113
- return _context.finish(21);
114
- case 24:
115
+ return _context.finish(22);
116
+ case 25:
115
117
  case "end":
116
118
  return _context.stop();
117
119
  }
118
- }, _callee, null, [[9,, 21, 24]]);
120
+ }, _callee, null, [[10,, 22, 25]]);
119
121
  }));
120
122
  return function request(_x, _x2, _x3) {
121
123
  return _ref.apply(this, arguments);
@@ -297,13 +299,20 @@ export default function (props) {
297
299
 
298
300
  // 搜索
299
301
  if (!searchUrl) {
300
- setSearchUrl(window.location.href);
302
+ var s = window.location.href;
303
+ s = s.replace(/page=\d+&?/, '');
304
+ realColumns.filter(function (c) {
305
+ return c.search !== false;
306
+ }).map(function (c) {
307
+ s = s.replace(new RegExp("".concat(c.dataIndex, "=[^&]*&?")), '');
308
+ });
309
+ setSearchUrl(s);
301
310
  }
302
311
  setDataSource(postData(props.dataSource || []));
303
312
  if (!modalContext.inModal) {
304
313
  var query = qs.parse(window.location.search.replace(/^\?/, ''));
305
314
  if (query && Object.keys(query).length) {
306
- var _formRef$current;
315
+ var _formRef$current2;
307
316
  Object.keys(query).forEach(function (key) {
308
317
  if (typeof query[key] === 'string') {
309
318
  /^\d+$/.test(query[key]) && (query[key] = parseInt(query[key]));
@@ -311,7 +320,7 @@ export default function (props) {
311
320
  });
312
321
  handleSearchRangeValue(query);
313
322
  handleSearchArrayKey(query);
314
- (_formRef$current = formRef.current) === null || _formRef$current === void 0 || _formRef$current.setFieldsValue(query);
323
+ (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 || _formRef$current2.setFieldsValue(query);
315
324
  setLastQuery(query);
316
325
  }
317
326
  }
@@ -363,7 +372,7 @@ export default function (props) {
363
372
  form: {
364
373
  initialValues: props.defaultSearchValue,
365
374
  onValuesChange: function onValuesChange(changedValues, allValues) {
366
- var _formRef$current2;
375
+ var _formRef$current3;
367
376
  var submit = realColumns.filter(function (c) {
368
377
  if (!c.searchOnChange) {
369
378
  return false;
@@ -374,7 +383,7 @@ export default function (props) {
374
383
  return;
375
384
  }
376
385
  // 是否立即搜索
377
- (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 || _formRef$current2.submit();
386
+ (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 || _formRef$current3.submit();
378
387
  }
379
388
  },
380
389
  rowSelection: props.rowSelection && {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quansitech/antd-admin",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"