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 {orderType} from '../../../../dataDic.js';
import {getOrderType} from '../../../../tools.js';

const MySettlementDetaile = Form.create()(React.createClass({
	loadData() {
        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;
                        theArr.push({
                             key:i,
                             roleName5:thisdata[i].id   
                        });
                    };
                   }
                this.setState({
                    dataSource: theArr,
                });
            }.bind(this),
        }).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));
    },
	getInitialState() {
		return {
			loading: false,
			visible: false,
			contractState:false,
			projectVisible:false,
			selectedRowKey:[],
			orderSelect:false,
			orgCodeUrl:[],
			checkedKeys: [],
			pagination: {
                defaultCurrent: 1,
                defaultPageSize: 10,
                showQuickJumper: true,
                pageSize: 10,
                onChange: function (page) {
                    this.loadData(page);
                }.bind(this),
                showTotal: function (total) {
                    return '共' + total + '条数据';
                }
            },
            //派单
            distributionPagination: {
                defaultCurrent: 1,
                defaultPageSize: 10,
                showQuickJumper: true,
                pageSize: 10,
                onChange: function (page) {
                    this.contactList(page);
                }.bind(this),
                showTotal: function (total) {
                    return '共' + total + '条数据';
                }
            },
			columns: [
				{
                    title: '任务名称',
                    dataIndex: 'roleName',
                    key: 'roleName'
                }, {
                    title: '业务类别',
                    dataIndex: 'creater1',
                    key: 'creater1'
                },{
                    title: '任务数量',
                    dataIndex: 'roleName2',
                    key: 'roleName2'
                }, {
                    title: '任务负责人',
                    dataIndex: 'creater4',
                    key: 'creater4'
                }, {
                    title: '任务状态',
                    dataIndex: 'roleName22',
                    key: 'roleName22'
                }, {
                    title: '是否锁定',
                    dataIndex: 'creater41',
                    key: 'creater41'
                },{
                    title: '任务说明',
                    dataIndex: 'roleName5',
                    key: 'roleName5',
                    render:(text) => {
                    	return(
                    		 text?text.substr(0,6)+'...':''
                    	)
                    }
                },{
                	title: '操作',
                    dataIndex: 'rrtk',
                    key: 'rrtk',
                    render:(text,record,index)=>{
                    	return (
                    		<div>
								<Popconfirm title={'您将作废项目任务 【'+record.name+'】,系统将自动同步作废项目资料单，请确认！'} onConfirm={(e)=>{this.voidOperation(record)}} okText="确认" cancelText="取消">
							   	   <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">作废</Button>                 
								</Popconfirm>
							   	<Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation(),this.confirmDelet(record)}} type="primary">派单</Button>                 
								<Popconfirm title={'您将锁定项目任务【'+record.name+'】,系统将自动同步锁定项目资料单，请确认！'} onConfirm={(e)=>{this.lockOperation(record)}} okText="确认" cancelText="取消">
							   	   <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">锁定</Button>                 
								</Popconfirm>
							</div>
							)
                    }
                }
			],
			//选择订单
			columnOrder: [
				{
                    title: '订单编号',
                    dataIndex: 'roleName',
                    key: 'roleName'
                }, {
                    title: '项目类别',
                    dataIndex: 'creater1',
                    key: 'creater1'
                },{
                    title: '项目数量',
                    dataIndex: 'roleName2',
                    key: 'roleName2'
                }, {
                    title: '下单时间',
                    dataIndex: 'creater4',
                    key: 'creater4'
                },{
                	title: '操作',
                    dataIndex: 'rrt',
                    key: 'rrt',
                    render:(text,record,index)=>{
                    	return (
                    		<div>
								<Popconfirm title={'是否选择订单 【'+record.name+'】'} onConfirm={(e)=>{this.listSelect(record)}} okText="确认" cancelText="取消">
							   	   <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">选择</Button>                 
								</Popconfirm>
							</div>
							)
                    }
                }
			],
			userList:[
            	{
                    title: '用户编号',
                    dataIndex: 'roleName',
                    key: 'roleName'
                }, {
                    title: '用户姓名',
                    dataIndex: 'creater',
                    key: 'creater'
                },{
                    title: '部门机构',
                    dataIndex: 'roleName1',
                    key: 'roleName1'
                }, {
                    title: '职务',
                    dataIndex: 'creater1',
                    key: 'creater1'
                },{
                    title: '联系手机',
                    dataIndex: 'roleName2',
                    key: 'roleName2'
                }, {
                    title: '操作',
                    dataIndex: 'abc',
                    key: 'abc',
                    render:(text,record,index)=>{
                    	return (
                    	    <Popconfirm title={'您确认将此订单 【'+ record.roleName+'】 分配给【'+record.roleName+'-'+record.roleName+'】进行业务跟进？'} onConfirm={(e)=>{this.confirmSelect(record)}} okText="确认" cancelText="取消">
							    <Button style={{marginRight:'5px'}} type="primary">选定</Button>                 
							</Popconfirm>
							)
                    }
                }
            ],
		};
	},
	//选定订单
	listSelect(record){
		this.setState({
			loading: true
		});
		$.ajax({
			method: "POST",
			dataType: "json",
			crossDomain: false,
			url: globalConfig.context +'/api/zuofei',
			data: {
				id:record.id,
			}
		}).done(function(data) {
			this.setState({
				loading: false
			});
			if(!data.error.length) {
				message.success('操作成功！');
				this.orderOk();
				this.addOrderDetaiel(record)		
			} else {
				message.warning(data.error[0].message);
			}
		}.bind(this));		
	},
	addOrderDetaiel(record){
		this.setState({
            loading: true
        });
        $.ajax({
            method: "post",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + '/api/admin/xiangqing',
            data: {
            	id:record.id
            },
            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;
                        this.setState({
		                    key: i,
		                });
                    };
                   }
            }.bind(this),
        }).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));
	},
	//查看基本详情基本信息
    loaduser(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 = {};
                };
                this.setState({
					ids:record.id,
                	roleName:thisData[0].rname,
                });                  
            }.bind(this),
       }).always(function () {
            this.setState({            	
                loading: false
            });
        }.bind(this));  
       }
    },
    //作废
    voidOperation(e){
    	this.unlock(e,true)
    },
    //锁定
    lockOperation(e){
    	this.unlock(e,false)
    },
    unlock(record,state){
    	this.setState({
            loading: true
        });
        let api=state?'/api/zuofei':'/api/suoding'
        $.ajax({
            method: "POST",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + api,
            data: {
            	id:this.props.datauser.id,
            	uid:record.id
            }
        }).done(function (data) {
            if (!data.error.length) {
                message.success('操作成功');
                this.setState({
                    loading: false,
                });
                this.loadData();
            } else {
                message.warning(data.error[0].message);
            };
            this.loadData();
        }.bind(this));
    },
    //订单编辑保存
	handleOk(e) {
		this.setState({
			visible: false,
		});
		this.props.closeDesc(false, true);
	},
	handleCancel(e) {
		this.setState({
			visible: false,
		});
		this.props.closeDesc(false);
	},
	//新建项目
	projectOk(e) {
		this.setState({
			projectVisible: false,
		});
		this.props.closeDesc(false, true);
	},
	projectCancel(e) {
		this.setState({
			projectVisible: false,
		});
		this.props.closeDesc(false);
	},
	//选定订单
	orderOk() {
		this.setState({
			orderSelect: false,
		});
	},
	SelectOrder(){
		this.setState({
			orderSelect: true,
		});
	},
	componentWillMount() {
		
	},
	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));  
	    }
	},
	//创建项目保存
	admissibleOrder(){
		if(this.state.Names==''||this.state.Names==null){
        	message.warning('请输入客户名称');
        	this.refs.Names.focus()
        	return false;
        };
		if(this.state.projectType==undefined){
        	message.warning('请选择项目类型');
        	return false;
        };
        if(this.state.pName==''||this.state.pName==null){
        	message.warning('请输入项目负责人');
        	this.refs.pName.focus()
        	return false;
        };
		this.setState({
			loading: true
		});
		$.ajax({
			method: "POST",
			dataType: "json",
			crossDomain: false,
			url: globalConfig.context + '/api/xinjianbaocun',
			data: {
				
			}
		}).done(function(data) {
			this.setState({
				loading: false
			});
			if(!data.error.length) {
				message.success('保存成功！');
				this.projectOk()
			} else {
				message.warning(data.error[0].message);
			}
		}.bind(this));
	},
	//编辑订单保存
	handleSubmit(e) {
		e.preventDefault();
		this.props.form.validateFields((err, values) => {
			if(!err) {
				this.setState({
					loading: true
				});
				$.ajax({
					method: "POST",
					dataType: "json",
					crossDomain: false,
					url: globalConfig.context + '/api/000',
					data: {
						id:this.props.datauser.id
					}
				}).done(function(data) {
					this.setState({
						loading: false
					});
					if(!data.error.length) {
						message.success('保存成功！');
						this.handleOk()
					} else {
						message.warning(data.error[0].message);
					}
				}.bind(this));
			}
		});
	},
	//派单
	//操作分配
    confirmDelet(index){
    	this.setState({
    		userDetaile:false,
    		distributionVisible:true
    	});
    	this.contactList(1,index.id)
    },
    distributionCancel(){
    	this.setState({
    		distributionVisible:false
    	})
    },
    distributionOk(){
    	this.setState({
    		distributionVisible:false
    	})
    },
    //分配对象列表
    contactList(pageNo,orderId){
        $.ajax({
            method: "post",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + '/api/admin/roles',
            data: {
                pageNo: pageNo || 1,
                pageSize: this.state.distributionPagination.pageSize,
            },
            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,
	                         id: thisdata.id,
	                         roleName: thisdata.roleName,
	                         creater:thisdata.creater,
	                         createTime:thisdata.createTimez,
	                         uid:orderId,
                        });
                    };
                    this.state.distributionPagination.current = data.data.pageNo;
                    this.state.distributionPagination.total = data.data.totalCount;
                };
                if(!data.data.list.length){
					this.state.distributionPagination.current=0
					this.state.distributionPagination.total=0
				}
                this.setState({
                    distributionList: theArr,
                    pagination: this.state.distributionPagination,
                });
            }.bind(this),
        }).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));
    },
    //选定对象
    confirmSelect(record){
    	this.setState({
            loading: true
        });
        $.ajax({
            method: "POST",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + "/api/paidan",
            data: {
            	id:this.props.datauser.id,
            	uid:record.id
            }
        }).done(function (data) {
            if (!data.error.length) {
                message.success('分派成功');
                this.setState({
                    loading: false,
                });
                this.distributionOk();
            } else {
                message.warning(data.error[0].message);
            };
            this.loadData();
        }.bind(this));
    },
    //添加任务
    addTask(){
    	this.setState({
    		addTaskState:true,
        	addnextVisible:true,
        });
    },
    //任务新建、编辑保存
	taskSumbit(e) {
		e.preventDefault();
//      if(!this.state.customerName&&!this.state.autoId){
//      	message.warning('请输入客户名称');
//      	return false;
//      };
		this.props.form.validateFields((err, values) => {
			if(!err) {
				this.setState({
					loading: true
				});
				let api=this.state.addTaskState?'/api/tianjia':'/api/admin/order/bianji';
				$.ajax({
					method: "POST",
					dataType: "json",
					crossDomain: false,
					url: globalConfig.context + api,
					data: this.state.addTaskState?{
						id:'tianjia'
					}:{
						id:'bianji'
					}
				}).done(function(data) {
					this.setState({
						loading: false
					});
					if(!data.error.length) {
						message.success('保存成功！');
						this.nextCancel();
						this.loadData();
					} else {
						message.warning(data.error[0].message);
					}
				}.bind(this));
			}
		});
	},
	//任务项目各种骚操作
	unlock(){ //解锁
		this.removeList('1')
	},
	lock(){ //锁定
		this.removeList('2')
	},
	removeItem(){ //撤项
		this.removeList('3')
	},
	Knot(){ //结项
		this.removeList('4')
	},
	removeList(e){
		if(!e) return false;
		this.setState({
			loading: true
		});
		let api='';
		switch (e){
			case '1': //解锁
			  api='/api/jiesuo' 
			break;
			case '2': //锁定
			  api='/api/suoding'
			break;
			case '3': //撤项
			  api='/api/chexiang'
			break;
			case '4': //结项
			  api='/api/jiexiang'
			break;
		};
		$.ajax({
			method: "POST",
			dataType: "json",
			crossDomain: false,
			url: globalConfig.context + api,
			data: {
				id:this.props.datauser.id
			}
		}).done(function(data) {
			this.setState({
				loading: false
			});
			if(!data.error.length) {
				message.success('操作成功！');
				this.handleOk()
			} else {
				message.warning(data.error[0].message);
			}
		}.bind(this));
	},
	tableRowClick(record, index) {
        this.setState({
        	addTaskState:false,
        	addnextVisible:true,
        });
        this.orderDetails(record)
    },
	componentWillReceiveProps(nextProps) { //props改变时触发
		this.state.projectVisible = nextProps.newProject;
		this.state.visible = nextProps.showDesc;
		if(nextProps.userDetaile && nextProps.showDesc ) {
			if(nextProps.datauser && nextProps.datauser.id ) {
				this.loaduser(nextProps.datauser);
				this.loadData();
			}
		}
	},
	render() {
		const FormItem = Form.Item
		const formItemLayout = {
			labelCol: { span: 8 },
			wrapperCol: { span: 14 },
		};
		const rowSelection = {
            selectedRowKey: this.state.selectedRowKey,
            onChange: (selectedRowKey, selectedRows) => {
	                this.setState({
	                    selectedRows: selectedRows.slice(-1),
	                    selectedRowKey: selectedRowKey.slice(-1)
	                }); 
            },
            onSelectAll: (selected, selectedRows, changeRows) => {
			   this.setState({
			   		selectedRowKey:[]
			   })
			},
        };
        const hasSelected = this.state.selectedRowKey.length > 0;
		const orderDetaiel=this.state.orderList || [];
		return(
			<div>
            <Modal maskClosable={false} visible={this.state.visible}
                    onOk={this.handleOk} onCancel={this.handleCancel}
                    width='1000px'
                    title={this.props.projectState?'项目管理':'编辑订单' }                    
                    footer=''
                    className="admin-desc-content">
		            <Form layout="horizontal" id="demand-form" style={{paddingBottom:'40px'}} onSubmit={this.handleSubmit}>
		                <Spin spinning={this.state.loading}>
	                        <div className="clearfix">
	                            <div className="clearfix">
		                       		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="订单关联" >
			                            <span>{orderDetaiel.roleName}</span>
			                            <Button type='primary' onClick={this.seeOrder} style={{float:'right'}}>查看订单</Button>
		                    		</FormItem>
		                    		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="项目编号" >  
			                            <span>{orderDetaiel.createTimez}</span>
		                    		</FormItem>
		                    		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="客户名称" >  
			                            <span>{orderDetaiel.roleName}</span>
			                            <Button type='primary' onClick={this.seeOrder} style={{float:'right'}}>查看联系人</Button>
		                    		</FormItem>
		                    		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="项目类型" >  
			                            <span>{orderDetaiel.roleName}</span>
		                    		</FormItem>
		                    		{!this.props.projectState?<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="项目负责人" >  
			                            <Input value={this.state.ordesss} onChange={(e)=>{this.setState({ordesss:e.target.value})}} style={{width:'240px'}}/>
			                            <span className="mandatory">*</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>
			                        <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
								            labelCol={{ span: 4 }}
								            wrapperCol={{ span: 16 }}
								            label="结项说明" >
							        		<span>{orderDetaiel.roleName}</span>			                      
								        </FormItem>
							        </div>
		                    	<div className='clearfix'>
		                    		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="是否作废" >  
			                            <span>{orderDetaiel.createTimez}</span>
		                    		</FormItem>
	                    		</div>
				                <div>
				                	<span style={{marginLeft:'50px',fontSize:'20px'}}>项目任务</span>
				                	{!this.props.projectState&&<Button type='primary' onClick={this.addTask} style={{float:'right',marginRight:'100px'}}>添加任务</Button>}
				                </div>
				                <div className="patent-table">
				                    <Spin spinning={this.state.loading}>
				                        <Table columns={this.state.columns}
				                            dataSource={this.state.dataSource}
				                            pagination={false}
				                            onRowClick={this.tableRowClick} 
				                            />
				                    </Spin>
					            </div>
					            {!this.props.projectState?<div style={{marginTop:'30px',paddingLeft:'100px'}}>
						            <Button className="setSave" type="primary" htmlType="submit" style={{marginRight:'50px'}}>保存</Button>  
						            <Button className="cancel" type="ghost" onClick={this.handleCancel}>返回</Button>
					            </div>:
					            <div style={{marginTop:'30px',paddingLeft:'100px'}}>
					            	<Button type="primary" onClick={this.removeItem}>撤项</Button>  
						            <Button type="primary" onClick={this.Knot} style={{margin:'15px'}}>结项</Button>
						            <Button type="danger" onClick={this.lock}>锁定</Button>
						            <Button type="primary" onClick={this.unlock} style={{margin:'15px'}}>解锁</Button>
						            <Button 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='800px'
                        title={this.state.addTaskState?'添加任务':'编辑任务'}                
                        footer=''
                        className="admin-desc-content">
			            <Form layout="horizontal" id="demand-form" onSubmit={this.taskSumbit}>
			                <Spin spinning={this.state.loading}>
		                        {this.state.addTaskState?<div className="clearfix">
	                        	    <FormItem className="half-item"
				                            {...formItemLayout}
				                            label="服务名称分类" >
			                    			<Select placeholder="选择服务项目分类"
					                            style={{ width: 200 ,marginRight:'10px'}}
					                            value={this.state.orderStatus}
					                            onChange={(e) => { this.setState({ orderStatus: e }) }}>
					                            {
				                                    orderType.map(function (item) {
				                                            return <Select.Option key={item.value} >{item.key}</Select.Option>
				                                    })
				                                }
					                        </Select>
					                        <span className="mandatory">*</span>
			                    	</FormItem>
			                    	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="服务项目名称" >
					                    	<Input value={this.state.leibie}  style={{ width: 200 }} placeholder="输入服务项目名称"
					                    			onChange={(e)=>{this.setState({leibie:e.target.value})}}/>
			                    			<span className="mandatory">*</span>
			                    	</FormItem>
			                    	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="数量" >
					                    	<Input value={this.state.leibie} style={{ width: 200 }} placeholder="输入数量"
					                    			onChange={(e)=>{this.setState({leibie:e.target.value})}}/>
			                    			<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>:
		                        <div className="clearfix">
		                        	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="项目编号" >
			                    			<span>{this.state.bianhao}</span>
			                    	</FormItem>
			                    	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="任务编号" >
			                    			<span>{this.state.bianhao}</span>
			                    	</FormItem>
		                        	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="服务名称分类" >
			                    			<Select placeholder="选择服务项目分类"
					                            style={{ width: 200 ,marginRight:'10px'}}
					                            value={this.state.orderStatus}
					                            onChange={(e) => { this.setState({ orderStatus: e }) }}>
					                            {
				                                    orderType.map(function (item) {
				                                            return <Select.Option key={item.value} >{item.key}</Select.Option>
				                                    })
				                                }
					                        </Select>
					                        <span className="mandatory">*</span>
			                    	</FormItem>
			                    	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="服务项目名称" >
					                    	<Input value={this.state.leibie}  style={{ width: 200 }} placeholder="输入服务项目名称"
					                    			onChange={(e)=>{this.setState({leibie:e.target.value})}}/>
			                    			<span className="mandatory">*</span>
			                    	</FormItem>
			                    	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="任务状态" >
					                    	<span>{this.state.bianhao}</span>
			                    	</FormItem>
			                    	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="是否锁定" >
					                    	<span>{this.state.bianhao}</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 className="half-item"
				                            {...formItemLayout}
				                            label="派单人" >
					                    	<span>{this.state.bianhao}</span>
				                    	</FormItem>
				                    	<FormItem className="half-item"
					                            {...formItemLayout}
					                            label="派单时间" >
						                    	<span>{this.state.bianhao}</span>
				                    	</FormItem>
				                    	<FormItem className="half-item"
					                            {...formItemLayout}
					                            label="资料负责人" >
						                    	<span>{this.state.bianhao}</span>
				                    	</FormItem>
							        </div>
		                        </div>}
		                        <div className="clearfix" style={{marginBottom:'20px'}}>
				                    <Button className="setSave" type="primary" htmlType="submit">保存</Button>  
	                                <Button className="cancel" type="ghost" onClick={this.nextCancel}>返回</Button>
		                        </div>
			                </Spin>
			            </Form >
			        </Modal>
			        <Modal maskClosable={false} visible={this.state.projectVisible}
	                    onOk={this.projectOk} onCancel={this.projectCancel}
	                    width='1000px'
	                    title='创建订单'                     
	                    footer=''
	                    className="admin-desc-content">
			            <Form layout="horizontal" id="demand-form" style={{paddingBottom:'40px'}} >
			                <Spin spinning={this.state.loading}>
			                        <div className="clearfix">
			                        	<div>
						                    <FormItem className="half-item"
					                            {...formItemLayout}
					                            label="订单关联" > 
					                            <span>{this.state.roleName}</span>
						                    </FormItem>
						                    <Button type='primary' onClick={this.SelectOrder}>选定</Button>
					                    </div>
					                    <div className='clearfix'>
						                    <FormItem className="half-item"
						                            {...formItemLayout}
						                            label="订单状态" > 
						                            <span>{this.state.roleName}</span>
							                </FormItem>
						                    <FormItem className="half-item"
						                            {...formItemLayout}
						                            label="订单时间" > 
						                            <span>{this.state.roleName}</span>
							                </FormItem>
						                    <FormItem className="half-item"
						                            {...formItemLayout}
						                            label="结算状态" > 
						                            <span>{this.state.roleName}</span>
							                </FormItem>
						                    <FormItem className="half-item"
						                            {...formItemLayout}
						                            label="是否特批" > 
						                            <span>{this.state.roleName}</span>
							                </FormItem>
							                <FormItem className="half-item"
						                            {...formItemLayout}
						                            label="订单类型" > 
						                            <span>{this.state.roleName}</span>
							                </FormItem>
							                <FormItem className="half-item"
						                            {...formItemLayout}
						                            label="订单负责人" > 
						                            <span>{this.state.roleName}</span>
							                </FormItem>
							            </div>
						                <div className='clearfix'>
							                <FormItem className="half-item"
					                            {...formItemLayout}
					                            label="客户名称" > 
					                             <Input placeholder="客户名称" value={this.state.Names} 
					                                    onChange={(e)=>{this.setState({Names:e.target.value})}} style={{width:'240px'}} ref='Names'/>
								                   		<span className="mandatory">*</span>
							                </FormItem>
							                <FormItem className="half-item"
					                            {...formItemLayout}
					                            label="项目类型" > 
					                            <Select placeholder="请选择项目类型"
						                            style={{ width:'240px'}}
						                            value={this.state.projectType}
						                            onChange={(e) => { this.setState({ projectType: e }) }}>
						                            {
					                                    orderType.map(function (item) {
					                                            return <Select.Option key={item.value} >{item.key}</Select.Option>
					                                    })
					                                }
						                        </Select>
					                    		<span className="mandatory">*</span>
						                    </FormItem>
						                    <FormItem className="half-item"
						                            {...formItemLayout}
						                            label="项目负责人" > 
						                             <Input placeholder="请输入项目负责人" value={this.state.pName} 
						                                    onChange={(e)=>{this.setState({pName:e.target.value})}} style={{width:'240px'}} ref='pName'/>
									                   		<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>
				                    </div>
				                    <FormItem wrapperCol={{ span: 12, offset: 4 }} className="half-middle">
				                     	<Popconfirm title={'系统将依据订单【'+this.props.datauser.roleName+'】自动生成项目任务，是否保存？'} onConfirm={(e)=>{this.admissibleOrder()}} okText="确认" cancelText="取消">
											<Button className="submitSave" type="primary" htmlType="submit">保存</Button>
										</Popconfirm>
				                        <Button className="submitSave" type="ghost" onClick={this.projectCancel}>返回</Button>
				                    </FormItem> 
	                        </Spin>
			            </Form >
			        </Modal> 
			        <Modal maskClosable={false} visible={this.state.orderSelect}
	                    onOk={this.orderOk} onCancel={this.orderOk}
	                    width='800px'
	                    title='选择关联订单'                     
	                    footer=''
	                    className="admin-desc-content">
			            <Form layout="horizontal" id="demand-form" style={{paddingBottom:'40px'}}>
			                <Spin spinning={this.state.loading}>
		                        <div className="clearfix">
		                        	<div className="clearfix">
		                        		<Table columns={this.state.columnOrder}
				                            dataSource={this.state.dataOrder}
				                            pagination={this.state.pagination}
				                            />
		                        	</div>
			        			</div>
				        	</Spin>
				        </Form>
			        </Modal>
			        <Modal maskClosable={false} visible={this.state.distributionVisible}
                        onOk={this.distributionOk} onCancel={this.distributionCancel}
                        width='800px'
                        title='分派财务订单'                     
                        footer=''
                        className="admin-desc-content">
			            <Form layout="horizontal" id="demand-form" style={{paddingBottom:'40px'}} >
			                <Spin spinning={this.state.loading}>
			                	<div>
			                		<Input placeholder="部门名称" style={{width:'150px'}}
				                        value={this.state.customerName}
				                        onChange={(e) => { this.setState({ customerName: e.target.value }); }} />
				                    <Input placeholder="财务负责人" style={{width:'150px',marginLeft:'10px'}}
				                        value={this.state.customerName}
				                        onChange={(e) => { this.setState({ customerName: e.target.value }); }} />  
				                    <Button type="primary" onClick={this.searchOrder} style={{marginLeft:'10px',marginRight:'10px'}}>搜索</Button>
	                    			<Button onClick={this.resetOrder}>重置</Button>
			                	</div>
			                	 <div className="patent-table" style={{marginTop:'10px'}}>
				                    <Spin spinning={this.state.loading}>
				                        <Table columns={this.state.userList}
				                            dataSource={this.state.distributionList}
				                            pagination={this.state.distributionPagination}
				                             />
				                    </Spin>
				                </div>
			                </Spin>
			            </Form>
			    </Modal>
    	    </div>
		)
	}
}));

export default MySettlementDetaile;