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, notification, } 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'; import { HomeOutlined } from '@ant-design/icons'; moment.locale('zh-cn'); import { getLabel } from '../../util/i18n.js'; import { SmileOutlined } from '@ant-design/icons'; export class TopBar extends React.Component { constructor(props) { super(props); this.state = { fclasslist: [], rootTreeData: [], //根节点异步树 treeLoadedKeys: [], treeExpandedKeys: [], requestData: { fclass: '0', root: undefined, level: '2', fisvitual: '0', hidedept: '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; const { labelData } = this.props; if (description.length == 0) { return message.error(`${getLabel(547512, labelData)}`); } this.setState({ confirmLoading: true }); let api = '/api/bs/hrmorganization/orgchart/versionRecord?fclass=' + requestData.fclass + '&description=' + description; fetch(api) .then((res) => res.json()) .then((data) => { if (data.api_status) { this.setState({ open: false, confirmLoading: false, }); message.success(`${getLabel(547513, labelData)}`, 2, 3); } else { message.error(`${getLabel(547514, labelData)}`, 2, 3); } }); }; 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]; } arr.map((item, index) => { item.icon = ; }); this.setState({ rootTreeData: arr, }); } }); }; /** * 根节点树异步加载 * @param {} parentId * @returns */ onRootLoadData = (treeNode) => new Promise((resolve) => { const { id } = treeNode; 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) => { data.companyTree.map((item, index) => { item.icon = ; }); this.setState({ fclasslist: data.fclasslist, rootTreeData: data.companyTree, }); }); }; menu = ( ); render() { const { disabled, type, labelData } = this.props; const { rootTreeData, open, confirmLoading, treeExpandedKeys } = this.state; return (
{getLabel(547293, labelData)}: {getLabel(547294, labelData)}: this.handleFormChange({ hidedept: e.target.checked ? '1' : '0', }) } > {getLabel(547296, labelData)} {getLabel(547299, labelData)}: this.handleFormChange({ fisvitual: e.target.checked ? '1' : '0', }) } > {getLabel(547302, labelData)} this.setState({ open: false })} >

{getLabel(547316, labelData)}

{getLabel(547317, labelData)}: