Commit adbbac63 authored by 彭俊龙's avatar 彭俊龙

diff: 日期选择控件分钟选择间隔从5改为1

parent e8e54763
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "6.10.89", "version": "6.10.95",
"description": "6.10.89 数值输入新增最大值最小值校验", "description": "6.10.95 日期时间控件分钟选择间隔从5改为1",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -81,13 +81,26 @@ const ValueEdit = (props) => { ...@@ -81,13 +81,26 @@ const ValueEdit = (props) => {
} }
}, []) }, [])
const dealNumberInput = ()=>{
if (autoArray.length) {
autoArray.forEach(v => {
if (v.fields.includes(fieldName)) {
let values = v.fields.map(s => {
if (s === fieldName) {
return { fieldName, fieldValue: value !== null ? `${value}` : '' }
}
return { fieldName: s, fieldValue: record?.[s] || '' }
})
formAuto({ ...v, values }, otherChange)
}
})
}
}
const dealSelect = ()=>{ const dealSelect = ()=>{
const random = Math.floor(Math.random() * (300 - 100 + 1)) + 100;
const random1 = Math.floor(Math.random() * (500 - 300 + 1)) + 300;
setTimeout(()=>{ setTimeout(()=>{
getTableData(); getTableData();
}, fieldTableKey ? random1 : random) }, 100)
if(fieldTableKey){ if(fieldTableKey){
eventEmitter.on(`${record.ID}_event`, (val)=> dealParentData(val)) eventEmitter.on(`${record.ID}_event`, (val)=> dealParentData(val))
...@@ -110,7 +123,7 @@ const ValueEdit = (props) => { ...@@ -110,7 +123,7 @@ const ValueEdit = (props) => {
value = userInfo.depart.name value = userInfo.depart.name
} }
} }
onChange({ fieldName, fieldValue: value }) onChange({ fieldName, fieldValue: value })
} }
} }
...@@ -205,7 +218,7 @@ const ValueEdit = (props) => { ...@@ -205,7 +218,7 @@ const ValueEdit = (props) => {
</div> </div>
), ),
userName: v.userName, userName: v.userName,
value: v[property] * 1, value: v[property],
groupName: v.groupName groupName: v.groupName
} }
})) }))
...@@ -281,6 +294,9 @@ const ValueEdit = (props) => { ...@@ -281,6 +294,9 @@ const ValueEdit = (props) => {
value={value === '' ? null : Number(value)} value={value === '' ? null : Number(value)}
onChange={(value) => { onChange={(value) => {
if (autoArray.length) { if (autoArray.length) {
console.log(autoArray,'autoArray')
let filedFormulas = autoArray.flatMap(x => x.filedFormulas || []);
let vals = []
autoArray.forEach(v => { autoArray.forEach(v => {
if (v.fields.includes(fieldName)) { if (v.fields.includes(fieldName)) {
let values = v.fields.map(s => { let values = v.fields.map(s => {
...@@ -289,9 +305,15 @@ const ValueEdit = (props) => { ...@@ -289,9 +305,15 @@ const ValueEdit = (props) => {
} }
return { fieldName: s, fieldValue: record?.[s] || '' } return { fieldName: s, fieldValue: record?.[s] || '' }
}) })
formAuto({ ...v, values }, otherChange) vals= [...vals, ...values]
} }
}) })
let params = {
filedFormulas,
tableName: autoArray[0].tableName,
values: vals
}
formAuto(params, otherChange)
}else{ }else{
onChange({ fieldName, fieldValue: value !== null ? `${value}` : '' }) onChange({ fieldName, fieldValue: value !== null ? `${value}` : '' })
} }
...@@ -300,9 +322,10 @@ const ValueEdit = (props) => { ...@@ -300,9 +322,10 @@ const ValueEdit = (props) => {
/> />
) )
}else if(w === 'PersonSelector'){ }else if(w === 'PersonSelector'){
const val = typeof value === 'number' ? value + '' : value
return ( return (
<Select <Select
value={value} value={val}
style={{ width: '100%' }} style={{ width: '100%' }}
disabled={disabled} disabled={disabled}
showSearch showSearch
......
import React, { useMemo, useState, forwardRef, useImperativeHandle, useRef } from 'react' import React, { useMemo, useState, forwardRef, useImperativeHandle, useRef, useEffect } from 'react'
import { Table, Button, Popconfirm, Input, Space, Tag, Popover, Checkbox, Form } from 'antd' import { Table, Button, Popconfirm, Input, Space, Tag, Popover, Checkbox, Form } from 'antd'
import { TweenOneGroup } from 'rc-tween-one' import { TweenOneGroup } from 'rc-tween-one'
import styles from './index.less' import styles from './index.less'
...@@ -14,7 +14,7 @@ import IDCard from './components/IDCard' ...@@ -14,7 +14,7 @@ import IDCard from './components/IDCard'
import DateView from './components/DateView' import DateView from './components/DateView'
import NumberView from './components/NumberView' import NumberView from './components/NumberView'
import { isObject, isArray, getFieldInfo } from '../../../../utils' import { isObject, isArray, getFieldInfo } from '../../../../utils'
import { formAutomaticComputation } from '../../../../apis/process'
const IconBtn = (props) => { const IconBtn = (props) => {
return <div className={styles.iconBtn} type={props.type}></div> return <div className={styles.iconBtn} type={props.type}></div>
} }
...@@ -38,7 +38,7 @@ const TablePack = (props, ref) => { ...@@ -38,7 +38,7 @@ const TablePack = (props, ref) => {
const [checks, setChecks] = useState([]) const [checks, setChecks] = useState([])
const searchInput = useRef(null) const searchInput = useRef(null)
const [form] = Form.useForm() const [form] = Form.useForm()
console.log(dataSource, props, 'dataSource');
const filtered = useMemo(() => { const filtered = useMemo(() => {
let array = [] let array = []
if (isObject(filteredInfo)) { if (isObject(filteredInfo)) {
...@@ -303,10 +303,12 @@ const TablePack = (props, ref) => { ...@@ -303,10 +303,12 @@ const TablePack = (props, ref) => {
if (['DateTime'].includes(widget)) { if (['DateTime'].includes(widget)) {
return <DateView {...props} /> return <DateView {...props} />
} }
if (['NumberInput'].includes(widget)) { // if (['NumberInput'].includes(widget)) {
return <NumberView {...props} /> // return <NumberView {...props} />
} // }
return <Text text={value} /> return <ValueEdit {...props} value={value} disabled={true} otherChange={(otherRow) => {
btnsClick({ type: '变化', row: { ...record, ...otherRow } })
}} onChange={()=>{ }}/>
} }
}, },
} }
...@@ -357,6 +359,7 @@ const TablePack = (props, ref) => { ...@@ -357,6 +359,7 @@ const TablePack = (props, ref) => {
const fileColumns = useMemo(() => { const fileColumns = useMemo(() => {
let json = getFieldInfo(formJson) let json = getFieldInfo(formJson)
console.log(json, 'json');
let autoArray = [] let autoArray = []
Object.keys(json).forEach(key => { Object.keys(json).forEach(key => {
let item = json[key] let item = json[key]
......
import React, { useMemo, useState, useRef, useLayoutEffect, useEffect } from 'react' import React, { useMemo, useState, useRef, useLayoutEffect, useEffect } from 'react'
import { Button, message, Pagination } from 'antd' import { Button, message, Pagination } from 'antd'
import styles from './index.less' import styles from './index.less'
import { GetAccountPageList, GetAccountConfigInfo, } from '../../../../apis/process' import { GetAccountPageList, GetAccountConfigInfo, formAutomaticComputation } from '../../../../apis/process'
import { PlusOutlined, VerticalAlignBottomOutlined } from '@ant-design/icons' import { PlusOutlined, VerticalAlignBottomOutlined } from '@ant-design/icons'
import BaseForm from './BaseForm' import BaseForm from './BaseForm'
import TablePack from '../../../Account/components/TablePack' import TablePack from '../../../Account/components/TablePack'
import { isObject, isJson, getNanoid } from '../../../../utils' import { isObject, isJson, getNanoid, getFieldInfo } from '../../../../utils'
import Drag from '../../../components/Drag' import Drag from '../../../components/Drag'
import SearchGroup from '../../../../core/Account/components/SearchGroup' import SearchGroup from '../../../../core/Account/components/SearchGroup'
...@@ -386,11 +386,11 @@ const RelationForm = (props) => { ...@@ -386,11 +386,11 @@ const RelationForm = (props) => {
setLoadingOther(false) setLoadingOther(false)
} }
const setDataSources = (array) => { const setDataSources = (dataList) => {
let i = 0 let i = 0
let timer = setInterval(() => { let timer = setInterval(() => {
if (i < array.length) { if (i < dataList.length) {
setDataSource(dataSource => [...dataSource, array[i]]) setDataSource(dataSource => [...dataSource, dataList[i]])
i++ i++
} else { } else {
clearInterval(timer) clearInterval(timer)
...@@ -398,7 +398,50 @@ const RelationForm = (props) => { ...@@ -398,7 +398,50 @@ const RelationForm = (props) => {
}, 100) }, 100)
} }
const rowsOk = () => { const dealDataSource = async (dataSource) => {
let json = getFieldInfo(config.formJson);
let autoArray = [];
Object.keys(json).forEach(key => {
let item = json[key];
if (item.widget === 'NumberInput' && item.calculateRule) {
let params = {
fields: item?.rules[0]?.fields,
tableName: item.tableNameParent,
filedFormulas: [
{
fieldName: key,
formula: item.calculateRule
}
]
};
autoArray.push(params);
}
});
if (autoArray.length > 0) {
for (let v of autoArray) {
for (let x of dataSource) {
const values = v.fields.map(d => ({
fieldName: d,
fieldValue: x[d]
}));
const params = {
...v,
values
};
const { code, data } = await formAutomaticComputation(params);
if (code === 0) {
data.forEach(d => {
x[d.fieldName] = d.fieldValue + '';
});
}
}
}
}
return dataSource;
};
const rowsOk = async () => {
if (!keys.length) { if (!keys.length) {
return message.info('请选择行数据!') return message.info('请选择行数据!')
} }
...@@ -445,12 +488,26 @@ const RelationForm = (props) => { ...@@ -445,12 +488,26 @@ const RelationForm = (props) => {
array.push(obj) array.push(obj)
} }
}) })
setDataSources(array) let dataList = await dealDataSource(array)
setDataSources(dataList)
// setDataSource([...dataSource, ...array]) // setDataSource([...dataSource, ...array])
setKeys([]) setKeys([])
for(let iItem of items){
for(let arrItem of dataList){
if(iItem.ID === arrItem.ID){
iItem.values.forEach(v => {
if(Object.keys(arrItem).includes(v.fieldName)){
v.fieldValue = arrItem[v.fieldName]
}
})
}
}
}
let relationForm = addons.getValue('relationForm') || { configs: [], data: [] } let relationForm = addons.getValue('relationForm') || { configs: [], data: [] }
let listArray = relationForm.data.concat(items) let listArray = relationForm.data.concat(items)
addons.setValue('relationForm', { ...relationForm, data: listArray }) addons.setValue('relationForm', { ...relationForm, data: listArray })
console.log('relationFormrelationFormrelationFormrelationForm', { ...relationForm, data: listArray }, array, items)
setTimeout(() => { setTimeout(() => {
onChange(value && value.includes(' ') ? `${array.length}` : `${array.length} `) onChange(value && value.includes(' ') ? `${array.length}` : `${array.length} `)
}, 0) }, 0)
......
...@@ -10,7 +10,7 @@ const UserSelect = (props) => { ...@@ -10,7 +10,7 @@ const UserSelect = (props) => {
const property = isStoreID ? 'userID' : 'userName' const property = isStoreID ? 'userID' : 'userName'
const [pullDown, setPullDown] = useState([]) const [pullDown, setPullDown] = useState([])
const [searchValue, setSearchValue] = useState('') const [searchValue, setSearchValue] = useState('')
console.log(props, '人员选择111111');
const valueShow = useMemo(() => { const valueShow = useMemo(() => {
if (isMultiple) { if (isMultiple) {
return value ? value.split(',') : [] return value ? value.split(',') : []
...@@ -57,10 +57,11 @@ const UserSelect = (props) => { ...@@ -57,10 +57,11 @@ const UserSelect = (props) => {
} }
useEffect(() => { useEffect(() => {
const pValue = typeof presetValue === 'number' ? presetValue + '' : presetValue
if (addons) { if (addons) {
addons.setValue(addons.dataPath, presetValue) addons.setValue(addons.dataPath, pValue)
} else { } else {
onChange(presetValue) onChange(pValue)
} }
}, [presetValue]) }, [presetValue])
......
...@@ -77,7 +77,7 @@ const DateTime = (props) => { ...@@ -77,7 +77,7 @@ const DateTime = (props) => {
const timeOtions = format === 'dateTime' ? const timeOtions = format === 'dateTime' ?
{ {
showTime: { showTime: {
minuteStep: 5, // minuteStep: 5,
format: 'HH:mm' format: 'HH:mm'
}, },
format: 'YYYY-MM-DD HH:mm' format: 'YYYY-MM-DD HH:mm'
......
...@@ -48,18 +48,15 @@ const NumberInput = (props) => { ...@@ -48,18 +48,15 @@ const NumberInput = (props) => {
if(min){ if(min){
if(Number(value) < Number(min)){ if(Number(value) < Number(min)){
callback(new Error(`最小值不能小于${min}`)) callback(new Error(`最小值不能小于${min}`))
}else{
callback()
} }
} }
if(max){ if(max){
if(Number(value) > Number(max)){ if(Number(value) > Number(max)){
callback(new Error(`最大值不能大于${max}`)) callback(new Error(`最大值不能大于${max}`))
}else{
callback()
} }
} }
callback()
} }
let uniqueRules = [ let uniqueRules = [
{ {
......
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