69 lines
2.1 KiB
JavaScript
69 lines
2.1 KiB
JavaScript
import React, { useEffect, useState } from 'react';
|
|
import { Form, Input, Button, DatePicker, Select } from 'antd';
|
|
import { DownOutlined, UpOutlined } from '@ant-design/icons'
|
|
|
|
import moment from 'moment';
|
|
const { RangePicker } = DatePicker;
|
|
const ToolBar = ({ setSearchVal, onSave }) => {
|
|
const [form] = Form.useForm();
|
|
const onFinish = (values) => {
|
|
const {releaseDate,...ret} = values
|
|
if(releaseDate){
|
|
ret.stm = moment(values.releaseDate[0]).format('YYYY-MM-DD')
|
|
ret.etm = moment(values.releaseDate[1]).format('YYYY-MM-DD')
|
|
}
|
|
setSearchVal(ret);
|
|
}
|
|
|
|
const opntios = [
|
|
{value:1,label:'防洪调度'},
|
|
{value:2,label:'兴利调度'},
|
|
{value:3,label:'生态调度'},
|
|
{value:4,label:'应急调度'},
|
|
{value:5,label:'其他'},
|
|
]
|
|
|
|
const opntios1 = [
|
|
{value:0,label:'已废弃'},
|
|
{value:1,label:'生效中'},
|
|
]
|
|
|
|
return (
|
|
<>
|
|
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
<Form form={form} className='toolbarBox' layout="inline" onFinish={onFinish}>
|
|
<Form.Item label="方案名称" name="name">
|
|
<Input allowClear style={{ width: '150px' }} />
|
|
</Form.Item>
|
|
<Form.Item label="调度类型" name="type">
|
|
<Select allowClear style={{ width: '150px' }} options={opntios} />
|
|
</Form.Item>
|
|
<Form.Item label="编制时间" name="releaseDate">
|
|
<RangePicker allowClear />
|
|
</Form.Item>
|
|
<Form.Item label="状态" name="status">
|
|
<Select allowClear style={{ width: '150px' }} options={opntios1} />
|
|
</Form.Item>
|
|
<Form.Item>
|
|
<Button type="primary" htmlType="submit">查询</Button>
|
|
</Form.Item>
|
|
|
|
<Form.Item>
|
|
<Button onClick={() => form.resetFields()}>重置</Button>
|
|
</Form.Item>
|
|
|
|
{
|
|
(onSave) ?
|
|
<Form.Item>
|
|
<Button onClick={onSave}>新增</Button>
|
|
</Form.Item>
|
|
: null
|
|
}
|
|
|
|
</Form>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default ToolBar; |