import React from 'react' import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import { Radio, Form, Modal, message, layout, Spin, Button,Tag } from 'antd'; const BusName = React.createClass({ loadData(ids) { this.setState({ loading: true }) $.ajax({ method: "post", dataType: "json", url: globalConfig.context + '/api/admin/ProjectSize/listProject', data: { pageNo: 1, pageSize: 100, cid: ids, }, success: function(data) { let listArr = []; let thedata = data.data; if(!thedata) { if(data.error && data.error.length) { message.warning(data.error[0].message); }; thedata = {}; }; if(data.data && data.data.list) { for(let i = 0; i < data.data.list.length; i++) { let thisdata = data.data.list[i]; listArr.push({ id: thisdata.id, name: thisdata.bname, }); }; } this.setState({ projectData: listArr, }); }.bind(this), }).always(function() { this.setState({ loading: false }); }.bind(this)); }, getLockedProject(ids) { this.setState({ loading: true }) $.ajax({ method: "get", dataType: "json", url: globalConfig.context + '/api/admin/customer/getLockedProject', data: { uid: ids }, success: function(data) { let theData = data.data, businessProjectName = []; if(!theData) { if(data.err && data.err.length) { message.warning(data.error[0].message); } } else { theData.map(item => { businessProjectName.push(item.businessProjectName) }) this.setState({ businessData: businessProjectName }) } }.bind(this) }).always(function() { this.setState({ loading: false }) }.bind(this)); }, getInitialState() { return { busModul: false } }, visitCancel() { this.setState({ busModul: false }) this.props.closeBus(null, false, false) }, selFn() { if(!this.state.contactType) { message.warning('未选定项目!') return false; }; this.setState({ busModul: false }); let idData = {}; idData.id = this.state.contactType; this.state.projectData.map(item => { if(this.state.contactType == item.id) { idData.name = item.name } }) this.props.closeBus(idData, false, true); }, componentWillReceiveProps(nextProps) { if(nextProps.busModul) { this.setState({ busModul: true, loading: false }) this.getLockedProject(nextProps.mid); this.loadData(nextProps.businessId); }; }, render() { const formItemLayout = { labelCol: { span: 4 }, wrapperCol: { span: 18 }, }; const projectData = this.state.projectData || []; const businessData = this.state.businessData ||[] return(
{ businessData.map((item,index)=>{ // console.log(item) return {item} }) } {} { this.setState({ contactType: e.target.value }) }}> { projectData.map((item,index)=>{ return {item.name} }) }
) } }) export default BusName;