From 227089fcb8f0facbc0d4456f876a75a747ee6af3 Mon Sep 17 00:00:00 2001 From: Mr Ke <kelq@hugeinfo.com.cn> Date: Fri, 29 May 2020 20:44:30 +0800 Subject: [PATCH] 绩效考核 --- src/components/common/SearchFormView/index.jsx | 56 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 42 insertions(+), 14 deletions(-) diff --git a/src/components/common/SearchFormView/index.jsx b/src/components/common/SearchFormView/index.jsx index bbc7bc1..24d7197 100644 --- a/src/components/common/SearchFormView/index.jsx +++ b/src/components/common/SearchFormView/index.jsx @@ -9,7 +9,7 @@ import { Row, Col, Form, Input, Button, Select, DatePicker, Divider, Card } from 'antd'; import moment from 'moment'; -const { RangePicker } = DatePicker; +const { RangePicker, MonthPicker } = DatePicker; import './index.scss'; // data参数:数据模板 @@ -106,8 +106,16 @@ }); }; + //月份选择器 + monthPickerChange = (name, m, d) => { + this.props.setFormData({ + ...this.props.formData, + [name]: d + }) + } + render() { - const { formData = {}, data = [], children, width = "25%" } = this.props; + const { formData = {}, data = [], children, width = "25%", showReset = true } = this.props; let size = 'default'; return ( @@ -128,13 +136,13 @@ style={{ width: '100%' }} placeholder={item.name} value={formData[item.key]} - allowClear + // allowClear onChange={this.handleSelectChange(item.key)}> {item.list && item.list.map(item => ( <Select.Option - value={item.id} - key={item.id}> + value={item.value} + key={item.value}> {item.name} </Select.Option> ))} @@ -201,6 +209,23 @@ /> </Form.Item> ); + case 'monthPicker': + return ( + <Form.Item label={item.label}> + <MonthPicker + style={{ width: '100%' }} + size={size} + placeholder={item.name} + onChange={(date, dateString) => { + console.log(date, dateString); + this.monthPickerChange(item.key, date, dateString); + }} + disabledDate={item.disabledDate || false} + value={formData[item.key] ? moment(formData[item.key], 'YYYY-MM') : undefined} + /> + </Form.Item> + + ) // case 'br': // return ( // <Col span={24} style={{ marginBottom: '10px' }} /> @@ -223,15 +248,18 @@ 查询 </Button> </Col> - <Col> - <Button - size={size} - onClick={() => { - this.onClick('reset'); - }}> - 重置 - </Button> - </Col> + { + showReset ? + <Col> + <Button + size={size} + onClick={() => { + this.onClick('reset'); + }}> + 重置 + </Button> + </Col> : null + } { children && <Col> -- Gitblit v1.8.0