import React from "react";
import $ from "jquery/src/ajax";
import moment from "moment";
import "@/manageCenter/financialManage/distribute/public.less";
import { ChooseList } from "../../order/orderNew/chooseList";
import { citySelect, provinceList, areaSelect, Birthplace } from "@/areaList";
import ReactToPrint from "react-to-print";
import "./personnelList.less"
import {
  Button,
  Form,
  Input,
  Select,
  Spin,
  Table,
  message,
  Modal,
  Tabs,
  Tag,
  RangePicker,
  DatePicker,
  Radio,
  Cascader,
  Upload,
  Tooltip,
} from "antd";
import { splitUrl } from "@/tools";
import { getProvinceList } from "@/addressList";
import PicModal from "./picModal"
import AddPicModal from "./addPicModal";
const FormItem = Form.Item;
const { TabPane } = Tabs;
const { TextArea } = Input;
const PersonnelAll = React.createClass({
  loadData(pageNo) {
    this.state.data = [];
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/selectList",
      data: {
        pageNo: pageNo || 1,
        pageSize: this.state.pagination.pageSize,
        name: this.state.nameSearch,
        status: this.state.statusSearch,
        company: this.state.departmenttList,
        sex: this.state.sexSearch,
        marriage: this.state.marriageSearch,
        politicalOutlook: this.state.politicalOutlookSearch,
        birthdayMonth: this.state.birthdayMonthSearch,
        promotionStart: this.state.promotionTime[0],
        promotionEnd: this.state.promotionTime[1],
        entryStart: this.state.entryTime[0],
        entryStart: this.state.entryTime[1],
        quitStart: this.state.quitTime[0],
        quitEnd: this.state.quitTime[1],
        system: this.state.systemSearch,
        workingYears: this.state.workingYearsSearch,
        education: this.state.educationSearch,
        contractStart: this.state.contractTime[0],
        contractEnd: this.state.contractTime[1],
      },
      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];
            thisdata.key = thisdata.id;
            theArr.push(thisdata);
          }
        }
        this.state.pagination.current = data.data.pageNo;
        this.state.pagination.total = data.data.totalCount;
        if (data.data && data.data.list && !data.data.list.length) {
          this.state.pagination.current = 0;
          this.state.pagination.total = 0;
        }
        this.setState({
          dataSource: theArr,
          pagination: this.state.pagination,
        });
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  getInitialState() {
    return {
      active: "1",
      detailFlag: false,
      editWelfareData: {},
      contractList: [],
      quitList: [],
      chooseList: [],
      starArr: [],
      starArrs: [],
      annexName: "",
      annexUrl: "",
      voucherUrl: [],
      ModalData: [],
      contractTime: [],
      contactList: [],
      quitTime: [],
      promotionList: [],
      promotionTime: [],
      entryTime: [],
      pic: [],
      previewImage: "",
      peoVisible: false,
      phoneVisible: false,
      isAddPeo: false,
      searchMore: true,
      stayVisible: false,
      assignVisible: false,
      releaseDate: [],
      residence: [],
      nativePlace: [],
      now: [],
      roleName: "",
      shouKuanDate: [],
      boHuivisible: false,
      departmentArr: [],
      selectedRowKeys: [],
      selectedRows: [],
      paginations: false,
      loading: false,
      pagination: {
        defaultCurrent: 1,
        defaultPageSize: 10,
        showQuickJumper: true,
        pageSize: 10,
        onChange: function (page) {
          this.loadData(page);
        }.bind(this),
        showTotal: function (total) {
          return "共" + total + "条数据";
        },
      },
      columns: [
        {
          title: "员工编号",
          dataIndex: "employeeId",
          key: "employeeId",
        },
        {
          title: "门禁编号",
          dataIndex: "doorId",
          key: "doorId",
        },
        {
          title: "名称",
          dataIndex: "name",
          key: "name",
        },
        {
          title: "员工状态",
          dataIndex: "statusName",
          key: "statusName",
        },
        {
          title: "所属系统",
          dataIndex: "systemName",
          key: "systemName",
        },
        {
          title: "公司名称",
          dataIndex: "depName",
          key: "depName",
        },
        {
          title: "职位名称",
          dataIndex: "jobsName",
          key: "jobsName",
        },
        {
          title: "等级名称",
          dataIndex: "starName",
          key: "starName",
        },
        {
          title: "级别",
          dataIndex: "lvlName",
          key: "lvlName",
        },
        {
          title: "入职时间",
          dataIndex: "entryTimes",
          key: "entryTimes",
        },
        {
          title: "转正时间",
          dataIndex: "promotionTimes",
          key: "promotionTimes",
          render: (text) => {
            let time = moment(text).valueOf();
            let today = Date.parse(new Date());
            let sevenDay = 604800000;
            if (time - today < sevenDay) {
              return (
                {text}
              );
            }
            return text;
          },
        },
        {
          title: "生日日期",
          dataIndex: "birthdays",
          key: "birthdays",
        },
        {
          title: "性别",
          dataIndex: "sex",
          key: "sex",
          render: (text) => {
            if (text == 0) {
              return "男";
            } else if (text == 1) {
              return "女";
            }
          },
        },
        {
          title: "婚姻状态",
          dataIndex: "marriageName",
          key: "marriageName",
        },
        {
          title: "子/女",
          dataIndex: "son",
          key: "son",
          render: (text, record) => {
            return {text + "/" + record.girl};
          },
        },
        {
          title: "政治面貌",
          dataIndex: "politicalOutlookName",
          key: "politicalOutlookName",
        },
        {
          title: "教育经历",
          dataIndex: "educationName",
          key: "educationName",
        },
        {
          title: "毕业学校",
          dataIndex: "school",
          key: "school",
        },
        {
          title: "专业",
          dataIndex: "major",
          key: "major",
        },
        {
          title: "职称",
          dataIndex: "title",
          key: "title",
        },
        {
          title: "晋升备注",
          dataIndex: "promotionRemarks",
          key: "promotionRemarks",
        },
        {
          title: "晋升时间",
          dataIndex: "promotionTime",
          key: "promotionTime",
        },
        {
          title: "合同时间",
          dataIndex: "contractStart",
          key: "contractStart",
          render: (text, record) => {
            let end = moment(record.contractEnd).valueOf();
            let today = Date.parse(new Date());
            let sevenDay = 604800000;
            if (text) {
              if (end - today < sevenDay) {
                return (
                  
                    {text + "~" + record.contractEnd}
                  
                );
              }
              return text + "~" + record.contractEnd;
            }
          },
        },
        {
          title: "手机号码",
          dataIndex: "mobile",
          key: "mobile",
        },
        {
          title: "电话",
          dataIndex: "fixedTel",
          key: "fixedTel",
        },
        {
          title: "身份证",
          dataIndex: "idCard",
          key: "idCard",
        },
        {
          title: "发证机构",
          dataIndex: "certificationAuthority",
          key: "certificationAuthority",
        },
        {
          title: "户籍地址",
          dataIndex: "residenceName",
          key: "residenceName",
        },
        {
          title: "籍贯",
          dataIndex: "nativePlaceName",
          key: "nativePlaceName",
        },
        {
          title: "现住地址",
          dataIndex: "nowName",
          key: "nowName",
        },
        {
          title: "紧急联系人",
          dataIndex: "emergencyContact",
          key: "emergencyContact",
        },
        {
          title: "紧急联系人电话",
          dataIndex: "emergencyMobile",
          key: "emergencyMobile",
        },
        {
          title: "离职时间",
          dataIndex: "quitTime",
          key: "quitTime",
        },
        {
          title: "工作年限",
          dataIndex: "workingYear",
          key: "workingYear",
        },
        {
          title: "年龄",
          dataIndex: "age",
          key: "age",
        },
        {
          title: "出生月份",
          dataIndex: "month",
          key: "month",
        },
        {
          title: "参保时间",
          dataIndex: "insuranceStartTimes",
          key: "insuranceStartTimes",
        },
        {
          title: "停保时间",
          dataIndex: "insuranceEndTimes",
          key: "insuranceEndTimes",
        },
        {
          title: "公积金时间",
          dataIndex: "fundStartTimes",
          key: "fundStartTimes",
        },
        {
          title: "停办公积金时间",
          dataIndex: "fundEndTimes",
          key: "fundEndTimes",
        },
      ],
      dataSource: [],
      resVisible: false,
      welfareColumns: [
        {
          title: "福利类型",
          dataIndex: "type",
          key: "type",
          render: (text) => {
            if (text == 0) {
              return "社保";
            } else if (text == 1) {
              return "公积金";
            } else if (text == 2) {
              return "雇主险";
            }
          },
        },
        {
          title: "购买状态",
          dataIndex: "status",
          key: "status",
          render: (text) => {
            if (text == 0) {
              return "未购买";
            } else if (text == 1) {
              return "已购买";
            } else if (text == 2) {
              return "已停止";
            }
          },
        },
        {
          title: "购买时间",
          dataIndex: "startTimes",
          key: "startTimes",
        },
        {
          title: "停缴时间",
          dataIndex: "endTimes",
          key: "endTimes",
        },
        {
          title: "公司名称",
          dataIndex: "depName",
          key: "depName",
        },
        {
          title: "备注信息",
          dataIndex: "welfareRemarks",
          key: "welfareRemarks",
        },
      ],
      welfareColumnsEdit: [
        {
          title: "福利类型",
          dataIndex: "type",
          key: "type",
          render: (text) => {
            if (text == 0) {
              return "社保";
            } else if (text == 1) {
              return "公积金";
            } else if (text == 2) {
              return "雇主险";
            }
          },
        },
        {
          title: "购买状态",
          dataIndex: "status",
          key: "status",
          render: (text) => {
            if (text == 0) {
              return "未购买";
            } else if (text == 1) {
              return "已购买";
            } else if (text == 2) {
              return "已停止";
            }
          },
        },
        {
          title: "购买时间",
          dataIndex: "startTimes",
          key: "startTimes",
        },
        {
          title: "停缴时间",
          dataIndex: "endTimes",
          key: "endTimes",
        },
        {
          title: "公司名称",
          dataIndex: "depName",
          key: "depName",
        },
        {
          title: "备注信息",
          dataIndex: "welfareRemarks",
          key: "welfareRemarks",
        },
        {
          title: "操作",
          dataIndex: "caozuo",
          key: "caozuo",
          render: (text, record) => {
            return (
              
            );
          },
        },
      ],
      table: [
        {
          key: "员工编号",
          value: "employeeId",
        },
        {
          key: "姓名",
          value: "name",
        },
        {
          key: "出生日期",
          value: "birthdays",
        },
        {
          key: "出生月份",
          value: "month",
        },
        {
          key: "门禁编号",
          value: "doorId",
        },
        {
          key: "性别",
          value: "sex",
          render: (e) => {
            if (e == 0) {
              return "男";
            } else if (e == 1) {
              return "女";
            }
          },
        },
        {
          key: "年龄",
          value: "age",
        },
        {
          key: "民族",
          value: "nation",
        },
        {
          key: "户籍地址",
          value: "residenceName",
        },
        {
          key: "籍贯",
          value: "nativePlaceName",
        },
        {
          key: "身份证",
          value: "idCard",
        },
        {
          key: "领证机关",
          value: "certificationAuthority",
        },
        {
          key: "现住地址",
          value: "nowName",
        },
        {
          key: "婚姻状态",
          value: "marriageName",
        },
        {
          key: "子/女",
          value: "son",
          render: (e, i) => {
            return e + "/" + i;
          },
        },
        {
          key: "政治面貌",
          value: "politicalOutlookName",
        },
      ],
    };
  },
  componentWillMount() {
    let areaArr = getProvinceList();
    let Area = areaSelect(areaArr);
    let Birthplaces = Birthplace(areaArr);
    this.setState({
      Area,
      Birthplaces: Birthplaces,
    });
    //城市
    let Province = [];
    areaArr.map(function (item) {
      var id = String(item.id);
      Province.push(
        
          {item.name}
        
      );
    });
    this.state.Provinces = Province;
    this.loadData();
    this.departmentList();
  },
  export() {
    const data = {
      pageSize: 9999999,
      name: this.state.nameSearch ? this.state.nameSearch : undefined,
      status: this.state.statusSearch ? this.state.statusSearch : undefined,
      company: this.state.departmenttList
        ? this.state.departmenttList
        : undefined,
      sex: this.state.sexSearch ? this.state.sexSearch : undefined,
      marriage: this.state.marriageSearch
        ? this.state.marriageSearch
        : undefined,
      politicalOutlook: this.state.politicalOutlookSearch
        ? this.state.politicalOutlookSearch
        : undefined,
      birthdayMonth: this.state.birthdayMonthSearch
        ? this.state.birthdayMonthSearch
        : undefined,
      promotionStart: this.state.promotionTime[0]
        ? this.state.promotionTime[0]
        : undefined,
      promotionEnd: this.state.promotionTime[1]
        ? this.state.promotionTime[1]
        : undefined,
      entryStart: this.state.entryTime[0] ? this.state.entryTime[0] : undefined,
      entryStart: this.state.entryTime[1] ? this.state.entryTime[1] : undefined,
      quitStart: this.state.quitTime[0] ? this.state.quitTime[0] : undefined,
      quitEnd: this.state.quitTime[1] ? this.state.quitTime[1] : undefined,
      system: this.state.systemSearch ? this.state.systemSearch : undefined,
      workingYears: this.state.workingYearsSearch
        ? this.state.workingYearsSearch
        : undefined,
      education: this.state.educationSearch
        ? this.state.educationSearch
        : undefined,
      contractStart: this.state.contractTime[0]
        ? this.state.contractTime[0]
        : undefined,
      contractEnd: this.state.contractTime[1]
        ? this.state.contractTime[1]
        : undefined,
    };
    for(let key in data) {
      if(!data[key]) {
        delete data[key]
      }
    }
    window.location.href =
      globalConfig.context +
      "/api/admin/personnel/exportPersonnelList?" +
      $.param(data);
  },
  departmentList() {
    $.ajax({
      method: "get",
      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);
          }
        } else {
          thedata.map(function (item, index) {
            theArr.push({
              key: index,
              name: item.name,
              id: item.id,
            });
          });
        }
        this.setState({
          departmentArr: theArr,
        });
      }.bind(this),
    });
  },
  welfareTable(record) {
    this.setState({
      editWelfareVisible: true,
    });
    if (record) {
      this.setState({
        editWelfareData: record,
      });
    } else {
      let editWelfareData = {
        status: undefined,
        id: undefined,
        depId: [],
        pdId: this.state.ModalData.id,
        type: undefined,
        welfareRemarks: undefined,
        endTimes: undefined,
        startTimes: undefined,
      };
      this.setState({
        editWelfareData
      });
    }
  },
  editWelfareDataOk() {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "post",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/updateWelfare",
      data: {
        startTimes:
          this.state.editWelfareData.status == 1 ||
          this.state.editWelfareData.status == 2
            ? this.state.editWelfareData.startTimes
            : "",
        endTimes:
          this.state.editWelfareData.status == 2
            ? this.state.editWelfareData.endTimes
            : "",
        pdId: this.state.editWelfareData.pdId,
        welfareRemarks:
          this.state.editWelfareData.status == 0
            ? this.state.editWelfareData.welfareRemarks
            : "",
        type: this.state.editWelfareData.type,
        id: this.state.editWelfareData.id,
        status: this.state.editWelfareData.status,
        depId: this.state.editWelfareData.status == 0 ? "" : this.state.editWelfareData.depId,
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          message.success("修改成功!");
          this.loadData();
          this.tableRowClick(this.state.ModalData);
          this.setState({
            editWelfareVisible: false,
          });
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  getWelfareData() {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "post",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/add",
      data: {
        name: this.state.name,
        doorId: this.state.doorId,
        sex: this.state.sex,
        nation: this.state.nation,
        residenceProvince: this.state.residence[0],
        residenceCity: this.state.residence[1],
        residenceArea: this.state.residence[2],
        residenceAddress: this.state.residenceAddress,
        nativePlaceProvince: this.state.nativePlace[0],
        nativePlaceCity: this.state.nativePlace[1],
        nowProvince: this.state.now[0],
        nowCity: this.state.now[1],
        nowArea: this.state.now[2],
        nowAddress: this.state.nowAddress,
        idCard: this.state.idCard,
        certificationAuthority: this.state.certificationAuthority,
        marriage: this.state.marriage,
        politicalOutlook: this.state.politicalOutlook,
        son: this.state.son,
        girl: this.state.girl,
        birthdays: this.state.birthdays,
        marriage: this.state.marriage,
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          message.success("添加成功!");
          this.loadData();
          this.addPeoCancel();
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  changeList(arr) {
    const newArr = [];
    this.state.columns.forEach((item) => {
      arr.forEach((val) => {
        if (val === item.title) {
          newArr.push(item);
        }
      });
    });
    this.setState({
      changeList: newArr,
    });
  },
  addPeo() {
    this.setState({
      peoVisible: true,
      isAddPeo: true,
    });
  },
  addPeoCancel() {
    this.setState({
      id: undefined,
      peoVisible: false,
      isAddPeo: false,
      name: undefined,
      doorId: undefined,
      sex: undefined,
      nation: undefined,
      residence: [],
      residenceAddress: undefined,
      nativePlace: [],
      now: [],
      nowAddress: undefined,
      idCard: undefined,
      certificationAuthority: undefined,
      marriage: undefined,
      politicalOutlook: undefined,
      employeeId: undefined,
      son: undefined,
      girl: undefined,
      birthdays: undefined,
      marriage: undefined,
    });
  },
  verifyDoor() {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/checkDoorId",
      data: {
        doorId: this.state.doorId,
        id: this.state.id,
      },
      success: function (data) {
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          message.success("此编号未被占用");
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  verifyId() {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/checkEmployeeId",
      data: {
        employeeId: this.state.employeeId,
        id: this.state.id
      },
      success: function (data) {
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          message.success("此编号未被占用");
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  addOk() {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "post",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/add",
      data: {
        name: this.state.name,
        doorId: this.state.doorId,
        sex: this.state.sex,
        nation: this.state.nation,
        residenceProvince: this.state.residence[0],
        residenceCity: this.state.residence[1],
        residenceArea: this.state.residence[2],
        residenceAddress: this.state.residenceAddress,
        nativePlaceProvince: this.state.nativePlace[0],
        nativePlaceCity: this.state.nativePlace[1],
        nowProvince: this.state.now[0],
        nowCity: this.state.now[1],
        nowArea: this.state.now[2],
        nowAddress: this.state.nowAddress,
        idCard: this.state.idCard,
        certificationAuthority: this.state.certificationAuthority,
        marriage: this.state.marriage,
        politicalOutlook: this.state.politicalOutlook,
        son: this.state.son,
        girl: this.state.girl,
        birthdays: this.state.birthdays,
        marriage: this.state.marriage,
        employeeId: this.state.employeeId,
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          message.success("添加成功!");
          this.loadData();
          this.addPeoCancel();
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  editOk() {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "post",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/update",
      data: {
        id: this.state.id,
        name: this.state.name,
        doorId: this.state.doorId,
        sex: this.state.sex,
        nation: this.state.nation,
        residenceProvince: this.state.residence[0],
        residenceCity: this.state.residence[1],
        residenceArea: this.state.residence[2],
        residenceAddress: this.state.residenceAddress,
        nativePlaceProvince: this.state.nativePlace[0],
        nativePlaceCity: this.state.nativePlace[1],
        nowProvince: this.state.now[0],
        nowCity: this.state.now[1],
        nowArea: this.state.now[2],
        nowAddress: this.state.nowAddress,
        idCard: this.state.idCard,
        certificationAuthority: this.state.certificationAuthority,
        marriage: this.state.marriage,
        politicalOutlook: this.state.politicalOutlook,
        son: this.state.son,
        girl: this.state.girl,
        birthdays: this.state.birthdays,
        employeeId: this.state.employeeId,
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          message.success("修改成功!");
          this.loadData();
          this.tableRowClick(this.state.ModalData);
          this.addPeoCancel();
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  editPeo() {
    this.state.residence[0] = this.state.ModalData.residenceProvince;
    this.state.residence[1] = this.state.ModalData.residenceCity;
    this.state.residence[2] = this.state.ModalData.residenceArea;
    this.state.nativePlace[0] = this.state.ModalData.nativePlaceProvince;
    this.state.nativePlace[1] = this.state.ModalData.nativePlaceCity;
    this.state.now[0] = this.state.ModalData.nowProvince;
    this.state.now[1] = this.state.ModalData.nowCity;
    this.state.now[2] = this.state.ModalData.nowArea;
    this.setState({
      peoVisible: true,
      isAddPeo: false,
      id: this.state.ModalData.id,
      doorId: this.state.ModalData.doorId,
      name: this.state.ModalData.name,
      birthdays: this.state.ModalData.birthdays,
      sex: this.state.ModalData.sex,
      nation: this.state.ModalData.nation,
      residence: this.state.residence ? this.state.residence : [],
      residenceAddress: this.state.ModalData.residenceAddress,
      now: this.state.now ? this.state.now : [],
      nowAddress: this.state.ModalData.nowAddress,
      nativePlace: this.state.nativePlace ? this.state.nativePlace : [],
      idCard: this.state.ModalData.idCard,
      certificationAuthority: this.state.ModalData.certificationAuthority,
      marriage: this.state.ModalData.marriage,
      son: this.state.ModalData.son,
      girl: this.state.ModalData.girl,
      politicalOutlook: this.state.ModalData.politicalOutlook || this.state.ModalData.politicalOutlook == 0
        ? this.state.ModalData.politicalOutlook
        : undefined,
      marriage: this.state.ModalData.marriage,
      employeeId: this.state.ModalData.employeeId,
    });
  },
  stayModal(id) {
    this.setState({
      stayVisible: true,
    });
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/selectBypdId",
      data: {
        id: id,
      },
      success: function (data) {
        let res = data.data;
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          this.setState({
            id: res.id,
            status: res.status + "",
            system: res.system + "",
            jobNature: res.jobNature,
            jobNatureRemarks: res.jobNatureRemarks,
            age: res.age,
            entryTimes: res.entryTimes,
            promotionTimes: res.promotionTimes,
            company: res.company,
            lvl: res.lvl ? res.lvl + "" : [],
            jobs: res.jobs ? res.jobs + "" : [],
            star: res.star ? res.star + "" : [],
            allowance: res.allowance,
          });
          this.getList();
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  stayCancel() {
    this.setState({
      stayVisible: false,
    });
  },
  editStay() {
    if (this.state.star == "" || this.state.star == undefined) {
      message.warning("请选择星级");
      return;
    }
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "post",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/update",
      data: {
        id: this.state.id,
        status: this.state.status,
        system: this.state.system,
        jobNature: this.state.jobNature,
        jobNatureRemarks: this.state.jobNatureRemarks,
        entryTimes: this.state.entryTimes,
        promotionTimes: this.state.promotionTimes,
        company: this.state.company,
        lvl: this.state.lvl,
        jobs: this.state.jobs,
        star: this.state.star,
        allowance: this.state.allowance,
      },
      success: function (data) {
        let res = data.data;
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          this.setState({
            stayVisible: false,
          });
          this.tableRowClick(this.state.ModalData);
          message.success("提交成功");
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  phoneModal() {
    let obj = [
      {
        id: undefined,
        pdid: this.state.ModalData.id,
        emergencyContact: "",
        emergencyMobile: "",
      },
      {
        id: undefined,
        pdid: this.state.ModalData.id,
        emergencyContact: "",
        emergencyMobile: "",
      },
      {
        id: undefined,
        pdid: this.state.ModalData.id,
        emergencyContact: "",
        emergencyMobile: "",
      },
    ];
    this.setState({
      phoneVisible: true,
      id: this.state.ModalData.id,
      mobile: this.state.ModalData.mobile,
      fixedTel: this.state.ModalData.fixedTel,
      contactList: this.state.ModalData.contactList.length
        ? JSON.parse(JSON.stringify(this.state.ModalData.contactList))
        : obj,
    });
  },
  phoneCancel() {
    this.setState({
      phoneVisible: false,
    });
  },
  editPhone() {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "post",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/updateContact",
      data: {
        id: this.state.id,
        mobile: this.state.mobile,
        fixedTel: this.state.fixedTel,
        contactList: JSON.stringify(this.state.contactList),
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          this.loadData();
          this.phoneCancel();
          this.tableRowClick(this.state.ModalData);
          message.success("修改成功");
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  entryModal() {
    this.setState({
      entryVisible: true,
    });
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/selectBypdId",
      data: {
        id: this.state.ModalData.id,
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          this.setState({
            id: data.data.personnelEntry ? data.data.personnelEntry.id : "",
            school: data.data.personnelEntry
              ? data.data.personnelEntry.school
              : "",
            education: data.data.personnelEntry
              ? data.data.personnelEntry.education
              : "",
            major: data.data.personnelEntry
              ? data.data.personnelEntry.major
              : "",
            title: data.data.personnelEntry
              ? data.data.personnelEntry.title
              : "",
            entryRemarks: data.data.personnelEntry
              ? data.data.personnelEntry.entryRemarks
              : "",
            annexUrl: data.data.personnelEntry
              ? data.data.personnelEntry.annexUrl
                ? data.data.personnelEntry.annexUrl
                : ""
              : "",
            annexName: data.data.personnelEntry
              ? data.data.personnelEntry.annexName
                ? data.data.personnelEntry.annexName
                : ""
              : "",
          });
          // }
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  entryCancel() {
    this.tableRowClick(this.state.ModalData);
    this.setState({
      entryVisible: false,
    });
  },
  cancel() {
    this.setState({
      visible: false,
      detailFlag: false,
      active: "1",
    });
  },
  tableRowClick(record) {
    this.setState({
      visible: true,
      id: record.id,
    });
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/selectBypdId",
      data: {
        id: record.id,
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          this.setState({
            ModalData: data.data,
          });
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  search() {
    this.loadData();
  },
  addPic() {
    this.setState({
      addPicModal: true,
    });
  },
  addPicModalCancel() {
    this.setState({
      addPicModal: false,
    });
  },
  getVoucherUrl(e) {
    this.setState({
      voucherUrl: e,
    });
  },
  add() {
    if (this.state.entryVisible) {
      return this.addRuzhi;
    } else if (this.state.upgradeVisible) {
      return this.addJinsheng;
    } else if (this.state.contractVisible) {
      return this.addContract;
    } else if (this.state.chooseVisible) {
      return this.addChoose;
    } else if (this.state.quitVisible) {
      return this.addQuit;
    } else if (this.state.welfareVisible) {
      return this.addWelfare;
    }
  },
  addRuzhi(e, i) {
    this.setState({
      addPicModal: false,
    });
    if (this.state.annexUrl.length > 0) {
      this.state.annexUrl += "," + e;
      this.state.annexName += "," + i;
    } else {
      this.state.annexUrl += e;
      this.state.annexName += i;
    }
    this.setState({
      annexUrl: this.state.annexUrl,
      annexName: this.state.annexName,
    });
  },
  addJinsheng(e, i) {
    this.setState({
      addPicModal: false,
    });
    if (
      this.state.promotionList.annexUrl &&
      this.state.promotionList.annexUrl.length > 0
    ) {
      this.state.promotionList.annexUrl += "," + e;
      this.state.promotionList.annexName += "," + i;
    } else {
      this.state.promotionList.annexUrl = e;
      this.state.promotionList.annexName = i;
    }
    this.setState({
      promotionList: this.state.promotionList,
    });
  },
  addContract(e, i) {
    this.setState({
      addPicModal: false,
    });
    if (
      this.state.contractList.annexUrl &&
      this.state.contractList.annexUrl.length > 0
    ) {
      this.state.contractList.annexUrl += "," + e;
      this.state.contractList.annexName += "," + i;
    } else {
      this.state.contractList.annexUrl = e;
      this.state.contractList.annexName = i;
    }
    this.setState({
      contractList: this.state.contractList,
    });
  },
  addChoose(e, i) {
    this.setState({
      addPicModal: false,
    });
    if (
      this.state.chooseList.annexUrl &&
      this.state.chooseList.annexUrl.length > 0
    ) {
      this.state.chooseList.annexUrl += "," + e;
      this.state.chooseList.annexName += "," + i;
    } else {
      this.state.chooseList.annexUrl = e;
      this.state.chooseList.annexName = i;
    }
    this.setState({
      chooseList: this.state.chooseList,
    });
  },
  addQuit(e, i) {
    this.setState({
      addPicModal: false,
    });
    if (
      this.state.quitList.annexUrl &&
      this.state.quitList.annexUrl.length > 0
    ) {
      this.state.quitList.annexUrl += "," + e;
      this.state.quitList.annexName += "," + i;
    } else {
      this.state.quitList.annexUrl = e;
      this.state.quitList.annexName = i;
    }
    this.setState({
      quitList: this.state.quitList,
    });
  },
  addWelfare(e, i) {
    this.setState({
      addPicModal: false,
    });
    if (
      this.state.ModalData.welfareAnnexUrl &&
      this.state.ModalData.welfareAnnexUrl.length > 0
    ) {
      this.state.ModalData.welfareAnnexUrl += "," + e;
      this.state.ModalData.welfareAnnexName += "," + i;
    } else {
      this.state.ModalData.welfareAnnexUrl = e;
      this.state.ModalData.welfareAnnexName = i;
    }
    this.setState({
      ModalData: this.state.ModalData,
    });
  },
  reset() {
    this.state.nameSearch = undefined;
    this.state.statusSearch = undefined;
    this.state.departmenttList = undefined;
    this.state.sexSearch = undefined;
    this.state.marriageSearch = undefined;
    this.state.politicalOutlookSearch = undefined;
    this.state.birthdayMonthSearch = undefined;
    this.state.systemSearch = undefined;
    this.state.workingYearsSearch = undefined;
    this.state.educationSearch = undefined;
    this.state.promotionTime = [];
    this.state.entryTime = [];
    this.state.quitTime = [];
    this.state.contractTime = [];
    this.loadData();
  },
  peoStatus(e) {
    if (e == 0) {
      return "在职(试用期)";
    } else if (e == 1) {
      return "在职(正式工)";
    } else if (e == 2) {
      return "离职";
    }
  },
  jobStatus(e, i) {
    if (e == 0) {
      return "全职";
    } else if (e == 1) {
      return "兼职";
    } else if (e == 2) {
      return i;
    }
  },
  educationStatus(e) {
    if (e == 0) {
      return "高中/中专";
    } else if (e == 1) {
      return "专科/高职";
    } else if (e == 2) {
      return "本科";
    } else if (e == 3) {
      return "研究生";
    } else if (e == 5) {
      return "博士";
    }
  },
  picToArr(e) {
    if (!e) return [];
    let arr = e.split(",");
    return arr;
  },
  ruzhiRemove(e) {
    let url = e.file.response.data;
    let arr = this.state.annexUrl.split(",");
    let arrName = this.state.annexName.split(",");
    let num = "";
    arr.forEach((item, index) => {
      if (item == url) {
        arr.splice(index, 1);
        num = index;
      }
    });
    arrName.splice(num, 1);
    this.setState({
      annexUrl: arr.join(","),
      annexName: arrName.join(","),
    });
  },
  jinshengRemove(e) {
    let url = e.file.response.data;
    let arr = this.state.promotionList.annexUrl.split(",");
    let arrName = this.state.promotionList.annexName.split(",");
    let num = "";
    arr.forEach((item, index) => {
      if (item == url) {
        arr.splice(index, 1);
        num = index;
      }
    });
    arrName.splice(num, 1);
    this.state.promotionList.annexUrl = arr.join(",");
    this.state.promotionList.annexName = arrName.join(",");
    this.setState({
      promotionList: this.state.promotionList,
    });
  },
  contractRemove(e) {
    let url = e.file.response.data;
    let arr = this.state.contractList.annexUrl.split(",");
    let arrName = this.state.contractList.annexName.split(",");
    let num = "";
    arr.forEach((item, index) => {
      if (item == url) {
        arr.splice(index, 1);
        num = index;
      }
    });
    arrName.splice(num, 1);
    this.state.contractList.annexUrl = arr.join(",");
    this.state.contractList.annexName = arrName.join(",");
    this.setState({
      contractList: this.state.contractList,
    });
  },
  chooseRemove(e) {
    let url = e.file.response.data;
    let arr = this.state.chooseList.annexUrl.split(",");
    let arrName = this.state.chooseList.annexName.split(",");
    let num = "";
    arr.forEach((item, index) => {
      if (item == url) {
        arr.splice(index, 1);
        num = index;
      }
    });
    arrName.splice(num, 1);
    this.state.chooseList.annexUrl = arr.join(",");
    this.state.chooseList.annexName = arrName.join(",");
    this.setState({
      chooseList: this.state.chooseList,
    });
  },
  quitRemove(e) {
    let url = e.file.response.data;
    let arr = this.state.quitList.annexUrl.split(",");
    let arrName = this.state.quitList.annexName.split(",");
    let num = "";
    arr.forEach((item, index) => {
      if (item == url) {
        arr.splice(index, 1);
        num = index;
      }
    });
    arrName.splice(num, 1);
    this.state.quitList.annexUrl = arr.join(",");
    this.state.quitList.annexName = arrName.join(",");
    this.setState({
      quitList: this.state.quitList,
    });
  },
  welfareRemove(e) {
    let url = e.file.response.data;
    let arr = this.state.ModalData.welfareAnnexUrl.split(",");
    let arrName = this.state.ModalData.welfareAnnexName.split(",");
    let num = "";
    arr.forEach((item, index) => {
      if (item == url) {
        arr.splice(index, 1);
        num = index;
      }
    });
    arrName.splice(num, 1);
    this.state.ModalData.welfareAnnexUrl = arr.join(",");
    this.state.ModalData.welfareAnnexName = arrName.join(",");
    this.setState({
      ModalData: this.state.ModalData,
    });
  },
  getList(jobs) {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/selectLvlList",
      data: {},
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          let arr = data.data;
          let starArr = [];
          arr.forEach((item, index) => {
            if(jobs && item.jobs == jobs) {
              let obj = {
                star: item.lvl + "",
                starName: item.lvlName,
              };
              starArr.push(obj);
              return
            }else if (!jobs && item.jobs == this.state.jobs) {
              let obj = {
                star: item.lvl + "",
                starName: item.lvlName,
              };
              starArr.push(obj);
            }
          });
          this.setState({
            starArr,
          });
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  getLists(jobs) {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "get",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/selectLvlList",
      data: {},
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          let arr = data.data;
          let starArrs = [];
          arr.forEach((item, index) => {
            if (jobs && item.jobs == jobs) {
              let obj = {
                star: item.lvl + "",
                starName: item.lvlName,
              };
              starArrs.push(obj);
              return;
            }
            if (item.jobs == this.state.jobss) {
              let obj = {
                star: item.lvl + "",
                starName: item.lvlName,
              };
              starArrs.push(obj);
            }
          });
          this.setState({
            starArrs,
          });
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  editRuzi() {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "post",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/updateEntry",
      data: {
        id: this.state.ModalData.id,
        school: this.state.school,
        education: this.state.education,
        major: this.state.major,
        title: this.state.title,
        entryRemarks: this.state.entryRemarks,
        annexUrl: this.state.annexUrl,
        annexName: this.state.annexName,
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          this.loadData();
          this.entryCancel();
          this.tableRowClick(this.state.ModalData);
          message.success("修改成功");
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  upgradeCancel() {
    this.tableRowClick(this.state.ModalData);
    this.setState({
      upgradeVisible: false,
    });
  },
  contractCancel() {
    this.tableRowClick(this.state.ModalData);
    this.setState({
      contractVisible: false,
    });
  },
  chooseCancel() {
    this.tableRowClick(this.state.ModalData);
    this.setState({
      chooseVisible: false,
    });
  },
  quitCancel() {
    this.tableRowClick(this.state.ModalData);
    this.setState({
      quitVisible: false,
    });
  },
  welfareCancel() {
    this.tableRowClick(this.state.ModalData);
    this.setState({
      welfareVisible: false,
    });
  },
  upgradeModal(flag, index) {
    this.setState({
      upgradeVisible: true,
    });
    let obj = {
      id: undefined,
      pdId: this.state.ModalData.id,
      oldJobs: [],
      oldLvl: [],
      newJobs: [],
      newLvl: [],
      promotionTimes: undefined,
      promotionRemarks: undefined,
      annexUrl: "",
      annexName: "",
    };
    this.setState({
      promotionList: flag ? obj : this.state.ModalData.promotionList[index],
    });
    this.getList(flag ? undefined : this.state.ModalData.promotionList[index].oldJobs);
    this.getLists(flag ? undefined : this.state.ModalData.promotionList[index].newJobs);
  },
  contractModal(flag, index) {
    this.setState({
      contractVisible: true,
    });
    let obj = {
      id: undefined,
      pdId: this.state.ModalData.id,
      startTimes: undefined,
      endTimes: undefined,
      contractRemarks: undefined,
      annexUrl: "",
      annexName: "",
    };
    this.setState({
      contractList: flag ? obj : this.state.ModalData.contractList[index],
    });
  },
  chooseModal(flag, index) {
    this.setState({
      chooseVisible: true,
    });
    let obj = {
      id: undefined,
      pdId: this.state.ModalData.id,
      chooseStatus: undefined,
      effectTimes: undefined,
      chooseRemarks: undefined,
      annexUrl: "",
      annexName: "",
    };
    this.setState({
      chooseList: flag ? obj : this.state.ModalData.chooseList[index],
    });
  },
  quitModal(flag, index) {
    this.setState({
      quitVisible: true,
    });
    let obj = {
      id: undefined,
      pdId: this.state.ModalData.id,
      effectTimes: undefined,
      quitRemarks: undefined,
      annexUrl: "",
      annexName: "",
    };
    this.setState({
      quitList: flag ? obj : this.state.ModalData.quitList[index],
    });
  },
  welfareModal() {
    this.setState({
      welfareVisible: true,
    });
  },
  editUpgrade() {
    if(!this.state.promotionList.oldLvl.length || !this.state.promotionList.newLvl.length) {
      message.warning("请选择星级")
      return
    }
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "post",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/updatePromotion",
      data: {
        id: this.state.promotionList.id,
        pdId: this.state.promotionList.pdId,
        oldJobs: this.state.promotionList.oldJobs,
        oldLvl: this.state.promotionList.oldLvl,
        newJobs: this.state.promotionList.newJobs,
        newLvl: this.state.promotionList.newLvl,
        promotionTimes: this.state.promotionList.promotionTimes,
        promotionRemarks: this.state.promotionList.promotionRemarks,
        annexUrl: this.state.promotionList.annexUrl,
        annexName: this.state.promotionList.annexName,
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          this.loadData();
          this.upgradeCancel();
          message.success("修改成功");
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  editContract() {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "post",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/updateContract",
      data: {
        id: this.state.contractList.id,
        pdId: this.state.contractList.pdId,
        startTimes: this.state.contractList.startTimes,
        endTimes: this.state.contractList.endTimes,
        contractRemarks: this.state.contractList.contractRemarks,
        annexUrl: this.state.contractList.annexUrl,
        annexName: this.state.contractList.annexName,
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          this.loadData();
          this.contractCancel();
          message.success("修改成功");
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  editChoose() {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "post",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/updateChoose",
      data: {
        id: this.state.chooseList.id,
        pdId: this.state.chooseList.pdId,
        chooseStatus: this.state.chooseList.chooseStatus,
        effectTimes: this.state.chooseList.effectTimes,
        chooseRemarks: this.state.chooseList.chooseRemarks,
        annexUrl: this.state.chooseList.annexUrl,
        annexName: this.state.chooseList.annexName,
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          this.loadData();
          this.chooseCancel();
          message.success("修改成功");
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  editQuit() {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "post",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/updateQuit",
      data: {
        id: this.state.quitList.id,
        pdId: this.state.quitList.pdId,
        effectTimes: this.state.quitList.effectTimes,
        quitRemarks: this.state.quitList.quitRemarks,
        annexUrl: this.state.quitList.annexUrl,
        annexName: this.state.quitList.annexName,
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          this.loadData();
          this.quitCancel();
          message.success("修改成功");
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  editWelfare() {
    this.setState({
      loading: true,
    });
    $.ajax({
      method: "post",
      dataType: "json",
      crossDomain: false,
      url: globalConfig.context + "/api/admin/personnel/updateWelfare",
      data: {
        pdId: this.state.ModalData.id,
        annexUrl: this.state.ModalData.welfareAnnexUrl,
        annexName: this.state.ModalData.welfareAnnexName,
        remarks: this.state.ModalData.welfareRemarks,
      },
      success: function (data) {
        let theArr = [];
        if (data.error && data.error.length) {
          message.warning(data.error[0].message);
        } else {
          this.loadData();
          this.welfareCancel();
          message.success("修改成功");
        }
      }.bind(this),
    }).always(
      function () {
        this.setState({
          loading: false,
        });
      }.bind(this)
    );
  },
  render() {
    const rowSelection = {
      selectedRowKeys: this.state.selectedRowKeys,
      onChange: (selectedRowKeys, selectedRows) => {
        this.setState({
          selectedRows: selectedRows.slice(-1),
          selectedRowKeys: selectedRowKeys.slice(-1),
        });
      },
    };
    const { RangePicker } = DatePicker;
    const formItemLayout = {
      labelCol: { span: 6 },
      wrapperCol: { span: 16 },
    };
    let departmentArr = this.state.departmentArr || [];
    return (
      
        
          人事档案统计
        
        
          
            
               {
                  this.setState({ nameSearch: e.target.value });
                }}
              />
              
              
              
              
              
              
              
              
              
              
              转正日期:
               {
                  this.setState({ promotionTime: dataString });
                }}
              />
              入职时间:
               {
                  this.setState({ entryTime: dataString });
                }}
              />
              离职时间:
               {
                  this.setState({ quitTime: dataString });
                }}
              />
              合同时间:
               {
                  this.setState({ contractTime: dataString });
                }}
              />
              
              
            
          
          
            
          
          
            
          
          
            
              
            
          
        
        
         {
            this.loadData();
            this.cancel();
          }}
        >
           (
              
            )}
            content={() => this.refs}
          />
           {
              this.refs = e;
            }}
          >
            
              {this.state.ModalData.name + "人事档案"}
            
            
            
              {this.state.table.map((item) => {
                let value = item.value;
                if (item.render) {
                  let fn = item.render;
                  return (
                    - 
                      
{item.key}
                      
                        
                          {fn(
                            this.state.ModalData[value],
                            value == "son" ? this.state.ModalData.girl : 0
                          )}
                        
                      
                     
                  );
                }
                return (
                  - 
                    
{item.key}
                    
                      
                        {this.state.ModalData[value] &&
                        this.state.ModalData[value].length > 10
                          ? this.state.ModalData[value].substring(0, 10) + "..."
                          : this.state.ModalData[value]}
                      
                    
                   
                );
              })}
            
            {this.state.detailFlag ? (
              
                
                  任职信息
                  {/*  */}
                
                
                  
                    {this.state.ModalData.statusName}
                  
                  
                    {this.state.ModalData.systemName}
                  
                
                
                  
                    {this.jobStatus(
                      this.state.ModalData.jobNature,
                      this.state.ModalData.jobNatureRemarks
                    )}
                  
                  
                    {this.state.ModalData.workingYear}
                  
                
                
                  
                    {this.state.ModalData.entryTimes}
                  
                  
                    {this.state.ModalData.promotionTimes}
                  
                
                
                  
                    {this.state.ModalData.depName}
                  
                  
                    {this.state.ModalData.lvlName}
                  
                
                
                  
                    {this.state.ModalData.jobsName}
                  
                  
                    {this.state.ModalData.allowance}
                  
                
                
                  
                    {this.state.ModalData.starName}
                  
                
                
                  联系信息
                  {/*  */}
                
                
                  
                    {this.state.ModalData.mobile}
                  
                  
                    {this.state.ModalData.fixedTel}
                  
                
                {this.state.ModalData.contactList &&
                this.state.ModalData.contactList.length > 0 ? (
                  this.state.ModalData.contactList.map((item, index) => {
                    return (
                      
                        
                          {item.emergencyContact}
                        
                        
                          {item.emergencyMobile}
                        
                      
                    );
                  })
                ) : (
                  
                    暂无紧急联系人信息
                  
                )}
                
                  入职资料
                  {/*  */}
                
                
                  
                    {this.state.ModalData.personnelEntry
                      ? this.state.ModalData.personnelEntry.school
                      : ""}
                  
                  
                    {this.state.ModalData.personnelEntry
                      ? this.educationStatus(
                          this.state.ModalData.personnelEntry.education
                        )
                      : ""}
                  
                
                
                  
                    {this.state.ModalData.personnelEntry
                      ? this.state.ModalData.personnelEntry.major
                      : ""}
                  
                  
                    {this.state.ModalData.personnelEntry
                      ? this.state.ModalData.personnelEntry.title
                      : ""}
                  
                
                
                
                  晋升情况
                  {/*  */}
                
                {this.state.ModalData.promotionList &&
                this.state.ModalData.promotionList.length > 0 ? (
                  this.state.ModalData.promotionList.map((item, index) => {
                    return (
                      
                        {/* 
 */}
                        
                          
                            {item.oldJobsName + "--->" + item.newJobsName}
                          
                          
                            {item.oldLvlName + "--->" + item.newLvlName}
                          
                        
                        
                          
                            {item.promotionTimes}
                          
                        
                        
                          
                            {item.promotionRemarks}
                          
                        
                        
                      
                    );
                  })
                ) : (
                  
                    暂无晋升情况
                  
                )}
                
                  合同情况
                  {/*  */}
                
                {this.state.ModalData.contractList &&
                this.state.ModalData.contractList.length > 0 ? (
                  this.state.ModalData.contractList.map((item, index) => {
                    return (
                      
                        {/* 
 */}
                        
                          
                            {item.startTimes}
                          
                          
                            {item.endTimes}
                          
                        
                        
                          
                            {item.contractRemarks}
                          
                        
                        
                      
                    );
                  })
                ) : (
                  
                    暂无合同情况
                  
                )}
                
                  奖惩情况
                  {/*  */}
                
                {this.state.ModalData.chooseList &&
                this.state.ModalData.chooseList.length > 0 ? (
                  this.state.ModalData.chooseList.map((item, index) => {
                    return (
                      
                        {/* 
 */}
                        
                          
                            {item.chooseStatus == 0 ? "奖励" : "惩罚"}
                          
                          
                            {item.effectTimes}
                          
                        
                        
                          
                            {item.chooseRemarks}
                          
                        
                        
                      
                    );
                  })
                ) : (
                  
                    暂无奖惩情况
                  
                )}
                
                  离职情况
                  {/*  */}
                
                {this.state.ModalData.quitList &&
                this.state.ModalData.quitList.length > 0 ? (
                  this.state.ModalData.quitList.map((item, index) => {
                    return (
                      
                        {/* 
 */}
                        
                          
                            {item.effectTimes}
                          
                          
                            {item.quitRemarks}
                          
                        
                        
                      
                    );
                  })
                ) : (
                  
                    暂无离职信息
                  
                )}
                
                  福利情况
                  {/*  */}
                
                
                
                  
                    {this.state.ModalData.welfareRemarks}
                  
                
                
               
            ) : (
               {
                  this.setState({ active: e });
                }}
              >
                
                  
                    任职信息
                    
                  
                  
                    
                      {this.state.ModalData.statusName}
                    
                    
                      {this.state.ModalData.systemName}
                    
                  
                  
                    
                      {this.jobStatus(
                        this.state.ModalData.jobNature,
                        this.state.ModalData.jobNatureRemarks
                      )}
                    
                    
                      {this.state.ModalData.workingYear}
                    
                  
                  
                    
                      {this.state.ModalData.entryTimes}
                    
                    
                      {this.state.ModalData.promotionTimes}
                    
                  
                  
                    
                      {this.state.ModalData.depName}
                    
                    
                      {this.state.ModalData.lvlName}
                    
                  
                  
                    
                      {this.state.ModalData.jobsName}
                    
                    
                      {this.state.ModalData.allowance}
                    
                  
                  
                    
                      {this.state.ModalData.starName}
                    
                  
                
                
                  
                    联系信息
                    
                  
                  
                    
                      {this.state.ModalData.mobile}
                    
                    
                      {this.state.ModalData.fixedTel}
                    
                  
                  {this.state.ModalData.contactList &&
                  this.state.ModalData.contactList.length > 0 ? (
                    this.state.ModalData.contactList.map((item, index) => {
                      return (
                        
                          
                            {item.emergencyContact}
                          
                          
                            {item.emergencyMobile}
                          
                        
                      );
                    })
                  ) : (
                    
                      暂无紧急联系人信息
                    
                  )}
                
                
                  
                    入职资料
                    
                  
                  
                    
                      {this.state.ModalData.personnelEntry
                        ? this.state.ModalData.personnelEntry.school
                        : ""}
                    
                    
                      {this.state.ModalData.personnelEntry
                        ? this.educationStatus(
                            this.state.ModalData.personnelEntry.education
                          )
                        : ""}
                    
                  
                  
                    
                      {this.state.ModalData.personnelEntry
                        ? this.state.ModalData.personnelEntry.major
                        : ""}
                    
                    
                      {this.state.ModalData.personnelEntry
                        ? this.state.ModalData.personnelEntry.title
                        : ""}
                    
                  
                  
                
                
                  
                    晋升情况
                    
                  
                  {this.state.ModalData.promotionList &&
                  this.state.ModalData.promotionList.length > 0 ? (
                    this.state.ModalData.promotionList.map((item, index) => {
                      return (
                        
                          
                          
                            
                              {item.oldJobsName + "--->" + item.newJobsName}
                            
                            
                              {item.oldLvlName + "--->" + item.newLvlName}
                            
                          
                          
                            
                              {item.promotionTimes}
                            
                          
                          
                            
                              {item.promotionRemarks}
                            
                          
                          
                         
                      );
                    })
                  ) : (
                    
                      暂无晋升情况
                    
                  )}
                
                
                  
                    合同情况
                    
                  
                  {this.state.ModalData.contractList &&
                  this.state.ModalData.contractList.length > 0 ? (
                    this.state.ModalData.contractList.map((item, index) => {
                      return (
                        
                          
                          
                            
                              {item.startTimes}
                            
                            
                              {item.endTimes}
                            
                          
                          
                            
                              {item.contractRemarks}
                            
                          
                          
                         
                      );
                    })
                  ) : (
                    
                      暂无合同情况
                    
                  )}
                
                
                  
                    奖惩情况
                    
                  
                  {this.state.ModalData.chooseList &&
                  this.state.ModalData.chooseList.length > 0 ? (
                    this.state.ModalData.chooseList.map((item, index) => {
                      return (
                        
                          
                          
                            
                              {item.chooseStatus == 0 ? "奖励" : "惩罚"}
                            
                            
                              {item.effectTimes}
                            
                          
                          
                            
                              {item.chooseRemarks}
                            
                          
                          
                         
                      );
                    })
                  ) : (
                    
                      暂无奖惩情况
                    
                  )}
                
                
                  
                    离职情况
                    
                  
                  {this.state.ModalData.quitList &&
                  this.state.ModalData.quitList.length > 0 ? (
                    this.state.ModalData.quitList.map((item, index) => {
                      return (
                        
                          
                          
                            
                              {item.effectTimes}
                            
                            
                              {item.quitRemarks}
                            
                          
                          
                         
                      );
                    })
                  ) : (
                    
                      暂无离职信息
                    
                  )}
                
                
                  
                    福利情况
                    
                  
                  
                  
                    
                      {this.state.ModalData.welfareRemarks}
                    
                  
                  
                
              
            )}
          
           {
              this.loadData();
              this.addPeoCancel();
            }}
          >
            
              
                {this.state.isAddPeo ? "新增人事档案" : "修改人事档案"}
              
              
                
                   {
                      this.setState({
                        employeeId: e.target.value,
                      });
                    }}
                  />
                  
                
                
                   {
                      this.setState({
                        doorId: e.target.value,
                      });
                    }}
                  />
                  
                
              
              
                
                   {
                      this.setState({
                        name: e.target.value,
                      });
                    }}
                  />
                
                
                   {
                      this.setState({
                        birthdays: t,
                      });
                    }}
                  />
                
              
              
                
                   {
                      this.setState({ sex: e.target.value });
                    }}
                    value={this.state.sex}
                  >
                    男
                    女
                  
                
                
                   {
                      this.setState({
                        nation: e.target.value,
                      });
                    }}
                  />
                
              
              
                
                   {
                      this.setState({ residence: e });
                    }}
                  />
                  {/* * */}
                
                
                   {
                      this.setState({
                        residenceAddress: e.target.value,
                      });
                    }}
                  />
                
              
              
                
                   {
                      this.setState({ now: e });
                    }}
                  />
                  {/* * */}
                
                
                   {
                      this.setState({
                        nowAddress: e.target.value,
                      });
                    }}
                  />
                
              
              
                
                   {
                      this.setState({ nativePlace: e });
                    }}
                  />
                  {/* * */}
                
                
                   {
                      // let reg = /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
                      this.setState({
                        idCard: e.target.value,
                      });
                    }}
                  />
                
              
              
                
                   {
                      // let reg = /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
                      this.setState({
                        certificationAuthority: e.target.value,
                      });
                    }}
                  />
                  {/* * */}
                
                
                   {
                      this.setState({ marriage: e.target.value });
                    }}
                    value={this.state.marriage}
                  >
                    未婚
                    已婚
                    离异
                  
                
              
              
                
                  儿子:
                   {
                      this.setState({
                        son: e.target.value,
                      });
                    }}
                  />
                  女儿:
                   {
                      this.setState({
                        girl: e.target.value,
                      });
                    }}
                  />
                
                
                  
                
              
              
            
          
        
         {
            this.loadData();
            this.addPeoCancel();
          }}
        >
          
            
              {this.state.isAddPeo ? "新增人事档案" : "修改人事档案"}
            
            
              
                 {
                    this.setState({
                      employeeId: e.target.value,
                    });
                  }}
                />
                
              
              
                 {
                    this.setState({
                      doorId: e.target.value,
                    });
                  }}
                />
                
              
            
            
              
                 {
                    this.setState({
                      name: e.target.value,
                    });
                  }}
                />
              
              
                 {
                    this.setState({
                      birthdays: t,
                    });
                  }}
                />
              
            
            
              
                 {
                    this.setState({ sex: e.target.value });
                  }}
                  value={this.state.sex}
                >
                  男
                  女
                
              
              
                 {
                    this.setState({
                      nation: e.target.value,
                    });
                  }}
                />
              
            
            
              
                 {
                    this.setState({ residence: e });
                  }}
                />
                {/* * */}
              
              
                 {
                    this.setState({
                      residenceAddress: e.target.value,
                    });
                  }}
                />
              
            
            
              
                 {
                    this.setState({ now: e });
                  }}
                />
                {/* * */}
              
              
                 {
                    this.setState({
                      nowAddress: e.target.value,
                    });
                  }}
                />
              
            
            
              
                 {
                    this.setState({ nativePlace: e });
                  }}
                />
                {/* * */}
              
              
                 {
                    // let reg = /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
                    this.setState({
                      idCard: e.target.value,
                    });
                  }}
                />
              
            
            
              
                 {
                    // let reg = /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
                    this.setState({
                      certificationAuthority: e.target.value,
                    });
                  }}
                />
                {/* * */}
              
              
                 {
                    this.setState({ marriage: e.target.value });
                  }}
                  value={this.state.marriage}
                >
                  未婚
                  已婚
                  离异
                
              
            
            
              
                儿子:
                 {
                    this.setState({
                      son: e.target.value,
                    });
                  }}
                />
                女儿:
                 {
                    this.setState({
                      girl: e.target.value,
                    });
                  }}
                />
              
              
                
              
            
            
          
        
         {
            this.loadData();
            this.stayCancel();
          }}
        >
          
            
              任职信息
            
            
              
                
              
              
                
              
            
            
              
                 {
                    this.setState({ jobNature: e.target.value });
                  }}
                  value={this.state.jobNature}
                >
                  全职
                  兼职
                  其他
                
                 {
                    this.setState({
                      jobNatureRemarks: e.target.value,
                    });
                  }}
                />
              
              
                {this.state.ModalData.workingYear}
              
            
            
              
                 {
                    this.setState({
                      entryTimes: t,
                    });
                  }}
                />
              
              
                 {
                    this.setState({
                      promotionTimes: t,
                    });
                  }}
                />
              
            
            
              
                
              
              
                
              
            
            
              
                
              
              
                
              
            
            
              
                 {
                    this.setState({
                      allowance: e.target.value,
                    });
                  }}
                />
              
            
            
          
        
         {
            this.loadData();
            this.phoneCancel();
          }}
        >
          
            
              联系信息
            
            
              
                 {
                    this.setState({
                      mobile: e.target.value,
                    });
                  }}
                />
              
              
                 {
                    this.setState({
                      fixedTel: e.target.value,
                    });
                  }}
                />
              
            
            
              
                 {
                    this.state.contactList[0].emergencyContact = e.target.value;
                    let obj = this.state.contactList;
                    this.setState({
                      contactList: obj,
                    });
                  }}
                />
              
              
                 {
                    this.state.contactList[0].emergencyMobile = e.target.value;
                    let obj = this.state.contactList;
                    this.setState({
                      contactList: obj,
                    });
                  }}
                />
              
            
            
              
                 {
                    this.state.contactList[1].emergencyContact = e.target.value;
                    let obj = this.state.contactList;
                    this.setState({
                      contactList: obj,
                    });
                  }}
                />
              
              
                 {
                    this.state.contactList[1].emergencyMobile = e.target.value;
                    let obj = this.state.contactList;
                    this.setState({
                      contactList: obj,
                    });
                  }}
                />
              
            
            
              
                 {
                    this.state.contactList[2].emergencyContact = e.target.value;
                    let obj = this.state.contactList;
                    this.setState({
                      contactList: obj,
                    });
                  }}
                />
              
              
                 {
                    this.state.contactList[2].emergencyMobile = e.target.value;
                    let obj = this.state.contactList;
                    this.setState({
                      contactList: obj,
                    });
                  }}
                />
              
            
            
          
        
         {
            this.loadData();
            this.entryCancel();
          }}
        >
          
            
              入职信息
            
            
              
                 {
                    this.setState({
                      school: e.target.value,
                    });
                  }}
                />
              
              
                
              
            
            
              
                 {
                    this.setState({
                      major: e.target.value,
                    });
                  }}
                />
              
              
                 {
                    this.setState({
                      title: e.target.value,
                    });
                  }}
                />
              
            
            
              
                 {
                    this.setState({
                      entryRemarks: e.target.value,
                    });
                  }}
                />
              
            
            
            
            
          
        
         {
            this.loadData();
            this.upgradeCancel();
          }}
        >
          
            
              晋升信息
            
            
              
                
                  
                
                
                  
                
              
              
                
                  
                
                
                  
                
              
              
                
                   {
                      this.state.promotionList.promotionTimes = t;
                      this.setState({
                        promotionList: this.state.promotionList,
                      });
                    }}
                  />
                
              
              
                
                   {
                      this.state.promotionList.promotionRemarks =
                        e.target.value;
                      this.setState({
                        promotionList: this.state.promotionList,
                      });
                    }}
                  />
                
              
              
             
            
            
          
        
         {
            this.loadData();
            this.contractCancel();
          }}
        >
          
            
              合同信息
            
            
            
            
          
        
         {
            this.loadData();
            this.chooseCancel();
          }}
        >
          
            
              奖惩信息
            
            
            
            
          
        
         {
            this.loadData();
            this.quitCancel();
          }}
        >
          
            
              离职信息
            
            
            
            
          
        
         {
            this.loadData();
            this.welfareCancel();
          }}
        >
          
            
              福利信息
            
            
            
            
            
          
        
         {
            this.setState({
              editWelfareVisible: false,
            });
          }}
        >
          
            
              
                
                  
                
                
                  
                
              
              
                
                   {
                      this.state.editWelfareData.startTimes = t;
                      this.setState({
                        editWelfareData: this.state.editWelfareData,
                      });
                    }}
                  />
                
                
                   {
                      this.state.editWelfareData.endTimes = t;
                      this.setState({
                        editWelfareData: this.state.editWelfareData,
                      });
                    }}
                  />
                
              
              
                
                  
                
              
              
                
                   {
                      this.state.editWelfareData.welfareRemarks =
                        e.target.value;
                      this.setState({
                        editWelfareData: this.state.editWelfareData,
                      });
                    }}
                  />
                
              
             
            
          
        
       
    );
  },
});
export default PersonnelAll;