Commit 636aaa5a authored by 田翔's avatar 田翔

fix: 台账选择器映射数值对值进行形态解析

parent 16b08c38
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "6.9.14", "version": "6.9.15",
"description": "6.9.14 区域任务优化", "description": "6.9.15 台账选择器映射数值对值进行形态解析",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -220,6 +220,7 @@ const RelationForm = (props) => { ...@@ -220,6 +220,7 @@ const RelationForm = (props) => {
const onOk = async () => { const onOk = async () => {
if (addons) { if (addons) {
const { formValue, errors } = await baseFormRef.current.getValues() const { formValue, errors } = await baseFormRef.current.getValues()
console.log('formValue', formValue)
if (errors.length) { if (errors.length) {
return message.error('请按照提示完善表单内容') return message.error('请按照提示完善表单内容')
} }
......
...@@ -141,6 +141,25 @@ const AccountSelector = (props) => { ...@@ -141,6 +141,25 @@ const AccountSelector = (props) => {
} }
} }
const formatterFn = ({ value, formatter, decimalDigits }) => {
if (value) {
if (formatter === '${百分比}') {
return `${value}%`
} else if (formatter === '${货币}') {
return formatMoney(Number(value), Number(decimalDigits))
} else if (formatter === '${整数}') {
return `${parseInt(value)}`
} else if (formatter === '${小数}') {
return Number(value).toFixed(Number(decimalDigits))
} else if (formatter === '${科学计数法}') {
return Number(value).toExponential()
} else if (formatter) {
return `${value}${formatter}`
}
}
return value
}
const onOk = () => { const onOk = () => {
if (fieldshine.length > 1) { if (fieldshine.length > 1) {
let row = dataSource.find(v => v.ID === keys[0]) || {}; let row = dataSource.find(v => v.ID === keys[0]) || {};
...@@ -151,6 +170,9 @@ const AccountSelector = (props) => { ...@@ -151,6 +170,9 @@ const AccountSelector = (props) => {
const schema = addons.getSchemaByPath(`${child}.${sun}`); const schema = addons.getSchemaByPath(`${child}.${sun}`);
if (['TextInput', 'fileUpload'].includes(schema.widget)) { if (['TextInput', 'fileUpload'].includes(schema.widget)) {
addons.setSchemaByPath(`${child}.${sun}`, { ...schema, otherValue: row[v.fromField] }); addons.setSchemaByPath(`${child}.${sun}`, { ...schema, otherValue: row[v.fromField] });
} else if (schema.widget === 'NumberInput') {
let numberValue = formatterFn({ value: row[v.fromField] || '', formatter: schema.formatter, decimalDigits: schema.decimalDigits })
addons.setValue(`${child}.${sun}`, numberValue);
} else { } else {
addons.setValue(`${child}.${sun}`, row[v.fromField] || ''); addons.setValue(`${child}.${sun}`, row[v.fromField] || '');
} }
......
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