import React from 'react';
import ReactDom from 'react-dom';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
import '../content.less';
import { citySelect,provinceList,areaSelect,provinceSelect,addressList} from '../../../NewDicProvinceList';
import { Form,Radio, Icon, Button, Input, Select, Spin, Table, Switch, message, DatePicker, Modal, Upload,Popconfirm,AutoComplete,Tabs,Checkbox,Tree,Cascader} from 'antd';
import {patternOrganization,conditionOrganization,intentionalService,messageType,designatedObjects,socialAttributeS,industry,socialAttribute,industryS,designatedObjectse,auditStatusL} from '../../../dataDic.js';
import {getPattern,getProvince,getCondition,getcustomerTyp,getSocialAttribute,getDesignated,getCertification,getAuditStatus, getContactType, getfllowSituation,getWhether,getLvl,getCurrentMember,getStatuslist,getMessageType} from '../../../tools.js';
const TabPane = Tabs.TabPane;
const TreeNodet = Tree.TreeNode;
const CheckboxGroup = Checkbox.Group;
const SystemMessage=Form.create()(React.createClass({
	//列表的展示和搜索
	loadData(pageNo,sendType) {
        this.state.data = [];
        this.setState({
            loading: true
        });
        $.ajax({
            method: "get",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + '/api/admin/message/listSystemMessage',
            data: {
                pageNo: pageNo || 1,
                pageSize: this.state.pagination.pageSize,
                isDraft:sendType,//是否发送
                subject:'01',//列表消息类型
            },
            success: function (data) {
                let theArr = [];
                if (!data.data || !data.data.list) {
                    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.messageId,//每一条消息的ID
                            createTime:thisdata.createTime,//创建时间
                            title:thisdata.title,//消息标题
                            body:thisdata.body,//消息内容
                            subject:thisdata.subject,//消息类型
                            consumerType:thisdata.consumerType,//发送目标类型
                        });
                    };
                    this.state.pagination.current = data.data.pageNo;
                    this.state.pagination.total = data.data.totalCount;
                };
                this.setState({
                    dataSource: theArr,
                    pagination: this.state.pagination
                });
            }.bind(this),
        }).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));
       
    },
    sanhuLoadData(pageNo, apiUrl) {
		this.setState({
			loading: true
		});
		$.ajax({
			method: "post",
			dataType: "json",
			crossDomain: false,
			url: globalConfig.context + '/api/admin/customer/listAllPersonalCustomer',
			data: {
				pageNo: pageNo || 1,
				pageSize: this.state.pagination.pageSize,
				name: this.state.nameSearch,
				societyTag: this.state.societyTagSearch,
			},
			success: function(data) {
				let theArr = [];
				if(data.error.length || data.data.list == "") {
					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: thisdata.uid,
							id: thisdata.uid,
							type: thisdata.type,
							name: thisdata.name,
							status: thisdata.status,
							contacts: thisdata.contacts,
							contactMobile: thisdata.contactMobile,
							industry: thisdata.industry,
							createTime: thisdata.createTime,
							businessAudit: thisdata.businessAudit,
							auditStatus: thisdata.auditStatus,
							lvl: thisdata.lvl,
							isMember: thisdata.isMember,
							status: thisdata.status,
							societyTag: thisdata.societyTag,
							currentMemberStatus: thisdata.currentMemberStatus,
							international: thisdata.international,
							listed: thisdata.listed,
							highTechZone: thisdata.highTechZone,
							locationProvince: thisdata.province ? thisdata.province + '-' + thisdata.city || '' + '-' + thisdata.area : '--'
						});
					};

				};
				this.state.pagination1.current = data.data.pageNo ? data.data.pageNo : '0';
				this.state.pagination1.total = data.data.totalCount ? data.data.totalCount : '0';
				this.setState({
					sanhuDataSource: theArr,
					pagination1: this.state.pagination1
				});
			}.bind(this),
		}).always(function() {
			this.setState({
				loading: false
			});
		}.bind(this));
	},
	sanhuLoadData21(pageNo, apiUrl) {
		this.setState({
			loading: true
		});
		$.ajax({
			method: "post",
			dataType: "json",
			crossDomain: false,
			url: globalConfig.context + '/api/admin/customer/listAllOrganizationCustomer',
			data: {
				pageNo: pageNo || 1,
				pageSize: this.state.pagination.pageSize,
				name: this.state.nameSearch,
				societyTag: this.state.societyTagSearch,
			},
			success: function(data) {
				let theArr = [];
				if(data.error.length || data.data.list == "") {
					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: thisdata.uid,
							id: thisdata.uid,
							type: thisdata.type,
							name: thisdata.name,
							status: thisdata.status,
							contacts: thisdata.contacts,
							contactMobile: thisdata.contactMobile,
							industry: thisdata.industry,
							createTime: thisdata.createTime,
							businessAudit: thisdata.businessAudit,
							auditStatus: thisdata.auditStatus,
							lvl: thisdata.lvl,
							isMember: thisdata.isMember,
							status: thisdata.status,
							societyTag: thisdata.societyTag,
							currentMemberStatus: thisdata.currentMemberStatus,
							international: thisdata.international,
							listed: thisdata.listed,
							highTechZone: thisdata.highTechZone,
							locationProvince: thisdata.province ? thisdata.province + '-' + thisdata.city || '' + '-' + thisdata.area : '--'
						});
					};

				};
				this.state.pagination21.current = data.data.pageNo ? data.data.pageNo : '0';
				this.state.pagination21.total = data.data.totalCount ? data.data.totalCount : '0';
				this.setState({
					sanhuDataSource21: theArr,
					pagination21: this.state.pagination21
				});
			}.bind(this),
		}).always(function() {
			this.setState({
				loading: false
			});
		}.bind(this));
	},
	sanhuLoadData1(pageNo) {
        this.setState({
            loading: true
        });
        $.ajax({
            type: 'get',
            cache: false,
            url: globalConfig.context + "/api/admin/supervise/adminList",
            dataType: "json",
            data: {
                pageNo: pageNo || 1,
                pageSize: this.state.pagination.pageSize,
                province: this.state.searchProvince,
                mobile: this.state.searchMobile,
                name: this.state.searchName,
                department:this.state.departmentt
            },
            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];
                        this.state.onlyProvince = thisdata.province;
                        theArr.push({
                            key: thisdata.id,
                            id: thisdata.id,
                            mobile: thisdata.mobile,
                            name: thisdata.name,
                            email: thisdata.email,
                            createTime: thisdata.createTime,
                            number: thisdata.number,
                            province: thisdata.province,
                            city:thisdata.city,
                            position: thisdata.position,
                            departmentName:thisdata.departmentName,
                            departmentId:thisdata.departmentId,
                            superior: thisdata.superior,
                            superiorId: thisdata.superiorId,
                            createTimeFormattedDate: thisdata.createTimeFormattedDate
                        });
                    };
                    this.state.pagination2.current = data.data.pageNo;
                    this.state.pagination2.total = data.data.totalCount;
                };
                this.setState({
                    sanhuDataSource1: theArr,
                    pagination2: this.state.pagination2
                });
            }.bind(this),
        }).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));
    },
    //分公司列表和搜索
    fengongsiLoadData(pageNo) {
        this.state.data = [];
        this.setState({
            loading: true
        });
        let nameText=this.state.departmentArr;
		let superText=(this.state.superId)?nameText[parseInt(this.state.superId)].name:"";
        $.ajax({
            method: "post",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + '/api/admin/organization/listOrganizationManagement',
            data: {
                pageNo: pageNo || 1,
                pageSize: this.state.pagination.pageSize,
                name: this.state.name, //组织名称
                superId:superText,//上级组织
                type:this.state.type,//组织类型
                depNo:this.state.depNo,//组织编号
            },
            success: function (data) {
                let theArr = [];
                if (!data.data || !data.data.list) {
                    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: thisdata.id,
                            id: thisdata.id,//每一条记录的ID
                            depNo:thisdata.depNo,//组织编号
                            name:thisdata.name,//组织名称
                            type:thisdata.type,//组织类型
                            managerId:thisdata.managerId,//负责人
                            superId:thisdata.superId,//上级组织
                            status:thisdata.status,//组织状态
                        });
                    };
                    this.state.pagination3.current = data.data.pageNo;
                    this.state.pagination3.total = data.data.totalCount;
                };
                this.setState({
                    fengongsiDataSource: theArr,
                    pagination3: this.state.pagination3
                });
            }.bind(this),
        }).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));
       
    },
    jueseLoadData(pageNo) {
        this.state.data = [];
        this.setState({
            loading: true
        });
        $.ajax({
            method: "post",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + '/api/admin/roles',
            data: {
                pageNo: pageNo || 1,
                pageSize: this.state.pagination.pageSize,
                roleName:this.state.roleNameSearch,
            },
            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: thisdata.id,
	                         id: thisdata.id,
	                         roleName: thisdata.roleName,
	                         creater:thisdata.creater,
	                         createTime:thisdata.createTimez,
                        });
                    };
                    this.state.pagination4.current = data.data.pageNo;
                    this.state.pagination4.total = data.data.totalCount;
                };
                this.setState({
                    jueseDataSource: theArr,
                    pagination4: this.state.pagination4
                });
            }.bind(this),
        }).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));
    },
    getInitialState() {
        return {
            data: [],
            sanhu:[],
            objText:[],
            callnub:'0',
            sendType:'0',
            showAdd: false,
            showDesc: false,
            expandedKeys: [],
            autoExpandParent: true,
            selectedKeys: [],
            searchMore: true,
            selectedRowKeys: [],
            selectedRows: [],
            loading: false,
            pagination: {
                defaultCurrent: 1,
                defaultPageSize: 10,
                showQuickJumper: true,
                pageSize: 10,
                onChange: function (page) {
                    this.loadData(page,this.state.sendType);
                }.bind(this),
                showTotal: function (total) {
                    return '共' + total + '条数据';
                }
            },
            pagination1: {
                defaultCurrent: 1,
                defaultPageSize: 10,
                showQuickJumper: true,
                pageSize: 10,
                onChange: function (page) {
                    this.sanhuLoadData(page);
                }.bind(this),
                showTotal: function (total) {
                    return '共' + total + '条数据';
                }
            },
            pagination21: {
                defaultCurrent: 1,
                defaultPageSize: 10,
                showQuickJumper: true,
                pageSize: 10,
                onChange: function (page) {
                    this.sanhuLoadData21(page);
                }.bind(this),
                showTotal: function (total) {
                    return '共' + total + '条数据';
                }
            },
            pagination2: {
                defaultCurrent: 1,
                defaultPageSize: 10,
                showQuickJumper: true,
                pageSize: 10,
                onChange: function (page) {
                    this.sanhuLoadData1(page);
                }.bind(this),
                showTotal: function (total) {
                    return '共' + total + '条数据';
                }
            },
            pagination3: {
                defaultCurrent: 1,
                defaultPageSize: 10,
                showQuickJumper: true,
                pageSize: 10,
                onChange: function (page) {
                    this.fengongsiLoadData(page);
                }.bind(this),
                showTotal: function (total) {
                    return '共' + total + '条数据';
                }
            },
            pagination4: {
                defaultCurrent: 1,
                defaultPageSize: 10,
                showQuickJumper: true,
                pageSize: 10,
                onChange: function (page) {
                    this.jueseLoadData(page);
                }.bind(this),
                showTotal: function (total) {
                    return '共' + total + '条数据';
                }
            },
            columns: [
                {
                    title: '消息时间',
                    dataIndex: 'createTime',
                    key: 'createTime',
                    width:'150px',
                }, {
                    title: '消息标题',
                    dataIndex: 'title',
                    key: 'title',
                    width:'300px',
                },{
                    title: '消息内容',
                    dataIndex: 'body',
                    key: 'body',
                },{
                    title: '消息类型',
                    dataIndex: 'subject',
                    key: 'subject',
                    width:'100px',
                    render: text => { return getMessageType(text) }
                },{
                    title: '发送目标',
                    dataIndex: 'consumerType',
                    key: 'consumerType',
                    width:'100px',
                    render: text => { return getDesignated(text) }
                    
                }
            ],
            dataSource: [],
            sanhuColumns1: [
                {
                    title: '编号',
                    dataIndex: 'number',
                    key: 'number'
                }, {
                    title: '登录账号',
                    dataIndex: 'mobile',
                    key: 'mobile'
                }, {
                    title: '名字',
                    dataIndex: 'name',
                    key: 'name'
                }, {
                    title: '职位',
                    dataIndex: 'position',
                    key: 'position'
                },{
                    title: '部门',
                    dataIndex: 'departmentName',
                    key: 'departmentName'
                }, {
                    title: '上级管理员',
                    dataIndex: 'superior',
                    key: 'superior'
                }, {
                    title: '邮箱',
                    dataIndex: 'email',
                    key: 'email'
                }, {
                    title: '创建时间',
                    dataIndex: 'createTimeFormattedDate',
                    key: 'createTimeFormattedDate'
                }
            ],
            sanhuDataSource1: [],
            sanhuColumns: [{
					title: '客户名称',
					dataIndex: 'name',
					key: 'name',
				},{
					title: '地区',
					dataIndex: 'locationProvince',
					key: 'locationProvince',
				}, {
					title: '联系人',
					dataIndex: 'contacts',
					key: 'contacts',
				},
				{
					title: '联系电话',
					dataIndex: 'contactMobile',
					key: 'contactMobile',
				},
				{
					title: '行业',
					dataIndex: 'industry',
					key: 'industry',
				},
				{
					title: '社会性质',
					dataIndex: 'societyTag',
					key: 'societyTag',
					render: text => { return getSocialAttribute(text) }
				},
				{
					title: '创建时间',
					dataIndex: 'createTime',
					key: 'createTime',
				},
				{
					title: '会员等级',
					dataIndex: 'lvl',
					key: 'lvl',
					render: text => { return getLvl(text) }
				},
				{
					title: '会员状态',
					dataIndex: 'currentMemberStatus',
					key: 'currentMemberStatus',
					render: text => { return getCurrentMember(text) }
				},
				{
					title: '账户状态',
					dataIndex: 'status',
					key: 'status',
					render: text => { return getStatuslist(text) }
				}			
			],
			sanhuDataSource: [],
			sanhuColumns21: [{
					title: '客户名称',
					dataIndex: 'name',
					key: 'name',
				},
				{
					title: '地区',
					dataIndex: 'locationProvince',
					key: 'locationProvince',
				}, {
					title: '联系人',
					dataIndex: 'contacts',
					key: 'contacts',
				},
				{
					title: '联系电话',
					dataIndex: 'contactMobile',
					key: 'contactMobile',
				},
				{
					title: '行业',
					dataIndex: 'industry',
					key: 'industry',
				},
				{
					title: '社会性质',
					dataIndex: 'societyTag',
					key: 'societyTag',
					render: text => { return getSocialAttribute(text) }
				},
				{
					title: '创建时间',
					dataIndex: 'createTime',
					key: 'createTime',
				},
			    {
					title: '会员状态',
					dataIndex: 'currentMemberStatus',
					key: 'currentMemberStatus',
					render: text => { return getCurrentMember(text) }
				},
				{
					title: '账户状态',
					dataIndex: 'status',
					key: 'status',
					render: text => { return getStatuslist(text) }
				}			
			],
			sanhuDataSource21: [],
            fengongsiColumns: [
                {
                    title: '组织编号',
                    dataIndex: 'depNo',
                    key: 'depNo',
                }, {
                    title: '组织名称',
                    dataIndex: 'name',
                    key: 'name',
                }, {
                    title: '负责人',
                    dataIndex: 'managerId',
                    key: 'managerId',
                },{
                    title: '组织类型',
                    dataIndex: 'type',
                    key: 'type',
                    render: text => { return getPattern(text) }
                },  {
                    title: '上级组织',
                    dataIndex: 'superId',
                    key: 'superId',
                },{
                    title: '组织状态',
                    dataIndex: 'status',
                    key: 'status',
                    render: text => { return getCondition(text) }
                  
                }
            ],
            fengongsiDataSource: [],
            jueseColumns: [
                {
                    title: '角色名称',
                    dataIndex: 'roleName',
                    key: 'roleName',
                    width:'300px'
                }, {
                    title: '创建人',
                    dataIndex: 'creater',
                    key: 'creater',
                    width:'300px'
                }, {
                    title: '创建时间',
                    dataIndex: 'createTime',
                    key: 'createTime',
                }
            ],
            jueseDataSource: [],
        };
    },
    componentWillMount() {
    	this.loadData(1,0);
    },
    //部门
	departmentList() {
		this.setState({
			loading: true
		});
		$.ajax({
			method: "post",
			dataType: "json",
			crossDomain: false,
			url: globalConfig.context + "/api/admin/organization/selectSuperId",
			data: {
				
			},
			success: function(data) {
				let thedata = data.data;
				let theArr=[];
				if(!thedata) {
					if(data.error && data.error.length) {
						message.warning(data.error[0].message);
					};
					thedata = {};
				}else{
					thedata.map(function(item,index){
						theArr.push({
							key:index,
							name:item.name,
							id:item.id,
							depNo:item.depNo
						})
					})
				}
				this.setState({
					departmentArr:theArr,
				})
			}.bind(this),
			}).always(function() {
				this.setState({
					loading: false
				});
			}.bind(this));
	},
	
	//整行点击
    bianji(record, index) {
    	this.state.RowData = record; 
        this.setState({
        	editvisible: true,
        	selectedRowKeys:[],
        	rowId:record.businessId,
        })    
        let deletedIds ='';
        for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
            let rowItem = this.state.selectedRows[idx];
            if (rowItem.id) {
                deletedIds=rowItem.id;
            };
        };
        $.ajax({
            method: "get",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context +"/api/admin/message/getSystemMessageDetail" ,
            data: {
               messageId: deletedIds
            },
            success: function (data) {
                let theArr = [];
                let thisdata = data.data;
                if (!data) {
                    if (data.error && data.error.length) {
                        message.warning(data.error[0].message);
                    };
                } else {
                    theArr.push({
                         editId: thisdata.messageId,//每一条消息的ID
                         editTitle:thisdata.title,//消息标题
                         editBody:thisdata.body,//消息内容
                         editCreateTime:thisdata.createTime,//消息时间
                         editSubject:thisdata.subject,//消息类型
                         editConsumerType:thisdata.consumerType,//消息发送对象
                    });
                };
                this.setState({
                	 editId: thisdata.messageId,//每一条消息的ID
                     editTitle:thisdata.title,//消息标题
                     editBody:thisdata.body,//消息内容
                     editCreateTime:thisdata.createTime,//消息时间
                     editSubject:thisdata.subject,//消息类型
                     editConsumerType:thisdata.consumerType,//上级组织
                     editDataSource: theArr,
                });
            }.bind(this),
        }).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));
    },
    //草稿删除
    delectRow() {
        let deletedIds ='';
        for (let idx = 0; idx < this.state.selectedRows.length; idx++) {
            let rowItem = this.state.selectedRows[idx];
            if (rowItem.id) {
                deletedIds=rowItem.id;
            };
        };
        this.setState({
            selectedRowKeys: [],
            loading: deletedIds.length > 0
        });
        $.ajax({
            method: "get",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + "/api/admin/message/deleteSystemMessage",
            data: {
                messageId: deletedIds
            }
        }).done(function (data) {
            if (!data.error.length) {
                message.success('删除成功！');
                this.loadData(1,1);
                this.setState({
                    loading: false,
                });
            } else {
                message.warning(data.error[0].message);
            };
            
        }.bind(this));
    },
    //新增一个部门，保存
    addhandleSubmit(e,isDraft){  
    	e.preventDefault();	
    	let duixiang=JSON.stringify(this.state.sanhu)||JSON.stringify(this.state.sanhu21)||JSON.stringify(this.state.shehui)||JSON.stringify(this.state.hangye)||JSON.stringify(this.state.fengongsi)||JSON.stringify(this.state.diqu)||JSON.stringify(this.state.yonghu)||JSON.stringify(this.state.juese);
        if(!this.state.addContent){
    		message.warning('请输入消息内容');
    		return false;
    	}
    	if(!this.state.addType){
    		message.warning('请选择消息类型');
    		return false;
    	}
    	if(!duixiang){
    		message.warning('请指定发送对象'); 
    		return false;
    	}
    	let diquText=this.state.diqu;
    	let pro=[];
    	let city=[];
    	let dis=[];
    	if(this.state.diqu){
	    	for(var i=0;i<diquText.length;i++){
	    		if(diquText[i]<=34){
	    			pro.push(diquText[i])
	    		}else if(diquText[i]>34&&diquText[i]<380){
	    			city.push(diquText[i])
	    		}else{
	    			dis.push(diquText[i])
	    		}
    		}
	    }else{
	    	pro=undefined;
	    	city=undefined;
	    	dis=undefined;
	    }
		this.props.form.validateFields((err, values) => {                                 
            if (!err) {
                this.setState({
                    loading: true
                }); 
                $.ajax({
                    method: "post",
                    dataType: "json",
                    crossDomain: false,
                    url:globalConfig.context + '/api/admin/message/createSystemMessage',
                    data:{
                    	title:this.state.addTitle,//消息标题
                    	body:this.state.addContent,//消息内容
                    	subject:this.state.addType,//消息类型
                        targetType:this.state.addObject, //指定对象
                        createTime:this.state.addCreateTime, //创建时间
                        isDraft:isDraft,//是否存为草稿
                        personalUserIds:this.state.sanhu?this.state.sanhu.join(","):undefined,//散户
                        organizationUserIds:this.state.sanhu21?this.state.sanhu21.join(","):undefined,//散户
                        societyTags:this.state.shehui?this.state.shehui.join(","):undefined,//社会属性
                        provinceIds:pro?pro.join(","):undefined,//省
                        cityIds:city?city.join(","):undefined,//市
                        areaIds:dis?dis.join(","):undefined,//区
                        industryIds:this.state.hangye?this.state.hangye.join(","):undefined,//行业
                        companyIds:this.state.fengongsi?this.state.fengongsi.join(","):undefined,//分公司
                        adminIds:this.state.yonghu?this.state.yonghu.join(","):undefined,//用户
                        roles:this.state.juese?this.state.juese.join(","):undefined,//角色
                    }
                }).done(function (data) { 
                    this.setState({
                        loading: false
                    });
                    if (!data.error.length) {
                        message.success('保存成功！'); 
                        this.handleCancel();
                        this.loadData(1,this.state.callnub);
                    } else {
                        message.warning(data.error[0].message);
                    }
                }.bind(this));
            }
        });
    },
    add(e){
    	e.preventDefault();	
    	this.addhandleSubmit(e,0);
    },
    adds(e){
    	e.preventDefault();	
    	this.addhandleSubmit(e,1);
    },
    edit(e){
    	e.preventDefault();	
    	this.editDraft(e,0);
    },
    edits(e){
    	e.preventDefault();	
    	this.editDraft(e,1);
    },
    //编辑一个部门，保存或者存为草稿
    editDraft(e,isDraft){
    	e.preventDefault();	
    	if(!this.state.editTitle){
    		message.warning('请输入消息标题');
    		return false;
    	}
    	if(!this.state.editBody){
    		message.warning('请选择消息内容');
    		return false;
    	}
    	this.props.form.validateFields((err, values) => {                                 
            if (!err) {
                this.setState({
                    loading: true
                }); 
                $.ajax({
                    method: "post",
                    dataType: "json",
                    crossDomain: false,
                    url:globalConfig.context + '/api/admin/message/updateSystemMessage',
                    data:{
                    	messageId:this.state.editId,//消息ID
                    	body:this.state.editBody,//消息内容
                    	title:this.state.editTitle,//消息标题
                    	isDraft:isDraft,//是否存为草稿
                    }
                }).done(function (data) { 
                    this.setState({
                        loading: false
                    });
                    if (!data.error.length) {
                        message.success('保存成功！'); 
                        this.edithandleCancel();
                        
                    } else {
                        message.warning(data.error[0].message);
                    }
                }.bind(this));
            }
        });
    },
    //主管初始加载(自动补全)
	supervisor(e){ 
		$.ajax({
            method: "post",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context + "/api/admin/organization/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({
			managerIdOrganization:value
		})
	},
	//失去焦点时
	blurChange(e){	
		this.setState({
			theTypes:e
		})
	},
	//消息发送列表切换数据处理
	callback(e) {
		this.setState({
			callnub: e,
		})
		if(e == 0) {
			this.setState({
				bianjiMore: false,
				selectedRowKeys:[],
				sendType:0,
			})
			this.loadData(1,0);
		}
		if(e == 1) {
			this.setState({
				bianjiMore: true,
				selectedRowKeys:[],
				sendType:1,
			})
			this.loadData(1,1);
		}
	},
	//切换系统消息类型
	changeNews(e){
		if(e == 1) {
			this.setState({ 
				newsChange: false,
				addObject:undefined,
			})
		}
		if(e == 0) {
			this.setState({
				newsChange: true ,
				addObject:undefined,
			})
		}
	},
	//切换创建系统消息中的指定发送对象
	selectObjects(e) {
		this.setState({
			addObject:e
		})
		if(e == 61) {
			this.sanhuReset();
			this.setState({ visible1: true })
			
		}
		if(e == 62) {
			this.sanhuReset21();
			this.setState({ visible21: true })
			
		}
		if(e == 1) {
			this.setState({ visible2: true })
		}
		if(e == 2) {
			this.setState({ visible4: true })
		}
		if(e == 0) {
			this.setState({ visible5: true })
		}
		
	},
	changeObjects(){
		this.objectReset();
	},
	changeObjects1(e){
		this.setState({
			addObject:e
		})
		if(e == 5) {
			this.sanhuReset1();
			this.setState({ visible6: true })
			
		}
		if(e == 4) {
			this.jueseReset();
			this.setState({ visible7: true })
			
		}
		if(e == 3) {
			this.fengongsiLoadData();
			this.setState({ visible3: true })
		}
	},
	//值改变时请求客户名称
	httpChange(e){
		if(e.length>=2){
			this.supervisor(e); 
		}	
		this.setState({
			managerIdOrganization:e
		})
	},
    addClick() {
    	this.state.addTitle= undefined;//消息标题
    	this.state.addContent= undefined;//消息内容
    	this.state.addType= undefined;//消息类型
        this.state.addObject= undefined; //指定对象
        this.state.RowData = {};
        this.setState({
            visible: true
        });
        $.ajax({
            method: "get",
            dataType: "json",
            crossDomain: false,
            url: globalConfig.context +"/api/admin/message/toCreateSystemMessage" ,
            data: {
            	
            },
            success: function (data) {
                let thisdata = data.data;
                this.setState({
                	 addCreateTime: thisdata.createTime,//每一条消息的时间
                });
            }.bind(this),
        }).always(function () {
            this.setState({
                loading: false
            });
        }.bind(this));
        
    },
    editClick() {
        this.state.RowData = {};
        this.setState({
            editvisible: true
        });
    },
   	handleCancel() {
   		this.state.addTitle= undefined;//消息标题
    	this.state.addContent= undefined;//消息内容
    	this.state.addType= undefined;//消息类型
        this.state.addObject= undefined; //指定对象
        this.setState({ visible: false })
    },
    handleCancel1() {
        this.setState({ visible1: false })
    },
    handleCancel21() {
        this.setState({ visible21: false })
    },
    handleCancel2() {
        this.setState({ visible2: false })
    },
    handleCancel3() {
        this.setState({ visible3: false })
    },
    handleCancel4() {
        this.setState({ visible4: false })
    },
    handleCancel5() {
        this.setState({ visible5: false })
    },
    handleCancel6() {
        this.setState({ visible6: false })
    },
    handleCancel7() {
        this.setState({ visible7: false })
    },
    edithandleCancel() {
        this.setState({ editvisible: false })
    },
    //地区多选
	onExpand(expandedKeys){
		this.setState({
			expandedKeys,
			autoExpandParent: false,
		});
	},
	onCheck(checkedKeys){
		this.setState({
			checkedKeys:checkedKeys 
		});
	},
	onSelectDi(selectedKeys, info){
		this.setState({ selectedKeys });
	},
	renderTreeNodes(data){
		return provinceList.map((item) => {
				return(
					<TreeNodet title={item.name} key={item.id} dataRef={item}>
			            {item.cityList.map((item) => {
							return(
								<TreeNodet title={item.name} key={item.id} dataRef={item}>
						            {item.areaList.map((item) => {
										return(
											<TreeNodet title={item.name} key={item.id} dataRef={item}>
									            
									        </TreeNodet>
										);
										})
						            }
						        </TreeNodet>
							);
							})
			            }
			        </TreeNodet>
				);
			
			return <TreeNodet {...item} />;
		});
	},
    search() {
        this.loadData();
    },
    //个人客户搜索
    sanhusearch(){
    	this.sanhuLoadData();
    },
    //单位客户搜索
    sanhusearch21(){
    	this.sanhuLoadData21();
    },
    //用户搜索
    sanhusearch1(){
    	this.sanhuLoadData1();
    },
    //用户搜索
    juesesearch(){
    	this.jueseLoadData();
    },
    //个人客户重置
    sanhuReset() {
		this.state.nameSearch = '';
		this.state.societyTagSearch = undefined;
		this.sanhuLoadData();
	},
	//单位客户重置
    sanhuReset21() {
		this.state.nameSearch = '';
		this.state.societyTagSearch = undefined;
		this.sanhuLoadData21();
	},
	//用户重置
	sanhuReset1() {
    	this.state.departmentt=undefined;
        this.state.searchMobile = undefined;
        this.state.searchName = undefined;
        this.state.searchProvince = undefined;
        this.sanhuLoadData1();
    },
    //角色重置
    jueseReset() {
    	this.state.roleNameSearch='';
        this.jueseLoadData();       
    },
    //把搜索的部分置零
    reset() {
    	this.state.addTitle= undefined;//消息标题
    	this.state.addContent= undefined;//消息内容
    	this.state.addType= undefined;//消息类型
        this.state.addObject= undefined; //指定对象
        this.loadData(1,0);       
    },
    searchSwitch() {
        this.setState({
            searchMore: !this.state.searchMore
        });
    },
    //选择发送对象时的数据处理
    //指定对象清零
    objectReset(){
    	this.state.sanhu=undefined;
    	this.state.sanhu21=undefined;
    	this.state.yonghu=undefined;
    	this.state.juese=undefined;
    	this.state.shehui=undefined;
    	this.state.diqu=undefined;
    	this.state.fengongsi=undefined;
    	this.state.hangye=undefined;
    },
    rowReset(){
    	this.state.selectedRowKeys=[];
    },
    //散户
    sanhuSubmit(e){
    	e.preventDefault();
    	this.objectReset();
    	this.setState({
    		sanhu:this.state.selectedRowKeys
    	});
    	this.rowReset();
    	this.handleCancel1();
    },//散户
    sanhuSubmit21(e){
    	e.preventDefault();
    	this.objectReset();
    	this.setState({
    		sanhu21:this.state.selectedRowKeys
    	});
    	this.rowReset();
    	this.handleCancel21();
    },
    //用户
    yonghuSubmit(e){
    	e.preventDefault();
    	this.objectReset();
    	this.setState({
    		yonghu:this.state.selectedRowKeys
    	});
    	this.rowReset();
    	this.handleCancel6();
    },
    //角色
    jueseSubmit(e){
    	e.preventDefault();
    	this.objectReset();
    	this.setState({
    		juese:this.state.selectedRowKeys
    	});
    	this.rowReset();
    	this.handleCancel7();
    },
    //社会属性
    shehuiSubmit(e){
    	e.preventDefault();
    	this.setState({
    		shehui:this.state.shehui
    	});
    	this.handleCancel2();
    },
    //分公司
    fengongsiSubmit(e){
    	e.preventDefault();
    	this.objectReset();
    	this.setState({
    		fengongsi:this.state.selectedRowKeys
    	});
    	this.rowReset();
    	this.handleCancel3();
    },
    //地区
    diquSubmit(e){
    	e.preventDefault();
    	this.objectReset();
    	this.setState({
    		diqu:this.state.checkedKeys
    	});
    	
    	this.handleCancel4();
    },
    //行业
    hangyeSubmit(e){
    	e.preventDefault();
    	this.setState({
    		hangye:this.state.hangye
    	});
    	this.handleCancel5();
    },
    render() {
    	let departmentArr = this.state.departmentArr || [];
    	const FormItem = Form.Item
        const rowSelection = {
            selectedRowKeys: this.state.selectedRowKeys,
            onChange: (selectedRowKeys, selectedRows) => {
                this.setState({
                    selectedRows: selectedRows.slice(-1),
                    selectedRowKeys: selectedRowKeys.slice(-1)
                });
            },
            onSelect: (recordt, selected, selectedRows) => {
			    this.setState({
			    	recordt:recordt.id
			    })
			},
        };
        const rowSelections = {
            selectedRowKeys: this.state.selectedRowKeys,
            onChange: (selectedRowKeys, selectedRows) => {
                this.setState({
                    selectedRows: selectedRows,
                    selectedRowKeys: selectedRowKeys
                });
            },
            onSelect: (recordt, selected, selectedRows) => {
			    this.setState({
			    	recordt:recordt.id
			    })
			},
        };
        const formItemLayout = {
            labelCol: { span: 8 },
            wrapperCol: { span: 14 },
        };
       	const { getFieldDecorator } = this.props.form;
        const hasSelected = this.state.selectedRowKeys.length > 0;
        const { RangePicker } = DatePicker;
        const dataSources=this.state.customerArr || [];
        const options = dataSources.map((group,index) =>
				      <Option key={index} value={group.name}>{group.name}</Option>
				     )
        return (
            <div className="user-content" >
                <div className="content-title">
	                <div className="user-search">
	                	<Button type="primary" className="addButton" onClick={this.addClick}>创建系统消息<Icon type="plus" /></Button>
	                	<Button type="primary" onClick={this.bianji} style={!this.state.bianjiMore ? { display: 'none',float:'right',marginRight:'10px'} : {display: 'inline-block',float:'right',marginRight:'10px'}} disabled={!hasSelected}>编辑</Button>
	                	<div style={!this.state.bianjiMore ? { display: 'none',float:'right',marginRight:'10px'} : {display: 'inline-block',float:'right',marginRight:'10px',marginTop:'10px'}}>
		                	<Popconfirm title="是否删除?" onConfirm={this.delectRow} okText="是" cancelText="否">
							     <Button style={{ background: "#ea0862", border: "none", color: "#fff",marginRight:'10px' ,marginLeft:'10px'}}
		                   			 disabled={!hasSelected} 
		                    		 >删除<Icon type="minus" />
		           			     </Button>
							</Popconfirm>
						</div>
	                </div>
	                <div className="clearfix" style={{marginTop:'-30px',marginLeft:'20px'}}>
					    <Tabs onChange={this.callback} type="card" activeKey={this.state.callnub} style={{paddingLeft:'15px',paddingRight:'15px',marginRight:'20px'}}>
					         <TabPane tab="已发送" key="0" ></TabPane>
							 <TabPane tab="未发送" key="1"></TabPane>
					    </Tabs>
					</div>
	                <div className="patent-table">
	                    <Spin spinning={this.state.loading}>
	                        <Table columns={this.state.columns}
	                            dataSource={this.state.dataSource}
	                            rowSelection={rowSelection}
	                            pagination={this.state.pagination}
	                            onRowClick={this.tableRowClick} />
	                    </Spin>
	                </div>
	           
	                 <div className="patent-desc">
	                    <Modal maskClosable={false} visible={this.state.visible}
	                        onOk={this.checkPatentProcess} onCancel={this.handleCancel}
	                        width='600px'
	                        title='新建系统消息'                       
	                        footer=''
	                        className="admin-desc-content">
	                         <Form horizontal onSubmit={this.add} id="add-form">
				                <Spin spinning={this.state.loading}>
				                    <div className="clearfix">
				                    	<FormItem 
					                            labelCol={{ span: 4 }}
					                        	wrapperCol={{ span: 18 }}
					                            label="消息标题" >
				                                <Input placeholder="消息标题" value={this.state.addTitle} style={{width:'95%'}}
				                                onChange={(e)=>{this.setState({addTitle:e.target.value})}} required="required"/>
				                           		<span className="mandatory" style={{color:'red',marginLeft:'5px'}}>*</span>
					                    </FormItem>
				                    </div>
				                    <div className="clearfix">
				                    	<FormItem 
				                         	labelCol={{ span: 4 }}
					                        wrapperCol={{ span: 18 }}
				                           	label="创建时间"
				                         > 
											<span>{this.state.addCreateTime}</span>
				                   		 </FormItem>
				                    </div>
				                    <div className="clearfix">
			                   		    <FormItem
					                        labelCol={{ span: 4 }}
					                        wrapperCol={{ span: 18 }}
					                        label="消息内容" >					                        
					                        <Input type="textarea" rows={4} placeholder="消息内容" value={this.state.addContent}
	                           				 	onChange={(e) => { this.setState({ addContent: e.target.value }) }} style={{width:'95%'}}/>					                           
					                    	<span className="mandatory" style={{color:'red',marginLeft:'5px'}}>*</span>
					                    </FormItem>
					                </div>   
					                <div className="clearfix">
				                    	<FormItem 
				                         	labelCol={{ span: 4 }}
					                        wrapperCol={{ span: 18 }}
				                           	label="消息类型"
				                         > 
											  <Select placeholder="消息类型" value={this.state.addType} 
				                                onChange={(e)=>{this.setState({addType:e})}} style={{width:'95%'}} required="required"
				                                onSelect={this.changeNews}>
				                                {
				                                    messageType.map(function(item) {
				                                        return <Select.Option key={item.value} >{item.key}</Select.Option>
				                                    })
				                                }
				                              </Select> 
				                              <span className="mandatory" style={{color:'red',marginLeft:'5px'}}>*</span>
				                   		 </FormItem>
				                    </div>
				                    <div className="clearfix" >
				                    	<FormItem 
				                         	labelCol={{ span: 4 }}
					                        wrapperCol={{ span: 18 }}
				                           	label="指定发送对象"
				                           	style={this.state.newsChange ? { display: 'none' } : {display: 'inline-block',width:'100%'}}
				                         > 
											  <Select placeholder="指定发送对象" value={this.state.addObject} 
				                                onSelect={this.selectObjects} onChange={this.changeObjects}  required="required" style={{width:'95%'}}>
				                                {
				                                    designatedObjects.map(function(item) {
				                                        return <Select.Option key={item.value} >{item.key}</Select.Option>
				                                    })
				                                }
				                              </Select> 
				                              <span className="mandatory" style={{color:'red',marginLeft:'5px'}}>*</span>
				                   		 </FormItem>
				                    </div>
				                    <div className="clearfix" >
				                    	<FormItem 
				                         	labelCol={{ span: 4 }}
					                        wrapperCol={{ span: 18 }}
				                           	label="指定发送对象"
				                           	style={!this.state.newsChange ? { display: 'none' } : {display: 'inline-block',width:'100%'}}
				                         > 
											  <Select placeholder="指定发送对象" value={this.state.addObject} 
				                                onSelect={this.changeObjects1}  required="required" style={{width:'95%'}}> 
				                                {
				                                    designatedObjectse.map(function(item) {
				                                        return <Select.Option key={item.value} >{item.key}</Select.Option>
				                                    })
				                                }
				                              </Select> 
				                              <span className="mandatory" style={{color:'red',marginLeft:'5px'}}>*</span>
				                   		 </FormItem>
				                    </div>
				                    <FormItem wrapperCol={{ span: 18, offset: 5 }}>
				                        <Button className="set-submit" type="primary" htmlType="submit">发送</Button>  
				                        <Button className="set-submit" type="ghost" onClick={this.adds} style={{marginLeft:'10px'}}>存为草稿</Button>
				                        <Button className="set-submit" type="ghost" onClick={this.handleCancel} style={{marginLeft:'10px'}}>取消</Button>
				                    </FormItem> 
				                </Spin>
				            </Form >
	                    </Modal>
                	 </div>
                	 <div className="patent-desc">
	                    <Modal maskClosable={false} visible={this.state.editvisible}
	                        onOk={this.checkPatentProcess} onCancel={this.edithandleCancel}
	                        width='600px'
	                        title='编辑系统消息'                       
	                        footer=''
	                        className="admin-desc-content">
	                         <Form horizontal onSubmit={this.edit} id="add-form">
				                <Spin spinning={this.state.loading}>
				                    <div className="clearfix">
				                    	<FormItem 
				                            labelCol={{ span: 4 }}
				                        	wrapperCol={{ span: 18 }}
				                            label="消息标题" >
			                                <Input placeholder="消息标题" value={this.state.editTitle} style={{width:'95%'}}
				                                onChange={(e)=>{this.setState({editTitle:e.target.value})}} required="required"/>
				                           		<span className="mandatory" style={{color:'red',marginLeft:'5px'}}>*</span>
					                    </FormItem>
				                    </div>
				                    <div className="clearfix">
			                   		    <FormItem
					                        labelCol={{ span: 4 }}
					                        wrapperCol={{ span: 18 }}
					                        label="消息内容" >					                        
					                        <Input type="textarea" rows={4} placeholder="消息内容" value={this.state.editBody}
	                           				 	onChange={(e) => { this.setState({ editBody: e.target.value }) }} style={{width:'95%'}}/>	
	                           				 	<span className="mandatory" style={{color:'red',marginLeft:'5px'}}>*</span>
					                    </FormItem>
					                </div>   
					                <div className="clearfix">
				                    	<FormItem 
				                         	labelCol={{ span: 4 }}
					                        wrapperCol={{ span: 18 }}
				                           	label="消息时间"
				                         > 
											<span>{this.state.editCreateTime}</span>
				                   		 </FormItem>
				                    </div>
					                <div className="clearfix">
				                    	<FormItem 
				                         	labelCol={{ span: 4 }}
					                        wrapperCol={{ span: 18 }}
				                           	label="消息类型"
				                         > 
											<span>{getMessageType(this.state.editSubject)}</span>
				                   		 </FormItem>
				                    </div>
				                    <div className="clearfix">
				                    	<FormItem 
				                         	labelCol={{ span: 4 }}
					                        wrapperCol={{ span: 18 }}
				                           	label="指定发送对象"
				                         > 
											<span>{getDesignated(this.state.editConsumerType)}</span>
				                   		</FormItem>
				                    </div>
				                    <FormItem wrapperCol={{ span: 18, offset: 5 }}>
				                        <Button className="set-submit" type="primary" htmlType="submit">发送</Button>  
				                        <Button className="set-submit" type="ghost" onClick={this.edits} style={{marginLeft:'10px'}}>存为草稿</Button>
				                        <Button className="set-submit" type="ghost" onClick={this.edithandleCancel} style={{marginLeft:'10px'}}>取消</Button>
				                    </FormItem> 
				                </Spin>
				            </Form >
	                    </Modal>
                	 </div>
                	 <div className="patent-desc">
	                    <Modal maskClosable={false} visible={this.state.visible6}
	                        onOk={this.checkPatentProcess} onCancel={this.handleCancel6}
	                        width='1100px'
	                        title='用户列表'                       
	                        footer=''
	                        className="admin-desc-content">
	                         <Form horizontal onSubmit={this.yonghuSubmit} id="add-form">
				                <Spin spinning={this.state.loading}>
				                	<div className="user-search">
					                    <Input placeholder="登录号" style={{width:'100px',marginRight:'10px',marginBottom:'10px'}}
				                            value={this.state.searchMobile}
				                            onChange={(e) => { this.setState({ searchMobile: e.target.value }); }} />
				                        <Input placeholder="管理员名字" style={{width:'100px',marginRight:'10px',marginBottom:'10px'}}
				                            value={this.state.searchName}
				                            onChange={(e) => { this.setState({ searchName: e.target.value }); }} />
				                        <Button type="primary" onClick={this.sanhusearch1} style={{marginRight:'10px'}}>搜索</Button>
					                    <Button onClick={this.sanhuReset1} style={{marginRight:'10px'}}>重置</Button>
					                </div>
				                    <div className="foster-table">
				                        <Spin spinning={this.state.loading}>
				                            <Table columns={this.state.sanhuColumns1}
				                                dataSource={this.state.sanhuDataSource1}
				                                rowSelection={rowSelections}
				                                pagination={this.state.pagination2}
				                                onRowClick={this.tableRowClick} />
				                        </Spin>
				                    </div>
				                    <FormItem wrapperCol={{ span: 12, offset: 7 }}>
				                        <Button className="set-submit" type="primary" htmlType="submit">选定</Button>  
				                        <Button className="set-submit" type="ghost" onClick={this.handleCancel6} style={{marginLeft:'100px'}}>取消</Button>
				                    </FormItem> 
				                </Spin>
				            </Form >
	                    </Modal>
                	 </div>
                	 <div className="patent-desc">
	                    <Modal maskClosable={false} visible={this.state.visible7}
	                        onOk={this.checkPatentProcess} onCancel={this.handleCancel7}
	                        width='1000px'
	                        title='角色列表'                       
	                        footer=''
	                        className="admin-desc-content">
	                         <Form horizontal onSubmit={this.jueseSubmit} id="add-form">
				                <Spin spinning={this.state.loading}>
				                	<div className="user-search">
					                    <Input placeholder="角色名称" style={{width:'100px',marginRight:'10px',marginBottom:'10px'}}
					                        value={this.state.roleNameSearch}
					                        onChange={(e) => { this.setState({ roleNameSearch: e.target.value }); }} />
					                    <Button type="primary" onClick={this.juesesearch} style={{marginRight:'10px'}}>搜索</Button>
					                    <Button onClick={this.jueseReset}>重置</Button>
					                </div>
				                    <div className="foster-table">
				                        <Spin spinning={this.state.loading}>
				                            <Table columns={this.state.jueseColumns}
				                                dataSource={this.state.jueseDataSource}
				                                rowSelection={rowSelections}
				                                pagination={this.state.pagination4}
				                                onRowClick={this.tableRowClick} />
				                        </Spin>
				                    </div>
				                    <FormItem wrapperCol={{ span: 12, offset: 7 }}>
				                        <Button className="set-submit" type="primary" htmlType="submit">选定</Button>  
				                        <Button className="set-submit" type="ghost" onClick={this.handleCancel7} style={{marginLeft:'100px'}}>取消</Button>
				                    </FormItem> 
				                </Spin>
				            </Form >
	                    </Modal>
                	 </div>
                	 <div className="patent-desc">
	                    <Modal maskClosable={false} visible={this.state.visible1}
	                        onOk={this.checkPatentProcess} onCancel={this.handleCancel1}
	                        width='1200px'
	                        title='个人客户'                       
	                        footer=''
	                        className="admin-desc-content">
	                         <Form horizontal onSubmit={this.sanhuSubmit} id="add-form">
				                <Spin spinning={this.state.loading}>
				                	<div className="user-search">
					                    <Input placeholder="客户名称" style={{width:'100px',marginRight:'10px',marginBottom:'10px'}}
					                        value={this.state.nameSearch}
					                        onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
					                    <Select placeholder="社会性质"
				                             style={{width:'100px',marginRight:'10px'}}
				                            value={this.state.societyTagSearch}
				                            onChange={(e) => { this.setState({ societyTagSearch: e }) }}>
				                                {
				                                    socialAttribute.map(function (item) {
				                                        return <Select.Option key={item.value} >{item.key}</Select.Option>
				                                    })
				                                }
				                        </Select>
					                    
					                    <Button type="primary" onClick={this.sanhusearch} style={{marginRight:'10px'}}>搜索</Button>
					                    <Button onClick={this.sanhuReset} style={{marginRight:'10px'}}>重置</Button>
					                </div>
				                    <div className="foster-table">
				                        <Spin spinning={this.state.loading}>
				                            <Table columns={this.state.sanhuColumns}
				                                dataSource={this.state.sanhuDataSource}
				                                rowSelection={rowSelections}
				                                pagination={this.state.pagination1}
				                                onRowClick={this.tableRowClick} />
				                        </Spin>
				                    </div>
				                    <FormItem wrapperCol={{ span: 12, offset: 7 }}>
				                        <Button className="set-submit" type="primary" htmlType="submit">选定</Button>  
				                        <Button className="set-submit" type="ghost" onClick={this.handleCancel1} style={{marginLeft:'100px'}}>取消</Button>
				                    </FormItem> 
				                </Spin>
				            </Form >
	                    </Modal>
                	 </div>
                	 <div className="patent-desc">
	                    <Modal maskClosable={false} visible={this.state.visible21}
	                        onOk={this.checkPatentProcess} onCancel={this.handleCancel21}
	                        width='1200px'
	                        title='单位客户'                       
	                        footer=''
	                        className="admin-desc-content">
	                         <Form horizontal onSubmit={this.sanhuSubmit21} id="add-form">
				                <Spin spinning={this.state.loading}>
				                	<div className="user-search">
					                    <Input placeholder="客户名称" style={{width:'100px',marginRight:'10px',marginBottom:'10px'}}
					                        value={this.state.nameSearch}
					                        onChange={(e) => { this.setState({ nameSearch: e.target.value }); }} />
					                    <Select placeholder="社会性质"
				                             style={{width:'100px',marginRight:'10px'}}
				                            value={this.state.societyTagSearch}
				                            onChange={(e) => { this.setState({ societyTagSearch: e }) }}>
				                                {
				                                    socialAttribute.map(function (item) {
				                                        return <Select.Option key={item.value} >{item.key}</Select.Option>
				                                    })
				                                }
				                        </Select>
					                    <Button type="primary" onClick={this.sanhusearch21} style={{marginRight:'10px'}}>搜索</Button>
					                    <Button onClick={this.sanhuReset21} style={{marginRight:'10px'}}>重置</Button>
					                </div>
				                    <div className="foster-table">
				                        <Spin spinning={this.state.loading}>
				                            <Table columns={this.state.sanhuColumns21}
				                                dataSource={this.state.sanhuDataSource21}
				                                rowSelection={rowSelections}
				                                pagination={this.state.pagination21}
				                                onRowClick={this.tableRowClick} />
				                        </Spin>
				                    </div>
				                    <FormItem wrapperCol={{ span: 12, offset: 7 }}>
				                        <Button className="set-submit" type="primary" htmlType="submit">选定</Button>  
				                        <Button className="set-submit" type="ghost" onClick={this.handleCancel21} style={{marginLeft:'100px'}}>取消</Button>
				                    </FormItem> 
				                </Spin>
				            </Form >
	                    </Modal>
                	 </div>
                	 <div className="patent-desc">
	                    <Modal maskClosable={false} visible={this.state.visible2}
	                        onOk={this.checkPatentProcess} onCancel={this.handleCancel2}
	                        width='600px'
	                        title='社会属性'                       
	                        footer=''
	                        className="admin-desc-content">
	                         <Form horizontal onSubmit={this.shehuiSubmit} id="add-form">
				                <Spin spinning={this.state.loading}>
				                    <FormItem  
			                         	labelCol={{ span: 7 }}
				                        wrapperCol={{ span: 12 }}
			                           	label="请选择社会属性"
			                         >    
		                              <CheckboxGroup options={socialAttributeS} value={this.state.shehui} onChange={(e)=>{this.setState({shehui:e})}} />
		                               
			                   		 </FormItem>
				                    <FormItem wrapperCol={{ span: 12, offset: 7 }}>
				                        <Button className="set-submit" type="primary" htmlType="submit">选定</Button>  
				                        <Button className="set-submit" type="ghost" onClick={this.handleCancel2} style={{marginLeft:'100px'}}>取消</Button>
				                    </FormItem> 
				                </Spin>
				            </Form >
	                    </Modal>
                	 </div>
                	 <div className="patent-desc">
	                    <Modal maskClosable={false} visible={this.state.visible3}
	                        onOk={this.checkPatentProcess} onCancel={this.handleCancel3}
	                        width='1200px'
	                        title='分公司列表'                       
	                        footer=''
	                        className="admin-desc-content">
	                         <Form horizontal onSubmit={this.fengongsiSubmit} id="add-form">
				                <Spin spinning={this.state.loading}>
				                    <div className="foster-table">
				                        <Spin spinning={this.state.loading}>
				                            <Table columns={this.state.fengongsiColumns}
				                                dataSource={this.state.fengongsiDataSource}
				                                rowSelection={rowSelections}
				                                pagination={this.state.pagination3}
				                                onRowClick={this.tableRowClick} />
				                        </Spin>
				                    </div>
				                    <FormItem wrapperCol={{ span: 12, offset: 7 }}>
				                        <Button className="set-submit" type="primary" htmlType="submit">选定</Button>  
				                        <Button className="set-submit" type="ghost" onClick={this.handleCancel3} style={{marginLeft:'100px'}}>取消</Button>
				                    </FormItem> 
				                </Spin>
				            </Form >
	                    </Modal>
                	 </div>
                	 <div className="patent-desc">
	                    <Modal maskClosable={false} visible={this.state.visible4}
	                        onOk={this.checkPatentProcess} onCancel={this.handleCancel4}
	                        width='600px'
	                        title='地区'                       
	                        footer=''
	                        className="admin-desc-content">
	                         <Form horizontal onSubmit={this.diquSubmit} id="add-form">
				                <Spin spinning={this.state.loading}>
				                    <div className="clearfix" style={{marginLeft:'90px'}}>
				                		<Tree
									        checkable
									        onExpand={this.onExpand}
									        expandedKeys={this.state.expandedKeys}
									        autoExpandParent={this.state.autoExpandParent}
									        onCheck={this.onCheck}
									        checkedKeys={this.state.checkedKeys}
									        onSelect={this.onSelectDi}
									        selectedKeys={this.state.selectedKeys}
									      >
									        {this.renderTreeNodes(this.state.Interface)}
									      </Tree>
					                </div>
				                    <FormItem wrapperCol={{ span: 12, offset: 7 }}>
				                        <Button className="set-submit" type="primary" htmlType="submit">选定</Button>  
				                        <Button className="set-submit" type="ghost" onClick={this.handleCancel4} style={{marginLeft:'100px'}}>取消</Button>
				                    </FormItem> 
				                </Spin>
				            </Form >
	                    </Modal>
                	 </div>
                	 <div className="patent-desc">
	                    <Modal maskClosable={false} visible={this.state.visible5}
	                        onOk={this.checkPatentProcess} onCancel={this.handleCancel5}
	                        width='600px'
	                        title='行业'                       
	                        footer=''
	                        className="admin-desc-content">
	                         <Form horizontal onSubmit={this.hangyeSubmit} id="add-form">
				                <Spin spinning={this.state.loading}>
				                    <FormItem  
			                         	labelCol={{ span: 7 }}
				                        wrapperCol={{ span: 12 }}
			                           	label="请选择行业"
			                         > 
		                              <CheckboxGroup options={industryS} value={this.state.hangye} onChange={(e)=>{this.setState({hangye:e})}} />
	                                </FormItem>
				                    <FormItem wrapperCol={{ span: 12, offset: 7 }}>
				                        <Button className="set-submit" type="primary" htmlType="submit">选定</Button>  
				                        <Button className="set-submit" type="ghost" onClick={this.handleCancel5} style={{marginLeft:'100px'}}>取消</Button>
				                    </FormItem> 
				                </Spin>
				            </Form >
	                    </Modal>
                	 </div> 
            	</div>
            </div>
        );
    }
}));

export default SystemMessage;
