import React from 'react'; import { QuestionCircleOutlined } from '@ant-design/icons'; import style from './index.less'; import { DatePicker, Select, Button, Checkbox, Row, Col, Dropdown, Menu, TreeSelect, Tooltip, Modal, Input, message, } from 'antd'; const { Option } = Select; const { TextArea } = Input; 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: [], rootTreeData: [], //根节点异步树 treeExpandedKeys: [], requestData: { fclass: '0', root: undefined, level: '2', fisvitual: '0', }, open: false, confirmLoading: false, description: '', }; } /** * 表单值改变 * @param {*} payload */ handleFormChange(payload) { let requestData = { ...this.state.requestData, ...payload }; this.setState({ requestData }); } onChange = (e) => { this.setState({ description: e.target.value }); }; /** * 弹窗确认 */ handleOk = () => { const { description, requestData } = this.state; if (description.length == 0) { return message.error('请填写描述信息'); } this.setState({ confirmLoading: true }); setTimeout(() => { this.setState({ open: false, confirmLoading: false, description: '' }); message.success('版本记录成功,请重新刷新页面'); }, 2000); // let api = '/api/bs/hrmorganization/orgchart/synchronousData?flcass='+requestData.fclass+ '&description=' +description; // fetch(api) // .then((res) => res.json()) // .then((data) => { // if (data.code == 200) { // this.setState({ open: false, confirmLoading: false,description:'' }); // message.success('版本记录成功,请重新刷新页面'); // } else { // message.error('版本记录失败,请联系相关人员处理数据'); // } // }); }; handleExportMenuClick(e) { this.props.onExport(e.key == '1' ? 'png' : 'pdf'); } handleExportButtonClick() { this.props.onExport('png'); } /** * 根节点树数据 * @param {} parentId * @returns */ getNodeTreeNode = (url, merge = true) => { fetch(url) .then((res) => res.json()) .then((data) => { if (data.api_status) { let arr = []; if (merge) { arr = [...this.state.rootTreeData, ...data.companyTree]; } else { arr = [...data.companyTree]; } this.setState({ rootTreeData: arr, }); } }); }; /** * 根节点树异步加载 * @param {} parentId * @returns */ onRootLoadData = (treeNode) => new Promise((resolve) => { const { id } = treeNode.props; setTimeout(() => { const { fclass } = this.state.requestData; let api = '/api/bs/hrmorganization/orgchart/getSubCompanyTree?subcompany=' + id + '&fclass=' + fclass; this.getNodeTreeNode(api); resolve(undefined); }, 500); }); onRootChange = (value) => { let requestData = { ...this.state.requestData, root: value }; this.setState({ requestData }); }; onTreeExpand = (expandedKeys) => { this.setState({ treeExpandedKeys: expandedKeys, }); }; componentDidMount() { this.getSeatchCondition(this.props.url); } getSeatchCondition = (url) => { fetch(url) .then((res) => res.json()) .then((data) => { this.setState({ fclasslist: data.fclasslist, rootTreeData: data.companyTree, }); }); }; menu = ( ); render() { const { disabled, type } = this.props; const { rootTreeData, open, confirmLoading } = this.state; return (
维度: 根节点: this.handleFormChange({ fisvitual: e.target.checked ? '1' : '0', }) } > 显示虚拟组织 部门层级: this.setState({ open: false })} >

提示:版本操作耗时较长,请谨慎操作(版本仅记录当前维度的数据)

主题: