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,getProjectState,getTaskStatus} from '../../../../tools.js';

const MySettlementDetaile = Form.create()(React.createClass({
	loadData(record) {
        this.setState({
            loading: true
        });
        $.ajax({
            method: "get",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + '/api/admin/techproject/getProjectTask',
            data: {
            	contractId:record?record.id:this.props.datauser.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.length; i++) {
                        let thisdata = data.data[i];
                        theArr.push({
                             key:i,
                             taskId:thisdata.taskId,
                             commodityName:thisdata.commodityName, 
                             commodityQuantity:thisdata.commodityQuantity, 
                             technicianName:thisdata.technicianName, 
                             taskStatus:thisdata.taskStatus, 
                             deleteSign:thisdata.deleteSign, 
                             taskComment:thisdata.taskComment, 
                        });
                    };
                   }
                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:[],
			customerArr:[],
			checkedKeys: [],
            //派单
			columns: [
				{
                    title: '任务名称',
                    dataIndex: 'commodityName',
                    key: 'commodityName'
                },{
                    title: '任务数量',
                    dataIndex: 'commodityQuantity',
                    key: 'commodityQuantity'
                }, {
                    title: '任务负责人',
                    dataIndex: 'technicianName',
                    key: 'technicianName'
                }, {
                    title: '任务状态',
                    dataIndex: 'taskStatus',
                    key: 'taskStatus',
                    render:(text)=>{return getTaskStatus(text)}
                }, {
                    title: '是否锁定',
                    dataIndex: 'deleteSign',
                    key: 'deleteSign',
                    render:(text)=>{return text==2?'锁定':'未锁定'}
                },{
                    title: '任务说明',
                    dataIndex: 'taskComment',
                    key: 'taskComment',
                    render:(text) => {
                    	return(
                    		 text?text.substr(0,8)+'...':''
                    	)
                    }
                },{
                	title: '操作',
                    dataIndex: 'rrtk',
                    key: 'rrtk',
                    render:(text,record,index)=>{
                    	return (
                    		<div>
								{record.taskStatus<=1&&<Popconfirm title={'您将删除项目任务 【'+record.commodityName+'】,系统将自动同步作废项目资料单，请确认！'} onConfirm={(e)=>{this.voidOperation(record)}} okText="确认" cancelText="取消">
							   	   <Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation()}} type="danger">删除</Button>                 
								</Popconfirm>}
							   	{record.taskStatus<1&&<Button style={{marginRight:'5px'}} onClick={(e) =>{ e.stopPropagation(),this.confirmDelet(record)}} type="primary">派单</Button>}                 
							</div>
							)
                    }
                }
			],
			 userList:[
            	{
                    title: '用户编号',
                    dataIndex: 'userNo',
                    key: 'userNo'
                }, {
                    title: '用户姓名',
                    dataIndex: 'name',
                    key: 'name'
                },{
                    title: '部门机构',
                    dataIndex: 'departmentName',
                    key: 'departmentName'
                }, {
                    title: '职务',
                    dataIndex: 'position',
                    key: 'position'
                },{
                    title: '联系手机',
                    dataIndex: 'mobile',
                    key: 'mobile'
                }, {
                    title: '操作',
                    dataIndex: 'abc',
                    key: 'abc',
                    render:(text,record,index)=>{
                    	return (
                    	    <Popconfirm title={'您确认将订单分配给【'+record.departmentName+'-'+record.name+'】进行业务跟进？'} onConfirm={(e)=>{this.confirmSelect(record)}} okText="确认" cancelText="取消">
							    <Button style={{marginRight:'5px'}} type="primary">选定</Button>                 
							</Popconfirm>
							)
                    }
                }
            ],
		};
	},
	//查看基本详情基本信息
    loaduser(record){
    	if(record){
    	$.ajax({
            method: "get",
			dataType: "json",
			crossDomain: false,
			url: globalConfig.context + '/api/admin/techproject/getProjectDetail',
            data: {
              contractId: 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:record.id,
					orderList:thisData,
					technicianName:thisData.technicianName, //项目负责人
					mid:thisData.buyerId
                });                  
            }.bind(this),
       }).always(function () {
            this.setState({            	
                loading: false
            });
        }.bind(this));  
       }
    },
    //删除
    voidOperation(record){
    	this.setState({
            loading: true
        });
        $.ajax({
            method: "get",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + '/api/admin/techproject/deleteProjectTask',
            data: {
            	taskId:record.taskId
            }
        }).done(function (data) {
            if (!data.error.length) {
                message.success('操作成功');
                this.setState({
                    loading: false,
                });
                this.loadData();
            } else {
                message.warning(data.error[0].message);
            };
        }.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,
		});
	},
	componentWillMount() {
		
	},
	nextCancel() {
		this.setState({
			addnextVisible: false
		})
	},
	//查看订单明细
	orderDetails(record){
		if(record){
	    	$.ajax({
	            method: "get",
				dataType: "json",
				crossDomain: false,
				url: globalConfig.context + '/api/admin/techproject/getProjectTaskDetail',
	            data: {
	              taskId: record.taskId
	            },
	            success: function (data) {
	                let thisData = data.data;                
	                if (!thisData) {
	                    if (data.error && data.error.length) {
	                        message.warning(data.error[0].message);
	                    };
	                    thisData = {};
	                };
	                this.setState({
						taskId:thisData.taskId,
						taskNo:thisData.taskNo,
						projectNo:thisData.projectNo,
						categoryId:thisData.categoryId,
						commodityName:thisData.commodityName,
						taskStatus:thisData.taskStatus,
						taskComment:thisData.taskComment,
						deletedSign:thisData.deletedSign,
						taskAllocatorName:thisData.taskAllocatorName,
						taskReceiverName:thisData.taskReceiverName,
						taskDistributionTime:thisData.taskDistributionTime,
	                });                  
	            }.bind(this),
	       }).always(function () {
	            this.setState({            	
	                loading: false
	            });
	        }.bind(this));  
	    }
	},
	//创建项目保存
	admissibleOrder(){
		if(!this.state.autoId||!this.state.customerName){
        	message.warning('客户名称不匹配');
        	return false;
       };
       if(!this.state.projectName){
       		message.warning('请选择项目负责人');
       		return false;
       };
		this.setState({
			loading: true
		});
		$.ajax({
			method: "POST",
			dataType: "json",
			crossDomain: false,
			url: globalConfig.context + '/api/admin/techproject/createProject',
			data: {
				uid:this.state.autoId,
				signComment:this.state.signComment,
				aid:this.state.aid
			}
		}).done(function(data) {
			this.setState({
				loading: false
			});
			if(!data.error.length) {
				message.success('创建成功！');
				this.projectOk()
			} else {
				message.warning(data.error[0].message);
			}
		}.bind(this));
	},
	//派单
	//操作分配
    confirmDelet(index){
    	console.log(index)
    	this.setState({
    		taskIds:index.taskId,
    		userDetaile:false,
    		distributionVisible:true
    	});
    },
    distributionCancel(){
    	this.setState({
    		distributionVisible:false
    	})
    },
    distributionOk(){
    	this.setState({
    		distributionVisible:false
    	})
    },
    //分配对象列表
    contactList(){
        $.ajax({
            method: "get",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + '/api/admin/superviser/adminList',
            data: {
                pageNo: 1,
                pageSize: 99,
                departmentId:this.state.departmenttList,
                name:this.state.financeNameSearch,
            },
            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,
	                         userNo: thisdata.userNo,
	                         name:thisdata.name,
	                         departmentName:thisdata.departmentName,
	                         departmentId:thisdata.departmentId,
	                         position:thisdata.position,
	                         mobile:thisdata.mobile,
                        });
                    };
                  
                };
               
                this.setState({
                    distributionList: theArr,
                });
            }.bind(this),
        }).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));
    },
    //选定对象
    confirmSelect(record){
    	if(this.state.projectVisible){
    		this.setState({
    			aid:record.id,
    			projectName:record.name
    		})
    		this.distributionOk();
    		return false
    	}
    	this.setState({
            loading: true
        });
        $.ajax({
            method: "POST",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + "/api/admin/techproject/distributionTask",
            data: {
            	taskId:this.state.taskIds,
            	taskReceiverId:record.id
            }
        }).done(function (data) {
            if (!data.error.length) {
                message.success('分派成功！');
                this.setState({
                    loading: false,
                });
                this.distributionOk();
                this.loadData();
            } else {
                message.warning(data.error[0].message);
            };
        }.bind(this));
    },
    searchOrder(){
    	this.contactList();
    },
    resetOrder(){
    	this.state.departmenttList=undefined;
    	this.state.financeNameSearch='';
    	this.setState({
    		distributionList:[]
    	})
    },
    //添加任务
    addTask(){
    	this.setState({
    		commodityQuantity:'',
    		commodityName:'',
    		taskComment:'',
    		kid:'',
    		commodityId:undefined,
    		addTaskState:true,
        	addnextVisible:true,
        	customerArr:[]
        });
    },
    //客户名称自动补全
    //加载(自动补全)
	supervisor(e,state){ //客户名称与服务名称自动补全
		let api=state?'/api/admin/customer/findCustomerByName':'/api/admin/order/getBusinessProjectByName';
		$.ajax({
            method: "get",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + api,
            data:state?{
            	name:e
            }:{
            	businessName: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({
						states:state,
						customerArr:thedata,	
                    });
				}.bind(this),
			}).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));  
	},
	//服务值改变时请求客户名称
	httpChange(e){
		if(e.length>=2){
			this.supervisor(e,false); 
		}	
		this.setState({
			commodityName:e
		})
	},
	//上级主管输入框失去焦点是判断客户是否存在
	selectAuto(value){
		let kid=[];
		let fwList=this.state.customerArr;
		fwList.map(function(item){
			if(value==item.bname){
				kid=item.id
			}
		})
		this.setState({
			kid:kid,
			commodityName:value,
		})
	},
	customerChange(e){
		if(e.length>=2){
			this.supervisor(e,true); 
		}	
		this.setState({
			customerName:e
		})
	},
	//客户
	selectAutoCUT(value){
		let autoIds;
		let fwList=this.state.customerArr;
		fwList.map(function(item){
			if(value==item.name){
				autoIds=item.id
			}
		})
		this.setState({
			customerName:value,
			autoId:autoIds
		})
	},
    //任务新建、编辑保存
	taskSumbit(e) {
		e.preventDefault();
		if(this.state.addTaskState){
			 if(!this.state.kid){
	      	message.warning('请输入服务项目名称');
	      	return false;
	      };
	      if(!this.state.commodityQuantity){
	      	message.warning('请输入数量');
	      	return false;
	      };
		}
		this.props.form.validateFields((err, values) => {
			if(!err) {
				this.setState({
					loading: true
				});
				let api=this.state.addTaskState?'/api/admin/techproject/addProjectTask':'/api/admin/techproject/updateProjectTask';
				$.ajax({
					method: "POST",
					dataType: "json",
					crossDomain: false,
					url: globalConfig.context + api,
					data: this.state.addTaskState?{
						contractId:this.props.datauser.id,
						commodityId:this.state.kid,
						commodityName:this.state.commodityName,
						commodityQuantity:this.state.commodityQuantity,
						taskComment:this.state.taskComment,
					}:{
						taskId:this.state.taskId,
						commodityId:this.state.kid?this.state.kid:this.state.commodityId,
						taskComment:this.state.taskComment
					}
				}).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(nextProps.datauser);
			}
		}else{
			this.setState({
				customerName:'',
				autoId:'',
				signComment:'',
				projectName:'',
				aid:''
			})
		}
	},
	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:[]
			   })
			},
        };
        //
        let departmentArr = this.props.departmentArr || [];
        const hasSelected = this.state.selectedRowKey.length > 0;
		const orderDetaiel=this.state.orderList || [];
		const dataSources=this.state.customerArr || [];
        const options = this.state.states?dataSources.map((group,index) =>
				      <Option key={index} value={group.name}>{group.name}</Option>
				     ):dataSources.map((group,index) =>
				      <Option key={index} value={group.bname}>{group.bname}</Option>
				     )
		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.orderNo}</span>
			                            <Button  onClick={this.seeOrder} style={{float:'right',fontSize:'12px'}}>查看订单</Button>
		                    		</FormItem>
		                    		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="项目编号" >  
			                            <span>{orderDetaiel.serialNumber}</span>
		                    		</FormItem>
		                    		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="客户名称" >  
			                            <span>{orderDetaiel.buyerName}</span>
			                            <Button  onClick={this.seeContract} style={{float:'right',fontSize:'12px'}}>查看联系人</Button>
		                    		</FormItem>
		                    		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="项目类型" >  
			                            <span>{getOrderType(orderDetaiel.projectType)}</span>
		                    		</FormItem>
		                    		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="项目负责人" >  
			                            <span>{orderDetaiel.principalName}</span>
		                    		</FormItem>
		                    		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="项目状态" >  
			                            <span>{getProjectState(orderDetaiel.projectStatus)}</span>
		                    		</FormItem>
		                    		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="是否锁定" >  
			                            <span>{orderDetaiel.deleteSign==2?'锁定':'未锁定'}</span>
		                    		</FormItem>
		                    		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="立项时间" >  
			                            <span>{orderDetaiel.signDate}</span>
		                    		</FormItem>
			                        <div className='clearfix'>
							        	<FormItem
								            labelCol={{ span: 4 }}
								            wrapperCol={{ span: 16 }}
								            label="立项说明" >
							        		 <span>{orderDetaiel.signComment}</span>			                      
								        </FormItem>
							        </div>
		                        </div>
		                        <div className='clearfix'>
		                    		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="结项日期" >  
			                            <span>{orderDetaiel.completeDate}</span>
		                    		</FormItem>
		                    	</div>
		                    	<div className='clearfix'>
							        	<FormItem
								            labelCol={{ span: 4 }}
								            wrapperCol={{ span: 16 }}
								            label="结项说明" >
							        		<span>{orderDetaiel.completeComment}</span>			                      
								        </FormItem>
							        </div>
		                    	<div className='clearfix'>
		                    		<FormItem className="half-item"
			                            {...formItemLayout}
			                            label="是否作废" >  
			                            <span>{orderDetaiel.deleteSign==1?'作废':'未作废'}</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>
					            </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="服务项目名称" >
			                    			<AutoComplete
										        className="certain-category-search"
										        dropdownClassName="certain-category-search-dropdown"
										        dropdownMatchSelectWidth={false}
										        dropdownStyle={{ width: 200 }}
										        style={{ width: '200px' }}
										        dataSource={options}
										        placeholder="输入服务名称"
										        value={this.state.commodityName}
										        onChange={this.httpChange}
										        filterOption={true}
										        onSelect={this.selectAuto}
										      >
										        <Input/>
										      </AutoComplete> 
										      <span className="mandatory">*</span>
			                    	</FormItem>
			                    	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="数量" >
					                    	<Input  style={{ width: '200px' }} placeholder="输入数量"
					                    			value={this.state.commodityQuantity}
					                    			onChange={(e)=>{this.setState({commodityQuantity: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.taskComment}
									    				onChange={(e)=>{this.setState({taskComment:e.target.value})}}/>			                      
								        </FormItem>
							        </div>
		                        </div>:
		                        <div className="clearfix">
		                        	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="项目编号" >
			                    			<span>{this.state.projectNo}</span>
			                    	</FormItem>
			                    	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="任务编号" >
			                    			<span>{this.state.taskNo}</span>
			                    	</FormItem>
			                    	{this.state.taskStatus<1?<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="服务项目名称" >
					                    	<AutoComplete
										        className="certain-category-search"
										        dropdownClassName="certain-category-search-dropdown"
										        dropdownMatchSelectWidth={false}
										        dropdownStyle={{ width: 200 }}
										        style={{ width: '200px' }}
										        dataSource={options}
										        placeholder="输入服务名称"
										        value={this.state.commodityName}
										        onChange={this.httpChange}
										        filterOption={true}
										        onSelect={this.selectAuto}
										      >
										        <Input/>
										      </AutoComplete> 
										      <span className="mandatory">*</span>
			                    	</FormItem>:
			                    	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="服务项目名称" >
			                    			<span>{this.state.commodityName}</span>
			                    	</FormItem>}
			                    	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="任务状态" >
					                    	<span>{getTaskStatus(this.state.taskStatus)}</span>
			                    	</FormItem>
			                    	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="是否锁定" >
					                    	<span>{this.state.deletedSign==2?'锁定':'未锁定'}</span>
			                    	</FormItem>
			                    	<div className='clearfix'>
							        	{this.state.taskStatus<1?<FormItem
								            labelCol={{ span: 4 }}
								            wrapperCol={{ span: 16 }}
								            label="任务说明" >
								                <Input type="textarea" placeholder="请输入订单留言" rows={4}  value={this.state.taskComment} 
									    				onChange={(e)=>{this.setState({taskComment:e.target.value})}}/>			                      
								        </FormItem>:
								        <FormItem className="half-item"
				                            {...formItemLayout}
				                            label="任务说明" >
					                    	<span>{this.state.taskComment}</span>
				                    	</FormItem>}
							        </div>
							        <div className='clearfix'>
							        	<FormItem className="half-item"
				                            {...formItemLayout}
				                            label="派单人" >
					                    	<span>{this.state.taskAllocatorName}</span>
				                    	</FormItem>
				                    	<FormItem className="half-item"
					                            {...formItemLayout}
					                            label="派单时间" >
						                    	<span>{this.state.taskDistributionTime}</span>
				                    	</FormItem>
				                    	<FormItem className="half-item"
					                            {...formItemLayout}
					                            label="资料负责人" >
						                    	<span>{this.state.taskReceiverName}</span>
				                    	</FormItem>
							        </div>
		                        </div>}
		                        {this.state.taskStatus<1||this.state.addTaskState?<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='600px'
	                    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'>
							                <div className="clearfix">
							                    <FormItem  
							                            {...formItemLayout}
							                            label="客户名称" >                             
						                                    <AutoComplete
													        className="certain-category-search"
													        dropdownClassName="certain-category-search-dropdown"
													        dropdownMatchSelectWidth={false}
													        dropdownStyle={{ width: 200 }}
													        size="large"
													        style={{ width: '200px' }}
													        dataSource={options}
													        placeholder="输入客户名称"
													        value={this.state.customerName}
													        onChange={this.customerChange}
													        filterOption={true}
													        onBlur={this.blurCutor}
													        onSelect={this.selectAutoCUT}
													      >
													        <Input/>
													      </AutoComplete> 
													      <span className="mandatory">*</span>
							                    </FormItem>
							                </div>
							                <div className='clearfix'>
							                	<FormItem  
						                            {...formItemLayout}
						                            label="项目负责人" > 
						                            <span style={{width:'150px'}}>{this.state.projectName}</span>
						                    		<Button onClick={this.confirmDelet} style={{float:'right',marginRight:'50px'}}>选择</Button>
							                    </FormItem>
							                </div>
							                <div className='clearfix'>
									        	<FormItem
										            labelCol={{ span: 8 }}
										            wrapperCol={{ span: 12 }}
										            label="项目说明" >
										                <Input type="textarea" placeholder="请输入签单备注" rows={4}  value={this.state.signComment} 
											    				onChange={(e)=>{this.setState({signComment:e.target.value})}}/>			                      
										        </FormItem>
									        </div>
									    </div>
				                    </div>
				                    <FormItem wrapperCol={{ span: 12, offset: 4 }} className="half-middle">
										<Button type="primary" onClick={this.admissibleOrder} style={{marginLeft:'55px'}}>保存</Button>
				                        <Button className="submitSave" type="ghost" onClick={this.projectCancel}>返回</Button>
				                    </FormItem> 
	                        </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>
			                		<Select placeholder="订单部门"
				                            style={{ width: 150 ,marginRight:'10px',marginLeft:'10px'}}
				                            value={this.state.departmenttList}
				                            onChange={(e) => { this.setState({ departmenttList: e }) }}>
				                            {
			                                    departmentArr.map(function (item) {
			                                            return <Select.Option key={item.id} >{item.name}</Select.Option>
			                                    })
			                                }
				                    </Select>
				                    <Input placeholder="财务负责人" style={{width:'150px',marginLeft:'10px'}}
				                        value={this.state.financeNameSearch}
				                        onChange={(e) => { this.setState({ financeNameSearch: 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={false}
				                             />
				                    </Spin>
				                </div>
			                </Spin>
			            </Form>
			    </Modal>
			    {/*<Modal maskClosable={false} visible={this.state.distributionVisible}
                        onOk={this.distributionOk} onCancel={this.distributionCancel}
                        width='800px'
                        title={this.state.seeState?'查看订单':'查看联系人'}                     
                        footer=''
                        className="admin-desc-content">
			            <Form layout="horizontal"  id="demand-form" style={{paddingBottom:'40px'}} >
			                <Spin spinning={this.state.loading}>
			                	 <div className="patent-table" style={{marginTop:'10px'}}>
				                    <Spin spinning={this.state.loading}>
				                        {this.state.seeState?<Table columns={this.state. }
				                            dataSource={this.state.seeOrderArr}
				                            pagination={false}
				                             />:
				                             <Table columns={this.state.contractList}
				                            dataSource={this.state.contractArr}
				                            pagination={false}
				                             />}
				                    </Spin>
				                </div>
			                </Spin>
			            </Form>
			    </Modal>
			    */}
    	    </div>
		)
	}
}));

export default MySettlementDetaile;