Commit 03d0646b authored by 田翔's avatar 田翔

fix: 代码优化

parent 48420e69
{
"name": "panda-xform",
"version": "6.10.24",
"description": "6.10.24 导出增加isExportRelationForm参数",
"version": "6.10.25",
"description": "6.10.25 增加正数/正整数配置",
"keywords": [
"panda-xform"
],
......
......@@ -13,6 +13,8 @@ import styles from './index.less'
const options = [
{ label: '整数', value: '${整数}' },
{ label: '正整数', value: '${正整数}' },
{ label: '正数', value: '${正数}' },
{ label: '小数', value: '${小数}' },
{ label: '货币', value: '${货币}' },
{ label: '百分比', value: '${百分比}' },
......
......@@ -52,7 +52,9 @@ const NumberInput = (props) => {
return formatMoney(Number(value), Number(decimalDigits))
} else if (formatter === '${整数}') {
return `${parseInt(value)}`
} else if (formatter === '${小数}') {
} else if (formatter === '${正整数}') {
return `${parseInt(value)}`
} else if (['${小数}', '${正数}'].includes(formatter)) {
return value
// return Number(value).toFixed(Number(decimalDigits))
} else if (formatter === '${科学计数法}') {
......@@ -64,13 +66,13 @@ const NumberInput = (props) => {
return value
}
const obj = formatter === '${小数}' ? { precision: decimalDigits } : { formatter: formatterFn }
const obj = ['${小数}', '${正数}'].includes(formatter) ? { precision: decimalDigits } : { formatter: formatterFn }
return (
<div className={styles.inputNumber} isdisabled={JSON.stringify(disabled)}>
<InputNumber
{...obj}
min={min || Number.MIN_SAFE_INTEGER}
min={['${正整数}', '${正数}'].includes(formatter) ? 0 : (min || Number.MIN_SAFE_INTEGER)}
max={max || Number.MAX_SAFE_INTEGER}
step={(formatter === '${百分比}' && isStoreFormatter) ? 0.01 : 1}
addonBefore={addonBefore}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment