Commit 2c25bf51 authored by 田翔's avatar 田翔

fix: 文本默认值只读不显示问题,下拉框标签颜色显示问题

parent dae7deda
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "4.1.4", "version": "4.1.5",
"description": "4.1.4 文件预览报错问题", "description": "4.1.5 文本默认值只读不显示问题,下拉框标签颜色显示问题",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -17,6 +17,7 @@ const XRender = (props, ref) => { ...@@ -17,6 +17,7 @@ const XRender = (props, ref) => {
useImperativeHandle(ref, () => ( useImperativeHandle(ref, () => (
{ {
getValues, getValues,
exportForm,
form, form,
} }
)) ))
...@@ -64,8 +65,7 @@ const XRender = (props, ref) => { ...@@ -64,8 +65,7 @@ const XRender = (props, ref) => {
} }
childObj[s] = { childObj[s] = {
...child[s], ...child[s],
// presetValue: value || child[s].presetValue, presetValue: value || child[s].presetValue,
presetValue: disabledField ? value : (value || child[s].presetValue),
textInputDefalut: child[s].presetValue, textInputDefalut: child[s].presetValue,
disabled: disabledField, disabled: disabledField,
required required
...@@ -90,7 +90,6 @@ const XRender = (props, ref) => { ...@@ -90,7 +90,6 @@ const XRender = (props, ref) => {
}, [schemaForm, form, startTime]) }, [schemaForm, form, startTime])
const getValues = async () => { const getValues = async () => {
console.log('form', form)
let { data, errors } = await form.submit() let { data, errors } = await form.submit()
let formValue = [] let formValue = []
Object.keys(data).map((k) => { Object.keys(data).map((k) => {
...@@ -107,6 +106,29 @@ const XRender = (props, ref) => { ...@@ -107,6 +106,29 @@ const XRender = (props, ref) => {
} }
} }
const exportForm = () => {
console.log('form', form)
const { properties } = schemaForm
let array = []
let hiddenFields = Object.keys(form.getHiddenValues()).map(v => v?.split('.')?.[1])
// console.log('hiddenFields', Object.keys(form.getHiddenValues()), hiddenFields)
Object.keys(properties).map(v => {
let childObj = properties[v]?.properties || {}
let child = []
Object.keys(childObj).forEach(v => {
if (hiddenFields.includes(v) ) {
}
})
array.push({
title: properties[v].title,
type: properties[v].type,
child,
})
})
// console.log('form', form.getHiddenValues())
}
//初始化时存储外部传的额外数据 //初始化时存储外部传的额外数据
const onMount = () => { const onMount = () => {
setTimeout(() => { setTimeout(() => {
......
import React from 'react' import React from 'react'
import { CloseOutlined } from '@ant-design/icons'
import styles from './index.less' import styles from './index.less'
const hexToRgba = (hex, opacity) => { const hexToRgba = (hex, opacity) => {
...@@ -11,7 +12,7 @@ const hexToRgba = (hex, opacity) => { ...@@ -11,7 +12,7 @@ const hexToRgba = (hex, opacity) => {
const TagPack = (props) => { const TagPack = (props) => {
const { color, text } = props const { color, text, onClose } = props
return ( return (
<span <span
...@@ -19,6 +20,7 @@ const TagPack = (props) => { ...@@ -19,6 +20,7 @@ const TagPack = (props) => {
style={{ background: hexToRgba(color, 0.4), color: color, border: color ? '1px solid' : 'none' }} style={{ background: hexToRgba(color, 0.4), color: color, border: color ? '1px solid' : 'none' }}
> >
{text} {text}
{onClose ? <CloseOutlined style={{ fontSize: '12px', marginLeft: '2px' }} onClick={() => onClose()} /> : null}
</span> </span>
) )
} }
......
...@@ -13,16 +13,9 @@ const AccountSelector = (props) => { ...@@ -13,16 +13,9 @@ const AccountSelector = (props) => {
const userID = window?.globalConfig?.userInfo?.OID || 1 const userID = window?.globalConfig?.userInfo?.OID || 1
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { disabled, accountName, fieldshine, siteFilter, sql, isMultiple, presetValue, placeholder, fieldList } = schema const { disabled, accountName, fieldshine, siteFilter, sql, isMultiple, presetValue, placeholder, fieldList } = schema
const initParams = { userID: userID, accountName, sortFields: '录入时间', direction: 'desc', total: 0, pageIndex: 1, pageSize: 100 }
const [params, setParams] = useState({ const [params, setParams] = useState(initParams)
userID: userID,
accountName,
sortFields: '录入时间',
direction: 'desc',
total: 0,
pageIndex: 1,
pageSize: 100
})
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const [dataSource, setDataSource] = useState([]) const [dataSource, setDataSource] = useState([])
const [config, setConfig] = useState({ webShowFieldGroup: '' }) const [config, setConfig] = useState({ webShowFieldGroup: '' })
......
import React, { useState, useMemo, useEffect } from 'react' import React, { useState, useMemo, useEffect } from 'react'
import { Select, message, Tag } from 'antd' import { Select, message, Tag } from 'antd'
import { GetSelectItemList, GetFieldValueFromTable, getStationListByUserID, getStationIDListByUserID } from '../../../../apis/process' import { GetSelectItemList, GetFieldValueFromTable, getStationListByUserID, getStationIDListByUserID } from '../../../../apis/process'
import TagPack from '../../../components/TagPack'
const { Option } = Select const { Option } = Select
...@@ -123,7 +124,7 @@ const ComboBox = (props) => { ...@@ -123,7 +124,7 @@ const ComboBox = (props) => {
const { label, value, closable, onClose } = props const { label, value, closable, onClose } = props
const color = useMemo(() => { const color = useMemo(() => {
let color = '#f2f4f5' let color = ''
options.forEach(v => { options.forEach(v => {
if (v.value === value) { if (v.value === value) {
color = v.color color = v.color
...@@ -137,19 +138,29 @@ const ComboBox = (props) => { ...@@ -137,19 +138,29 @@ const ComboBox = (props) => {
event.stopPropagation() event.stopPropagation()
} }
if(!color) {
return label
}
return ( return (
<Tag <span style={{ marginRight: '3px' }}>
color={color} <TagPack color={color} text={label} onClose={onClose} />
onMouseDown={onPreventMouseDown} </span>
closable={closable} )
onClose={onClose}
style={{ // return (
marginRight: 3, // <Tag
}} // color={color}
> // onMouseDown={onPreventMouseDown}
{label} // closable={closable}
</Tag> // onClose={onClose}
); // style={{
// marginRight: 3,
// }}
// >
// {label}
// </Tag>
// );
} }
const isTagRender = color ? { tagRender } : {} const isTagRender = color ? { tagRender } : {}
......
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