import React from 'react';
import { Icon, Table, Modal, message, Spin, Input, Select, Button, Form ,Upload,Popconfirm,AutoComplete} from 'antd';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
import '../userMangagement.less';
import {lvl} from '../../../dataDic.js';  
import {splitUrl} from '../../../tools.js';
const Option = AutoComplete.Option;

//图片组件
const PicturesWall = React.createClass({
    getInitialState() {
        return {
            previewVisible: false,
            previewImage: '',
            fileList: [],
        }
    },
    handleCancel() {
        this.setState({ previewVisible: false })
    },
    handlePreview(file) {
        this.setState({
            previewImage: file.url || file.thumbUrl,
            previewVisible: true,
        });
    },
    handleChange(info) {
        let fileList = info.fileList;
        this.setState({ fileList });
        this.props.fileList(fileList);
    },
    componentWillReceiveProps(nextProps) {
        this.state.fileList = nextProps.pictureUrl; 
    },
    render() {
        const { previewVisible, previewImage, fileList } = this.state;
        const uploadButton = (
            <div>
                <Icon type="plus" />
                <div className="ant-upload-text">点击上传</div>
            </div>
        );
        return (
            <div style={{display:"inline-block"}}>
                <Upload
                    action={globalConfig.context + "/api/admin/superviser/uploadAdminImg"}
                    data={{ 'sign': this.props.pictureSign }}
                    listType="picture-card"
                    fileList={fileList}
                    onPreview={this.handlePreview}
                    onChange={this.handleChange} >
                    {fileList.length >= 4 ? null : uploadButton}
                </Upload>
                <Modal maskClosable={false} visible={previewVisible} footer={null} onCancel={this.handleCancel}>
                    <img alt="example" style={{ width: '100%' }} src={previewImage} />
                </Modal>
            </div>
        );
    }
});
const NewService = Form.create()(React.createClass({
	loadData() {
        this.state.data = [];
        this.setState({
            loading: true
        });
        $.ajax({
            method: "post",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + '/api/admin/roles',
            data: {
            },
            success: function (data) {
                let theArr = [];
                if (!data.data) {
                    if (data.error && data.error.length) {
                        message.warning(data.error[0].message);
                    };
                } else {
                    for (let i = 0; i < data.data.list.length; i++) {
                        let thisdata = data.data.list[i];
                        theArr.push({
                             key: i,
                        });
                    };
                   }
                this.setState({
                    dataSource: theArr,
                    pagination: false,
                });
            }.bind(this),
        }).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));
    },
	getInitialState() {
		return {
			loading: false,
			visible: false,
			orgCodeUrl:[],
			checkedKeys: [],
			signBillVisible:false,
			columns: [
				{
                    title: '业务项目名称',
                    dataIndex: 'roleName',
                    key: 'roleName'
                }, {
                    title: '项目类别',
                    dataIndex: 'creater1',
                    key: 'creater1'
                },{
                    title: '项目数量',
                    dataIndex: 'roleName2',
                    key: 'roleName2'
                }, {
                    title: '服务市价',
                    dataIndex: 'creater2',
                    key: 'creater2'
                }, {
                    title: '实签价格',
                    dataIndex: 'roleName3',
                    key: 'roleName3'
                }, {
                    title: '下单时间',
                    dataIndex: 'creater4',
                    key: 'creater4'
                }, {
                    title: '项目说明',
                    dataIndex: 'roleName5',
                    key: 'roleName5'
                }, {
                    title: '操作',
                    dataIndex: 'ABC',
                    key: 'ABC',
                    render: (text, record, index) => {
						return <div style={{display:true?'block':'none'}}>
								<Popconfirm title="是否删除?" onConfirm={(e)=>{this.delectRow(record)}} okText="是" cancelText="否">
								    <Button onClick={(e) =>{ e.stopPropagation()}} type="danger">删除</Button>                 
								</Popconfirm>
							</div>
							}
                },
			]
		};
	},
	//新建订单、编辑订单保存
	handleSubmit(e) {
		e.preventDefault();
		let theorgCodeUrl = [];
        if (this.state.orgCodeUrl.length) {
            let picArr = [];
            this.state.orgCodeUrl.map(function (item) {
				if ( item.response && item.response.data && item.response.data.length ){
					picArr.push(item.response.data);
				}
            });
            theorgCodeUrl = picArr.join(",");
        };
        if(this.state.orderType==undefined){
        	message.warning('请选择订单类型');
        	return false;
        };
        if(!this.state.customerName){
        	message.warning('请输入客户名称');
        	this.refs.customerName.focus();
        	return false;
        };
		this.props.form.validateFields((err, values) => {
			if(!err) {
				this.setState({
					loading: true
				});
				let api=this.props.userDetaile?'/api/bianji':'/api/xinjian'
				$.ajax({
					method: "POST",
					dataType: "json",
					crossDomain: false,
					url: globalConfig.context + api,
					data: {
						
					}
				}).done(function(data) {
					this.setState({
						loading: false
					});
					if(!data.error.length) {
						message.success('保存成功！');
						this.handleOk()
					} else {
						message.warning(data.error[0].message);
					}
				}.bind(this));
			}
		});
	},
	//查看基本详情基本信息
    loaduser(record){
    	if(record){
    	this.state.orderList=[]
    	$.ajax({
            method: "post",
			dataType: "json",
			crossDomain: false,
			url: globalConfig.context + '/api/admin/role/rolePermission',
            data: {
              id: record.id
            },
            success: function (data) {
                let thisData = data.data;                
                if (!thisData) {
                    if (data.error && data.error.length) {
                        message.warning(data.error[0].message);
                    };
                    thisData = {};
                };
                this.setState({
					id:thisData.id,
					orderList:thisData,
                    orgCodeUrl: thisData.orgCodeUrl ? splitUrl(thisData.orgCodeUrl, ',', globalConfig.avatarHost + '/upload') : [],
                });                  
            }.bind(this),
       }).always(function () {
            this.setState({            	
                loading: false
            });
        }.bind(this));  
       }
    },
	handleOk(e) {
		this.setState({
			visible: false,
		});
		this.props.closeDesc(false, true);
	},
	handleCancel(e) {
		this.setState({
			visible: false,
		});
		this.props.closeDesc(false);
	},
	//删除
    delectRow(record) {
        this.setState({
            loading: true
        });
        $.ajax({
            method: "POST",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + "",
            data: {
            	id:record.id
            }
        }).done(function (data) {
            if (!data.error.length) {
                message.success('删除成功！');
                this.setState({
                    loading: false,
                });
            } else {
                message.warning(data.error[0].message);
            };
            this.loadData();
        }.bind(this));
    },
	//添加明细
	addDetailed(){
		this.setState({
			auto:'',
			autoId:'',
			url:'',
			addState:1,
			addnextVisible: true
		})
	},
	nextCancel() {
		this.setState({
			addnextVisible: false
		})
	},
	//查看订单明细
	orderDetails(record){
		if(record){
	    	$.ajax({
	            method: "post",
				dataType: "json",
				crossDomain: false,
				url: globalConfig.context + '/api/admin/role/rolePermission',
	            data: {
	              id: record.id
	            },
	            success: function (data) {
	                let thisData = data.data;                
	                if (!thisData) {
	                    if (data.error && data.error.length) {
	                        message.warning(data.error[0].message);
	                    };
	                    thisData = {};
	                };
	                let idList=[];
	                thisData.map(function(item){
	                	idList.push(
	                		item.pid
	                	)
	                })
	                this.setState({
						ids:record.id,
	                });                  
	            }.bind(this),
	       }).always(function () {
	            this.setState({            	
	                loading: false
	            });
	        }.bind(this));  
	    }
	},
	tableRowClick(record, index) {
        this.setState({
        	addnextVisible:true,
        	addState:0,
        });
        this.orderDetails(record)
    },
	getOrgCodeUrl(e) {
        this.setState({ orgCodeUrl: e });
    },
	componentWillMount() {
		
	},
	//查看订单详情里面的各种骚操作
	//受理订单
    admissibleOrder(){
    	let idArr=this.props.datauser;
    	this.props.operation(idArr,'admissibleOrder')
    },
    //取消订单
    cancelOrder(){
    	let idArr=this.props.datauser;
    	this.props.operation(idArr,'cancelOrder')
    },
    //作废订单
    scrapOrder(){
    	let idArr=this.props.datauser;
    	this.props.operation(idArr,'scrapOrder')
    },
    //锁定订单
    lockOrder(){
    	let idArr=this.props.datauser;
    	this.props.operation(idArr,'lockOrder')
    },
    //解锁订单
    unlockOrder(){
    	let idArr=this.props.datauser;
    	this.props.operation(idArr,'unlockOrder')
    },
    //签单
    signBill(){
    	let idArr=this.props.datauser;
    	this.setState({
    		signBillVisible:true
    	})
    	this.signBillDetaiel(idArr)
    },
    signBillOk(){
    	this.setState({
    		signBillVisible:false
    	})
    },
    //点击签单获取数据函数
    signBillDetaiel(idArr){
    	if(idArr){
	    	$.ajax({
	            method: "post",
				dataType: "json",
				crossDomain: false,
				url: globalConfig.context + '/api/admin/role/rolePermission',
	            data: {
	              id: idArr.id
	            },
	            success: function (data) {
	                let thisData = data.data;                
	                if (!thisData) {
	                    if (data.error && data.error.length) {
	                        message.warning(data.error[0].message);
	                    };
	                    thisData = {};
	                };
	                this.setState({
						roleName:thisData.roleName,
                    	orgCodeUrl: thisData.orgCodeUrl ? splitUrl(thisData.orgCodeUrl, ',', globalConfig.avatarHost + '/upload') : [],
	                });                  
	            }.bind(this),
	       }).always(function () {
	            this.setState({            	
	                loading: false
	            });
	        }.bind(this));  
	    }
    },
	//加载(自动补全)
	supervisor(e){ 
		$.ajax({
            method: "post",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + "/api/admin/selectName",
            data:{
            	name:e
            },
            success: function (data) {                	  
				       let thedata=data.data;
				    if (!thedata) {
                    if (data.error && data.error.length) {
                        message.warning(data.error[0].message);
                    };	
                    thedata = {}; 
              }; 
					this.setState({
						customerArr:thedata,	
                    });
				}.bind(this),
			}).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));  
	},
	//上级主管输入框失去焦点是判断客户是否存在
	selectAuto(value,options){
		this.setState({
			auto:value
		})
	},
	blurChange(e){
		let theType;
		let contactLists=this.state.customerArr||[];
			if (e) {
            contactLists.map(function (item) {
                if (item.name == e.toString()) {
                    theType=item.id
                }
           });     
   	    }
		this.setState({
			autoId:theType
		})
	},
	//值改变时请求客户名称
	httpChange(e){
		if(e.length>=1){
			this.supervisor(e); 
		}	
		this.setState({
			auto:e
		})
	},
	//新建明细保存
	nextSubmit(e) {
		e.preventDefault();
		this.setState({
			loading: true
		});
		let api=this.state.addState?'/api/admin/addPermission':'/api/bianji';
		$.ajax({
			method: "POST",
			dataType: "json",
			crossDomain: false,
			url: globalConfig.context +api ,
			data: {
				
			}
		}).done(function(data) {
			this.setState({
				loading: false
			});
			if(!data.error.length) {
				message.success('保存成功！');
				this.signBillOk()
			} else {
				message.warning(data.error[0].message);
			}
		}.bind(this));
	},
	//签单保存
	signOk(e){
		e.preventDefault();
		this.temporarySave(false)
	},
	//暂存信息
	temporary(){
		this.temporarySave(true)
	},
	//签单保存与暂存函数
	temporarySave(e){
		this.setState({
			loading: true
		});
		let api=e?'/api/admin/zancun':'/api/quedingqiandan';
		$.ajax({
			method: "POST",
			dataType: "json",
			crossDomain: false,
			url: globalConfig.context +api ,
			data: {
				id:this.props.uid?this.props.uid.id:this.props.datauser.id
			}
		}).done(function(data) {
			this.setState({
				loading: false
			});
			if(!data.error.length) {
				message.success('保存成功！');
				this.signBillOk()
				this.props.closeDesc(false,true)
			} else {
				message.warning(data.error[0].message);
			}
		}.bind(this));
	},
	componentWillReceiveProps(nextProps) { //props改变时触发
		this.state.visible = nextProps.showDesc;
		this.state.signBillVisible=nextProps.signBillVisible;
		if(this.state.signBillVisible){
			this.signBillDetaiel(nextProps.uid)
		};
		if(nextProps.userDetaile && nextProps.showDesc) {
			if(nextProps.datauser && nextProps.datauser.id&&nextProps.signBillState) {
				this.loaduser(nextProps.datauser);
				this.loadData();
			}
		}else{
			this.setState({
				orderType:undefined,
				customerName:'',
			})
		}
	},
	render() {
		const FormItem = Form.Item
		const formItemLayout = {
			labelCol: { span: 8 },
			wrapperCol: { span: 14 },
		};
		const orderDetaiel=this.state.orderList || []
		const dataSources=this.state.customerArr || [];
        const options = dataSources.map((group,index) =>
				      <Option key={index} value={group.name}>{group.name}</Option>
				     )
		return(
			<div>
            <Modal maskClosable={false} visible={this.state.visible}
                        onOk={this.handleOk} onCancel={this.handleCancel}
                        width={!this.props.userDetaile?'600px':'1000px'}  
                        title={!this.props.userDetaile?'创建订单':'编辑订单'}                      
                        footer=''
                        className="admin-desc-content">
			            <Form layout="horizontal" onSubmit={this.handleSubmit} id="demand-form" style={{paddingBottom:'40px'}} >
			                <Spin spinning={this.state.loading}>
			                        <div className="clearfix">
			                            {!this.props.userDetaile?
			                            <div className="clearfix">
			                            	<div className="clearfix">
						                    	<FormItem 
							                            {...formItemLayout}
							                            label="订单类型" > 
							                            <Select placeholder="请选择订单类型"
								                            style={{ width:'240px'}}
								                            value={this.state.orderType}
								                            onChange={(e) => { this.setState({ orderType: e }) }}>
								                            {
							                                    lvl.map(function (item) {
							                                            return <Select.Option key={item.value} >{item.key}</Select.Option>
							                                    })
							                                }
								                        </Select>
							                    		<span className="mandatory">*</span>
							                    </FormItem>
							                </div>
							                <div className="clearfix">
							                    <FormItem 
							                            {...formItemLayout}
							                            label="客户名称" >                             
						                                    <Input placeholder="请输入客户名称" ref='customerName' value={this.state.customerName} onChange={(e)=>{this.setState({customerName:e.target.value})}} style={{width:'240px'}}/>
							                    		<span className="mandatory">*</span>
							                    </FormItem>
							                </div>    
						                </div>:<div className="clearfix">
						                       		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="订单编号" >
							                            <span>{orderDetaiel.roleName}</span>
						                    		</FormItem>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="下单时间" >  
							                            <span>{orderDetaiel.createTimez}</span>
						                    		</FormItem>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="客户名称" >  
							                            <span>{orderDetaiel.roleName}</span>
						                    		</FormItem>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="订单类型" >  
							                            <span>{orderDetaiel.roleName}</span>
						                    		</FormItem>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="订单渠道" >  
							                            <span>{orderDetaiel.roleName}</span>
						                    		</FormItem>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="订单状态" >  
							                            <span>{orderDetaiel.roleName}</span>
						                    		</FormItem>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="已收款项" >  
							                            <span>{orderDetaiel.roleName}</span>
						                    		</FormItem>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="结算状态" >  
							                            <span>{orderDetaiel.roleName}</span>
						                    		</FormItem>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="市价订单金额" >    
						                            	<span>{orderDetaiel.roleName}</span>
								                    </FormItem>
								                    <FormItem className="half-item"
							                            {...formItemLayout}
							                            label="市价首款金额" >   
							                            <span>{orderDetaiel.roleName}</span>
								                    </FormItem>
								                    {true?
							                    	<div className='clearfix'>
									                    <FormItem className="half-item"
								                            {...formItemLayout}
								                            label="实签订单金额" >                             
							                                    <Input placeholder="实签订单金额" value={this.state.roleName} onChange={(e)=>{this.setState({roleName:e.target.value})}} style={{width:'240px'}} required="required"/>
									                   			<span className="mandatory">*</span>
									                    </FormItem>
									                    <FormItem className="half-item"
									                            {...formItemLayout}
									                            label="实签首款金额" >                             
								                                    <Input placeholder="请输入实签首款金额" value={this.state.roleName} onChange={(e)=>{this.setState({roleName:e.target.value})}} style={{width:'240px'}} required="required"/>
									                    		<span className="mandatory">*</span>
									                    </FormItem>
							                    		<FormItem className="half-item"
								                            {...formItemLayout}
								                            label="特批立项" >  
								                            <Select placeholder="选择特批立项类型"
									                            style={{ width:'240px'}}
									                            value={this.state.orderType}
									                            onChange={(e) => { this.setState({ orderType: e }) }}>
									                            <Select.Option value='0'>不特批</Select.Option>
									                            <Select.Option value='1'>申请特批</Select.Option>
									                            <Select.Option value='2'>特批通过</Select.Option>
									                            <Select.Option value='3'>特批驳回</Select.Option>
									                        </Select>
								                    		<span className="mandatory">*</span>
							                    		</FormItem>
							                    		<div className='clearfix'>
												            <FormItem
												                labelCol={{ span: 4 }}
												                wrapperCol={{ span: 18 }}
												                label="合同扫描件" >
												                <PicturesWall
												                    pictureSign="customer_sys_file"
												                    fileList={this.getOrgCodeUrl}
												                    pictureUrl={this.state.orgCodeUrl} />
												                    <p>图片建议：要清晰。</p>
												            </FormItem>
												        </div>
												        <div className='clearfix'>
												        	<FormItem
													            labelCol={{ span: 4 }}
													            wrapperCol={{ span: 16 }}
													            label="订单留言" >
													                <Input type="textarea" placeholder="请输入订单留言" rows={4}  value={this.state.introduction} 
														    				onChange={(e)=>{this.setState({introduction:e.target.value})}}/>			                      
													        </FormItem>
												        </div>
											        </div>:
											        <div className='clearfix'>
											        	<FormItem className="half-item"
								                            {...formItemLayout}
								                            label="实签订单金额" >   
								                            <span>{orderDetaiel.roleName}</span>
							                    		</FormItem>
							                    		<FormItem className="half-item"
								                            {...formItemLayout}
								                            label="实签首款金额" >   
								                            <span>{orderDetaiel.roleName}</span>
							                    		</FormItem>
							                    		<FormItem className="half-item"
								                            {...formItemLayout}
								                            label="特批立项" >   
								                            <span>{orderDetaiel.roleName}</span>
							                    		</FormItem>
														<div className="clearfix">
															<FormItem
										                        labelCol={{ span: 4 }}
										                        wrapperCol={{ span: 18 }}
										                        label="合同扫描件" >
									                            <Upload className="demandDetailShow-upload"
									                                listType="customer_sys_file"
									                                fileList={this.state.orgCodeUrl}
									                                onPreview={(file) => {
									                                    this.setState({
									                                        previewImage: file.url || file.thumbUrl,
									                                        previewVisible: true,
									                                    });
									                                }} >
									                            </Upload>
									                            <Modal maskClosable={false} footer={null}
									                                visible={this.state.previewVisible}
									                                onCancel={() => { this.setState({ previewVisible: false }) }}>
									                                <img alt="" style={{ width: '100%' }} src={this.state.previewImage || ''} />
									                            </Modal>
									                        </FormItem>    
								                        </div>
								                        <div className='clearfix'>
												        	<FormItem
													            labelCol={{ span: 4 }}
													            wrapperCol={{ span: 16 }}
													            label="订单留言" >
												        		<span>{orderDetaiel.roleName}</span>
													        </FormItem>
												        </div>
											        </div>}
										        <div className='clearfix'>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="订单负责人" >  
							                            <span>{orderDetaiel.roleName}</span>
						                    		</FormItem>
						                    	</div>
						                    	<div className='clearfix'>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="意向时间" >  
							                            <span>{orderDetaiel.createTimez}</span>
						                    		</FormItem>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="签单时间" >  
							                            <span>{orderDetaiel.createTimez}</span>
						                    		</FormItem>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="财务负责人" >  
							                            <span>{orderDetaiel.createTimez}</span>
						                    		</FormItem>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="首付时间" >  
							                            <span>{orderDetaiel.createTimez}</span>
						                    		</FormItem>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="项目负责人" >  
							                            <span>{orderDetaiel.roleName}</span>
						                    		</FormItem>
						                    		<FormItem className="half-item"
							                            {...formItemLayout}
							                            label="立项时间" >  
							                            <span>{orderDetaiel.createTimez}</span>
						                    		</FormItem>
					                    		</div>
					                    		<div>
								                	<span style={{marginLeft:'50px',fontSize:'20px'}}>订单明细</span>
								                	<Button type='primary' onClick={this.addDetailed} style={{float:'right',marginRight:'50px',marginBottom:'15px',display:true?'block':'none'}}>添加明细</Button>
								                </div>
								                <div className="patent-table">
								                    <Spin spinning={this.state.loading}>
								                        <Table columns={this.state.columns}
								                            dataSource={this.state.dataSource}
								                            pagination={this.state.pagination}
								                            onRowClick={this.tableRowClick} 
								                            />
								                    </Spin>
									            </div>
					                        </div>}
						               		<div className='btnSave'>
							                    <Button className="setSave" type="primary" htmlType="submit">保存</Button>  
				                                {this.props.userDetaile?<div className='operations'>
						                            <Popconfirm title={'请确认您是否受理来自【'+this.props.datauser.roleName+'】发起的服务意向订单？'} onConfirm={(e)=>{this.admissibleOrder()}} okText="确认" cancelText="取消">
													    <Button style={{marginRight:'10px'}} onClick={(e) =>{ e.stopPropagation()}} type="primary">受理意向</Button>                 
													</Popconfirm>
													<Button style={{marginRight:'10px'}} onClick={(e) =>{this.signBill()}} type="primary">签单</Button>                 
													<Popconfirm title={'请确认您是否取消客户【'+this.props.datauser.roleName+'】的服务订单，订单取消将导致业务终止！'} onConfirm={(e)=>{this.cancelOrder()}} okText="确认" cancelText="取消">
													    <Button style={{marginRight:'10px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">取消订单</Button>                 
													</Popconfirm>
													<Popconfirm title={'请确认您是否作废客户【'+this.props.datauser.roleName+'】的服务订单，订单作废将导致订单失效！'} onConfirm={(e)=>{this.scrapOrder()}} okText="确认" cancelText="取消">
													    <Button style={{marginRight:'10px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">作废</Button>                 
													</Popconfirm>
													<Popconfirm title={'请确认您是否锁定客户【'+this.props.datauser.roleName+'】的服务订单，订单锁定将导致订单暂停！'} onConfirm={(e)=>{this.lockOrder()}} okText="确认" cancelText="取消">
													    <Button style={{marginRight:'10px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">锁定</Button>                 
													</Popconfirm>
													<Popconfirm title={'请确认您是否解锁客户【'+this.props.datauser.roleName+'】的服务订单，订单解锁将导致订单正常！'} onConfirm={(e)=>{this.unlockOrder()}} okText="确认" cancelText="取消">
													    <Button style={{marginRight:'10px'}} onClick={(e) =>{ e.stopPropagation()}} type="primary">解锁</Button>                 
													</Popconfirm>	
				                                </div>:''}
				                                <Button className="cancel" type="ghost" onClick={this.handleCancel}>返回</Button>
			                            </div>
				                    </div>
			                </Spin>
			            </Form >
			        </Modal> 
			        <Modal maskClosable={false} visible={this.state.addnextVisible}
                        onOk={this.nextCancel} onCancel={this.nextCancel}
                        width='550px'
                        title={this.state.addState?'添加订单明细服务':'查看订单明细服务'}                     
                        footer=''
                        className="admin-desc-content">
			            <Form layout="horizontal" onSubmit={this.nextSubmit} id="demand-form">
			                <Spin spinning={this.state.loading}>
			                        {this.state.addState?<div className="clearfix">
				                    	<FormItem className="half-middle"
				                            {...formItemLayout}
				                            label="服务名称" >   
			                                    <AutoComplete
										        className="certain-category-search"
										        dropdownClassName="certain-category-search-dropdown"
										        dropdownMatchSelectWidth={false}
										        dropdownStyle={{ width: 230 }}
										        style={{ width: '230px' }}
										        dataSource={options}
										        placeholder="输入服务名称"
										        value={this.state.auto}
										        onChange={this.httpChange}
										        filterOption={true}
										        onBlur={this.blurChange}
										        onSelect={this.selectAuto}
										      >
										        <Input/>
										      </AutoComplete> 
					                    </FormItem>
					                    <FormItem className="half-middle"
					                            {...formItemLayout}
					                            label="市场价格" >   
				                                    <Input placeholder="输入市场价格" value={this.state.url} style={{width:'230px'}}
				                                    onChange={(e)=>{this.setState({url:e.target.value})}} />
					                    </FormItem>
					                    <FormItem className="half-middle"
					                            {...formItemLayout}
					                            label="实签价格" >   
				                                    <Input placeholder="请输入实签价格" value={this.state.url} style={{width:'230px'}}
				                                    onChange={(e)=>{this.setState({url:e.target.value})}} />
					                    </FormItem>
					                    <FormItem className="half-middle"
					                            {...formItemLayout}
					                            label="服务数量" >   
				                                    <Input placeholder="请输入服务数量" value={this.state.url} style={{width:'230px'}}
				                                    onChange={(e)=>{this.setState({url:e.target.value})}} />
					                    </FormItem>
					                    <FormItem className="half-middle"
					                            {...formItemLayout}
					                            label="服务说明" >   
				                                    <Input placeholder="请输入服务说明" value={this.state.url} style={{width:'230px'}}
				                                    onChange={(e)=>{this.setState({url:e.target.value})}} />
					                    </FormItem>
					                    <FormItem wrapperCol={{ span: 12, offset: 4 }} className="half-middle">
					                        <Button className="submitSave" type="primary" htmlType="submit">保存</Button>  
					                        <Button className="submitSave" type="ghost" onClick={this.nextCancel}>取消</Button>
					                    </FormItem> 
				                    </div>:
				                    <div className='clearfix'>
				                    	<FormItem className="half-middle"
					                            {...formItemLayout}
					                            label="服务名称" >
				                    			<span>{this.state.aaa}</span>
				                    	</FormItem>
				                    	<FormItem className="half-middle"
					                            {...formItemLayout}
					                            label="市场价格" >
				                    			<span>{this.state.aaa}</span>
				                    	</FormItem>
				                    	<FormItem className="half-middle"
					                            {...formItemLayout}
					                            label="实签价格" >
				                    			<span>{this.state.aaa}</span>
				                    	</FormItem>
				                    	<FormItem className="half-middle"
					                            {...formItemLayout}
					                            label="服务数量" >
				                    			<span>{this.state.aaa}</span>
				                    	</FormItem>
				                    	<FormItem className="half-middle"
					                            {...formItemLayout}
					                            label="服务说明" >
				                    			<span>{this.state.aaa}</span>
				                    	</FormItem>
				                    </div>}
			                </Spin>
			            </Form >
			        </Modal>
			        <Modal maskClosable={false} visible={this.state.signBillVisible}
                        onOk={this.signBillOk} onCancel={this.signBillOk}
                        width='800px'
                        title='签单信息'                    
                        footer=''
                        className="admin-desc-content">
			            <Form layout="horizontal" onSubmit={this.signOk} id="demand-form">
			                <Spin spinning={this.state.loading}>
			                        <div className="clearfix">
					                    <FormItem className="half-item"
					                            {...formItemLayout}
					                            label="市场价格" > 
					                            <span>{this.state.roleName}</span>
					                    </FormItem>
					                    <FormItem className="half-item"
					                            {...formItemLayout}
					                            label="客户名称" >   
				                                    <Input placeholder="请输入客户名称" value={this.state.roleName} style={{width:'200px'}}
				                                    onChange={(e)=>{this.setState({roleName:e.target.value})}} />
				                                    <span className="mandatory">*</span>
					                    </FormItem>
					                    <FormItem className="half-item"
					                            {...formItemLayout}
					                            label="实签款项" >   
				                                    <Input placeholder="请输入实签款项" value={this.state.url} style={{width:'200px'}}
				                                    onChange={(e)=>{this.setState({url:e.target.value})}} />
				                                    <span className="mandatory">*</span>
					                    </FormItem>
					                    <FormItem className="half-item"
					                            {...formItemLayout}
					                            label="实签首款" >   
				                                    <Input placeholder="请输入实签首款" value={this.state.url} style={{width:'200px'}}
				                                    onChange={(e)=>{this.setState({url:e.target.value})}} />
				                                    <span className="mandatory">*</span>
					                    </FormItem>
					                    <FormItem className="half-item"
					                            {...formItemLayout}
					                            label="特批立项" >  
					                            <Select placeholder="选择特批立项类型"
						                            style={{ width:'200px'}}
						                            value={this.state.orderType}
						                            onChange={(e) => { this.setState({ orderType: e }) }}>
						                            <Select.Option value='0'>未特批</Select.Option>
						                            <Select.Option value='1'>申请特批</Select.Option>
						                        </Select>
					                    		<span className="mandatory">*</span>
						                </FormItem>
						                <div className='clearfix'>
								        	<FormItem
									            labelCol={{ span: 4 }}
									            wrapperCol={{ span: 16 }}
									            label="签单备注" >
									                <Input type="textarea" placeholder="请输入签单备注" rows={4}  value={this.state.introduction} 
										    				onChange={(e)=>{this.setState({introduction:e.target.value})}}/>			                      
									        </FormItem>
								        </div>
								        <div className='clearfix'>
								            <FormItem
								                labelCol={{ span: 4 }}
								                wrapperCol={{ span: 18 }}
								                label="合同扫描件" >
								                <PicturesWall
								                    pictureSign="customer_sys_file"
								                    fileList={this.getOrgCodeUrl}
								                    pictureUrl={this.state.orgCodeUrl} />
								                    <p>图片建议：要清晰。</p>
								            </FormItem>
								        </div>
				                    </div>
			                    <FormItem wrapperCol={{ span: 12, offset: 4 }} className="half-middle">
			                        <Button className="submitSave" type="primary" onClick={this.temporary}>暂存信息</Button> 
			                        <Button className="submitSave" type="primary" htmlType="submit">确定签单</Button>  
			                        <Button className="submitSave" type="ghost" onClick={this.signBillOk}>返回</Button>
			                    </FormItem> 
			                </Spin>
			            </Form >
			        </Modal>
    	    </div>
		)
	}
}));

export default NewService;