Commit dbb01e7d authored by 田翔's avatar 田翔

fix: 默认当前时间bug

parent de945359
{
"name": "panda-xform",
"version": "2.8.3",
"description": "2.8.3: 关联表单映射字段查询添加的字段",
"version": "2.8.4",
"description": "2.8.4: 默认当前时间bug",
"keywords": [
"panda-xform"
],
......
......@@ -22,10 +22,12 @@ const Time = (props) => {
useEffect(() => {
if (addons) {
let value = presetValue || (options === '默认为当前时间' ? moment(new Date()).format('HH:mm:ss') : null)
let value = presetValue || (options === '默认为当前时间' ? moment().format('YYYY-MM-DD HH:mm:ss') : null)
console.log('value', options, value)
addons.setValue(addons.dataPath, value)
} else {
onChange(presetValue)
let value = presetValue || (options === '默认为当前时间' ? moment().format('YYYY-MM-DD HH:mm:ss') : null)
onChange(value)
}
}, [presetValue, options])
......
import React, { useState, useEffect, useMemo } from 'react'
import { TimePicker } from 'antd'
import locale from 'antd/lib/date-picker/locale/zh_CN'
import moment from 'moment'
const TimeDefault = (props) => {
const { onChange } = props
const { value, onChange } = props
const { format } = props.addons.formData
const dateChange = (date, dateStr) => {
onChange(dateStr)
const dateChange = (time, dateStr) => {
onChange(moment(time).format('YYYY-MM-DD HH:mm:ss'))
}
return (
<TimePicker
value={value ? moment(value) : null}
picker={format}
onChange={dateChange}
showTime={format === 'dateTime'}
......
......@@ -71,8 +71,8 @@ const MappedField = (props) => {
key={key}
style={{
display: 'flex',
marginBottom: '5px ',
justifyContent: 'center'
marginBottom: '5px',
justifyContent: 'center',
}}
align="baseline"
>
......
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