| | |
| | | * handleSearch, // 搜索 |
| | | * exportButton //导出按钮 |
| | | */ |
| | | const NewTableSearch = ({ form, itemData, labelLength = 5, rowNum = 3, handleReset, handleSearch, exportButton }) => { |
| | | const NewTableSearch = ({ form, itemData, labelLength = 5, rowNum = 3, handleReset, handleSearch, exportButtonShow = true, exportButton }) => { |
| | | const [searchMore, setSearchMore] = useState(false); |
| | | |
| | | const span = 24 / rowNum; |
| | |
| | | |
| | | return ( |
| | | <Form form={form} labelAlign="right" className="tableSearch"> |
| | | |
| | | <Row className='tableSearch-searchMore-row' gutter={[24, 16]} > |
| | | {itemData.map((x, t) => { |
| | | let placeholder = x.placeholder || setPlaceholder(x.name, x.type); |
| | | let allowClear = x.allowClear || true; |
| | |
| | | /> |
| | | ); |
| | | } |
| | | if (x.type === 'null') { |
| | | dom = ( |
| | | <Col span={x.span || 8}></Col> |
| | | ); |
| | | } |
| | | return ( |
| | | <Row className='tableSearch-searchMore-row' gutter={[24, 16]} style={display && { display: searchMore ? 'block' : t < lineNum ? 'block' : 'none' }}> |
| | | <Col span={x.span || 8} key={t + 1}> |
| | | <Col span={x.span || 8} style={display && { display: searchMore ? 'block' : t < lineNum ? 'block' : 'none' }} key={t + 1}> |
| | | { |
| | | x.type === 'null' ? <>{ dom }</> : |
| | | <Form.Item name={x.name} rules={[rules]} label={<div style={{ width: `${fontSize * labelLength}px` }}>{x.label}</div>}> |
| | | {dom} |
| | | </Form.Item> |
| | | } |
| | | </Col> |
| | | </Row> |
| | | // <div> |
| | | // <Col span={8} style={display && { display: searchMore ? 'block' : t < lineNum ? 'block' : 'none' }} key={t + 1}> |
| | | // <Form.Item name={x.name} rules={[rules]} label={<div style={{ width: `${fontSize * labelLength}px` }}>{x.label}</div>}> |
| | |
| | | // </div> |
| | | ); |
| | | })} |
| | | </Row> |
| | | <div className='NewTableSearch-border'></div> |
| | | <Row style={{ marginTop: '16px' }}> |
| | | <Col span={24} style={{ textAlign: 'left' }}> |
| | | <Button className="public-buttonMargin" type="primary" htmlType="submit" icon={<SearchOutlined />} onClick={handleSearch}> |
| | | 查询 |
| | | </Button> |
| | | { |
| | | exportButtonShow && |
| | | <Button className="public-buttonMargin" type="primary" ghost htmlType="submit" onClick={exportButton}> |
| | | 导出查询结果 |
| | | </Button> |
| | | } |
| | | <Button onClick={handleReset}> |
| | | 重置条件 |
| | | </Button> |