Commit ca555162 authored by 田翔's avatar 田翔

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

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