2024-09-20 15:02:50 +08:00
|
|
|
import React, { useEffect,useState } from 'react';
|
|
|
|
|
import { Form, Input, Button, DatePicker } from 'antd';
|
|
|
|
|
|
|
|
|
|
import moment from 'moment';
|
|
|
|
|
import NormalSelect from '../../../../components/Form/NormalSelect';
|
|
|
|
|
const { RangePicker } = DatePicker;
|
|
|
|
|
const ToolBar = ({ setSearchVal, onSave, storeData, role }) => {
|
2025-03-21 17:36:23 +08:00
|
|
|
// const addBtn = role?.rule?.find(item => item.menuName == "新增")|| true;
|
|
|
|
|
// const searchBtn = role?.rule?.find(item => item.menuName == "查询")|| true;
|
2024-09-20 15:02:50 +08:00
|
|
|
const [form] = Form.useForm();
|
|
|
|
|
|
|
|
|
|
const onFinish = (values) => {
|
2024-09-27 17:49:18 +08:00
|
|
|
let dateSo;
|
2024-09-20 15:02:50 +08:00
|
|
|
if (values.year) {
|
2024-09-27 17:49:18 +08:00
|
|
|
dateSo = moment(values.year).format('YYYY')
|
2024-09-20 15:02:50 +08:00
|
|
|
}
|
|
|
|
|
delete values.year
|
2024-09-27 17:49:18 +08:00
|
|
|
setSearchVal({...values, year:Number(dateSo)});
|
2024-09-20 15:02:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// useEffect(() => {
|
2024-09-27 17:49:18 +08:00
|
|
|
// let dateSo = {
|
2024-09-20 15:02:50 +08:00
|
|
|
// start: moment().subtract(1,"years").format('YYYY-MM-DD 00:00:00'),
|
|
|
|
|
// end: moment().format('YYYY-MM-DD 00:00:00')
|
|
|
|
|
// }
|
2024-09-27 17:49:18 +08:00
|
|
|
// form.setFieldValue("tm", [moment(dateSo.start), moment(dateSo.end)])
|
|
|
|
|
// setSearchVal({ dateSo })
|
2024-09-20 15:02:50 +08:00
|
|
|
// }, [])
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div style={{display:'flex',justifyContent:'space-between'}}>
|
|
|
|
|
<Form form={form} className='toolbarBox' layout="inline" onFinish={onFinish}>
|
2025-03-21 17:36:23 +08:00
|
|
|
<Form.Item label="监测日期" name="year">
|
2024-09-20 15:02:50 +08:00
|
|
|
<DatePicker
|
|
|
|
|
allowClear
|
|
|
|
|
style={{ width: "150px" }}
|
|
|
|
|
/>
|
|
|
|
|
</Form.Item>
|
2025-03-21 17:36:23 +08:00
|
|
|
<Form.Item label="测点编号" name="year">
|
|
|
|
|
<Input
|
|
|
|
|
allowClear
|
|
|
|
|
style={{ width: "150px" }}
|
|
|
|
|
/>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
{/* <Form.Item label="危害情况" name="isHarm">
|
2024-09-20 15:02:50 +08:00
|
|
|
<NormalSelect
|
|
|
|
|
allowClear
|
|
|
|
|
style={{ width: '150px' }}
|
|
|
|
|
options={[{ label: "无危害 ", value: 0 },{ label: "有危害 ", value: 1 }]} />
|
2025-03-21 17:36:23 +08:00
|
|
|
</Form.Item> */}
|
|
|
|
|
<Form.Item>
|
2024-09-20 15:02:50 +08:00
|
|
|
<Button type="primary" htmlType="submit">查询</Button>
|
2025-03-21 17:36:23 +08:00
|
|
|
</Form.Item>
|
2024-09-20 15:02:50 +08:00
|
|
|
</Form>
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default ToolBar;
|