import React from 'react'; import { Button, Input, Select, message, Modal,Spin } from 'antd'; import { companySearch } from '../../../tools.js'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; const WebsiteAdd = React.createClass({ getInitialState() { return { visible: false, loading: false }; }, componentWillReceiveProps(nextProps) { if (!this.state.visible && nextProps.showAdd) { this.state.unitName = undefined; this.state.department = undefined; this.state.website = undefined; this.state.accountNumber = undefined; this.state.password = undefined; }; this.state.visible = nextProps.showAdd }, showModal() { this.setState({ visible: true, }); }, handleOk() { this.setState({ loading: true }); if (!this.state.unitName) { message.warning('请选择一个公司!'); this.setState({ loading: false }); return; }; $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/techproject/disposeTechWebsite", data: { uid: this.state.unitName, department: this.state.department, website: this.state.website, accountNumber: this.state.accountNumber, password: this.state.password } }).done(function (data) { if (!data.error.length) { message.success('保存成功!'); this.setState({ loading: false, visible: false }); this.props.closeAdd(false); } else { message.warning(data.error[0].message); this.setState({ loading: false }); } }.bind(this)); }, handleCancel(e) { this.setState({ visible: false, }); this.props.closeAdd(false); }, spinChange(e) { this.setState({ loading: e }); }, render() { return (