57 lines
1.9 KiB
JavaScript
57 lines
1.9 KiB
JavaScript
import React, { useEffect, useState } from 'react';
|
|
import { Form, Select, Button, DatePicker } from 'antd';
|
|
|
|
import moment from 'moment';
|
|
const { RangePicker } = DatePicker;
|
|
const ToolBar = ({ setSearchVal, onExport, storeData, role }) => {
|
|
const addBtn = role?.rule?.find(item => item.menuName == "新增");
|
|
const searchBtn = role?.rule?.find(item => item.menuName == "查询");
|
|
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="types">
|
|
<Select options={[
|
|
{value:1,label:'大事记'}, {value:2,label:'调度指令'}, {value:3,label:'维修养护'},{value:4,label:'安全鉴定'}, {value:5,label:"除险加固"}, {value:6,label:'白蚁普查'}
|
|
]} allowClear mode='multiple' maxTagCount='responsive' style={{ width: "200px" }}/>
|
|
</Form.Item>
|
|
<Form.Item label="发生日期" name="tm">
|
|
<RangePicker
|
|
allowClear
|
|
showTime
|
|
style={{ width: "300px" }}
|
|
format="YYYY-MM-DD HH:mm:ss"
|
|
/>
|
|
</Form.Item>
|
|
<Form.Item>
|
|
<Button type="primary" htmlType="submit">查询</Button>
|
|
</Form.Item>
|
|
|
|
<Form.Item>
|
|
<Button onClick={() => form.resetFields()}>重置</Button>
|
|
</Form.Item>
|
|
<Form.Item>
|
|
<Button type="primary" onClick={onExport}>导出</Button>
|
|
</Form.Item>
|
|
</Form>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default ToolBar; |