Antdesign中Form多行显示,每行显示多个控件的实现

核心代码如下:ui如下
在这里插入图片描述

需要注意的点,form提交的时候,时间控件需要特殊处理
在onFinish= (value){
const dates = moment(fieldsValue[‘date-picker’]).format(‘YYYYMMDD’)
}



<Form form= {form}  onFinish ={onFinish}>
                         <Row justify="space-around">
                                <Col span={6}>
                                  <Form.Item label="日期:" name="data-picker" initialValue = {moment(new Date(),dateFormat)}  style = {{marginBottom: '10px'}} rules={[{ required: true, message: '请选择日期' }]} >
                                     <DatePicker allowClear={false}  style = {{width:'200px'}}/>
                                  </Form.Item>
                                </Col>
                                <Col span={6}>
                                 <Form.Item label="大区:" name="areaCodes" style = {{marginBottom: '10px'}} rules ={[{ required: true, message: '请选择大区' }]} >
                                   <Select placeholder='业务区' showSearch
                                           onChange={selectChange} style = {{width:'200px'}}
                                           filterOption={(inputValue, option: any) => option?.children.includes(inputValue)}
                                           >
                                              {
                                                 allServiceAreas && allServiceAreas.map((pItem: string[]) => <Select.Option value={pItem[1]} key={pItem.areaName + '|' + pItem.areaCode}>{pItem.areaName + '|' + pItem.areaCode}</Select.Option>)
                                               }

                                    </Select>
                                 </Form.Item>
                                </Col>
                                <Col span={6}>
                                  <Form.Item label="业务区:" name="areaCode" style = {{marginBottom: '10px'}} rules ={[{ required: true, message: '请选择业务区' }]}>
                                    <Select  placeholder='业务区' showSearch
                                           onChange={selectChange} style = {{width:'200px'}}
                                           filterOption={(inputValue, option: any) => option?.children.includes(inputValue)}>
                                              {
                                                 allServiceAreas && allServiceAreas.map((pItem: string[]) => <Select.Option value={pItem[1]} key={pItem.areaName + '|' + pItem.areaCode}>{pItem.areaName + '|' + pItem.areaCode}</Select.Option>)
                                               }

                                           </Select>
                                          
                                  </Form.Item>
                                </Col>
                            </Row>
                            <Row justify="space-around">
                                <Col span={6}>
                                  <Form.Item label="运单号:" name='translateCode' rules ={[{required: true,type: 'string',min: 0,max: 12}]}  style = {{marginBottom: '10px',marginTop:'10px'}}>
                                     <input style = {{width:'200px'}}/>
                                  </Form.Item>
                                </Col>
                                <Col span={6}>
                                 <Form.Item label="月结账号:" name="monthCode" rules ={[{required: true,type: 'number',min: 0,max: 10}]} style = {{marginBottom: '10px',marginTop:'10px'}} >
                                   <input  style = {{width:'200px'}}/>
                                 </Form.Item>
                                </Col>
                                <Col span={6}>
                                  <Form.Item label="COD账号:" name= 'codCode' rules ={[{required: true,type: 'number',min: 0,max: 10}]} style = {{marginBottom: '10px',marginTop:'10px'}}>
                                    <input style = {{width:'200px'}}/>
                                  </Form.Item>
                                </Col>
                            </Row>
                         

                            <Row justify="end">
                                <Col span={1}>
                                  <Form.Item style = {{marginBottom: '1px'}} >
                                    <Button onClick={() => resetForm()} >重置</Button>
                                  </Form.Item>
                                </Col>
                                <Col span={1}>
                                 <Form.Item style = {{marginBottom: '1px'}} >
                                   <Button type="primary" htmlType="submit" >查询</Button>
                                 </Form.Item>
                                </Col>
                                <Col span={1}>
                                  <Form.Item style = {{marginBottom: '1px'}}>
                                    <Button>导出</Button>
                                  </Form.Item>
                                </Col>
                            </Row>
                   </Form>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值