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';
import { HomeOutlined } from '@ant-design/icons';
moment.locale('zh-cn');
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;
if (description.length == 0) {
return message.error('请填写描述信息');
}
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('版本记录成功,请重新刷新页面', 2, 3);
} else {
message.error('版本记录失败,请联系相关人员处理数据', 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 =
提示:版本记录耗时较长,请谨慎操作(仅记录当前维度的数据版本)
主题: