import React from 'react';
import {connect, routerRedux} from 'dva';
import {Table, Button, DatePicker, Select, Menu, Modal, Input} from "antd";
import styles from './style.less';
import {ConnectState} from "@/models/connect";
import ExportJsonExcel from 'js-export-excel';
import {router} from "umi";


//npm install js-export-excel

const { RangePicker,  } = DatePicker;

class TosUserEdit extends React.Component {

  //构造
  constructor(props) {
    super(props);
    this.state = {
      record: [],
      data: [],
      total: 1,
      type: undefined,
      typeList: ["扫描模块故障", "打印机故障", "触摸屏故障","副屏故障"],
      moment: [],
      current: 'record',
      delData: [],
      visible: false,
      ownerCommunityList:[],
      ownerUnitList:[]
    }
  }

  /*-----------------   方法集  ------------------*/
  //打印excel
  downloadExcel = () => {
    let flag = 0;
    const nowUser = this.props.currentUser;
    if(nowUser.permission!=null){
      for(let i=0;i<nowUser.permission.length;i++){
        if(nowUser.permission[i]=="14"){
          flag = 1;
          const data = this.state.record ? this.state.record : '';//表格数据
          var option={};
          let dataTable = [];
          if (data) {
            for (let i in data) {
              if(data){
                let warnType;
                if(data[i].warn_type == 1) {
                  warnType = '扫描模块故障';
                }else if(data[i].warn_type == 2) {
                  warnType = '打印机故障';
                }else if(data[i].warn_type == 3) {
                  warnType = '触摸屏故障';
                }else if(data[i].warn_type == 4) {
                  warnType = '副屏故障';
                }
                let obj = {
                  '设备名称': data[i].device_name,
                  '设备型号': data[i].device_model,
                  '警报类型': warnType,
                  '报警时间': data[i].warn_time,
                  '地址': data[i].device_address,
                  '联系人': data[i].user_account,
                  '联系方式': data[i].user_phone,
                }
                dataTable.push(obj);
              }
            }
          }
          option.fileName = '警报信息';
          option.datas=[
            {
              sheetData:dataTable,
              sheetName:'sheet',
              sheetFilter:['设备名称','设备型号','警报类型','报警时间','联系人','联系方式','地址'],
              sheetHeader:['设备名称','设备型号','警报类型','报警时间','联系人','联系方式','地址'],
            }
          ];

          var toExcel = new ExportJsonExcel(option);
          toExcel.saveExcel();
        }
      }
    }else{
    //alert("找不到用户权限记录！");
      //return;;
    }
    if(flag == 0){
      alert("缺少批量下载权限！");
      return;
    }
  };
  //模态框相关
  showModal = () => {
    let flag = 0;
    let permissionNum = null;
    const nowUser = this.props.currentUser;
    if(nowUser.permission!=null){
      for(let i=0;i<nowUser.permission.length;i++){
        if(this.state.current == "record"){
          permissionNum = "15";
        }else{
          permissionNum = "12";
        }
        if(nowUser.permission[i]==permissionNum){
          if(this.state.delData==null||this.state.delData.length<=0){
            alert("未选中删除项！");
            return;
          }
          flag = 1;
          this.setState({
            visible: true,
          });
        }
      }
    }else{
    //alert("找不到用户权限记录！");
      //return;;
    }
    if(flag == 0){
      if(this.state.current == "record"){
        alert("缺少警报记录删除权限！");
      }else{
        alert("缺少警报模板删除权限！");
      }
    }
  };
  handleOk = () => {
    this.del();
    this.setState({
      visible: false,
    });
  };
  handleCancel = () => {
    this.setState({
      visible: false,
    });
  };
  //查询业主详情小区名
  getDetailcommunity = () => {
    const nowUser = this.props.currentUser.userid;
    const params = {
      type: this.state.type,
      userID: nowUser,
      // userPhone:"18813787835",
      ownerId:this.props.location.query.id,
      owerName:this.props.location.query.owerName,
      /*communityName:this.props.location.query.communityName,
      unit:this.props.location.query.buildingNumber+"#"+
        this.props.location.query.floorNumber+"-"+
        this.props.location.query.roomNumber*/
    };
    this.props.dispatch({
      type: 'tUModel/getDetailCommunityList',
      payload: params,
      callback: (res) => {
        if (res) {
          console.log(res);
          if(res.error_code == "0000"){
            this.setState({
              communityData: res.data.rows,
              communitytotal: res.data.total,
              ownerCommunityList: res.data.ownerCommunity,
            })

          } else if(res.error_code == "0002") {
            alert(res.error_msg);
          }  else if(res.error_code == "0008"){
            alert(res.error_msg);
            window.location.href = '/';
            router.replace('/');
          } else {
            alert("获取失败！未知错误！");
          }
        }
      }
    });
  };

