Commit ca555162 authored by 田翔's avatar 田翔

fix: 表单设计器中默认值不显示

parent 2c3d8f5b
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "5.6.8", "version": "5.6.9",
"description": "5.6.8 台账滚动条问题修复", "description": "5.6.9 表单设计器中默认值不显示",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -11,7 +11,7 @@ import { Radio } from 'antd' ...@@ -11,7 +11,7 @@ import { Radio } from 'antd'
const TableNames = (props) => { const TableNames = (props) => {
console.log(props,'props布局内容。。。。');
const { value, schema, onChange } = props const { value, schema, onChange } = props
const [values, setvalues] = useState(value) const [values, setvalues] = useState(value)
...@@ -29,11 +29,11 @@ const TableNames = (props) => { ...@@ -29,11 +29,11 @@ const TableNames = (props) => {
return ( return (
<Radio.Group onChange={onSelect} defaultValue={value} buttonStyle="solid"> <Radio.Group onChange={onSelect} defaultValue={value} buttonStyle="solid">
{schema?.enum?.map((v,i)=>{ {schema?.enum?.map((v, i) => {
return <Radio.Button value={v}>{schema.enumNames[i] return <Radio.Button value={v}>{schema.enumNames[i]
}</Radio.Button> }</Radio.Button>
}) })
} }
</Radio.Group> </Radio.Group>
) )
......
...@@ -11,13 +11,13 @@ import { Radio } from 'antd' ...@@ -11,13 +11,13 @@ import { Radio } from 'antd'
const TableNames = (props) => { const TableNames = (props) => {
console.log(props,sessionStorage.getItem('RadioButtonValue'),'props布局内容宽度。。。。');
let num =sessionStorage.getItem('RadioButtonValue')||3 let num = sessionStorage.getItem('RadioButtonValue') || 3
const { value, schema, onChange } = props const { value, schema, onChange } = props
let val ='33.3%' let val = '33.3%'
if(num==4) val ='25%' if (num == 4) val = '25%'
if(num==5) val ='20%' if (num == 5) val = '20%'
const [values, setvalues] = useState(value||val) const [values, setvalues] = useState(value || val)
...@@ -25,42 +25,43 @@ const TableNames = (props) => { ...@@ -25,42 +25,43 @@ const TableNames = (props) => {
setvalues(value) setvalues(value)
onChange(value) onChange(value)
} }
const getHtml =() =>{ const getHtml = () => {
if(num==3){ if (num == 3) {
let val =['33.3%','66.6%','100%'] let val = ['33.3%', '66.6%', '100%']
// let width=['50px','100px','150px'] // let width=['50px','100px','150px']
return ['1/3','2/3','1'].map((v,i)=>{ return ['1/3', '2/3', '1'].map((v, i) => {
return <Radio.Button style={{textAlign:'center'}} value={val[i]}>{v return <Radio.Button style={{ textAlign: 'center' }} value={val[i]}>{v
}</Radio.Button> }</Radio.Button>
}) })
} }
if(num==4){ if (num == 4) {
let val =['25%','50%','75%','100%'] let val = ['25%', '50%', '75%', '100%']
// let width=['50px','100px','150px','200px'] // let width=['50px','100px','150px','200px']
return ['1/4','1/2','3/4','1'].map((v,i)=>{ return ['1/4', '1/2', '3/4', '1'].map((v, i) => {
return <Radio.Button style={{textAlign:'center'}} value={val[i]}>{v return <Radio.Button style={{ textAlign: 'center' }} value={val[i]}>{v
}</Radio.Button> }</Radio.Button>
}) })
} }
if(num==5){ if (num == 5) {
let val =['20%','40%','60%','80%','100%'] let val = ['20%', '40%', '60%', '80%', '100%']
//let width=['50px','100px','150px','200px','250px'] //let width=['50px','100px','150px','200px','250px']
return ['1/5','2/5','3/5','4/5','1'].map((v,i)=>{ return ['1/5', '2/5', '3/5', '4/5', '1'].map((v, i) => {
return <Radio.Button style={{textAlign:'center'}} value={val[i]}>{v return <Radio.Button style={{ textAlign: 'center' }} value={val[i]}>{v
}</Radio.Button> }</Radio.Button>
}) })
}} }
}
return ( return (
<Radio.Group onChange={onSelect} defaultValue={values} buttonStyle="solid"> <Radio.Group onChange={onSelect} defaultValue={values} buttonStyle="solid">
{ {
getHtml() getHtml()
} }
</Radio.Group> </Radio.Group>
) )
......
...@@ -97,8 +97,8 @@ const TextInput = (props) => { ...@@ -97,8 +97,8 @@ const TextInput = (props) => {
} }
useEffect(() => { useEffect(() => {
if (addons) {
let valueNext = presetValue let valueNext = presetValue
if (preview !== 'preview') {
if (loaclPaths.includes(presetValue)) { if (loaclPaths.includes(presetValue)) {
if (formDisabled) { if (formDisabled) {
valueNext = '' valueNext = ''
...@@ -110,12 +110,7 @@ const TextInput = (props) => { ...@@ -110,12 +110,7 @@ const TextInput = (props) => {
valueNext = getValueNext() valueNext = getValueNext()
} }
} }
}
if (addons) {
addons.setValue(addons.dataPath, valueNext || '') addons.setValue(addons.dataPath, valueNext || '')
} else {
onChange(valueNext || '')
}
setShowValue(valueNext) setShowValue(valueNext)
if (isStoreID && valueNext) { if (isStoreID && valueNext) {
if (textDefalut === '【本人姓名】') { if (textDefalut === '【本人姓名】') {
...@@ -124,6 +119,7 @@ const TextInput = (props) => { ...@@ -124,6 +119,7 @@ const TextInput = (props) => {
getDeptInfo(valueNext) getDeptInfo(valueNext)
} }
} }
}
}, []) }, [])
useEffect(() => { useEffect(() => {
......
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