74 lines
2.1 KiB
JavaScript
74 lines
2.1 KiB
JavaScript
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';
|
|
const { RangePicker } = DatePicker;
|
|
const ToolBar = ({ setSearchVal, onSave, storeData,role }) => {
|
|
const addBtn = role?.rule?.find(item => item.menuName == "新增")||true;
|
|
const searchBtn = role?.rule?.find(item => item.menuName == "查询")||true;
|
|
const optionsType = [
|
|
{
|
|
label: "渗压监测",
|
|
value:1
|
|
},
|
|
{
|
|
label: "渗流监测",
|
|
value:2
|
|
},
|
|
{
|
|
label:"位移监测",
|
|
value:3
|
|
},
|
|
]
|
|
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={optionsType}
|
|
/>
|
|
</Form.Item>
|
|
<Form.Item label="测点编号" name="stationCode">
|
|
<Input allowClear/>
|
|
</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>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default ToolBar; |