Commit 1c8137bf authored by 田翔's avatar 田翔

fix: 关联选择排除本身数据源

parent 420bb67f
{
"name": "panda-xform",
"version": "3.0.6",
"description": "3.0.6: 数值为空时保存为null",
"version": "3.0.7",
"description": "3.0.7: 关联选择排除本身数据源,数值",
"keywords": [
"panda-xform"
],
......
......@@ -421,9 +421,6 @@ const textWidgets = [
widget: 'VerifyNumberInput',
disabled: disabled,
dependencies: ['tableTypeParent', 'IsSystemField'],
props: {
allowClear: true
},
},
presetValue: {
title: '默认值',
......@@ -1310,7 +1307,7 @@ const selectWidgets = [
title: '默认值',
type: 'string',
widget: 'CascadeDefault',
dependencies: ['sourceType']
dependencies: ['sourceType'],
},
description: {
title: '字段说明',
......@@ -1327,6 +1324,7 @@ const selectWidgets = [
type: 'string',
required: true,
widget: 'FieldNames',
dependencies: ['$id'],
},
dictionary: {
title: '数据字典',
......
......@@ -7,16 +7,17 @@ import styles from './index.less'
import { widgetData, getStyles } from '../../../../../constant/constant'
const FieldNames = (props) => {
let fields = window.designer || []
const { value, onChange, addons, disabled } = props
const { tableNameParent, widget } = addons.formData
const { tableNameParent, widget, $id } = addons.formData
const isRelevanceFieldParent = widget === 'RelevanceSelect' && addons.dataPath === 'fieldParent'
const [fieldName, setFieldName] = useState([])
const [visible, setVisible] = useState(false)
const [radioValue, setRadioValue] = useState(value)
const options = useMemo(() => {
if (widget === 'RelevanceSelect' && addons.dataPath === 'fieldParent') {
if (isRelevanceFieldParent) {
return fieldName
} else {
let array = []
......@@ -29,7 +30,7 @@ const FieldNames = (props) => {
}, [fieldName, addons])
const plusShow = useMemo(() => {
if (widget === 'RelevanceSelect' && addons.dataPath === 'fieldParent') {
if (isRelevanceFieldParent) {
return false
}
return true
......@@ -54,9 +55,21 @@ const FieldNames = (props) => {
if (!tableNameParent) {
return message.info('缺少表名!')
}
if (isRelevanceFieldParent) {
//防止没有选择数据源情况
if ($id && $id.includes('关联选择_') && $id.length === 11) {
return message.info('请先选择数据源')
}
}
const { data } = await ReloadTableFields({ tableName: tableNameParent })
if (Array.isArray(data.root)) {
setFieldName(data.root)
let array = []
if (isRelevanceFieldParent) {
array = data.root.filter(v => v.name !== $id)
} else {
array = data.root
}
setFieldName(array)
}
}
......
import React from 'react'
import { Input, Dropdown, Menu } from 'antd'
import { Input, Dropdown, Menu, Select } from 'antd'
import { PlusOutlined } from '@ant-design/icons'
import styles from './index.less'
const options = [
{ label: '整数', key: '${整数}' },
{ label: '小数', key: '${小数}' },
{ label: '货币', key: '${货币}' },
{ label: '百分比', key: '${百分比}' },
{ label: '整数', value: '${整数}' },
{ label: '小数', value: '${小数}' },
{ label: '货币', value: '${货币}' },
{ label: '百分比', value: '${百分比}' },
]
const Formatting = (props) => {
......@@ -19,12 +19,23 @@ const Formatting = (props) => {
}
const menuClick = (item) => {
onChange(item.key)
onChange(item.value)
}
const selectChange = (value) => {
onChange(value)
}
return (
<div className={styles.formatting}>
<Input
<Select
style={{ width: '100%', color: options.map(v => v.value).includes(value) ? '#4096ff' : '' }}
options={options}
onChange={selectChange}
allowClear
>
</Select>
{/* <Input
style={{ color: options.map(v => v.key).includes(value) ? '#4096ff' : '' }}
value={value}
onChange={inputChange}
......@@ -42,7 +53,7 @@ const Formatting = (props) => {
>
<PlusOutlined />
</Dropdown>
</div>
</div> */}
</div>
)
......
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