提交 6c500a23 authored 作者: chscls@163.com's avatar chscls@163.com

是否显示时间选择

上级 da983358
...@@ -64,7 +64,7 @@ export default class MobileDate extends Component { ...@@ -64,7 +64,7 @@ export default class MobileDate extends Component {
} }
render() { render() {
let {dates} = this.state let {dates} = this.state
const {format}=this.props
const startTime=dates.length>0?dates[0].valueOf():null const startTime=dates.length>0?dates[0].valueOf():null
const endTime=dates.length>1?dates[1].valueOf():null const endTime=dates.length>1?dates[1].valueOf():null
...@@ -72,18 +72,20 @@ export default class MobileDate extends Component { ...@@ -72,18 +72,20 @@ export default class MobileDate extends Component {
<div> <div>
<DatePicker <DatePicker
// value={this.state.date} // value={this.state.date}
extra={<span style={{fontSize:14}}>{!!startTime?moment(startTime).format('YYYY-MM-DD HH:mm:ss'):'请选择时间'}</span>} extra={<span style={{fontSize:14}}>{!!startTime?moment(startTime).format(format?format:'YYYY-MM-DD HH:mm:ss'):'请选择时间'}</span>}
locale={{okText:"确定",dismissText:'取消'}} locale={{okText:"确定",dismissText:'取消'}}
value={ !!startTime?new Date(startTime):null} value={ !!startTime?new Date(startTime):null}
format={format?format:'YYYY-MM-DD HH:mm:ss'}
onChange={date => this.handelStartChange(date)} onChange={date => this.handelStartChange(date)}
> >
<List.Item arrow="horizontal">开始时间</List.Item> <List.Item arrow="horizontal">开始时间</List.Item>
</DatePicker> </DatePicker>
<DatePicker <DatePicker
// value={this.state.date} // value={this.state.date}
extra={<span style={{fontSize:14}}>{!!endTime?moment(endTime).format('YYYY-MM-DD HH:mm:ss'):'请选择时间'}</span>} extra={<span style={{fontSize:14}}>{!!endTime?moment(endTime).format(format?format:'YYYY-MM-DD HH:mm:ss'):'请选择时间'}</span>}
value={!!endTime?new Date(endTime):null} value={!!endTime?new Date(endTime):null}
locale={{okText:"确定",dismissText:'取消'}} locale={{okText:"确定",dismissText:'取消'}}
format={format?format:'YYYY-MM-DD HH:mm:ss'}
onChange={date => this.handelEndChange(date)} onChange={date => this.handelEndChange(date)}
> >
<List.Item arrow="horizontal">结束时间</List.Item> <List.Item arrow="horizontal">结束时间</List.Item>
......
...@@ -1931,19 +1931,14 @@ export default class tableCom extends Component { ...@@ -1931,19 +1931,14 @@ export default class tableCom extends Component {
if (end != null) ivs.push(moment(parseInt(init[end.base52]))); if (end != null) ivs.push(moment(parseInt(init[end.base52])));
} }
if (begin != null && end != null) { if (begin != null && end != null) {
if (!isEdit) {
r:
cm = <span> cm = <span>
{moment(parseInt(obj[begin.base52])).format(json.format ? json.format : 'YYYY-MM-DD HH:mm:ss')}{' '} {moment(parseInt(obj[begin.base52])).format(json.format ? json.format : 'YYYY-MM-DD HH:mm:ss')}{' '}
{moment(parseInt(obj[end.base52])).format(json.format ? json.format : 'YYYY-MM-DD HH:mm:ss')} {moment(parseInt(obj[end.base52])).format(json.format ? json.format : 'YYYY-MM-DD HH:mm:ss')}
</span> </span>
} else {
cm = getFieldDecorator(begin.base52 + '_' + end.base52, {
initialValue: ivs,
rules: [{ required: required, message: '请选择起止时间' }],
})(<RangePicker showTime />);
}
} else { } else {
cm = "" cm = ""
} }
...@@ -2543,7 +2538,7 @@ export default class tableCom extends Component { ...@@ -2543,7 +2538,7 @@ export default class tableCom extends Component {
cm = getFieldDecorator(begin.base52 + '$' + end.base52, { cm = getFieldDecorator(begin.base52 + '$' + end.base52, {
initialValue: ivs, initialValue: ivs,
rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }], rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }],
})(<MobileDate disabled={disabled} />); })(<MobileDate disabled={disabled} formate={json.format}/>);
if (json.isLabel && title) { if (json.isLabel && title) {
cm = <Form.Item cm = <Form.Item
labelCol={{ span: json.labelSpan }} labelCol={{ span: json.labelSpan }}
...@@ -2558,7 +2553,7 @@ export default class tableCom extends Component { ...@@ -2558,7 +2553,7 @@ export default class tableCom extends Component {
cm = getFieldDecorator(begin.base52 + '$' + end.base52, { cm = getFieldDecorator(begin.base52 + '$' + end.base52, {
initialValue: ivs, initialValue: ivs,
rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }], rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }],
})(<RangePicker showTime disabled={disabled} />); })(<RangePicker showTime={json.showTime!=null?json.showTime:true} format={json.format?json.format:"YYYY-MM-DD HH:mm:ss"} disabled={disabled} />);
} }
if (json.label == null) title = '起止时间'; if (json.label == null) title = '起止时间';
break; break;
...@@ -2610,7 +2605,7 @@ export default class tableCom extends Component { ...@@ -2610,7 +2605,7 @@ export default class tableCom extends Component {
rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }], rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{ required: required, message: '请选择起止时间' }],
})(<DatePicker })(<DatePicker
disabled={disabled} disabled={disabled}
showTime showTime={json.showTime!=null?json.showTime:true}
onOpenChange={get === 'mobile' ? () => { // 取消唤起移动端小键盘 onOpenChange={get === 'mobile' ? () => { // 取消唤起移动端小键盘
setTimeout(() => { setTimeout(() => {
if (document.querySelector('.ant-calendar-input ')) { if (document.querySelector('.ant-calendar-input ')) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论