@yilianjituan/yilian_dgerm 1.0.6 → 1.0.7-alpha.2

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.
@@ -111,14 +111,18 @@ var PageTemplate = function PageTemplate(props, ref) {
111
111
  useImperativeHandle(ref, function () {
112
112
  return {
113
113
  onSearch: function onSearch(param) {
114
+ // isRetainParam 是否保留参数
114
115
  var _ref = param || {},
115
- pageNo = _ref.pageNo;
116
- _onSearch(pageNo || 1);
116
+ pageNo = _ref.pageNo,
117
+ _ref$isRetainParam = _ref.isRetainParam,
118
+ isRetainParam = _ref$isRetainParam === void 0 ? false : _ref$isRetainParam;
119
+ _onSearch(pageNo, isRetainParam);
117
120
  },
118
121
  filters: _objectSpread({
119
122
  pageNo: current,
120
123
  pageSize: pageSizeRef.current
121
- }, form.getFieldsValue(true))
124
+ }, form.getFieldsValue(true)),
125
+ form: form
122
126
  };
123
127
  });
124
128
  useLayoutEffect(function () {
@@ -179,6 +183,7 @@ var PageTemplate = function PageTemplate(props, ref) {
179
183
  }, [props.columns, current, pageSizeRef.current]);
180
184
  var _onSearch = function _onSearch() {
181
185
  var current = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
186
+ var isRetainParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
182
187
  if (Number.isNaN(Number(current))) current = 1;
183
188
  setTableLoading(true);
184
189
  var _props$url = props.url,
@@ -197,13 +202,15 @@ var PageTemplate = function PageTemplate(props, ref) {
197
202
  } : _props$afterErrorRequ;
198
203
  form.validateFields().then(function () {
199
204
  var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
205
+ // 是否保留参数
206
+ var _pageNo = isRetainParam ? paramsRef.current.pageNo : current;
200
207
  // 当前页码、每页条数暴露给beforeRequest的参数中
201
208
  var options = {
202
- pageNum: current,
209
+ pageNum: _pageNo,
203
210
  pageSize: pageSizeRef.current
204
211
  };
205
212
  paramsRef.current = beforeRequest(_objectSpread(_objectSpread({
206
- pageNo: current
213
+ pageNo: _pageNo
207
214
  }, values), options));
208
215
  if (!paramsRef.current) return; // 是否阻断搜索
209
216
 
@@ -231,12 +238,19 @@ var PageTemplate = function PageTemplate(props, ref) {
231
238
  return afterRequest(data.result || {});
232
239
  case 2:
233
240
  result = _context.sent;
234
- _ref3 = result || {}, totalElements = _ref3.totalElements, content = _ref3.content;
235
- setDataSource(content || []);
236
- dataSourceRef.current = content || [];
237
- setTotal(totalElements || '');
238
- setCurrent(current);
239
- case 8:
241
+ _ref3 = result || {}, totalElements = _ref3.totalElements, content = _ref3.content; // 没有数据,重置到上一页
242
+ if (content.length === 0 && _pageNo > 1) {
243
+ paramsRef.current = _objectSpread(_objectSpread({}, paramsRef.current), {}, {
244
+ pageNo: _pageNo - 1
245
+ });
246
+ _onSearch(paramsRef.current.pageNo, true);
247
+ } else {
248
+ setDataSource(content || []);
249
+ dataSourceRef.current = content || [];
250
+ setTotal(totalElements || '');
251
+ setCurrent(_pageNo);
252
+ }
253
+ case 5:
240
254
  case "end":
241
255
  return _context.stop();
242
256
  }
@@ -8,9 +8,10 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
8
8
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
9
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
- import React, { useRef, useState } from 'react';
11
+ import { CloseOutlined } from '@ant-design/icons';
12
12
  import { Modal } from 'antd';
13
13
  import debounce from 'lodash/debounce';
14
+ import React, { useRef, useState } from 'react';
14
15
  import Draggable from 'react-draggable';
15
16
  // 平台常见弹窗宽度分类
16
17
  // 1300 审方 开户信息查询详情
@@ -66,7 +67,10 @@ var YLModal = function YLModal(props) {
66
67
  closable: closable,
67
68
  maskClosable: false,
68
69
  width: width || 700,
69
- className: "yl-modal ".concat(className || '')
70
+ className: "yl-modal custom_modal_close_icon ".concat(className || ''),
71
+ closeIcon: /*#__PURE__*/React.createElement("span", {
72
+ className: "custom_close_icon"
73
+ }, /*#__PURE__*/React.createElement(CloseOutlined, null), "\u5173\u95ED")
70
74
  }, restParams, {
71
75
  onOk: whetherDebounce && props.onOk ? React.useMemo(function () {
72
76
  return debounce(props.onOk, debounceTimeout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yilianjituan/yilian_dgerm",
3
- "version": "1.0.6",
3
+ "version": "1.0.7-alpha.2",
4
4
  "description": "A react library developed with dumi",
5
5
  "keywords": [
6
6
  "React",