66 lines
2.1 KiB
JavaScript
66 lines
2.1 KiB
JavaScript
|
|
import React, { useEffect,useState } from 'react';
|
||
|
|
import { Form, Input, Button, DatePicker } from 'antd';
|
||
|
|
import moment from 'moment';
|
||
|
|
const { RangePicker } = DatePicker;
|
||
|
|
const ToolBar = ({ setSearchVal, onSave, storeData, role = [] }) => {
|
||
|
|
const [form] = Form.useForm();
|
||
|
|
const addBtn = role?.rule?.find(item => item.menuName == "新增")|| true;
|
||
|
|
const searchBtn = role?.rule?.find(item => item.menuName == "查询")|| true;
|
||
|
|
const onFinish = (values) => {
|
||
|
|
let dateSo;
|
||
|
|
if (values.tm) {
|
||
|
|
dateSo = {
|
||
|
|
start: moment(values.tm[0]).format('YYYY'),
|
||
|
|
end: moment(values.tm[1]).format('YYYY')
|
||
|
|
}
|
||
|
|
}
|
||
|
|
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="tm">
|
||
|
|
<RangePicker
|
||
|
|
allowClear
|
||
|
|
showTime
|
||
|
|
style={{ width: "300px" }}
|
||
|
|
picker='year'
|
||
|
|
/>
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="填报人" name="teamName">
|
||
|
|
<Input allowClear style={{width:'150px'}}/>
|
||
|
|
</Form.Item>
|
||
|
|
<Form.Item label="培训班名称" name="teamName">
|
||
|
|
<Input allowClear style={{width:'150px'}}/>
|
||
|
|
</Form.Item>
|
||
|
|
{searchBtn ? <Form.Item>
|
||
|
|
<Button type="primary" htmlType="submit">查询</Button>
|
||
|
|
</Form.Item> : null }
|
||
|
|
|
||
|
|
<Form.Item>
|
||
|
|
<Button onClick={() => form.resetFields()}>重置</Button>
|
||
|
|
</Form.Item>
|
||
|
|
{
|
||
|
|
(onSave && addBtn) ?
|
||
|
|
<Form.Item>
|
||
|
|
<Button onClick={onSave}>新增</Button>
|
||
|
|
</Form.Item>
|
||
|
|
:null
|
||
|
|
}
|
||
|
|
<Form.Item>
|
||
|
|
<Button onClick={() => form.resetFields()}>导入</Button>
|
||
|
|
</Form.Item><Form.Item>
|
||
|
|
<Button onClick={() => form.resetFields()}>导出</Button>
|
||
|
|
</Form.Item>
|
||
|
|
</Form>
|
||
|
|
</div>
|
||
|
|
</>
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
export default ToolBar;
|