Commit 86eb56ab authored by 田翔's avatar 田翔

数值默认值问题

parent dd14cc75
{
"name": "panda-xform",
"version": "2.4.1",
"description": "2.4.1: 当一个因子影响多个的时候计算属性出现BUG",
"version": "2.4.3",
"description": "2.4.3: 数值默认值问题",
"keywords": [
"panda-xform"
],
......
......@@ -441,7 +441,7 @@ const textWidgets = [
title: '数值',
type: 'string',
widget: 'NumberInput',
presetValue: 0,
presetValue: '0',
},
setting: {
groupBase: {
......
......@@ -167,7 +167,6 @@ export const getWatch = (schema, form, startTime) => {
}
})
}
console.log('paths', paths)
return watch
}
......
......@@ -10,7 +10,7 @@ let AMapFunction = null; // 存储地图的构造函数
let coverLayer = {}; // 存储分区的地图对象
const DrawPartition = ({ value, onChange, name, schema }) => {
console.log('DrawPartition')
const mapSettings = window.globalConfig.mapsettings;
const [loading, setLoading] = useState(false);
const [visible, setVisible] = useState(false);
......
import React, { useMemo, useState } from 'react'
import { Input, Modal, Popover, Select } from 'antd'
import { Input, Modal, Popover, Select, Dropdown, Menu } from 'antd'
import { EllipsisOutlined } from '@ant-design/icons'
const options = [
{ label: '本人姓名', value: '【本人姓名】' },
{ label: '本人部门', value: '【本人部门】' },
{ label: '本人姓名', key: '【本人姓名】' },
{ label: '本人部门', key: '【本人部门】' },
]
const InputDefault = (props) => {
......@@ -19,24 +19,13 @@ const InputDefault = (props) => {
return null
}, [value])
const selectChange = (value) => {
onChange(value)
}
const inputChange = (e) => {
onChange(e.target.value)
}
const content = (
<Select
placeholder='请选择环境变量'
style={{ width: '100%' }}
options={options}
onChange={selectChange}
>
</Select>
)
const menuClick = (item) => {
onChange(item.key)
}
return (
<div className='InputDefault'>
......@@ -46,14 +35,16 @@ const InputDefault = (props) => {
onChange={inputChange}
style={style}
addonAfter={
<Popover
placement="topRight"
content={content}
title="环境变量"
trigger="click"
<Dropdown
overlay={(
<Menu
onClick={menuClick}
items={options}
/>
)}
>
<EllipsisOutlined />
</Popover>
</Dropdown>
}
/>
</div>
......
......@@ -17,7 +17,6 @@ const MappedField = (props) => {
const [toField, setToField] = useState([])
const inputClick = async () => {
console.log('addons', addons)
if (!accountName) {
message.info('请选择台账名称')
}
......
......@@ -63,8 +63,6 @@ const PercentSlider = (props) => {
setInputValue(value)
}
console.log('marks', marks)
return (
<Slider
min={0}
......
......@@ -9,7 +9,7 @@ const options = [
message: '邮箱校验未通过'
},
{
name: 'email',
name: 'identity',
label: '身份证号(identity)',
value: '(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)',
message: '手机号校验未通过'
......
......@@ -39,7 +39,6 @@ const Coding = (props) => {
// }
// let code = toUtf8(tableNameParent)
// let codeValue = `${prefixion ? `${prefixion}-` : ''}${date ? `${date}-` : date}${code}`
// console.log('value', value, code)
// onChange(codeValue)
// }, [prefixion, codingType])
......
......@@ -70,12 +70,10 @@ const RichText = forwardRef(({ schema, onChange, value }, ref) => {
MENU_CONF: {
uploadImage: {
customInsert(res, inserFn) {
console.log('res', res)
const formData = new FormData();
formData.append('file', file);
},
// onBeforeUpload: (e) => {
// console.log(e)
// const file = e?.clipboardData?.items[0]?.getAsFile() || null;
// if (!file) return;
// const formData = new FormData();
......
......@@ -27,7 +27,7 @@ const TextInput = (props) => {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext)
const prefixCls = getPrefixCls('pandaXform')
const { value, onChange, schema, addons } = props
const { title, disabled, placeholder, presetValue, addonBefore, addonAfter, maxLength, rules, uniqueVerify, tableName, fieldName } = schema
const { title, disabled, placeholder, presetValue, addonBefore, addonAfter, maxLength, rules, uniqueVerify, tableName, fieldName, isStoreID } = schema
const handleChange = (e) => {
if (addons) {
......@@ -35,14 +35,34 @@ const TextInput = (props) => {
}
}
const valueShow = useMemo(() => {
if (isStoreID) {
if (presetValue === '【本人姓名】') {
return userInfo.fullName
}
if (presetValue === '【本人部门】') {
return userInfo.depart.name
}
}
return value
}, [presetValue, value, isStoreID])
useEffect(() => {
let paths = ['【本人姓名】', '【本人部门】']
let value = presetValue
if (paths.includes(value)) {
if (value === '【本人姓名】') {
value = userInfo.fullName
if (isStoreID) {
value = userInfo.OID + ''
} else {
value = userInfo.fullName
}
} else if (value === '【本人部门】') {
value = userInfo.depart.name
if (isStoreID) {
value = userInfo.depart.OID + ''
} else {
value = userInfo.depart.name
}
}
}
if (addons) {
......@@ -78,7 +98,7 @@ const TextInput = (props) => {
<div className={`${prefixCls}-input`} isdisabled={JSON.stringify(disabled)}>
<Input
disabled={disabled}
value={value}
value={valueShow}
maxLength={maxLength}
placeholder={disabled ? null : placeholder}
onChange={handleChange}
......
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