diff --git a/src/components/topBar/index.jsx b/src/components/topBar/index.jsx index f0dcdb2..c43acb9 100644 --- a/src/components/topBar/index.jsx +++ b/src/components/topBar/index.jsx @@ -1,118 +1,169 @@ -import React from 'react' -import style from './index.less' -import { DatePicker, Select, Button, Checkbox, Row, Col, Dropdown, Menu, } from 'antd' +import React from 'react'; +import style from './index.less'; +import { + DatePicker, + Select, + Button, + Checkbox, + Row, + Col, + Dropdown, + Menu, +} from 'antd'; const { Option } = Select; import moment from 'moment'; - +import 'moment/locale/zh-cn'; +import locale from 'antd/lib/date-picker/locale/zh_CN'; +moment.locale('zh-cn'); export class TopBar extends React.Component { + constructor(props) { + super(props); + this.state = { + fclasslist: [], + companylist: [], + requestData: { + date: moment(new Date()).format('YYYY-MM-DD'), + fclass: '0', + root: '0', + level: '3', + fisvitual: '0', + }, + }; + } - constructor(props) { - super(props) - this.state = { - fclasslist: [], - companylist: [], - requestData: { - date: moment(new Date()).format("YYYY-MM-DD"), - fclass: "0", - root: "0", - level: "3", - fisvitual: "0" - } - } - } + handleFormChange(payload) { + let requestData = { ...this.state.requestData, ...payload }; + this.setState({ requestData }); + } - handleFormChange(payload) { - let requestData = {...this.state.requestData, ...payload} - this.setState({requestData}) - } + handleExportMenuClick(e) { + this.props.onExport(e.key == '1' ? 'png' : 'pdf'); + } - handleExportMenuClick(e) { - this.props.onExport(e.key == '1' ? "png" : "pdf") - } + handleExportButtonClick() { + this.props.onExport('png'); + } - handleExportButtonClick() { - this.props.onExport("png") - } + componentDidMount() { + fetch(this.props.url) + .then((res) => res.json()) + .then((data) => { + this.setState({ + fclasslist: data.fclasslist, + companylist: data.companylist, + }); + }); + } - componentDidMount() { - fetch(this.props.url).then(res => res.json()).then(data => { - this.setState({ - fclasslist: data.fclasslist, - companylist: data.companylist - }) - }) - } + menu = ( +
+ ); - menu = ( - - ); + render() { + return ( +