@cloudbase/weda-ui 3.6.7 → 3.6.8
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.
|
@@ -184,22 +184,23 @@ const getSearchValues = (searchValues) => {
|
|
|
184
184
|
};
|
|
185
185
|
});
|
|
186
186
|
};
|
|
187
|
+
const orderByFieldKey = (key, columns) => {
|
|
188
|
+
var _a;
|
|
189
|
+
return ((_a = columns === null || columns === void 0 ? void 0 : columns.find((i) => key === (i === null || i === void 0 ? void 0 : i.slotKey))) === null || _a === void 0 ? void 0 : _a.fieldKey) || key;
|
|
190
|
+
};
|
|
187
191
|
const getPageParam = ({ defaultSort, sort: _sort, params, _defaultPageSize, _defaultPageIndex, supportManyRelated, columns, isSupportMultipleSort, }) => {
|
|
188
192
|
let sort = defaultSort || [];
|
|
189
193
|
// 运行态有值,以运行态为准
|
|
190
194
|
if ((_sort === null || _sort === void 0 ? void 0 : _sort.length) && _sort[0].order) {
|
|
191
|
-
params.orderBy = _sort[0].by;
|
|
195
|
+
params.orderBy = orderByFieldKey(_sort[0].by, columns);
|
|
192
196
|
params.orderType = _sort[0].order;
|
|
193
197
|
sort = _sort;
|
|
194
198
|
}
|
|
195
199
|
// 后端根据业务字段排序
|
|
196
|
-
sort = sort === null || sort === void 0 ? void 0 : sort.map((n) => {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
by: ((_a = columns === null || columns === void 0 ? void 0 : columns.find((i) => n.by === i.slotKey)) === null || _a === void 0 ? void 0 : _a.fieldKey) || n.by,
|
|
201
|
-
});
|
|
202
|
-
});
|
|
200
|
+
sort = sort === null || sort === void 0 ? void 0 : sort.map((n) => ({
|
|
201
|
+
...n,
|
|
202
|
+
by: orderByFieldKey(n.by, columns),
|
|
203
|
+
}));
|
|
203
204
|
const _pageSize = parseInt(`${params.pageSize}`);
|
|
204
205
|
params.pageSize = isNaN(_pageSize) ? _defaultPageSize : _pageSize;
|
|
205
206
|
const _pageNo = parseInt(`${params.pageNo}`);
|