给我采用antd的Form+Row+Col+FormItem+Input构建一段条件查询代码:CREATE TABLE `ssr_sample` ( `sam_id` varchar(32) NOT NULL, `sam_barcode` varchar(128) DEFAULT NULL COMMENT '样品条码号', `sam_number` varchar(32) DEFAULT NULL COMMENT '样品编号', `sam_name` varchar(128) DEFAULT NULL COMMENT '样品名称', `sam_origin` longtext COMMENT '样品来源', `sam_kind` varchar(32) DEFAULT NULL COMMENT '样品类:自交系/杂交种', `sam_species` varchar(32) DEFAULT NULL COMMENT '样品种属,如玉米,水稻等', `sam_update_date` datetime DEFAULT NULL, `sam_create_date` datetime DEFAULT NULL, `sam_comments` varchar(2048) DEFAULT NULL, `sam_is_deleted` varchar(1) DEFAULT NULL COMMENT '0-否,1-是', `sam_order` int(11) DEFAULT NULL COMMENT '排序', `sam_manager` varchar(32) DEFAULT NULL COMMENT '负责人', `sam_contrast` varchar(2) DEFAULT NULL COMMENT '是否可对照,默认可对照,0/1-不可/可对照', `sam_relate_barcode` varchar(512) DEFAULT NULL COMMENT '关联条码号,如:归档号', `sam_labels` longtext COMMENT '样品标签', PRIMARY KEY (`sam_id`), KEY `SSR_SAMPLE_BARCODE_INDEX` (`sam_barcode`), KEY `SSR_SAMPLE_NUMBER_INDEX` (`sam_number`), KEY `SSR_SAMPLE_NAME_INDEX` (`sam_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='样品信息表'
时间: 2023-06-27 08:08:35 浏览: 100
react PC端项目构建TS,react@18.2.0+antd+vite+axios+redux+sass+ts
以下是基于antd的Form+Row+Col+FormItem+Input构建的条件查询代码:
```jsx
import React from 'react';
import { Form, Row, Col, Input, Button } from 'antd';
const { Item } = Form;
const SampleQueryForm = ({ onFinish }) => {
const [form] = Form.useForm();
const onFinishFailed = (errorInfo) => {
console.log('Failed:', errorInfo);
};
return (
<Form form={form} onFinish={onFinish} onFinishFailed={onFinishFailed}>
<Row gutter={16}>
<Col span={8}>
<Item name="sam_barcode" label="样品条码号">
<Input placeholder="请输入样品条码号" />
</Item>
</Col>
<Col span={8}>
<Item name="sam_number" label="样品编号">
<Input placeholder="请输入样品编号" />
</Item>
</Col>
<Col span={8}>
<Item name="sam_name" label="样品名称">
<Input placeholder="请输入样品名称" />
</Item>
</Col>
</Row>
<Row gutter={16}>
<Col span={8}>
<Item name="sam_origin" label="样品来源">
<Input placeholder="请输入样品来源" />
</Item>
</Col>
<Col span={8}>
<Item name="sam_kind" label="样品类">
<Input placeholder="请输入样品类" />
</Item>
</Col>
<Col span={8}>
<Item name="sam_species" label="样品种属">
<Input placeholder="请输入样品种属" />
</Item>
</Col>
</Row>
<Row gutter={16}>
<Col span={8}>
<Item name="sam_update_date" label="更新时间">
<Input placeholder="请输入更新时间" />
</Item>
</Col>
<Col span={8}>
<Item name="sam_create_date" label="创建时间">
<Input placeholder="请输入创建时间" />
</Item>
</Col>
<Col span={8}>
<Item name="sam_manager" label="负责人">
<Input placeholder="请输入负责人" />
</Item>
</Col>
</Row>
<Row gutter={16}>
<Col span={8}>
<Item name="sam_contrast" label="是否可对照">
<Input placeholder="请输入是否可对照" />
</Item>
</Col>
<Col span={8}>
<Item name="sam_relate_barcode" label="关联条码号">
<Input placeholder="请输入关联条码号" />
</Item>
</Col>
<Col span={8}>
<Item name="sam_labels" label="样品标签">
<Input placeholder="请输入样品标签" />
</Item>
</Col>
</Row>
<Row>
<Col span={24} style={{ textAlign: 'right' }}>
<Button type="primary" htmlType="submit">
查询
</Button>
</Col>
</Row>
</Form>
);
};
export default SampleQueryForm;
```
然后可以在需要使用的地方引入该组件并在`onFinish`回调中获取表单数据来进行条件查询。
阅读全文