[backend] fix: 修复异常处理和类型转换问题

This commit is contained in:
xsl
2026-01-26 11:53:40 +08:00
parent 7ccc2a6ac6
commit 83e05bf85f
28639 changed files with 2506458 additions and 93 deletions
+32
View File
@@ -0,0 +1,32 @@
export const getColumnKey = (column, defaultKey) => {
if ('key' in column && column.key !== undefined && column.key !== null) {
return column.key;
}
if (column.dataIndex) {
return Array.isArray(column.dataIndex) ? column.dataIndex.join('.') : column.dataIndex;
}
return defaultKey;
};
export function getColumnPos(index, pos) {
return pos ? `${pos}-${index}` : `${index}`;
}
export const renderColumnTitle = (title, props) => {
if (typeof title === 'function') {
return title(props);
}
return title;
};
/**
* Safe get column title
*
* Should filter [object Object]
*
* @param title
*/
export const safeColumnTitle = (title, props) => {
const res = renderColumnTitle(title, props);
if (Object.prototype.toString.call(res) === '[object Object]') {
return '';
}
return res;
};