  //查询业主详情小区名
  getDetailUnit = () => {
    const nowUser = this.props.currentUser.userid;
    const params = {
      type: this.state.type,
      userID: nowUser,
      // userPhone:"18813787835",
      ownerId:this.props.location.query.id,
      owerName:this.props.location.query.owerName,
      communityName:this.props.location.query.communityName,
      /*unit:this.props.location.query.buildingNumber+"#"+
        this.props.location.query.floorNumber+"-"+
        this.props.location.query.roomNumber*/
    };
    this.props.dispatch({
      type: 'tUModel/getDetailUnitList',
      payload: params,
      callback: (res) => {
        if (res) {
          console.log(res);
          if(res.error_code == "0000"){
            this.setState({
              unitData: res.data.rows,
              unitTotal: res.data.total,
              ownerUnitList: res.data.ownerUnit,
            })

          } else if(res.error_code == "0002") {
            alert(res.error_msg);
          }  else if(res.error_code == "0008"){
            alert(res.error_msg);
            window.location.href = '/';
            router.replace('/');
          } else {
            alert("获取失败！未知错误！");
          }
        }
      }
    });
  };
  //获取二维码
  getQrCode = () => {
    const nowUser = this.props.currentUser.userid;
    const params = {
      type: this.state.type,
      userID: nowUser,
      // userPhone:"18813787835",
      ownerId:this.props.location.query.id,
      owerName:this.props.location.query.owerName,
      communityName:this.props.location.query.communityName,
      unit:this.props.location.query.buildingNumber+"#"+
        this.props.location.query.floorNumber+"-"+
        this.props.location.query.roomNumber
    };
    this.props.dispatch({
      type: 'tUModel/getOwnerQr',
      payload: params,
      callback: (res) => {
        if (res) {
          console.log(res);
          if(res.error_code == "0000"){
            this.setState({
              qrUrl: res.data.qrUrl,
            })

          } else if(res.error_code == "0002") {
            alert(res.error_msg);
          }  else if(res.error_code == "0008"){
            alert(res.error_msg);
            window.location.href = '/';
            router.replace('/');
          } else {
            alert("获取失败！未知错误！");
          }
        }
      }
    });
  };
  //获取警报数据
  getData = () => {
    const nowUser = this.props.currentUser.userid;
    const params = {
      type: this.state.type,
      userID: nowUser,
      // userPhone:"18813787835",
      ownerId:this.props.location.query.id,
      owerName:this.props.location.query.owerName,
      communityName:this.props.location.query.communityName
    };
    this.props.dispatch({
      type: 'tUModel/getOwnerDetail',
      payload: params,
      callback: (res) => {
        if (res) {
          console.log(res);
          if(res.error_code == "0000"){
            this.setState({
              data: res.data.rows,
              total: res.data.total,
            })
          } else if(res.error_code == "0002") {
            alert(res.error_msg);
          }  else if(res.error_code == "0008"){
            alert(res.error_msg);
            window.location.href = '/';
            router.replace('/');
          } else {
            alert("获取失败！未知错误！");
          }
        }
      }
    });
  };
  //获取警报记录数据
  getRecord = () => {
    const params = {
      type: this.state.type,
      moment: this.state.moment,
      id: this.props.currentUser.userid,
      // userPhone:"18813787835"
      ownerId:this.props.location.query.id,
      owerName:this.props.location.query.owerName,
      communityName:this.props.location.query.communityName
    };
    this.props.dispatch({
      // type: 'tUModel/getTosUser',
      type: 'tUModel/getOwnerDetail',
      payload: params,
      callback: (res) => {
        // if (res.error_code == "0000"){
        this.setState({
          record: res.data.rows,
          total: res.data.total,
        })
        /*      } else if(res.error_code == "0002"){
                alert(res.error_msg);
              }  else if(res.error_code == "0008"){
                alert(res.error_msg);
                window.location.href = '/';
                router.replace('/');
              }
              else {
                // alert("获取警报记录失败！未知错误！")
              }*/
      }
    });
  };
  //批量删除
  del(){
    this.props.dispatch({
      type: this.state.current == 'model'?'warnModel/delWarn':'warnModel/delWarnRecord',
      payload: this.state.delData,
      callback: (res) => {
        if (res) {
          console.log(res);
          if(res.error_code == "0000"){
            alert("删除完毕！");
            if(this.state.current == 'model'){
              this.getData();
            }else{
              // this.getRecord();
            }
          }else if(res.error_code == "0001") {
            alert(res.error_msg);
          } else if(res.error_code == "0002"){
            alert(res.error_msg);
          }  else if(res.error_code == "0008"){
            alert(res.error_msg);
            window.location.href = '/';
            router.replace('/');
          } else {
            alert("删除失败！未知错误！");
          }
        }
      }
    });
  };
  //跳转到编辑页面
  edit = (params) => {

    this.props.dispatch(routerRedux.push({
      pathname: '/UserManagement/tosUser/common',
      query: params,
    }))

    let flag = 0;
    const nowUser = this.props.currentUser;
    if(nowUser.permission!=null){
      if(params==null){
        for(let i=0;i<nowUser.permission.length;i++){
          if(nowUser.permission[i]=="11"){
            flag = 1;
            this.props.dispatch(routerRedux.push({
              pathname: '/UserManagement/tosUser/common',
              query: params,
            }))
          }
        }
      }
     /* else{
        for(let i=0;i<nowUser.permission.length;i++){
          if(nowUser.permission[i]=="10"){
            flag = 1;
            this.props.dispatch(routerRedux.push({
              pathname: '/warn/edit',
              query: params,
            }))
          }
        }
      }*/
    }else{
    //alert("找不到用户权限记录！");
      //return;;
    }
    if(flag == 0){
      if(params==null){
        // alert("缺少添加警报模板权限！");
      }else{
        // alert("缺少修改警报模版权限！");
      }
    }
  };
  //警报启用禁用
  changeStatus = (e) => {
    const params = {
      status: e.warnStatus == '0'? 1:0,
      warnID: e.warnID ? e.warnID : null,
    };
    this.props.dispatch({
      type: 'warnModel/quitAndUserWarn',
      payload: params,
      callback: () => {
        this.getData();
      }
    });
  };
  //状态变更
  typeChange = (e) => {
    this.setState({type: e == undefined?undefined:e+1});
  };
  //日期变更
  dateChange = (e) => {
    this.setState({moment: e});
  };
  //水平导航
  handleClick = (e) => {
    this.setState({
      current: e.key,
    },() => {
      if(this.state.current == "record"){
        // this.getRecord();
      }else{
        // this.getData(null);
      }
    });
  };

