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

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

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