react&antd问题(4)

react&antd问题(4)

在工作中遇到一个需求是批量输入订单id,然后把这个订单id的数组传过去给后端
思路:点击批量查询后弹出一个模态框,然后通过换行输入多个id,点击查询后把订单数组通过post请求发给后端
在这里插入图片描述

//首先我们用一个按钮来控制批量查询模态框是否显示
<Button
  onClick={() => { this.ShowModal() }}
  type="primary"
  icon={<SearchOutlined />}
  shape="round"
  >
  批量查询
  </Button>
 ShowModal = () => {
    this.setState({
      visible: true
    })
  }
//这个是批量查询的模态框
	  <Modal
          title='批量查询'
          visible={this.state.visible}
          destroyOnClose={true}
          footer={null}
          onCancel={this.handleCancel}
        >
          <Form onFinish={this.handleOk} layout={'vertical'}>//onFinish是点击查询后单且数据验证成功后的回调事件
            <Form.Item name={['user', 'introduction']} label="输入订单(多个换行)">
              <Input.TextArea rows={8} cols={1} onChange={this.inputOrderid} value={this.state.text} allowClear />
            </Form.Item>
            <div style={{ color: 'rgba(0, 0, 0, 0.45)', textAlign: 'center' }}>{this.state.order_list.length}/200</div>
            <Form.Item style={{ textAlign: 'center' }}>
              <Button type="primary" htmlType='submit'>
                查询
              </Button>
            </Form.Item>
          </Form>
        </Modal>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值