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

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

parent 16b08c38
{
"name": "panda-xform",
"version": "6.9.14",
"description": "6.9.14 区域任务优化",
"version": "6.9.15",
"description": "6.9.15 台账选择器映射数值对值进行形态解析",
"keywords": [
"panda-xform"
],
......
......@@ -220,6 +220,7 @@ const RelationForm = (props) => {
const onOk = async () => {
if (addons) {
const { formValue, errors } = await baseFormRef.current.getValues()
console.log('formValue', formValue)
if (errors.length) {
return message.error('请按照提示完善表单内容')
}
......
......@@ -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 = () => {
if (fieldshine.length > 1) {
let row = dataSource.find(v => v.ID === keys[0]) || {};
......@@ -151,6 +170,9 @@ const AccountSelector = (props) => {
const schema = addons.getSchemaByPath(`${child}.${sun}`);
if (['TextInput', 'fileUpload'].includes(schema.widget)) {
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 {
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