diff --git a/components/apolloTable/component/base/_utils/getFormatter.tsx b/components/apolloTable/component/base/_utils/getFormatter.tsx index 4bef74043bb262b0436c9c985c09d29523c5f67e..6cc35459aaba63b27a5df0a8ba37306151fb5aed 100644 --- a/components/apolloTable/component/base/_utils/getFormatter.tsx +++ b/components/apolloTable/component/base/_utils/getFormatter.tsx @@ -93,11 +93,16 @@ export const GetFormatter = { return newValue[0].value; }, NUMBER: (val, config) => { - const newValue = initValue(val); + let newValue = initValue(val); if (!newValue) { return undefined; } - const { precision } = config; + const { precision, unit } = config; + if (unit && unit.code === 'wan') { + let formateVal = Number((newValue[0] || {}).value); + formateVal = formateVal ? formateVal / 10000 : formateVal; + newValue = [{ value: formateVal, text: formateVal }] + } if (precision >= 0 && isNumber(newValue[0].value)) { return Number(newValue[0].value).toFixed(precision); } diff --git a/components/apolloTable/component/base/_utils/setFormatter.tsx b/components/apolloTable/component/base/_utils/setFormatter.tsx index ebf34905cfcacfc8b896330746433b6b959c9056..8f54f0a1da41f256a97f7f2fae3e18556446bb24 100644 --- a/components/apolloTable/component/base/_utils/setFormatter.tsx +++ b/components/apolloTable/component/base/_utils/setFormatter.tsx @@ -82,8 +82,14 @@ export const SetFormatter = { RATE: (val) => { return [{ value: val, text: val }]; }, - NUMBER: (val) => { + NUMBER: (val, config) => { + debugger if (!isNumber(val)) return emptyModel; + const { unit = {} } = config || {}; // 设置单位 + if (unit && unit.code === 'wan') { + const newVal = val ? val * 10000 : val; + return [{ value: newVal, text: newVal }] + } return [{ value: val, text: val }]; }, PERCENTAGE: (val) => { diff --git a/components/apolloTable/editFormV3/index.tsx b/components/apolloTable/editFormV3/index.tsx index 348fc1096dd5892271014f88351428acf04f3b4e..db2b6cb51ad5b4c738be814d6c756613bc462c75 100644 --- a/components/apolloTable/editFormV3/index.tsx +++ b/components/apolloTable/editFormV3/index.tsx @@ -132,6 +132,7 @@ class FormWrap extends Component { }; const transferColumn = transferAttr(columnType, newProps); const disabled = readOnlyFlag || (dynamicCellConfigDTO && dynamicCellConfigDTO.readonlyFlag); + return ( {getFieldDecorator(columnName, {