  //跳转到设备页面
  back = () => {
    this.props.dispatch(routerRedux.push({
      pathname: '/UserManagement/tosUser',
    }))
  };
  //设备sn变更
  snChange = (e) => {
    this.setState({sn: e.target.value});
  };
  //设备sn变更
  snChange1 = (e) => {
    this.setState({sn1: e.target.value});
  };
  //设备sn变更
  snChange2 = (e) => {
    this.setState({sn2: e.target.value});
  };
  //提交
  onSubmit = () => {
    this.phoneBlur();
  };
  phoneBlur = () => {

    const params = {
       id:this.props.location.query.id,
      owerName: this.state.sn,
      owerPhone:this.state.sn1,
      owerEmail:this.state.sn2,
      communityName:this.props.location.query.communityName,
      buildingNumber:this.props.location.query.buildingNumber,
      floorNumber:this.props.location.query.floorNumber,
      roomNumber:this.props.location.query.roomNumber,
      addressAndpostalCode:this.props.location.query.addressAndpostalCode


    };
    console.log("params",params);
    this.props.dispatch({
      type: 'tUModel/updateOwner',
      payload: params,
      callback: (res) => {
        if (res.error_code == "0000") {
          alert(res.error_msg);
          this.back();
        } else if (res.error_code == "0002") {
          alert(res.error_msg);
          this.back();
        } else if (res.error_code == "0001"){
          alert(res.error_msg);
        } else if (res.error_code == "0003"){
          alert(res.error_msg)
        } else if(res.error_code == "0008"){
          alert(res.error_msg);
          window.location.href = '/';
          router.replace('/');
        }else {
          alert("提交错误！未知原因！");
        }
      }
    });


  };
  //初始化
  componentDidMount() {
    if (this.props.location.query != null) {
      const params = this.props.location.query;
      this.setState({
        current: params.current?params.current:'record',
      },() => {
        if(this.state.current == "record"){
          // this.getRecord();
          this.getData();
          this.getQrCode();
          this.getDetailcommunity();
          this.getDetailUnit();
        }else{
          this.getData();
          this.getQrCode();
          this.getDetailcommunity();
          this.getDetailUnit();
          // this.getData();
        }
      });
    }
  }

