import React,{Component} from "react"; import {message, Select, Spin} from "antd"; import $ from "jquery/src/ajax"; class DepartmentList extends Component{ constructor(props) { super(props); this.state={ departmentArr:[], } } componentDidMount() { this.departmentList(); } departmentList() { $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/organization/selectSuperId", data: {}, success: function (data) { let thedata = data.data; let theArr = []; if (!thedata) { if (data.error && data.error.length) { message.warning(data.error[0].message); } } else { thedata.map(function (item, index) { theArr.push({ key: index, name: item.name, id: item.id }); }); } this.setState({ departmentArr: theArr }); }.bind(this) }).always( function () { }.bind(this) ); } render() { return( ) } } export default DepartmentList;