@fle-ui/plus-table 1.2.28 → 1.2.29
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.
- package/es/{FormSearch → components/FormSearch}/FormRender.d.ts +1 -1
- package/es/{FormSearch → components/FormSearch}/FormRender.js +1 -2
- package/es/{FormSearch → components/FormSearch}/index.less +0 -3
- package/es/index.d.ts +3 -3
- package/es/index.js +425 -337
- package/es/mock/list.json +720 -0
- package/es/utils/common.d.ts +0 -10
- package/es/utils/common.js +0 -5
- package/lib/{FormSearch → components/FormSearch}/FormRender.d.ts +1 -1
- package/lib/{FormSearch → components/FormSearch}/FormRender.js +3 -4
- package/lib/{FormSearch → components/FormSearch}/index.less +0 -3
- package/lib/index.d.ts +3 -3
- package/lib/index.js +422 -336
- package/lib/mock/list.json +720 -0
- package/lib/utils/common.d.ts +0 -10
- package/lib/utils/common.js +1 -7
- package/package.json +6 -6
- package/es/components/icon/index.d.ts +0 -3
- package/es/components/icon/index.js +0 -7
- package/es/json/columnKeys.d.ts +0 -15
- package/es/json/columnKeys.js +0 -182
- package/es/json/list.d.ts +0 -1365
- package/es/json/list.js +0 -1388
- package/lib/components/icon/index.d.ts +0 -3
- package/lib/components/icon/index.js +0 -13
- package/lib/json/columnKeys.d.ts +0 -15
- package/lib/json/columnKeys.js +0 -188
- package/lib/json/list.d.ts +0 -1365
- package/lib/json/list.js +0 -1394
- /package/es/{FormSearch → components/FormSearch}/index.d.ts +0 -0
- /package/es/{FormSearch → components/FormSearch}/index.js +0 -0
- /package/lib/{FormSearch → components/FormSearch}/index.d.ts +0 -0
- /package/lib/{FormSearch → components/FormSearch}/index.js +0 -0
package/lib/index.js
CHANGED
|
@@ -7,11 +7,11 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _proComponents = require("@ant-design/pro-components");
|
|
9
9
|
var _antd = require("antd");
|
|
10
|
-
var _index = _interopRequireDefault(require("./FormSearch/index"));
|
|
10
|
+
var _index = _interopRequireDefault(require("./components/FormSearch/index"));
|
|
11
11
|
var _icons = require("@ant-design/icons");
|
|
12
12
|
var _common = require("./utils/common");
|
|
13
|
-
require("./FormSearch/index.less");
|
|
14
|
-
var _excluded = ["columns", "hasShowFull", "request", "pagination", "formRef", "actionRef", "defaultColumnsState", "options", "action", "showDefaultSetting"];
|
|
13
|
+
require("./components/FormSearch/index.less");
|
|
14
|
+
var _excluded = ["columns", "hasShowFull", "request", "pagination", "formRef", "actionRef", "defaultColumnsState", "options", "action", "search", "showDefaultSetting"];
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -33,8 +33,22 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
33
33
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
34
34
|
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; }
|
|
35
35
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
36
|
+
// 常量定义
|
|
37
|
+
var CONSTANTS = {
|
|
38
|
+
DRAWER_WIDTH: 380,
|
|
39
|
+
DEFAULT_TOP: 92,
|
|
40
|
+
RELOAD_DELAY: 100,
|
|
41
|
+
SEARCH_SPAN: {
|
|
42
|
+
xs: 12,
|
|
43
|
+
sm: 12,
|
|
44
|
+
md: 12,
|
|
45
|
+
lg: 12,
|
|
46
|
+
xl: 8,
|
|
47
|
+
xxl: 6
|
|
48
|
+
},
|
|
49
|
+
LABEL_WIDTH: 80
|
|
50
|
+
};
|
|
36
51
|
function PlusTable(props, ref) {
|
|
37
|
-
var _otherProps$scroll;
|
|
38
52
|
var columns = props.columns,
|
|
39
53
|
_props$hasShowFull = props.hasShowFull,
|
|
40
54
|
hasShowFull = _props$hasShowFull === void 0 ? true : _props$hasShowFull,
|
|
@@ -46,6 +60,7 @@ function PlusTable(props, ref) {
|
|
|
46
60
|
_props$options = props.options,
|
|
47
61
|
options = _props$options === void 0 ? {} : _props$options,
|
|
48
62
|
action = props.action,
|
|
63
|
+
search = props.search,
|
|
49
64
|
_props$showDefaultSet = props.showDefaultSetting,
|
|
50
65
|
showDefaultSetting = _props$showDefaultSet === void 0 ? true : _props$showDefaultSet,
|
|
51
66
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
@@ -63,296 +78,401 @@ function PlusTable(props, ref) {
|
|
|
63
78
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
64
79
|
columnsStateMap = _useState6[0],
|
|
65
80
|
setColumnsStateMap = _useState6[1];
|
|
81
|
+
var _useState7 = (0, _react.useState)(false),
|
|
82
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
83
|
+
isLoading = _useState8[0],
|
|
84
|
+
setIsLoading = _useState8[1];
|
|
66
85
|
var actionRef = (0, _react.useRef)();
|
|
67
86
|
(0, _react.useImperativeHandle)(propsActionRef, function () {
|
|
68
87
|
return actionRef.current;
|
|
69
88
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}));
|
|
97
|
-
function getFieldsValue() {
|
|
98
|
-
return _getFieldsValue.apply(this, arguments);
|
|
99
|
-
}
|
|
100
|
-
return getFieldsValue;
|
|
101
|
-
}(),
|
|
102
|
-
setFiledsValue: function () {
|
|
103
|
-
var _setFiledsValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
104
|
-
var _searchRef$current2, _drawFormRef$current2;
|
|
105
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
106
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
107
|
-
case 0:
|
|
108
|
-
_context2.next = 2;
|
|
109
|
-
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current2 = searchRef.current) === null || _searchRef$current2 === void 0 ? void 0 : _searchRef$current2.setFieldsValue(params);
|
|
110
|
-
case 2:
|
|
111
|
-
_context2.next = 4;
|
|
112
|
-
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current2 = drawFormRef.current) === null || _drawFormRef$current2 === void 0 ? void 0 : _drawFormRef$current2.setFieldsValue(params);
|
|
113
|
-
case 4:
|
|
114
|
-
case "end":
|
|
115
|
-
return _context2.stop();
|
|
116
|
-
}
|
|
117
|
-
}, _callee2);
|
|
118
|
-
}));
|
|
119
|
-
function setFiledsValue(_x) {
|
|
120
|
-
return _setFiledsValue.apply(this, arguments);
|
|
121
|
-
}
|
|
122
|
-
return setFiledsValue;
|
|
123
|
-
}(),
|
|
124
|
-
setFiledValue: function () {
|
|
125
|
-
var _setFiledValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, value) {
|
|
126
|
-
var _searchRef$current3, _drawFormRef$current3;
|
|
127
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
128
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
129
|
-
case 0:
|
|
130
|
-
_context3.next = 2;
|
|
131
|
-
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current3 = searchRef.current) === null || _searchRef$current3 === void 0 ? void 0 : _searchRef$current3.setFieldValue(key, value);
|
|
132
|
-
case 2:
|
|
133
|
-
_context3.next = 4;
|
|
134
|
-
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current3 = drawFormRef.current) === null || _drawFormRef$current3 === void 0 ? void 0 : _drawFormRef$current3.setFieldValue(key, value);
|
|
135
|
-
case 4:
|
|
136
|
-
case "end":
|
|
137
|
-
return _context3.stop();
|
|
138
|
-
}
|
|
139
|
-
}, _callee3);
|
|
140
|
-
}));
|
|
141
|
-
function setFiledValue(_x2, _x3) {
|
|
142
|
-
return _setFiledValue.apply(this, arguments);
|
|
143
|
-
}
|
|
144
|
-
return setFiledValue;
|
|
145
|
-
}()
|
|
146
|
-
};
|
|
147
|
-
});
|
|
148
|
-
var handleOnChangeColumn = function handleOnChangeColumn(map) {
|
|
149
|
-
// 列设置更新
|
|
150
|
-
setColumnsStateMap(function (columnsStateMap) {
|
|
151
|
-
var newObj = {};
|
|
152
|
-
for (var key in map) {
|
|
153
|
-
newObj[key] = _objectSpread(_objectSpread({}, columnsStateMap[key]), map[key]);
|
|
89
|
+
// 优化:使用 useCallback 避免重复创建函数
|
|
90
|
+
var getFieldsValue = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
91
|
+
var _searchRef$current, _drawFormRef$current, res1, res2;
|
|
92
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
93
|
+
while (1) switch (_context.prev = _context.next) {
|
|
94
|
+
case 0:
|
|
95
|
+
_context.prev = 0;
|
|
96
|
+
_context.next = 3;
|
|
97
|
+
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : _searchRef$current.getFieldsValue();
|
|
98
|
+
case 3:
|
|
99
|
+
res1 = _context.sent;
|
|
100
|
+
_context.next = 6;
|
|
101
|
+
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current = drawFormRef.current) === null || _drawFormRef$current === void 0 ? void 0 : _drawFormRef$current.getFieldsValue();
|
|
102
|
+
case 6:
|
|
103
|
+
res2 = _context.sent;
|
|
104
|
+
return _context.abrupt("return", _objectSpread(_objectSpread({}, dealFetchParams(_objectSpread(_objectSpread({}, res1), res2))), {}, {
|
|
105
|
+
showFull: showFull
|
|
106
|
+
}));
|
|
107
|
+
case 10:
|
|
108
|
+
_context.prev = 10;
|
|
109
|
+
_context.t0 = _context["catch"](0);
|
|
110
|
+
console.error('获取字段值失败:', _context.t0);
|
|
111
|
+
return _context.abrupt("return", {});
|
|
112
|
+
case 14:
|
|
113
|
+
case "end":
|
|
114
|
+
return _context.stop();
|
|
154
115
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return _regeneratorRuntime().wrap(function
|
|
161
|
-
while (1) switch (
|
|
116
|
+
}, _callee, null, [[0, 10]]);
|
|
117
|
+
})), [showFull]);
|
|
118
|
+
var setFiledsValue = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
119
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
120
|
+
var _searchRef$current2, _drawFormRef$current2;
|
|
121
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
122
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
162
123
|
case 0:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
_context4.next = 3;
|
|
168
|
-
return props.updateSetting(columnsStateMap);
|
|
124
|
+
_context2.prev = 0;
|
|
125
|
+
_context2.next = 3;
|
|
126
|
+
return Promise.all([searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current2 = searchRef.current) === null || _searchRef$current2 === void 0 ? void 0 : _searchRef$current2.setFieldsValue(params), drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current2 = drawFormRef.current) === null || _drawFormRef$current2 === void 0 ? void 0 : _drawFormRef$current2.setFieldsValue(params)]);
|
|
169
127
|
case 3:
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
case
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return function handleSave() {
|
|
178
|
-
return _ref.apply(this, arguments);
|
|
179
|
-
};
|
|
180
|
-
}();
|
|
181
|
-
var handleReset = /*#__PURE__*/function () {
|
|
182
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
183
|
-
var _props$resetSetting;
|
|
184
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
185
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
186
|
-
case 0:
|
|
187
|
-
return _context5.abrupt("return", (_props$resetSetting = props.resetSetting) === null || _props$resetSetting === void 0 ? void 0 : _props$resetSetting.call(props).then(function (res) {
|
|
188
|
-
res.success && init();
|
|
189
|
-
}));
|
|
190
|
-
case 1:
|
|
128
|
+
_context2.next = 8;
|
|
129
|
+
break;
|
|
130
|
+
case 5:
|
|
131
|
+
_context2.prev = 5;
|
|
132
|
+
_context2.t0 = _context2["catch"](0);
|
|
133
|
+
console.error('设置字段值失败:', _context2.t0);
|
|
134
|
+
case 8:
|
|
191
135
|
case "end":
|
|
192
|
-
return
|
|
136
|
+
return _context2.stop();
|
|
193
137
|
}
|
|
194
|
-
},
|
|
138
|
+
}, _callee2, null, [[0, 5]]);
|
|
195
139
|
}));
|
|
196
|
-
return function
|
|
140
|
+
return function (_x) {
|
|
197
141
|
return _ref2.apply(this, arguments);
|
|
198
142
|
};
|
|
199
|
-
}();
|
|
200
|
-
var
|
|
201
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
202
|
-
var
|
|
203
|
-
return _regeneratorRuntime().wrap(function
|
|
204
|
-
while (1) switch (
|
|
143
|
+
}(), []);
|
|
144
|
+
var setFiledValue = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
145
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, value) {
|
|
146
|
+
var _searchRef$current3, _drawFormRef$current3;
|
|
147
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
148
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
205
149
|
case 0:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
_context6.next = 3;
|
|
211
|
-
return (_props$fetchSetting = props.fetchSetting) === null || _props$fetchSetting === void 0 ? void 0 : _props$fetchSetting.call(props);
|
|
150
|
+
_context3.prev = 0;
|
|
151
|
+
_context3.next = 3;
|
|
152
|
+
return Promise.all([searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current3 = searchRef.current) === null || _searchRef$current3 === void 0 ? void 0 : _searchRef$current3.setFieldValue(key, value), drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current3 = drawFormRef.current) === null || _drawFormRef$current3 === void 0 ? void 0 : _drawFormRef$current3.setFieldValue(key, value)]);
|
|
212
153
|
case 3:
|
|
213
|
-
|
|
214
|
-
|
|
154
|
+
_context3.next = 8;
|
|
155
|
+
break;
|
|
215
156
|
case 5:
|
|
157
|
+
_context3.prev = 5;
|
|
158
|
+
_context3.t0 = _context3["catch"](0);
|
|
159
|
+
console.error('设置字段值失败:', _context3.t0);
|
|
160
|
+
case 8:
|
|
216
161
|
case "end":
|
|
217
|
-
return
|
|
162
|
+
return _context3.stop();
|
|
218
163
|
}
|
|
219
|
-
},
|
|
164
|
+
}, _callee3, null, [[0, 5]]);
|
|
220
165
|
}));
|
|
221
|
-
return function
|
|
166
|
+
return function (_x2, _x3) {
|
|
222
167
|
return _ref3.apply(this, arguments);
|
|
223
168
|
};
|
|
224
|
-
}();
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
169
|
+
}(), []);
|
|
170
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
171
|
+
return {
|
|
172
|
+
getFieldsValue: getFieldsValue,
|
|
173
|
+
setFiledsValue: setFiledsValue,
|
|
174
|
+
setFiledValue: setFiledValue
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
// 优化:使用 useCallback 避免重复创建函数
|
|
178
|
+
var handleOnChangeColumn = (0, _react.useCallback)(function (map) {
|
|
179
|
+
setColumnsStateMap(function (prevState) {
|
|
180
|
+
var newObj = {};
|
|
181
|
+
for (var key in map) {
|
|
182
|
+
if (Object.prototype.hasOwnProperty.call(map, key)) {
|
|
183
|
+
newObj[key] = _objectSpread(_objectSpread({}, prevState[key]), map[key]);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return newObj;
|
|
187
|
+
});
|
|
188
|
+
}, []);
|
|
189
|
+
var handleSave = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
190
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
191
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
192
|
+
case 0:
|
|
193
|
+
if (!props.updateSetting) {
|
|
194
|
+
_context4.next = 14;
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
_context4.prev = 1;
|
|
198
|
+
setIsLoading(true);
|
|
199
|
+
_context4.next = 5;
|
|
200
|
+
return props.updateSetting(columnsStateMap);
|
|
201
|
+
case 5:
|
|
202
|
+
(0, _common.simulateClick)();
|
|
203
|
+
_context4.next = 11;
|
|
204
|
+
break;
|
|
205
|
+
case 8:
|
|
206
|
+
_context4.prev = 8;
|
|
207
|
+
_context4.t0 = _context4["catch"](1);
|
|
208
|
+
console.error('保存列设置失败:', _context4.t0);
|
|
209
|
+
case 11:
|
|
210
|
+
_context4.prev = 11;
|
|
211
|
+
setIsLoading(false);
|
|
212
|
+
return _context4.finish(11);
|
|
213
|
+
case 14:
|
|
214
|
+
case "end":
|
|
215
|
+
return _context4.stop();
|
|
216
|
+
}
|
|
217
|
+
}, _callee4, null, [[1, 8, 11, 14]]);
|
|
218
|
+
})), [props.updateSetting, columnsStateMap]);
|
|
219
|
+
var handleReset = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
220
|
+
var _props$resetSetting, res, fetchRes;
|
|
221
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
222
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
223
|
+
case 0:
|
|
224
|
+
_context5.prev = 0;
|
|
225
|
+
_context5.next = 3;
|
|
226
|
+
return (_props$resetSetting = props.resetSetting) === null || _props$resetSetting === void 0 ? void 0 : _props$resetSetting.call(props);
|
|
227
|
+
case 3:
|
|
228
|
+
res = _context5.sent;
|
|
229
|
+
if (!((res === null || res === void 0 ? void 0 : res.success) && props.fetchSetting)) {
|
|
230
|
+
_context5.next = 9;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
_context5.next = 7;
|
|
234
|
+
return props.fetchSetting();
|
|
235
|
+
case 7:
|
|
236
|
+
fetchRes = _context5.sent;
|
|
237
|
+
setColumnsStateMap(fetchRes);
|
|
238
|
+
case 9:
|
|
239
|
+
_context5.next = 14;
|
|
240
|
+
break;
|
|
241
|
+
case 11:
|
|
242
|
+
_context5.prev = 11;
|
|
243
|
+
_context5.t0 = _context5["catch"](0);
|
|
244
|
+
console.error('重置列设置失败:', _context5.t0);
|
|
245
|
+
case 14:
|
|
246
|
+
case "end":
|
|
247
|
+
return _context5.stop();
|
|
248
|
+
}
|
|
249
|
+
}, _callee5, null, [[0, 11]]);
|
|
250
|
+
})), [props.resetSetting, props.fetchSetting]);
|
|
251
|
+
var onValuesChange = (0, _react.useCallback)(function (changeValue, allValue) {
|
|
252
|
+
try {
|
|
253
|
+
var _drawFormRef$current4;
|
|
254
|
+
var currentValues = (_drawFormRef$current4 = drawFormRef.current) === null || _drawFormRef$current4 === void 0 ? void 0 : _drawFormRef$current4.getFieldsValue();
|
|
255
|
+
if (currentValues) {
|
|
256
|
+
var _searchRef$current4;
|
|
257
|
+
searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current4 = searchRef.current) === null || _searchRef$current4 === void 0 ? void 0 : _searchRef$current4.setFieldsValue(currentValues);
|
|
258
|
+
}
|
|
259
|
+
} catch (error) {
|
|
260
|
+
console.error('同步表单值失败:', error);
|
|
261
|
+
}
|
|
262
|
+
}, []);
|
|
263
|
+
var handleSearchAll = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
264
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(searchConfig) {
|
|
265
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
266
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
233
267
|
case 0:
|
|
234
|
-
|
|
268
|
+
try {
|
|
269
|
+
searchConfig.form.submit();
|
|
270
|
+
} catch (error) {
|
|
271
|
+
console.error('搜索失败:', error);
|
|
272
|
+
}
|
|
235
273
|
case 1:
|
|
236
274
|
case "end":
|
|
237
|
-
return
|
|
275
|
+
return _context6.stop();
|
|
238
276
|
}
|
|
239
|
-
},
|
|
277
|
+
}, _callee6);
|
|
240
278
|
}));
|
|
241
|
-
return function
|
|
242
|
-
return
|
|
279
|
+
return function (_x4) {
|
|
280
|
+
return _ref6.apply(this, arguments);
|
|
243
281
|
};
|
|
244
|
-
}();
|
|
245
|
-
(0, _react.
|
|
246
|
-
|
|
282
|
+
}(), []);
|
|
283
|
+
var handleShowFullChange = (0, _react.useCallback)(function (e) {
|
|
284
|
+
setShowFull(e.target.checked);
|
|
285
|
+
// 优化:使用 requestAnimationFrame 替代 setTimeout
|
|
286
|
+
requestAnimationFrame(function () {
|
|
287
|
+
var _actionRef$current, _actionRef$current$re;
|
|
288
|
+
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$re = _actionRef$current.reload) === null || _actionRef$current$re === void 0 ? void 0 : _actionRef$current$re.call(_actionRef$current);
|
|
289
|
+
});
|
|
290
|
+
}, []);
|
|
291
|
+
var handleAdvancedFilterClick = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
292
|
+
var newDrawerState, _searchRef$current5, _drawFormRef$current5, fieldsValue;
|
|
293
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
294
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
295
|
+
case 0:
|
|
296
|
+
_context7.prev = 0;
|
|
297
|
+
newDrawerState = !searchDrawer;
|
|
298
|
+
setSearchDrawer(newDrawerState);
|
|
299
|
+
if (!newDrawerState) {
|
|
300
|
+
_context7.next = 8;
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
_context7.next = 6;
|
|
304
|
+
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current5 = searchRef.current) === null || _searchRef$current5 === void 0 ? void 0 : _searchRef$current5.getFieldsValue();
|
|
305
|
+
case 6:
|
|
306
|
+
fieldsValue = _context7.sent;
|
|
307
|
+
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current5 = drawFormRef.current) === null || _drawFormRef$current5 === void 0 ? void 0 : _drawFormRef$current5.setFieldsValue(fieldsValue);
|
|
308
|
+
case 8:
|
|
309
|
+
_context7.next = 13;
|
|
310
|
+
break;
|
|
311
|
+
case 10:
|
|
312
|
+
_context7.prev = 10;
|
|
313
|
+
_context7.t0 = _context7["catch"](0);
|
|
314
|
+
console.error('切换高级筛选失败:', _context7.t0);
|
|
315
|
+
case 13:
|
|
316
|
+
case "end":
|
|
317
|
+
return _context7.stop();
|
|
318
|
+
}
|
|
319
|
+
}, _callee7, null, [[0, 10]]);
|
|
320
|
+
})), [searchDrawer]);
|
|
321
|
+
var handleResetForm = (0, _react.useCallback)(function () {
|
|
322
|
+
try {
|
|
323
|
+
var _drawFormRef$current6, _actionRef$current2, _actionRef$current2$r, _actionRef$current3, _actionRef$current3$r;
|
|
324
|
+
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current6 = drawFormRef.current) === null || _drawFormRef$current6 === void 0 ? void 0 : _drawFormRef$current6.resetFields();
|
|
325
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$r = _actionRef$current2.reset) === null || _actionRef$current2$r === void 0 ? void 0 : _actionRef$current2$r.call(_actionRef$current2);
|
|
326
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$r = _actionRef$current3.reload) === null || _actionRef$current3$r === void 0 ? void 0 : _actionRef$current3$r.call(_actionRef$current3);
|
|
327
|
+
} catch (error) {
|
|
328
|
+
console.error('重置表单失败:', error);
|
|
329
|
+
}
|
|
247
330
|
}, []);
|
|
248
|
-
|
|
249
|
-
|
|
331
|
+
// 修复死循环:只在组件挂载时执行一次,不依赖 init 函数
|
|
332
|
+
(0, _react.useEffect)(function () {
|
|
333
|
+
// 组件挂载时执行一次初始化
|
|
334
|
+
if (props.fetchSetting) {
|
|
335
|
+
props.fetchSetting().then(function (res) {
|
|
336
|
+
setColumnsStateMap(res);
|
|
337
|
+
}).catch(function (error) {
|
|
338
|
+
console.error('获取列设置失败:', error);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}, []); // 空依赖数组,只在挂载时执行一次
|
|
342
|
+
// 优化:使用 useMemo 缓存计算结果
|
|
343
|
+
var dealFetchParams = (0, _react.useCallback)(function (params) {
|
|
250
344
|
var fetchParams = {};
|
|
251
345
|
columns.forEach(function (item) {
|
|
252
|
-
var
|
|
253
|
-
if ((item === null || item === void 0 ? void 0 :
|
|
254
|
-
|
|
346
|
+
var dataIndex = item.dataIndex;
|
|
347
|
+
if ((item === null || item === void 0 ? void 0 : item.search) && _typeof(item.search) === 'object' && item.search.transform && params[dataIndex]) {
|
|
348
|
+
var transformResult = item.search.transform(params[dataIndex], dataIndex, params);
|
|
349
|
+
if (transformResult && _typeof(transformResult) === 'object') {
|
|
350
|
+
Object.assign(fetchParams, transformResult);
|
|
351
|
+
}
|
|
255
352
|
} else {
|
|
256
|
-
fetchParams =
|
|
353
|
+
fetchParams[dataIndex] = params[dataIndex];
|
|
257
354
|
}
|
|
258
355
|
});
|
|
259
356
|
return fetchParams;
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
357
|
+
}, [columns]);
|
|
358
|
+
// 优化:使用 useMemo 缓存列状态配置
|
|
359
|
+
var columnsState = (0, _react.useMemo)(function () {
|
|
360
|
+
return {
|
|
361
|
+
defaultValue: defaultColumnsState,
|
|
362
|
+
value: columnsStateMap,
|
|
363
|
+
onChange: handleOnChangeColumn
|
|
364
|
+
};
|
|
365
|
+
}, [defaultColumnsState, columnsStateMap, handleOnChangeColumn]);
|
|
366
|
+
// 优化:使用 useCallback 缓存请求函数
|
|
367
|
+
var propsRequest = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
368
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params, sort, filter) {
|
|
369
|
+
var _searchRef$current6, _drawFormRef$current7, res1, res2;
|
|
271
370
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
272
371
|
while (1) switch (_context8.prev = _context8.next) {
|
|
273
372
|
case 0:
|
|
274
|
-
_context8.
|
|
275
|
-
|
|
276
|
-
|
|
373
|
+
_context8.prev = 0;
|
|
374
|
+
_context8.next = 3;
|
|
375
|
+
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current6 = searchRef.current) === null || _searchRef$current6 === void 0 ? void 0 : _searchRef$current6.getFieldsValue();
|
|
376
|
+
case 3:
|
|
277
377
|
res1 = _context8.sent;
|
|
278
|
-
_context8.next =
|
|
279
|
-
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$
|
|
280
|
-
case
|
|
378
|
+
_context8.next = 6;
|
|
379
|
+
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current7 = drawFormRef.current) === null || _drawFormRef$current7 === void 0 ? void 0 : _drawFormRef$current7.getFieldsValue();
|
|
380
|
+
case 6:
|
|
281
381
|
res2 = _context8.sent;
|
|
282
|
-
if (
|
|
283
|
-
_context8.next =
|
|
382
|
+
if (request) {
|
|
383
|
+
_context8.next = 9;
|
|
284
384
|
break;
|
|
285
385
|
}
|
|
286
|
-
_context8.
|
|
386
|
+
return _context8.abrupt("return", {});
|
|
387
|
+
case 9:
|
|
388
|
+
_context8.next = 11;
|
|
287
389
|
return request(_objectSpread(_objectSpread(_objectSpread({}, params), dealFetchParams(_objectSpread(_objectSpread(_objectSpread({}, res1), res2), params))), {}, {
|
|
288
390
|
showFull: showFull
|
|
289
391
|
}), sort, filter);
|
|
290
|
-
case
|
|
291
|
-
_context8.
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
_context8.t0
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
return _context8.abrupt("return", res);
|
|
299
|
-
case 15:
|
|
392
|
+
case 11:
|
|
393
|
+
return _context8.abrupt("return", _context8.sent);
|
|
394
|
+
case 14:
|
|
395
|
+
_context8.prev = 14;
|
|
396
|
+
_context8.t0 = _context8["catch"](0);
|
|
397
|
+
console.error('请求数据失败:', _context8.t0);
|
|
398
|
+
return _context8.abrupt("return", {});
|
|
399
|
+
case 18:
|
|
300
400
|
case "end":
|
|
301
401
|
return _context8.stop();
|
|
302
402
|
}
|
|
303
|
-
}, _callee8);
|
|
403
|
+
}, _callee8, null, [[0, 14]]);
|
|
304
404
|
}));
|
|
305
|
-
return function
|
|
306
|
-
return
|
|
405
|
+
return function (_x5, _x6, _x7) {
|
|
406
|
+
return _ref8.apply(this, arguments);
|
|
307
407
|
};
|
|
308
|
-
}();
|
|
309
|
-
|
|
310
|
-
var __options = (
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
408
|
+
}(), [request, dealFetchParams, showFull]);
|
|
409
|
+
// 优化:使用 useMemo 缓存选项配置
|
|
410
|
+
var __options = (0, _react.useMemo)(function () {
|
|
411
|
+
var optionsSetting = _typeof(options) === 'object' && _typeof(options.setting) === 'object' ? options.setting : {};
|
|
412
|
+
console.log(action === null || action === void 0 ? void 0 : action.includes('columnSetting'), showDefaultSetting !== true);
|
|
413
|
+
if ((action === null || action === void 0 ? void 0 : action.includes('columnSetting')) && showDefaultSetting !== true) {
|
|
414
|
+
return _objectSpread(_objectSpread({}, options), {}, {
|
|
415
|
+
setting: _objectSpread(_objectSpread({}, optionsSetting), {}, {
|
|
416
|
+
checkedReset: false,
|
|
417
|
+
showListItemOption: true,
|
|
418
|
+
extra: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("a", {
|
|
419
|
+
onClick: handleSave,
|
|
420
|
+
style: {
|
|
421
|
+
cursor: isLoading ? 'not-allowed' : 'pointer',
|
|
422
|
+
opacity: isLoading ? 0.6 : 1,
|
|
423
|
+
pointerEvents: isLoading ? 'none' : 'auto'
|
|
424
|
+
}
|
|
425
|
+
}, isLoading ? '保存中...' : '保存'), /*#__PURE__*/_react.default.createElement("a", {
|
|
426
|
+
style: {
|
|
427
|
+
color: '#333'
|
|
428
|
+
},
|
|
429
|
+
onClick: handleReset
|
|
430
|
+
}, "\u91CD\u7F6E"))
|
|
431
|
+
})
|
|
432
|
+
});
|
|
333
433
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
434
|
+
return options;
|
|
435
|
+
}, [options, action, showDefaultSetting, handleSave, handleReset, isLoading]);
|
|
436
|
+
// 优化:使用 useMemo 缓存列配置
|
|
437
|
+
var processedColumns = (0, _react.useMemo)(function () {
|
|
438
|
+
if (!(action === null || action === void 0 ? void 0 : action.includes('advancedFilter'))) {
|
|
439
|
+
return columns;
|
|
440
|
+
}
|
|
441
|
+
return columns.map(function (item) {
|
|
442
|
+
if (item.baseSearch) {
|
|
443
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
444
|
+
search: item.search,
|
|
445
|
+
fieldProps: _objectSpread({
|
|
446
|
+
onChange: function onChange(e) {
|
|
447
|
+
try {
|
|
448
|
+
if (e) {
|
|
449
|
+
var _drawFormRef$current8;
|
|
450
|
+
var value = e.target ? e.target.value : e;
|
|
451
|
+
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current8 = drawFormRef.current) === null || _drawFormRef$current8 === void 0 ? void 0 : _drawFormRef$current8.setFieldsValue(_defineProperty({}, item.dataIndex, value));
|
|
452
|
+
} else {
|
|
453
|
+
var _drawFormRef$current10;
|
|
454
|
+
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current10 = drawFormRef.current) === null || _drawFormRef$current10 === void 0 ? void 0 : _drawFormRef$current10.resetFields([item.dataIndex]);
|
|
455
|
+
}
|
|
456
|
+
} catch (error) {
|
|
457
|
+
console.error('字段值变更处理失败:', error);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}, item.fieldProps)
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
464
|
+
search: false
|
|
465
|
+
});
|
|
466
|
+
});
|
|
467
|
+
}, [columns, action]);
|
|
468
|
+
// 优化:使用 useMemo 缓存搜索配置
|
|
469
|
+
var searchConfig = (0, _react.useMemo)(function () {
|
|
470
|
+
if (!(action === null || action === void 0 ? void 0 : action.includes('advancedFilter'))) {
|
|
471
|
+
return props.search;
|
|
472
|
+
}
|
|
473
|
+
return _objectSpread(_objectSpread({}, search), {}, {
|
|
474
|
+
span: CONSTANTS.SEARCH_SPAN,
|
|
475
|
+
labelWidth: CONSTANTS.LABEL_WIDTH,
|
|
356
476
|
collapseRender: function collapseRender() {
|
|
357
477
|
return null;
|
|
358
478
|
},
|
|
@@ -362,17 +482,12 @@ function PlusTable(props, ref) {
|
|
|
362
482
|
size: "middle",
|
|
363
483
|
type: "primary",
|
|
364
484
|
onClick: function onClick() {
|
|
365
|
-
handleSearchAll(searchConfig);
|
|
485
|
+
return handleSearchAll(searchConfig);
|
|
366
486
|
}
|
|
367
487
|
}, "\u67E5\u8BE2"), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
368
488
|
key: "2",
|
|
369
489
|
type: "default",
|
|
370
|
-
onClick:
|
|
371
|
-
var _drawFormRef$current5, _actionRef$current, _actionRef$current$re, _actionRef$current2, _actionRef$current2$r;
|
|
372
|
-
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current5 = drawFormRef.current) === null || _drawFormRef$current5 === void 0 ? void 0 : _drawFormRef$current5.resetFields();
|
|
373
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$re = _actionRef$current.reset) === null || _actionRef$current$re === void 0 ? void 0 : _actionRef$current$re.call(_actionRef$current);
|
|
374
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$r = _actionRef$current2.reload) === null || _actionRef$current2$r === void 0 ? void 0 : _actionRef$current2$r.call(_actionRef$current2);
|
|
375
|
-
},
|
|
490
|
+
onClick: handleResetForm,
|
|
376
491
|
size: "middle"
|
|
377
492
|
}, "\u91CD\u7F6E"), /*#__PURE__*/_react.default.createElement("a", {
|
|
378
493
|
key: "3",
|
|
@@ -380,75 +495,63 @@ function PlusTable(props, ref) {
|
|
|
380
495
|
wordBreak: 'break-word',
|
|
381
496
|
whiteSpace: 'nowrap'
|
|
382
497
|
},
|
|
383
|
-
onClick:
|
|
384
|
-
var _drawFormRef$current6, _searchRef$current6;
|
|
385
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
386
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
387
|
-
case 0:
|
|
388
|
-
_context9.next = 2;
|
|
389
|
-
return setSearchDrawer(!searchDrawer);
|
|
390
|
-
case 2:
|
|
391
|
-
// 没法实时监听数据所以这里要带过来
|
|
392
|
-
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current6 = drawFormRef.current) === null || _drawFormRef$current6 === void 0 ? void 0 : _drawFormRef$current6.setFieldsValue(searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current6 = searchRef.current) === null || _searchRef$current6 === void 0 ? void 0 : _searchRef$current6.getFieldsValue());
|
|
393
|
-
case 3:
|
|
394
|
-
case "end":
|
|
395
|
-
return _context9.stop();
|
|
396
|
-
}
|
|
397
|
-
}, _callee9);
|
|
398
|
-
}))
|
|
498
|
+
onClick: handleAdvancedFilterClick
|
|
399
499
|
}, /*#__PURE__*/_react.default.createElement(_icons.BarsOutlined, null), "\u9AD8\u7EA7\u7B5B\u9009")];
|
|
400
500
|
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
|
|
501
|
+
});
|
|
502
|
+
}, [action, props.search, handleSearchAll, handleResetForm, handleAdvancedFilterClick]);
|
|
503
|
+
// 优化:使用 useMemo 缓存工具栏渲染
|
|
504
|
+
var toolBarRender = (0, _react.useCallback)(function (searchConfig, rows) {
|
|
505
|
+
return [(action === null || action === void 0 ? void 0 : action.includes('viewInvisibleData')) ? /*#__PURE__*/_react.default.createElement(_antd.Checkbox, {
|
|
506
|
+
defaultChecked: showFull,
|
|
507
|
+
onChange: handleShowFullChange
|
|
508
|
+
}, "\u663E\u793A\u6240\u6709\u6570\u636E") : null, typeof otherProps.toolBarRender === 'function' && otherProps.toolBarRender(searchConfig, rows)];
|
|
509
|
+
}, [action, showFull, handleShowFullChange, otherProps.toolBarRender]);
|
|
510
|
+
// 优化:使用 useMemo 缓存抽屉样式
|
|
511
|
+
var drawerStyle = (0, _react.useMemo)(function () {
|
|
512
|
+
return {
|
|
513
|
+
position: 'fixed',
|
|
514
|
+
top: props.top || CONSTANTS.DEFAULT_TOP
|
|
515
|
+
};
|
|
516
|
+
}, [props.top]);
|
|
517
|
+
// 优化:使用 useMemo 缓存抽屉底部按钮样式
|
|
518
|
+
var bottomButtonStyle = (0, _react.useMemo)(function () {
|
|
519
|
+
return {
|
|
520
|
+
position: 'fixed',
|
|
521
|
+
bottom: 0,
|
|
522
|
+
background: 'white',
|
|
523
|
+
display: 'flex',
|
|
524
|
+
width: "".concat(CONSTANTS.DRAWER_WIDTH, "px"),
|
|
525
|
+
borderTop: '1px solid #f0f0f0',
|
|
526
|
+
right: '0',
|
|
527
|
+
justifyContent: 'space-around',
|
|
528
|
+
padding: '16px',
|
|
529
|
+
boxSizing: 'border-box'
|
|
530
|
+
};
|
|
531
|
+
}, []);
|
|
532
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
533
|
+
className: "page_plustable__body"
|
|
534
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
535
|
+
prefixCls: "ant"
|
|
536
|
+
}, /*#__PURE__*/_react.default.createElement(_proComponents.ProTable, _extends({
|
|
537
|
+
pagination: _objectSpread({
|
|
538
|
+
size: 'default'
|
|
539
|
+
}, pagination),
|
|
540
|
+
actionRef: actionRef,
|
|
541
|
+
formRef: searchRef,
|
|
542
|
+
search: searchConfig,
|
|
404
543
|
columnsState: (action === null || action === void 0 ? void 0 : action.includes('columnSetting')) ? columnsState : props.columnsState,
|
|
405
|
-
request: request ? propsRequest : undefined
|
|
406
|
-
|
|
407
|
-
,
|
|
408
|
-
columns: (action === null || action === void 0 ? void 0 : action.includes('advancedFilter')) ? columns.map(function (item) {
|
|
409
|
-
// 只保留基本搜索栏的配置
|
|
410
|
-
if (item.baseSearch) {
|
|
411
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
412
|
-
search: item.search,
|
|
413
|
-
fieldProps: _objectSpread({
|
|
414
|
-
onChange: function onChange(e) {
|
|
415
|
-
if (e) {
|
|
416
|
-
var _drawFormRef$current7;
|
|
417
|
-
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current7 = drawFormRef.current) === null || _drawFormRef$current7 === void 0 ? void 0 : _drawFormRef$current7.setFieldsValue(_defineProperty({}, item.dataIndex, e.target ? e.target.value : e));
|
|
418
|
-
} else {
|
|
419
|
-
var _drawFormRef$current9;
|
|
420
|
-
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current9 = drawFormRef.current) === null || _drawFormRef$current9 === void 0 ? void 0 : _drawFormRef$current9.resetFields([item.dataIndex]);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}, item.fieldProps)
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
427
|
-
search: false
|
|
428
|
-
});
|
|
429
|
-
}) : columns,
|
|
430
|
-
toolBarRender: function toolBarRender(searchConfig, rows) {
|
|
431
|
-
return [(action === null || action === void 0 ? void 0 : action.includes('viewInvisibleData')) ? /*#__PURE__*/_react.default.createElement(_antd.Checkbox, {
|
|
432
|
-
defaultChecked: showFull,
|
|
433
|
-
onChange: function onChange(e) {
|
|
434
|
-
setShowFull(e.target.checked);
|
|
435
|
-
setTimeout(function () {
|
|
436
|
-
searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.reload();
|
|
437
|
-
}, 100);
|
|
438
|
-
}
|
|
439
|
-
}, "\u663E\u793A\u6240\u6709\u6570\u636E") : null, typeof otherProps.toolBarRender === 'function' && otherProps.toolBarRender(searchConfig, rows)];
|
|
440
|
-
},
|
|
544
|
+
request: request ? propsRequest : undefined,
|
|
545
|
+
columns: processedColumns,
|
|
546
|
+
toolBarRender: toolBarRender,
|
|
441
547
|
options: __options
|
|
442
548
|
}, otherProps)), /*#__PURE__*/_react.default.createElement(_antd.Drawer, {
|
|
443
549
|
onClose: function onClose() {
|
|
444
550
|
return setSearchDrawer(false);
|
|
445
551
|
},
|
|
446
|
-
title:
|
|
447
|
-
width:
|
|
448
|
-
rootStyle:
|
|
449
|
-
position: 'fixed',
|
|
450
|
-
top: props.top || 92
|
|
451
|
-
},
|
|
552
|
+
title: "\u9AD8\u7EA7\u7B5B\u9009",
|
|
553
|
+
width: CONSTANTS.DRAWER_WIDTH,
|
|
554
|
+
rootStyle: drawerStyle,
|
|
452
555
|
getContainer: (otherProps === null || otherProps === void 0 ? void 0 : otherProps.getContainer) || document.getElementsByTagName('body')[0],
|
|
453
556
|
className: "search-drawer",
|
|
454
557
|
open: searchDrawer,
|
|
@@ -457,9 +560,7 @@ function PlusTable(props, ref) {
|
|
|
457
560
|
}, /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
458
561
|
columns: columns,
|
|
459
562
|
loading: false,
|
|
460
|
-
changeValue:
|
|
461
|
-
return onValuesChange(_changeValue, allValue);
|
|
462
|
-
},
|
|
563
|
+
changeValue: onValuesChange,
|
|
463
564
|
onFormSearchSubmit: function onFormSearchSubmit() {
|
|
464
565
|
var _searchRef$current7;
|
|
465
566
|
searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current7 = searchRef.current) === null || _searchRef$current7 === void 0 ? void 0 : _searchRef$current7.submit();
|
|
@@ -474,32 +575,17 @@ function PlusTable(props, ref) {
|
|
|
474
575
|
search: {
|
|
475
576
|
optionRender: function optionRender(searchConfig) {
|
|
476
577
|
return [/*#__PURE__*/_react.default.createElement("div", {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
bottom: 0,
|
|
480
|
-
background: 'white',
|
|
481
|
-
display: 'flex',
|
|
482
|
-
width: '380px',
|
|
483
|
-
borderTop: '1px solid #f0f0f0',
|
|
484
|
-
right: '0',
|
|
485
|
-
justifyContent: 'space-around',
|
|
486
|
-
padding: '16px',
|
|
487
|
-
boxSizing: 'border-box'
|
|
488
|
-
}
|
|
578
|
+
key: "bottom-buttons",
|
|
579
|
+
style: bottomButtonStyle
|
|
489
580
|
}, /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
490
581
|
size: "middle",
|
|
491
582
|
type: "primary",
|
|
492
583
|
onClick: function onClick() {
|
|
493
|
-
handleSearchAll(searchConfig);
|
|
584
|
+
return handleSearchAll(searchConfig);
|
|
494
585
|
}
|
|
495
586
|
}, "\u67E5\u8BE2"), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
496
587
|
type: "default",
|
|
497
|
-
onClick:
|
|
498
|
-
var _drawFormRef$current10, _actionRef$current3, _actionRef$current3$r, _actionRef$current4, _actionRef$current4$r;
|
|
499
|
-
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current10 = drawFormRef.current) === null || _drawFormRef$current10 === void 0 ? void 0 : _drawFormRef$current10.resetFields();
|
|
500
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$r = _actionRef$current3.reset) === null || _actionRef$current3$r === void 0 ? void 0 : _actionRef$current3$r.call(_actionRef$current3);
|
|
501
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$r = _actionRef$current4.reload) === null || _actionRef$current4$r === void 0 ? void 0 : _actionRef$current4$r.call(_actionRef$current4);
|
|
502
|
-
},
|
|
588
|
+
onClick: handleResetForm,
|
|
503
589
|
size: "middle"
|
|
504
590
|
}, "\u91CD\u7F6E"))];
|
|
505
591
|
},
|
|
@@ -510,6 +596,6 @@ function PlusTable(props, ref) {
|
|
|
510
596
|
},
|
|
511
597
|
manualRequest: true,
|
|
512
598
|
action: actionRef
|
|
513
|
-
})));
|
|
599
|
+
}))));
|
|
514
600
|
}
|
|
515
601
|
var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(PlusTable);
|