  /*--------------------------------------*/
  //表格列名
  columns = [
    {
      title: 'User Name',
      dataIndex: 'owner_family_name',
      key: 'owner_family_name',
    },
    {
      title: 'Contact Details',
      dataIndex: 'owner_family_phone',
      key: 'owner_family_phone',
    },
    {
      title: 'E-mail',
      dataIndex: 'owner_family_email',
      key: 'owner_family_email',

    },
    {
      title: 'cdk_code',
      dataIndex: 'cdk_code',
      key: 'cdk_code',
    },
    /*{
      title: 'community_name',
      dataIndex: 'community_name',
      key: 'community_name',
    },
    {
      title: 'community_build',
      dataIndex: 'community_build',
      key: 'community_build',
    },
    {
      title: 'community_floor',
      dataIndex: 'community_floor',
      key: 'community_floor',
    },
    {
      title: 'communtiy_room',
      dataIndex: 'communtiy_room',
      key: 'communtiy_room',
    },*/
    {
      title: 'Account Type',
      dataIndex: 'owner_relationship',
      key: 'owner_relationship',
      render: (text, record) => (
        <span>
         {record.owner_relationship == 1?'家属':''}
          {record.owner_relationship == 2?'租户':''}
       </span>
      ),
    },
    {
      title: 'User Status',
      dataIndex: 'status',
      key: 'status',
      defaultSortOrder: 'descend',
      sorter: (a, b) => a.user_account - b.user_account,
      render: (text, record) => (
        <span>
         {record.status == 0?'未注册':''}
          {record.status == 1?'注册':''}
          {record.status == 2?'注销':''}
       </span>
      ),
    },
    {
      title: 'Actions',
      dataIndex: 'action',
      key: 'action',
      render: (text, record) => (
        <span>
          <Button style={{background: 'transparent', border: 0, color: '#1890FF'}}
                  onClick={() => this.edit(record)}>Details</Button>
          {/*   <Button style={{background: 'transparent', border: 0, color: '#1890FF'}}
                  onClick={() => this.changeStatus(record)}>{record.warnStatus == 1? "关闭": "启用"}</Button>*/}
        </span>
      ),
    },
  ];
  columns2 = [
    {
      title: 'User Name',
      dataIndex: 'owner_family_name',
      key: 'owner_family_name',
    },
    {
      title: 'Contact Details',
      dataIndex: 'owner_family_phone',
      key: 'owner_family_phone',
    },
    {
      title: 'E-mail',
      dataIndex: 'owner_family_email',
      key: 'owner_family_email',

    },
    {
      title: 'cdk_code',
      dataIndex: 'cdk_code',
      key: 'cdk_code',
    },
    /*{
      title: 'community_name',
      dataIndex: 'community_name',
      key: 'community_name',
    },
    {
      title: 'community_build',
      dataIndex: 'community_build',
      key: 'community_build',
    },
    {
      title: 'community_floor',
      dataIndex: 'community_floor',
      key: 'community_floor',
    },
    {
      title: 'communtiy_room',
      dataIndex: 'communtiy_room',
      key: 'communtiy_room',
    },*/
    {
      title: 'Account Type',
      dataIndex: 'owner_relationship',
      key: 'owner_relationship',
      render: (text, record) => (
        <span>
         {record.owner_relationship == 1?'家属':''}
          {record.owner_relationship == 2?'租户':''}
       </span>
      ),
    },
    {
      title: 'User Status',
      dataIndex: 'status',
      key: 'status',
      defaultSortOrder: 'descend',
      sorter: (a, b) => a.user_account - b.user_account,
      render: (text, record) => (
        <span>
         {record.status == 0?'未注册':''}
          {record.status == 1?'注册':''}
          {record.status == 2?'注销':''}
       </span>
      ),
    },
    {
      title: 'Actions',
      dataIndex: 'action',
      key: 'action',
      render: (text, record) => (
        <span>
          <Button style={{background: 'transparent', border: 0, color: '#1890FF'}}
                  onClick={() => this.edit(record)}>Details</Button>
          {/*   <Button style={{background: 'transparent', border: 0, color: '#1890FF'}}
                  onClick={() => this.edit(record)}>编辑</Button>*/}
        </span>
      ),
    },
    /*    {
          title: '联系方式',
          dataIndex: 'user_phone',
          key: 'user_phone',
        },
        {
          title: '地址',
          dataIndex: 'device_address',
          key: 'device_address',
        },*/
  ];
  //行选择
  rowSelection = {
    onChange: (selectedRowKeys, selectedRows) => {
      this.setState({
        delData: selectedRows
      },() => {
        console.log(this.state.delData);
      });
    }
  };

