Commit 29dfb800 authored by 田翔's avatar 田翔

fix: 可编辑选择器修改

parent 28ecd8f6
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "1.6.0", "version": "1.6.1",
"description": "1.6.0: 在运维取值兼容性增强,附件根据文件类型固定样式,字段名称修复", "description": "1.6.1: 可编辑选择器修改",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
import React from 'react' import React, { useEffect } from 'react'
import { Switch } from 'antd' import { Switch } from 'antd'
const BooleanSwitch = (props) => { const BooleanSwitch = (props) => {
const { value, onChange, schema, disabled } = props const { value, onChange, addons, schema, disabled } = props
const { name } = addons.formData
const switchChange = (checked) => {
onChange(checked)
}
useEffect(() => {
if (name === '下拉框') {
if (value) {
const schemas = addons.getSchemaByPath('isMultiple')
addons.setSchemaByPath('isMultiple', { ...schemas, isMultiple: false, hidden: true })
} else {
const schemas = addons.getSchemaByPath('isMultiple')
addons.setSchemaByPath('isMultiple', { ...schemas, isMultiple: false, hidden: false })
}
}
}, [addons, value])
return ( return (
<Switch <Switch
checked={value} checked={value}
checkedChildren='是' checkedChildren='是'
unCheckedChildren='否' unCheckedChildren='否'
onChange={(checked) => onChange(checked)} onChange={switchChange}
/> />
) )
......
...@@ -11,11 +11,11 @@ const FieldNames = (props) => { ...@@ -11,11 +11,11 @@ const FieldNames = (props) => {
const [fieldName, setFieldName] = useState([]) const [fieldName, setFieldName] = useState([])
const options = useMemo(() => { const options = useMemo(() => {
if (name === '关联选择') { if (name === '关联选择' && addons.dataPath === 'fieldParent') {
return fieldName return fieldName
} }
return fieldName.filter(v => !fields.includes(v.name)) return fieldName.filter(v => !fields.includes(v.name))
}, [fieldName]) }, [fieldName, addons])
const selectChange = (value) => { const selectChange = (value) => {
if (name !== '关联表单') { if (name !== '关联表单') {
......
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