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

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

parent 702768d5
{
"name": "panda-xform",
"version": "2.4.5",
"description": "2.4.5: 位置坐标控件未显示值问题",
"version": "2.4.6",
"description": "2.4.6: 增加显示控件类型,多行文本提示语优化,点击关联表单报错修复",
"keywords": [
"panda-xform"
],
......
......@@ -124,6 +124,13 @@ const textWidgets = [
properties: {},
default: null
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -300,7 +307,8 @@ const textWidgets = [
schema: {
title: '多行文本',
type: 'string',
widget: 'TextArea'
widget: 'TextArea',
placeholder: '请输入内容'
},
setting: {
groupBase: {
......@@ -308,6 +316,13 @@ const textWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -328,8 +343,8 @@ const textWidgets = [
title: '提示语',
type: 'string',
displayType: 'row',
widget: 'Placeholder',
labelWidth: 80,
default: '请输入内容'
},
presetValue: {
title: '默认值',
......@@ -449,6 +464,13 @@ const textWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -575,6 +597,13 @@ const textWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -670,6 +699,13 @@ const textWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -785,6 +821,13 @@ const selectWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -1016,6 +1059,13 @@ const selectWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -1173,6 +1223,13 @@ const selectWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -1333,6 +1390,13 @@ const selectWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -1439,6 +1503,13 @@ const selectWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -1543,6 +1614,13 @@ const selectWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -1667,6 +1745,13 @@ const businessWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -1812,6 +1897,13 @@ const businessWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -1925,6 +2017,13 @@ const businessWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -2066,6 +2165,13 @@ const dateWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -2213,6 +2319,13 @@ const dateWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -2363,6 +2476,13 @@ const fileWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -2491,6 +2611,13 @@ const mapWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -2532,6 +2659,13 @@ const mapWidgets = [
type: 'object',
properties: {}
},
required: {
title: '必填',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '33%',
},
disabled: {
title: '只读',
type: 'boolean',
......@@ -2589,6 +2723,13 @@ const mapWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -2617,6 +2758,13 @@ const mapWidgets = [
type: 'object',
properties: {}
},
required: {
title: '必填',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '33%',
},
disabled: {
title: '只读',
type: 'boolean',
......@@ -2674,6 +2822,13 @@ const mapWidgets = [
type: 'object',
properties: {}
},
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 80,
},
$id: {
title: '字段名称',
type: 'string',
......@@ -2702,6 +2857,13 @@ const mapWidgets = [
type: 'object',
properties: {}
},
required: {
title: '必填',
type: 'boolean',
widget: 'checkbox',
default: false,
width: '33%',
},
disabled: {
title: '只读',
type: 'boolean',
......
......@@ -64,12 +64,14 @@ const RelationForm = (props) => {
let str = controlShow
try {
let matchArr = str ? str.match(/\{(.+?)\}/g) : []
matchArr?.forEach(v => {
let value = v.replace(/{/g, '').replace(/}/g, '')
let valueArr = value ? value.split('.') : []
let fieldValue = formDataObj[valueArr[1]]
str = str.replace(v, `'${fieldValue}'`)
})
if (Array.isArray(matchArr)) {
matchArr?.forEach(v => {
let value = v.replace(/{/g, '').replace(/}/g, '')
let valueArr = value ? value.split('.') : []
let fieldValue = formDataObj[valueArr[1]]
str = str.replace(v, `'${fieldValue}'`)
})
}
str = str.replace(/and/g, '&&')
str = str.replace(/or/, '||')
if (str && eval(str)) {
......@@ -92,11 +94,13 @@ const RelationForm = (props) => {
return codes ? (codes[s.fromField] || formDataObj[s.fromField]) : formDataObj[s.fromField]
}
field.forEach(v => {
mappedField.forEach(s => {
if (s.toField === v) {
array.push({ fieldName: s.toField, fieldValue: getFieldValue(s, formDataObj, codes) })
}
})
if (Array.isArray(mappedField)) {
mappedField.forEach(s => {
if (s.toField === v) {
array.push({ fieldName: s.toField, fieldValue: getFieldValue(s, formDataObj, codes) })
}
})
}
})
return array
}, [formDataObj, config, mappedField, codes, dataSource])
......@@ -242,11 +246,13 @@ const RelationForm = (props) => {
let queryWheres = []
let formDataObj = getFormDataObj(addons?.formData)
addFieldGroup.forEach(v => {
mappedField.forEach(s => {
if (s.toField === v) {
queryWheres.push({ field: s.toField, type: '等于', value: codes ? (codes[s.fromField] || formDataObj[s.fromField]) : formDataObj[s.fromField] })
}
})
if (Array.isArray(mappedField)) {
mappedField.forEach(s => {
if (s.toField === v) {
queryWheres.push({ field: s.toField, type: '等于', value: codes ? (codes[s.fromField] || formDataObj[s.fromField]) : formDataObj[s.fromField] })
}
})
}
})
let relationForm = addons.getValue('relationForm') || { configs: [], data: [] }
relationForm?.configs.forEach(v => {
......@@ -300,13 +306,15 @@ const RelationForm = (props) => {
let itemData = { type, accountTable: accountName, id: row.ID, values: formValue }
if (formStateStr !== '添加') {
let array = []
dataSource.forEach(v => {
if (v.ID === row.ID) {
array.push({ ...v, ...getItem(formValue) })
} else {
array.push({ ...v })
}
})
if (Array.isArray(dataSource)) {
dataSource.forEach(v => {
if (v.ID === row.ID) {
array.push({ ...v, ...getItem(formValue) })
} else {
array.push({ ...v })
}
})
}
setDataSource(array)
setTimeout(() => {
onChange(`${array.length}`)
......
import React, { useMemo, useEffect, useState } from 'react'
import { Input } from 'antd'
import { EllipsisOutlined } from '@ant-design/icons'
import Drag from '../../../../components/Drag'
const Placeholder = (props) => {
const { value, addons, onChange } = props
const { title } = addons.formData
const [visible, setVisible] = useState(false)
const [areaValue, setAreaValue] = useState('')
const inputChange = (e) => {
onChange(e.target.value)
}
useEffect(() => {
if (!value) {
onChange(`请输入${title}`)
}
}, [title, value])
const areaChange = (e) => {
setAreaValue(e.target.value)
}
const onOk = () => {
onChange(areaValue)
setVisible(false)
}
const onCancel = () => {
setVisible(false)
}
const iconClick = () => {
setAreaValue(value)
setVisible(true)
}
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'
import CascadeDefault from './CascadeDefault'
import DateDefault from './DateDefault'
import TimeDefault from './TimeDefault'
import WidgetType from './WidgetType'
const groupBase = {
FieldNames,
......@@ -14,6 +15,7 @@ const groupBase = {
CascadeDefault,
DateDefault,
TimeDefault,
WidgetType,
}
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