import React from 'react';
import { Modal, Spin } from 'antd';
import DemandForm from '@/account/business/businessForm';
import DemandDetaiel from '@/account/business/businessDetails';

class DemandDesc extends React.Component {
	constructor(props) {
		super(props);
		this.state = {
			loading: false,
			pictureUrl: [],
			showState:false
		};
	}
	handleCancel() {
		this.setState({
			visible: false,
		});
		this.props.closeDesc(false, false);
	}
	handOk() {
		this.setState({
			visible: false,
		});
		this.props.closeDesc(false, true);
	}
	componentWillReceiveProps(nextProps) {
		this.state.visible = nextProps.showDesc;
	}
	render() {
		let data = this.props.data || {auditStatus:0};
		return (
			<div className="patent-desc">
				<Modal
					maskClosable={false}
					visible={this.state.visible}
					onOk={this.handOk.bind(this)}
					onCancel={this.handleCancel.bind(this)}
					width="1000px"
					title={!data.id ? '新建项目' : '项目详情'}
					footer=""
					className="admin-desc-content"
				>
					<div>
						<div>
								{data.auditStatus=='1'||data.auditStatus=='2'?
									<DemandDetaiel
									closeDesc={this.handleCancel.bind(this)}
									data={this.props.data}
									categoryList={this.props.categoryList}
									visible={this.state.visible}
									handOk={this.handOk.bind(this)}
									tagList={this.props.tagList}
									/>
									:
									<DemandForm 
										closeDesc={this.handleCancel.bind(this)}
										data={this.props.data}
										categoryList={this.props.categoryList}
										visible={this.state.visible}
										handOk={this.handOk.bind(this)}
										tagList={this.props.tagList}
										/>
								} 
						</div>
					</div>
				</Modal>
			</div>
		);
	}
}

export default DemandDesc;
