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

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

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