83 lines
2.1 KiB
JavaScript
83 lines
2.1 KiB
JavaScript
import React, { useEffect,useState } from 'react';
|
|
import { Form, Input, Button, DatePicker } from 'antd';
|
|
import NormalSelect from '../../../../components/Form/NormalSelect';
|
|
|
|
import moment from 'moment';
|
|
const { RangePicker } = DatePicker;
|
|
const ToolBar = ({ setSearchVal, onSave, storeData, exportFile1 }) => {
|
|
|
|
const types = [
|
|
{
|
|
label: "闸后流量",
|
|
value: 0,
|
|
},
|
|
{
|
|
label: "闸前水位",
|
|
value: 1,
|
|
},
|
|
{
|
|
label: "闸后水位",
|
|
value: 2,
|
|
},
|
|
]
|
|
|
|
const types1 = [
|
|
{
|
|
label: "报警中",
|
|
value: 0,
|
|
},
|
|
{
|
|
label: "已解除",
|
|
value: 1,
|
|
},
|
|
]
|
|
const [form] = Form.useForm();
|
|
|
|
const onFinish = (values) => {
|
|
let dateSo;
|
|
if (values.tm) {
|
|
dateSo = {
|
|
start: moment(values.tm[0]).format('YYYY-MM-DD HH:mm:ss'),
|
|
end: moment(values.tm[1]).format('YYYY-MM-DD HH:mm:ss')
|
|
}
|
|
}
|
|
delete values.tm
|
|
setSearchVal({...values, dateSo});
|
|
}
|
|
|
|
|
|
return (
|
|
<>
|
|
<div style={{display:'flex',justifyContent:'space-between'}}>
|
|
<Form form={form} className='toolbarBox' layout="inline" onFinish={onFinish}>
|
|
<Form.Item label="监测项目" name="type">
|
|
<NormalSelect allowClear style={{ width: '150px' }} options={types} />
|
|
</Form.Item>
|
|
<Form.Item label="报警时间" name="tm">
|
|
<RangePicker
|
|
allowClear
|
|
showTime
|
|
style={{ width: "300px" }}
|
|
format="YYYY-MM-DD HH:mm:ss"
|
|
/>
|
|
</Form.Item>
|
|
<Form.Item label="状态" name="status">
|
|
<NormalSelect allowClear style={{ width: '150px' }} options={types1} />
|
|
</Form.Item>
|
|
<Form.Item>
|
|
<Button type="primary" htmlType="submit">查询</Button>
|
|
</Form.Item>
|
|
|
|
<Form.Item>
|
|
<Button onClick={() => form.resetFields()}>重置</Button>
|
|
</Form.Item>
|
|
<Form.Item>
|
|
<Button onClick={()=>exportFile1()}>导出</Button>
|
|
</Form.Item>
|
|
</Form>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default ToolBar; |