Commit 50ea5ee5 authored by 田翔's avatar 田翔

fix: 增加显示控件类型,多行文本提示语优化,点击关联表单报错修复

parent 702768d5
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "2.4.5", "version": "2.4.6",
"description": "2.4.5: 位置坐标控件未显示值问题", "description": "2.4.6: 增加显示控件类型,多行文本提示语优化,点击关联表单报错修复",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -124,6 +124,13 @@ const textWidgets = [ ...@@ -124,6 +124,13 @@ const textWidgets = [
properties: {}, properties: {},
default: null default: null
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -300,7 +307,8 @@ const textWidgets = [ ...@@ -300,7 +307,8 @@ const textWidgets = [
schema: { schema: {
title: '多行文本', title: '多行文本',
type: 'string', type: 'string',
widget: 'TextArea' widget: 'TextArea',
placeholder: '请输入内容'
}, },
setting: { setting: {
groupBase: { groupBase: {
...@@ -308,6 +316,13 @@ const textWidgets = [ ...@@ -308,6 +316,13 @@ const textWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -328,8 +343,8 @@ const textWidgets = [ ...@@ -328,8 +343,8 @@ const textWidgets = [
title: '提示语', title: '提示语',
type: 'string', type: 'string',
displayType: 'row', displayType: 'row',
widget: 'Placeholder',
labelWidth: 80, labelWidth: 80,
default: '请输入内容'
}, },
presetValue: { presetValue: {
title: '默认值', title: '默认值',
...@@ -449,6 +464,13 @@ const textWidgets = [ ...@@ -449,6 +464,13 @@ const textWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -575,6 +597,13 @@ const textWidgets = [ ...@@ -575,6 +597,13 @@ const textWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -670,6 +699,13 @@ const textWidgets = [ ...@@ -670,6 +699,13 @@ const textWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -785,6 +821,13 @@ const selectWidgets = [ ...@@ -785,6 +821,13 @@ const selectWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -1016,6 +1059,13 @@ const selectWidgets = [ ...@@ -1016,6 +1059,13 @@ const selectWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -1173,6 +1223,13 @@ const selectWidgets = [ ...@@ -1173,6 +1223,13 @@ const selectWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -1333,6 +1390,13 @@ const selectWidgets = [ ...@@ -1333,6 +1390,13 @@ const selectWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -1439,6 +1503,13 @@ const selectWidgets = [ ...@@ -1439,6 +1503,13 @@ const selectWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -1543,6 +1614,13 @@ const selectWidgets = [ ...@@ -1543,6 +1614,13 @@ const selectWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -1667,6 +1745,13 @@ const businessWidgets = [ ...@@ -1667,6 +1745,13 @@ const businessWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -1812,6 +1897,13 @@ const businessWidgets = [ ...@@ -1812,6 +1897,13 @@ const businessWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -1925,6 +2017,13 @@ const businessWidgets = [ ...@@ -1925,6 +2017,13 @@ const businessWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -2066,6 +2165,13 @@ const dateWidgets = [ ...@@ -2066,6 +2165,13 @@ const dateWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -2213,6 +2319,13 @@ const dateWidgets = [ ...@@ -2213,6 +2319,13 @@ const dateWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -2363,6 +2476,13 @@ const fileWidgets = [ ...@@ -2363,6 +2476,13 @@ const fileWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -2491,6 +2611,13 @@ const mapWidgets = [ ...@@ -2491,6 +2611,13 @@ const mapWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -2532,6 +2659,13 @@ const mapWidgets = [ ...@@ -2532,6 +2659,13 @@ const mapWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
required: {
title: '必填',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '33%',
},
disabled: { disabled: {
title: '只读', title: '只读',
type: 'boolean', type: 'boolean',
...@@ -2589,6 +2723,13 @@ const mapWidgets = [ ...@@ -2589,6 +2723,13 @@ const mapWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -2617,6 +2758,13 @@ const mapWidgets = [ ...@@ -2617,6 +2758,13 @@ const mapWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
required: {
title: '必填',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '33%',
},
disabled: { disabled: {
title: '只读', title: '只读',
type: 'boolean', type: 'boolean',
...@@ -2674,6 +2822,13 @@ const mapWidgets = [ ...@@ -2674,6 +2822,13 @@ const mapWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: { $id: {
title: '字段名称', title: '字段名称',
type: 'string', type: 'string',
...@@ -2702,6 +2857,13 @@ const mapWidgets = [ ...@@ -2702,6 +2857,13 @@ const mapWidgets = [
type: 'object', type: 'object',
properties: {} properties: {}
}, },
required: {
title: '必填',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '33%',
},
disabled: { disabled: {
title: '只读', title: '只读',
type: 'boolean', type: 'boolean',
......
...@@ -64,12 +64,14 @@ const RelationForm = (props) => { ...@@ -64,12 +64,14 @@ const RelationForm = (props) => {
let str = controlShow let str = controlShow
try { try {
let matchArr = str ? str.match(/\{(.+?)\}/g) : [] let matchArr = str ? str.match(/\{(.+?)\}/g) : []
if (Array.isArray(matchArr)) {
matchArr?.forEach(v => { matchArr?.forEach(v => {
let value = v.replace(/{/g, '').replace(/}/g, '') let value = v.replace(/{/g, '').replace(/}/g, '')
let valueArr = value ? value.split('.') : [] let valueArr = value ? value.split('.') : []
let fieldValue = formDataObj[valueArr[1]] let fieldValue = formDataObj[valueArr[1]]
str = str.replace(v, `'${fieldValue}'`) str = str.replace(v, `'${fieldValue}'`)
}) })
}
str = str.replace(/and/g, '&&') str = str.replace(/and/g, '&&')
str = str.replace(/or/, '||') str = str.replace(/or/, '||')
if (str && eval(str)) { if (str && eval(str)) {
...@@ -92,11 +94,13 @@ const RelationForm = (props) => { ...@@ -92,11 +94,13 @@ const RelationForm = (props) => {
return codes ? (codes[s.fromField] || formDataObj[s.fromField]) : formDataObj[s.fromField] return codes ? (codes[s.fromField] || formDataObj[s.fromField]) : formDataObj[s.fromField]
} }
field.forEach(v => { field.forEach(v => {
if (Array.isArray(mappedField)) {
mappedField.forEach(s => { mappedField.forEach(s => {
if (s.toField === v) { if (s.toField === v) {
array.push({ fieldName: s.toField, fieldValue: getFieldValue(s, formDataObj, codes) }) array.push({ fieldName: s.toField, fieldValue: getFieldValue(s, formDataObj, codes) })
} }
}) })
}
}) })
return array return array
}, [formDataObj, config, mappedField, codes, dataSource]) }, [formDataObj, config, mappedField, codes, dataSource])
...@@ -242,11 +246,13 @@ const RelationForm = (props) => { ...@@ -242,11 +246,13 @@ const RelationForm = (props) => {
let queryWheres = [] let queryWheres = []
let formDataObj = getFormDataObj(addons?.formData) let formDataObj = getFormDataObj(addons?.formData)
addFieldGroup.forEach(v => { addFieldGroup.forEach(v => {
if (Array.isArray(mappedField)) {
mappedField.forEach(s => { mappedField.forEach(s => {
if (s.toField === v) { if (s.toField === v) {
queryWheres.push({ field: s.toField, type: '等于', value: codes ? (codes[s.fromField] || formDataObj[s.fromField]) : formDataObj[s.fromField] }) queryWheres.push({ field: s.toField, type: '等于', value: codes ? (codes[s.fromField] || formDataObj[s.fromField]) : formDataObj[s.fromField] })
} }
}) })
}
}) })
let relationForm = addons.getValue('relationForm') || { configs: [], data: [] } let relationForm = addons.getValue('relationForm') || { configs: [], data: [] }
relationForm?.configs.forEach(v => { relationForm?.configs.forEach(v => {
...@@ -300,6 +306,7 @@ const RelationForm = (props) => { ...@@ -300,6 +306,7 @@ const RelationForm = (props) => {
let itemData = { type, accountTable: accountName, id: row.ID, values: formValue } let itemData = { type, accountTable: accountName, id: row.ID, values: formValue }
if (formStateStr !== '添加') { if (formStateStr !== '添加') {
let array = [] let array = []
if (Array.isArray(dataSource)) {
dataSource.forEach(v => { dataSource.forEach(v => {
if (v.ID === row.ID) { if (v.ID === row.ID) {
array.push({ ...v, ...getItem(formValue) }) array.push({ ...v, ...getItem(formValue) })
...@@ -307,6 +314,7 @@ const RelationForm = (props) => { ...@@ -307,6 +314,7 @@ const RelationForm = (props) => {
array.push({ ...v }) array.push({ ...v })
} }
}) })
}
setDataSource(array) setDataSource(array)
setTimeout(() => { setTimeout(() => {
onChange(`${array.length}`) onChange(`${array.length}`)
......
import React, { useMemo, useEffect, useState } from 'react' import React, { useMemo, useEffect, useState } from 'react'
import { Input } from 'antd' import { Input } from 'antd'
import { EllipsisOutlined } from '@ant-design/icons'
import Drag from '../../../../components/Drag'
const Placeholder = (props) => { const Placeholder = (props) => {
const { value, addons, onChange } = props const { value, addons, onChange } = props
const { title } = addons.formData const { title } = addons.formData
const [visible, setVisible] = useState(false)
const [areaValue, setAreaValue] = useState('')
const inputChange = (e) => { const inputChange = (e) => {
onChange(e.target.value) onChange(e.target.value)
} }
useEffect(() => { const areaChange = (e) => {
if (!value) { setAreaValue(e.target.value)
onChange(`请输入${title}`) }
const onOk = () => {
onChange(areaValue)
setVisible(false)
}
const onCancel = () => {
setVisible(false)
}
const iconClick = () => {
setAreaValue(value)
setVisible(true)
} }
}, [title, value])
return ( return (
<Input value={value} onChange={inputChange} /> <div>
<Input
value={value}
onChange={inputChange}
addonAfter={<EllipsisOutlined onClick={iconClick} />}
/>
<Drag
width='500px'
getContainer={false}
title='图标选择'
visible={visible}
onOk={onOk}
onCancel={onCancel}
>
<Input.TextArea rows={5} value={areaValue} onChange={areaChange} />
</Drag>
</div>
) )
} }
......
import React from 'react'
const data = {
'TextInput': '文本',
'TextArea': '多行文本',
'NumberInput': '数值',
'RichText': '富文本',
'Coding': '编码',
'ComboBox': '下拉框',
'RadioButton': '单选框',
'CheckBox': '复选框',
'SwitchSelector': '开关',
'RelevanceSelect': '关联选择',
'CascadeSelector': '联级选择',
'PersonSelector': '人员选择器',
'DeptSelector': '部门选择器',
'AccountSelector': '台账选择器',
'DateTime': '日期选择',
'Time': '时间选择',
'FileUpload': '附件',
'Coordinate': '坐标控件',
'Device': '设备选择',
'SearchLocation': '位置坐标',
}
const WidgetType = (props) => {
const { value } = props
return (
<span style={{ background: '#f1f1f1', borderRadius: '5px', padding: '0 7px' }}>{data[value]}</span>
)
}
export default WidgetType
\ No newline at end of file
...@@ -5,6 +5,7 @@ import NumerDefault from './NumerDefault' ...@@ -5,6 +5,7 @@ import NumerDefault from './NumerDefault'
import CascadeDefault from './CascadeDefault' import CascadeDefault from './CascadeDefault'
import DateDefault from './DateDefault' import DateDefault from './DateDefault'
import TimeDefault from './TimeDefault' import TimeDefault from './TimeDefault'
import WidgetType from './WidgetType'
const groupBase = { const groupBase = {
FieldNames, FieldNames,
...@@ -14,6 +15,7 @@ const groupBase = { ...@@ -14,6 +15,7 @@ const groupBase = {
CascadeDefault, CascadeDefault,
DateDefault, DateDefault,
TimeDefault, TimeDefault,
WidgetType,
} }
export default groupBase export default groupBase
\ No newline at end of file
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