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

数值默认值问题

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