2024-09-20 15:02:50 +08:00
|
|
|
import React, { useEffect,useState } from 'react';
|
|
|
|
|
import { Form, Input, Button, DatePicker } from 'antd';
|
|
|
|
|
import { getDictService } from '../../../../service/SelectValue'
|
|
|
|
|
import AdcdFuzzyTreeSelect from '../../../../components/Form/AdcdFuzzyTreeSelect';
|
|
|
|
|
import NormalSelect from '../../../../components/Form/NormalSelect';
|
|
|
|
|
import { config } from '../../../../config';
|
|
|
|
|
import moment from 'moment';
|
|
|
|
|
import { httppost2 } from '../../../../utils/request';
|
|
|
|
|
import apiurl from '../../../../service/apiurl';
|
|
|
|
|
const ToolBar = ({ setSearchVal, setDmName, exportFile, role }) => {
|
2024-09-23 13:49:58 +08:00
|
|
|
const exportBtn = 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) => {
|
|
|
|
|
let dataSo;
|
|
|
|
|
if (values.tm) {
|
|
|
|
|
dataSo = moment(values.tm).format('YYYY')
|
|
|
|
|
}
|
|
|
|
|
delete values.tm
|
|
|
|
|
setSearchVal({ ...values, year: dataSo });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
let time = moment()
|
|
|
|
|
form.setFieldValue("tm", time)
|
|
|
|
|
setSearchVal({ year: moment().format("YYYY")})
|
|
|
|
|
}, [])
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<div style={{display:'flex',justifyContent:'space-between'}}>
|
|
|
|
|
<Form form={form} className='toolbarBox' layout="inline" onFinish={onFinish}>
|
|
|
|
|
<Form.Item label="上报时间" name="tm">
|
|
|
|
|
<DatePicker
|
|
|
|
|
allowClear
|
|
|
|
|
picker="year"
|
|
|
|
|
style={{ width: "200px" }}
|
|
|
|
|
format={'YYYY'}
|
|
|
|
|
/>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
{searchBtn ? <Form.Item>
|
|
|
|
|
<Button type="primary" htmlType="submit">查询</Button>
|
|
|
|
|
</Form.Item> : null }
|
|
|
|
|
{exportBtn ? <Form.Item>
|
|
|
|
|
<Button onClick={()=>exportFile()}>导出</Button>
|
|
|
|
|
</Form.Item>: null}
|
|
|
|
|
</Form>
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default ToolBar;
|