|
|
@@ -374,17 +374,13 @@ export function formatValue(callValue: any) {
|
|
|
* @param {String} prop 当前 prop
|
|
|
* @returns {*}
|
|
|
* */
|
|
|
-export function handleRowAccordingToProp(row: { [key: string]: any }, prop: string, ...args: any[]) {
|
|
|
- const format = args[0];
|
|
|
-
|
|
|
- if (format) {
|
|
|
- const val = row[prop];
|
|
|
- const hasValue = val !== null && val !== undefined && val !== "";
|
|
|
-
|
|
|
- return hasValue && formatFn[format] ? formatFn[format]({ val, format }) : val ?? "";
|
|
|
+export function handleRowAccordingToProp(row: { [key: string]: any }, prop: string, ...args: any) {
|
|
|
+ if (args[0]) {
|
|
|
+ return row[prop] && formatFn[args[0]] ? formatFn[args[0]]({ val: row[prop], format: args[0] }) : "";
|
|
|
}
|
|
|
-
|
|
|
- return row[prop];
|
|
|
+ if (!prop.includes(".")) return row[prop] ?? "";
|
|
|
+ prop.split(".").forEach(item => (row = row[item] ?? ""));
|
|
|
+ return row;
|
|
|
}
|
|
|
|
|
|
// 工具函数:解析 formatType
|