@fle-ui/plus-table 1.2.28 → 1.2.30-beta.0
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 +5 -3
- package/es/index.d.ts +3 -3
- package/es/index.js +437 -336
- 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 +5 -3
- package/lib/index.d.ts +3 -3
- package/lib/index.js +436 -335
- 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,417 @@ 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
|
-
|
|
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;
|
|
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)) {
|
|
230
|
+
_context5.next = 7;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
_context5.next = 7;
|
|
234
|
+
return init();
|
|
235
|
+
case 7:
|
|
236
|
+
_context5.next = 12;
|
|
237
|
+
break;
|
|
238
|
+
case 9:
|
|
239
|
+
_context5.prev = 9;
|
|
240
|
+
_context5.t0 = _context5["catch"](0);
|
|
241
|
+
console.error('重置列设置失败:', _context5.t0);
|
|
242
|
+
case 12:
|
|
243
|
+
case "end":
|
|
244
|
+
return _context5.stop();
|
|
245
|
+
}
|
|
246
|
+
}, _callee5, null, [[0, 9]]);
|
|
247
|
+
})), [props.resetSetting]);
|
|
248
|
+
// 优化:使用 useCallback 避免重复创建函数
|
|
249
|
+
var init = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
250
|
+
var res;
|
|
251
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
252
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
253
|
+
case 0:
|
|
254
|
+
if (!props.fetchSetting) {
|
|
255
|
+
_context6.next = 11;
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
_context6.prev = 1;
|
|
259
|
+
_context6.next = 4;
|
|
260
|
+
return props.fetchSetting();
|
|
261
|
+
case 4:
|
|
262
|
+
res = _context6.sent;
|
|
263
|
+
setColumnsStateMap(res);
|
|
264
|
+
_context6.next = 11;
|
|
265
|
+
break;
|
|
266
|
+
case 8:
|
|
267
|
+
_context6.prev = 8;
|
|
268
|
+
_context6.t0 = _context6["catch"](1);
|
|
269
|
+
console.error('获取列设置失败:', _context6.t0);
|
|
270
|
+
case 11:
|
|
271
|
+
case "end":
|
|
272
|
+
return _context6.stop();
|
|
273
|
+
}
|
|
274
|
+
}, _callee6, null, [[1, 8]]);
|
|
275
|
+
})), [props.fetchSetting]);
|
|
276
|
+
var onValuesChange = (0, _react.useCallback)(function (changeValue, allValue) {
|
|
277
|
+
try {
|
|
278
|
+
var _drawFormRef$current4;
|
|
279
|
+
var currentValues = (_drawFormRef$current4 = drawFormRef.current) === null || _drawFormRef$current4 === void 0 ? void 0 : _drawFormRef$current4.getFieldsValue();
|
|
280
|
+
if (currentValues) {
|
|
281
|
+
var _searchRef$current4;
|
|
282
|
+
searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current4 = searchRef.current) === null || _searchRef$current4 === void 0 ? void 0 : _searchRef$current4.setFieldsValue(currentValues);
|
|
283
|
+
}
|
|
284
|
+
} catch (error) {
|
|
285
|
+
console.error('同步表单值失败:', error);
|
|
286
|
+
}
|
|
287
|
+
}, []);
|
|
288
|
+
var handleSearchAll = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
289
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(searchConfig) {
|
|
231
290
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
232
291
|
while (1) switch (_context7.prev = _context7.next) {
|
|
233
292
|
case 0:
|
|
234
|
-
|
|
293
|
+
try {
|
|
294
|
+
searchConfig.form.submit();
|
|
295
|
+
} catch (error) {
|
|
296
|
+
console.error('搜索失败:', error);
|
|
297
|
+
}
|
|
235
298
|
case 1:
|
|
236
299
|
case "end":
|
|
237
300
|
return _context7.stop();
|
|
238
301
|
}
|
|
239
302
|
}, _callee7);
|
|
240
303
|
}));
|
|
241
|
-
return function
|
|
242
|
-
return
|
|
304
|
+
return function (_x4) {
|
|
305
|
+
return _ref7.apply(this, arguments);
|
|
243
306
|
};
|
|
244
|
-
}();
|
|
307
|
+
}(), []);
|
|
308
|
+
var handleShowFullChange = (0, _react.useCallback)(function (e) {
|
|
309
|
+
setShowFull(e.target.checked);
|
|
310
|
+
// 优化:使用 requestAnimationFrame 替代 setTimeout
|
|
311
|
+
requestAnimationFrame(function () {
|
|
312
|
+
var _actionRef$current, _actionRef$current$re;
|
|
313
|
+
(_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);
|
|
314
|
+
});
|
|
315
|
+
}, []);
|
|
316
|
+
var handleAdvancedFilterClick = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
317
|
+
var newDrawerState, _searchRef$current5, _drawFormRef$current5, fieldsValue;
|
|
318
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
319
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
320
|
+
case 0:
|
|
321
|
+
_context8.prev = 0;
|
|
322
|
+
newDrawerState = !searchDrawer;
|
|
323
|
+
setSearchDrawer(newDrawerState);
|
|
324
|
+
if (!newDrawerState) {
|
|
325
|
+
_context8.next = 8;
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
_context8.next = 6;
|
|
329
|
+
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current5 = searchRef.current) === null || _searchRef$current5 === void 0 ? void 0 : _searchRef$current5.getFieldsValue();
|
|
330
|
+
case 6:
|
|
331
|
+
fieldsValue = _context8.sent;
|
|
332
|
+
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current5 = drawFormRef.current) === null || _drawFormRef$current5 === void 0 ? void 0 : _drawFormRef$current5.setFieldsValue(fieldsValue);
|
|
333
|
+
case 8:
|
|
334
|
+
_context8.next = 13;
|
|
335
|
+
break;
|
|
336
|
+
case 10:
|
|
337
|
+
_context8.prev = 10;
|
|
338
|
+
_context8.t0 = _context8["catch"](0);
|
|
339
|
+
console.error('切换高级筛选失败:', _context8.t0);
|
|
340
|
+
case 13:
|
|
341
|
+
case "end":
|
|
342
|
+
return _context8.stop();
|
|
343
|
+
}
|
|
344
|
+
}, _callee8, null, [[0, 10]]);
|
|
345
|
+
})), [searchDrawer]);
|
|
346
|
+
var handleResetForm = (0, _react.useCallback)(function () {
|
|
347
|
+
try {
|
|
348
|
+
var _drawFormRef$current6, _actionRef$current2, _actionRef$current2$r, _actionRef$current3, _actionRef$current3$r;
|
|
349
|
+
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current6 = drawFormRef.current) === null || _drawFormRef$current6 === void 0 ? void 0 : _drawFormRef$current6.resetFields();
|
|
350
|
+
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);
|
|
351
|
+
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);
|
|
352
|
+
} catch (error) {
|
|
353
|
+
console.error('重置表单失败:', error);
|
|
354
|
+
}
|
|
355
|
+
}, []);
|
|
245
356
|
(0, _react.useEffect)(function () {
|
|
246
357
|
init();
|
|
247
|
-
}, []);
|
|
248
|
-
|
|
249
|
-
|
|
358
|
+
}, [init]);
|
|
359
|
+
// 优化:使用 useMemo 缓存计算结果
|
|
360
|
+
var dealFetchParams = (0, _react.useCallback)(function (params) {
|
|
250
361
|
var fetchParams = {};
|
|
251
362
|
columns.forEach(function (item) {
|
|
252
|
-
var
|
|
253
|
-
if ((item === null || item === void 0 ? void 0 :
|
|
254
|
-
|
|
363
|
+
var dataIndex = item.dataIndex;
|
|
364
|
+
if ((item === null || item === void 0 ? void 0 : item.search) && _typeof(item.search) === 'object' && item.search.transform && params[dataIndex]) {
|
|
365
|
+
var transformResult = item.search.transform(params[dataIndex], dataIndex, params);
|
|
366
|
+
if (transformResult && _typeof(transformResult) === 'object') {
|
|
367
|
+
Object.assign(fetchParams, transformResult);
|
|
368
|
+
}
|
|
255
369
|
} else {
|
|
256
|
-
fetchParams =
|
|
370
|
+
fetchParams[dataIndex] = params[dataIndex];
|
|
257
371
|
}
|
|
258
372
|
});
|
|
259
373
|
return fetchParams;
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
374
|
+
}, [columns]);
|
|
375
|
+
// 优化:使用 useMemo 缓存列状态配置
|
|
376
|
+
var columnsState = (0, _react.useMemo)(function () {
|
|
377
|
+
return {
|
|
378
|
+
defaultValue: defaultColumnsState,
|
|
379
|
+
value: columnsStateMap,
|
|
380
|
+
onChange: handleOnChangeColumn
|
|
381
|
+
};
|
|
382
|
+
}, [defaultColumnsState, columnsStateMap, handleOnChangeColumn]);
|
|
383
|
+
// 优化:使用 useCallback 缓存请求函数
|
|
384
|
+
var propsRequest = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
385
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(params, sort, filter) {
|
|
386
|
+
var _searchRef$current6, _drawFormRef$current7, res1, res2;
|
|
387
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
388
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
273
389
|
case 0:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
390
|
+
_context9.prev = 0;
|
|
391
|
+
_context9.next = 3;
|
|
392
|
+
return 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
|
+
res1 = _context9.sent;
|
|
395
|
+
_context9.next = 6;
|
|
396
|
+
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current7 = drawFormRef.current) === null || _drawFormRef$current7 === void 0 ? void 0 : _drawFormRef$current7.getFieldsValue();
|
|
397
|
+
case 6:
|
|
398
|
+
res2 = _context9.sent;
|
|
399
|
+
if (request) {
|
|
400
|
+
_context9.next = 9;
|
|
284
401
|
break;
|
|
285
402
|
}
|
|
286
|
-
|
|
403
|
+
return _context9.abrupt("return", {});
|
|
404
|
+
case 9:
|
|
405
|
+
_context9.next = 11;
|
|
287
406
|
return request(_objectSpread(_objectSpread(_objectSpread({}, params), dealFetchParams(_objectSpread(_objectSpread(_objectSpread({}, res1), res2), params))), {}, {
|
|
288
407
|
showFull: showFull
|
|
289
408
|
}), sort, filter);
|
|
290
|
-
case
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
return _context8.abrupt("return", res);
|
|
299
|
-
case 15:
|
|
409
|
+
case 11:
|
|
410
|
+
return _context9.abrupt("return", _context9.sent);
|
|
411
|
+
case 14:
|
|
412
|
+
_context9.prev = 14;
|
|
413
|
+
_context9.t0 = _context9["catch"](0);
|
|
414
|
+
console.error('请求数据失败:', _context9.t0);
|
|
415
|
+
return _context9.abrupt("return", {});
|
|
416
|
+
case 18:
|
|
300
417
|
case "end":
|
|
301
|
-
return
|
|
418
|
+
return _context9.stop();
|
|
302
419
|
}
|
|
303
|
-
},
|
|
420
|
+
}, _callee9, null, [[0, 14]]);
|
|
304
421
|
}));
|
|
305
|
-
return function
|
|
306
|
-
return
|
|
422
|
+
return function (_x5, _x6, _x7) {
|
|
423
|
+
return _ref9.apply(this, arguments);
|
|
307
424
|
};
|
|
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
|
-
x: (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$scroll = otherProps.scroll) === null || _otherProps$scroll === void 0 ? void 0 : _otherProps$scroll.x) || 1300
|
|
425
|
+
}(), [request, dealFetchParams, showFull]);
|
|
426
|
+
// 优化:使用 useMemo 缓存选项配置
|
|
427
|
+
var __options = (0, _react.useMemo)(function () {
|
|
428
|
+
var optionsSetting = _typeof(options) === 'object' && _typeof(options.setting) === 'object' ? options.setting : {};
|
|
429
|
+
if ((action === null || action === void 0 ? void 0 : action.includes('columnSetting')) && showDefaultSetting !== true) {
|
|
430
|
+
return _objectSpread(_objectSpread({}, options), {}, {
|
|
431
|
+
setting: _objectSpread(_objectSpread({}, optionsSetting), {}, {
|
|
432
|
+
checkedReset: false,
|
|
433
|
+
showListItemOption: true,
|
|
434
|
+
extra: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("a", {
|
|
435
|
+
onClick: handleSave,
|
|
436
|
+
style: {
|
|
437
|
+
cursor: isLoading ? 'not-allowed' : 'pointer',
|
|
438
|
+
opacity: isLoading ? 0.6 : 1,
|
|
439
|
+
pointerEvents: isLoading ? 'none' : 'auto'
|
|
440
|
+
}
|
|
441
|
+
}, isLoading ? '保存中...' : '保存'), /*#__PURE__*/_react.default.createElement("a", {
|
|
442
|
+
style: {
|
|
443
|
+
color: '#333'
|
|
444
|
+
},
|
|
445
|
+
onClick: handleReset
|
|
446
|
+
}, "\u91CD\u7F6E"))
|
|
447
|
+
})
|
|
448
|
+
});
|
|
333
449
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
450
|
+
return options;
|
|
451
|
+
}, [options, action, showDefaultSetting, handleSave, handleReset, isLoading]);
|
|
452
|
+
// 优化:使用 useMemo 缓存列配置
|
|
453
|
+
var processedColumns = (0, _react.useMemo)(function () {
|
|
454
|
+
if (!(action === null || action === void 0 ? void 0 : action.includes('advancedFilter'))) {
|
|
455
|
+
return columns;
|
|
456
|
+
}
|
|
457
|
+
return columns.map(function (item) {
|
|
458
|
+
if (item.baseSearch) {
|
|
459
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
460
|
+
search: item.search,
|
|
461
|
+
fieldProps: _objectSpread({
|
|
462
|
+
onChange: function onChange(e) {
|
|
463
|
+
try {
|
|
464
|
+
if (e) {
|
|
465
|
+
var _drawFormRef$current8;
|
|
466
|
+
var value = e.target ? e.target.value : e;
|
|
467
|
+
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));
|
|
468
|
+
} else {
|
|
469
|
+
var _drawFormRef$current10;
|
|
470
|
+
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current10 = drawFormRef.current) === null || _drawFormRef$current10 === void 0 ? void 0 : _drawFormRef$current10.resetFields([item.dataIndex]);
|
|
471
|
+
}
|
|
472
|
+
} catch (error) {
|
|
473
|
+
console.error('字段值变更处理失败:', error);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}, item.fieldProps)
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
480
|
+
search: false
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
}, [columns, action]);
|
|
484
|
+
// 优化:使用 useMemo 缓存搜索配置
|
|
485
|
+
var searchConfig = (0, _react.useMemo)(function () {
|
|
486
|
+
if (!(action === null || action === void 0 ? void 0 : action.includes('advancedFilter'))) {
|
|
487
|
+
return props.search;
|
|
488
|
+
}
|
|
489
|
+
return _objectSpread(_objectSpread({}, search), {}, {
|
|
490
|
+
span: CONSTANTS.SEARCH_SPAN,
|
|
491
|
+
labelWidth: CONSTANTS.LABEL_WIDTH,
|
|
356
492
|
collapseRender: function collapseRender() {
|
|
357
493
|
return null;
|
|
358
494
|
},
|
|
@@ -362,17 +498,12 @@ function PlusTable(props, ref) {
|
|
|
362
498
|
size: "middle",
|
|
363
499
|
type: "primary",
|
|
364
500
|
onClick: function onClick() {
|
|
365
|
-
handleSearchAll(searchConfig);
|
|
501
|
+
return handleSearchAll(searchConfig);
|
|
366
502
|
}
|
|
367
503
|
}, "\u67E5\u8BE2"), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
368
504
|
key: "2",
|
|
369
505
|
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
|
-
},
|
|
506
|
+
onClick: handleResetForm,
|
|
376
507
|
size: "middle"
|
|
377
508
|
}, "\u91CD\u7F6E"), /*#__PURE__*/_react.default.createElement("a", {
|
|
378
509
|
key: "3",
|
|
@@ -380,75 +511,62 @@ function PlusTable(props, ref) {
|
|
|
380
511
|
wordBreak: 'break-word',
|
|
381
512
|
whiteSpace: 'nowrap'
|
|
382
513
|
},
|
|
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
|
-
}))
|
|
514
|
+
onClick: handleAdvancedFilterClick
|
|
399
515
|
}, /*#__PURE__*/_react.default.createElement(_icons.BarsOutlined, null), "\u9AD8\u7EA7\u7B5B\u9009")];
|
|
400
516
|
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
|
|
517
|
+
});
|
|
518
|
+
}, [action, props.search, handleSearchAll, handleResetForm, handleAdvancedFilterClick]);
|
|
519
|
+
// 优化:使用 useMemo 缓存工具栏渲染
|
|
520
|
+
var toolBarRender = (0, _react.useCallback)(function (searchConfig, rows) {
|
|
521
|
+
return [(action === null || action === void 0 ? void 0 : action.includes('viewInvisibleData')) ? /*#__PURE__*/_react.default.createElement(_antd.Checkbox, {
|
|
522
|
+
defaultChecked: showFull,
|
|
523
|
+
onChange: handleShowFullChange
|
|
524
|
+
}, "\u663E\u793A\u6240\u6709\u6570\u636E") : null, typeof otherProps.toolBarRender === 'function' && otherProps.toolBarRender(searchConfig, rows)];
|
|
525
|
+
}, [action, showFull, handleShowFullChange, otherProps.toolBarRender]);
|
|
526
|
+
// 优化:使用 useMemo 缓存抽屉样式
|
|
527
|
+
var drawerStyle = (0, _react.useMemo)(function () {
|
|
528
|
+
return {
|
|
529
|
+
position: 'fixed',
|
|
530
|
+
top: props.top || CONSTANTS.DEFAULT_TOP
|
|
531
|
+
};
|
|
532
|
+
}, [props.top]);
|
|
533
|
+
// 优化:使用 useMemo 缓存抽屉底部按钮样式
|
|
534
|
+
var bottomButtonStyle = (0, _react.useMemo)(function () {
|
|
535
|
+
return {
|
|
536
|
+
position: 'fixed',
|
|
537
|
+
bottom: 0,
|
|
538
|
+
background: 'white',
|
|
539
|
+
display: 'flex',
|
|
540
|
+
width: "".concat(CONSTANTS.DRAWER_WIDTH, "px"),
|
|
541
|
+
borderTop: '1px solid #f0f0f0',
|
|
542
|
+
right: '0',
|
|
543
|
+
justifyContent: 'space-around',
|
|
544
|
+
padding: '16px',
|
|
545
|
+
boxSizing: 'border-box'
|
|
546
|
+
};
|
|
547
|
+
}, []);
|
|
548
|
+
console.log('searchConfig', searchConfig);
|
|
549
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
550
|
+
className: "page_plustable__body"
|
|
551
|
+
}, /*#__PURE__*/_react.default.createElement(_proComponents.ProTable, _extends({
|
|
552
|
+
pagination: _objectSpread({
|
|
553
|
+
size: 'default'
|
|
554
|
+
}, pagination),
|
|
555
|
+
actionRef: actionRef,
|
|
556
|
+
formRef: searchRef,
|
|
557
|
+
search: searchConfig,
|
|
404
558
|
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
|
-
},
|
|
559
|
+
request: request ? propsRequest : undefined,
|
|
560
|
+
columns: processedColumns,
|
|
561
|
+
toolBarRender: toolBarRender,
|
|
441
562
|
options: __options
|
|
442
563
|
}, otherProps)), /*#__PURE__*/_react.default.createElement(_antd.Drawer, {
|
|
443
564
|
onClose: function onClose() {
|
|
444
565
|
return setSearchDrawer(false);
|
|
445
566
|
},
|
|
446
|
-
title:
|
|
447
|
-
width:
|
|
448
|
-
rootStyle:
|
|
449
|
-
position: 'fixed',
|
|
450
|
-
top: props.top || 92
|
|
451
|
-
},
|
|
567
|
+
title: "\u9AD8\u7EA7\u7B5B\u9009",
|
|
568
|
+
width: CONSTANTS.DRAWER_WIDTH,
|
|
569
|
+
rootStyle: drawerStyle,
|
|
452
570
|
getContainer: (otherProps === null || otherProps === void 0 ? void 0 : otherProps.getContainer) || document.getElementsByTagName('body')[0],
|
|
453
571
|
className: "search-drawer",
|
|
454
572
|
open: searchDrawer,
|
|
@@ -457,9 +575,7 @@ function PlusTable(props, ref) {
|
|
|
457
575
|
}, /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
458
576
|
columns: columns,
|
|
459
577
|
loading: false,
|
|
460
|
-
changeValue:
|
|
461
|
-
return onValuesChange(_changeValue, allValue);
|
|
462
|
-
},
|
|
578
|
+
changeValue: onValuesChange,
|
|
463
579
|
onFormSearchSubmit: function onFormSearchSubmit() {
|
|
464
580
|
var _searchRef$current7;
|
|
465
581
|
searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current7 = searchRef.current) === null || _searchRef$current7 === void 0 ? void 0 : _searchRef$current7.submit();
|
|
@@ -474,32 +590,17 @@ function PlusTable(props, ref) {
|
|
|
474
590
|
search: {
|
|
475
591
|
optionRender: function optionRender(searchConfig) {
|
|
476
592
|
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
|
-
}
|
|
593
|
+
key: "bottom-buttons",
|
|
594
|
+
style: bottomButtonStyle
|
|
489
595
|
}, /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
490
596
|
size: "middle",
|
|
491
597
|
type: "primary",
|
|
492
598
|
onClick: function onClick() {
|
|
493
|
-
handleSearchAll(searchConfig);
|
|
599
|
+
return handleSearchAll(searchConfig);
|
|
494
600
|
}
|
|
495
601
|
}, "\u67E5\u8BE2"), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
496
602
|
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
|
-
},
|
|
603
|
+
onClick: handleResetForm,
|
|
503
604
|
size: "middle"
|
|
504
605
|
}, "\u91CD\u7F6E"))];
|
|
505
606
|
},
|