From 4c53a5386893f07e9e5a583c46e21792a9b5c3ca Mon Sep 17 00:00:00 2001 From: zhangwenshuai Date: Thu, 25 Jun 2020 02:38:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E6=9C=9Fformat?= =?UTF-8?q?=E5=88=A4=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/base/_utils/setFormatter.tsx | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/components/apolloTable/component/base/_utils/setFormatter.tsx b/components/apolloTable/component/base/_utils/setFormatter.tsx index 21406a7..e079244 100644 --- a/components/apolloTable/component/base/_utils/setFormatter.tsx +++ b/components/apolloTable/component/base/_utils/setFormatter.tsx @@ -84,10 +84,10 @@ export const SetFormatter = { }, NUMBER: (val, config) => { if (!isNumber(val)) return emptyModel; - const { unit = {} } = config || {}; // 设置单位 + const { unit = {} } = config || {}; // 设置单位 if (unit && unit.code === 'wan') { const newVal = val ? val * 10000 : val; - return [{ value: newVal, text: newVal }] + return [{ value: newVal, text: newVal }]; } return [{ value: val, text: val }]; }, @@ -148,7 +148,7 @@ export const SetFormatter = { } const formateArr = arr .map((ls, index) => { - return ls.format ? ls.format(index === 0 ? setStartFormat : setEndFormat) : ls; + return ls && ls.format ? ls.format(index === 0 ? setStartFormat : setEndFormat) : ls; }) .join('~'); return [ @@ -198,6 +198,19 @@ export const SetFormatter = { textArr.push(ls.label); valueArr.push(ls.value); }); - return [{ text: textArr.filter((ls) => { return ls; }).join('-'), value: valueArr.filter((ls) => { return ls; }).join('-') }]; + return [ + { + text: textArr + .filter((ls) => { + return ls; + }) + .join('-'), + value: valueArr + .filter((ls) => { + return ls; + }) + .join('-'), + }, + ]; }, }; -- 2.21.0