  //渲染
  render() {
    const { data, total, typeList, current, record, visible,tosUser,sn,sn1,sn2,qrUrl,
      communityData,
      communitytotal,
      ownerCommunityList,
      unitTotal,
      unitData,
      ownerUnitList} = this.state;

    const typeSelect = typeList.map((item, index) => (
      <Select.Option value={index}>{item}</Select.Option>
    ));

    return (
      <div className={styles.body}>
        <Button className={styles.button11} onClick={() => this.back()}>Return</Button>
        <div style={{marginTop:48}}>
          <div>
            <span className={styles.detailsTitle}>Edit Owner Information</span>
            <div className={styles.detailsBox}>
              <div>
                <span className={styles.detailsContent}>Name Of Owner</span>
                <Input className={styles.input} value={sn}  placeholder={this.props.location.query.owerName}
                       onChange={(e) => this.snChange(e)}
                />
                <span className={styles.detailsContent2}>{tosUser}</span>
                {/*<span className={styles.detailsContent}>锶想</span>*/}
                <span className={styles.detailsContent2}>{tosUser}</span>
                {/*   <span className={styles.detailsContent}>设备ID</span>*/}
                <span className={styles.detailsContent2}>{tosUser}</span>
              </div>
              <div>
                <span className={styles.detailsContent}>Contact Details</span>
                <Input className={styles.input} value={sn1} placeholder={this.props.location.query.owerPhone}
                  onChange={(e) => this.snChange1(e)}
                />
                <span className={styles.detailsContent3} style={{width:200}}>{tosUser}</span>
                {/*<span className={styles.detailsContent}>18817589685</span>*/}
                <Input className={styles.input} value={sn2} placeholder={this.props.location.query.owerEmail}
                  onChange={(e) => this.snChange2(e)}
                />
                <span className={styles.detailsContent2}>{tosUser}</span>
                {/*<span className={styles.detailsContent}>sales@huahuico.com</span>*/}
                <span className={styles.detailsContent2}>{tosUser}</span>
              </div>
              {/*<div>*/}
              {/*  <span className={styles.detailsContent}>联系地址</span>*/}
              {/*  <span className={styles.detailsContent3}>{total}</span>*/}
              {/*</div>*/}
            </div>
          </div>
        </div>


        <div style={{padding:30}}>
          <Menu
            className={styles.menu}
            onClick={this.handleClick}
            selectedKeys={[current]}
            mode="horizontal">
            <Menu.Item key="record" className={styles.menuItem}>
              {this.props.location.query.communityName}
            </Menu.Item>
            <Menu.Item key="model">
              {communitytotal>1?ownerCommunityList[1]:"A9"}
            </Menu.Item>
          </Menu>
        </div>
        <div className={styles.inputBox}>


          <div>
            <span className={styles.detailsContent}>Address</span>
            <span className={styles.detailsContent2}>{tosUser}</span>
            <span className={styles.detailsContent}>{this.props.location.query.addressAndpostalCode}</span>

          </div>
          <div>
            <span className={styles.detailsContent}>Unit No.</span>
            <span className={styles.detailsContent2}>{tosUser}</span>
            <span className={styles.detailsContent}>{this.props.location.query.roomNumber}</span>
            <span className={styles.detailsContent2}>{tosUser}</span>
          </div>

          {/*  <Select className={styles.input} placeholder="警报类型" onChange={(e) => this.typeChange(e)}
                  allowClear={true}>{typeSelect}</Select>

          {current == 'record'?
            <RangePicker
              style={{marginLeft: 20}}
              renderExtraFooter={() => ''}
              showTime
              onChange={(e) => this.dateChange(e)}
            />:''}*/}
        </div>
        <div>
          {current == 'record'?
            <div>
              <img style ={{width:100,height:100,float:"right"}}src= {this.props.location.query.cdkStatus == 0?qrUrl:"http://www.srthinker.com:5205/file/d575594254a141f29d23d711d9158ba5.png"} />
              {/*<Button className={styles.button1} onClick={() => this.getRecord()}>删除单位</Button>*/}

            </div>
            :''}
          {current == 'model'?
            <div>
              <img style ={{width:100,height:100,float:"right"}}src= {this.props.location.query.cdkStatus == 0?qrUrl:"http://www.srthinker.com:5205/file/d575594254a141f29d23d711d9158ba5.png"} />
              {/*<Button className={styles.button1} onClick={() => this.getData()}>删除单位1</Button>*/}
            </div>
            :''}
          {/* {current == 'model'?
            <Button className={styles.button2} onClick={() => this.edit(null)}>新建</Button>:''}*/}
        </div>
        <div>
          {current == 'record'?
            <div>

              <Table
                rowKey={record => record.warn_record_id}
                className={styles.table}
                rowSelection={this.rowSelection}
                columns={this.columns2}
                dataSource={data}
                size="small"
                pagination={{showQuickJumper: true, pageSize: 10, total: total}}
              />
              <div>
                <span className={styles.detailsContent}>Unit No.</span>
                <span className={styles.detailsContent2}>{tosUser}</span>
                <span className={styles.detailsContent}>{unitTotal>1?ownerUnitList[1]:"03#06-369"}</span>
                <span className={styles.detailsContent2}>{tosUser}</span>
                <img style ={{width:100,height:100,float:"right"}}src= {this.props.location.query.cdkStatus == 0?qrUrl:"http://www.srthinker.com:5205/file/d575594254a141f29d23d711d9158ba5.png"} />
                {/*<Button className={styles.button1} onClick={() => this.getRecord()}>删除单位</Button>*/}

              </div>

              <Table
                rowKey={record => record.warn_record_id}
                className={styles.table}
                rowSelection={this.rowSelection}
                columns={this.columns2}
                dataSource={data}
                size="small"
                pagination={{showQuickJumper: true, pageSize: 10, total: total}}
              />
              <div>
                <Button className={styles.button2} onClick={() => this.onSubmit()}>Submit</Button>
              </div>
            </div>
            :''}
          {current == 'model'?
            <div>
              <Table
                rowKey={record => record.warnID}
                className={styles.table}
                rowSelection={this.rowSelection}
                columns={this.columns}
                dataSource={data}
                size="small"
                pagination={{showQuickJumper: true, pageSize: 10, total: total}}
              />
              <div>
                <span className={styles.detailsContent}>Unit No.</span>
                <span className={styles.detailsContent2}>{tosUser}</span>
                <span className={styles.detailsContent}>03#05-301</span>
                <span className={styles.detailsContent2}>{tosUser}</span>
                <img style ={{width:100,height:100,float:"right"}}src= {this.props.location.query.cdkStatus == 0?qrUrl:"http://www.srthinker.com:5205/file/d575594254a141f29d23d711d9158ba5.png"} />
                {/*<Button className={styles.button1} onClick={() => this.getRecord()}>删除单位</Button>*/}
              </div>
              <Table
                rowKey={record => record.warnID}
                className={styles.table}
                rowSelection={this.rowSelection}
                columns={this.columns}
                dataSource={data}
                size="small"
                pagination={{showQuickJumper: true, pageSize: 10, total: total}}
              />

            </div>
            :''}
          {/*{current == 'record'?
            <Button className={styles.button3}
                    style={{width:120}}
                    onClick={() => this.downloadExcel()}>
              批量下载</Button>:''}*/}
          {/*<Button className={styles.button3} onClick={() => this.showModal()}>删除</Button>*/}

        </div>
        <div>

        </div>
        <Modal
          title="确认删除？"
          visible={visible}
          onOk={this.handleOk}
          onCancel={this.handleCancel}>
          <div style={{textAlign:"center"}}><p style={{fontSize:18}}>删除信息将不可恢复</p></div>
        </Modal>
      </div>
    );
  }
}

export default connect(({user}:ConnectState) => ({
  currentUser: user.currentUser,
}))(TosUserEdit);
