From 7af2107493fb4df42e40c2cd545f6588685654e7 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 6 Sep 2022 13:46:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A5=E6=9C=9F=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/topBar/index.jsx | 253 +++++++++++++++++++------------- 1 file changed, 152 insertions(+), 101 deletions(-) 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 ( +
+ + + 数据日期: + + this.handleFormChange({ + date: value && value != '' ? value.format('YYYY-MM-DD') : '', + }) + } + /> + - render() { - return ( -
- + + 维度: + + - - 数据日期: this.handleFormChange({date: value && value != "" ? value.format("YYYY-MM-DD") : ""})} /> - + + 根节点: + + + + 显示层级: + + - - 维度: - - - - 根节点: - - - - 显示层级: - - - {/* + {/* this.handleFormChange({fisvitual: e.target.checked ? "1": "0"})}>显示虚拟组织 */} - - - - - - - - - -
- ) - } -} \ No newline at end of file + + + + + + +
+
+ ); + } +}