import { message, Checkbox, Radio } from "antd/lib/index";
import { getPropertyData, extendInclude, extendRule, getDataFieldValue, setDataFieldValue, initFilter, empty, onBeforeSaveHandleRecordLog, Format } from "../../utils/common";
import { connect } from 'dva';
import moment from 'moment';
/**
 * @return {string}
 */
// 编辑  监测结果统计与分析汇总
export default {
  onBeforeEdit: ({ isNew, stateData, dispatch, login, app, setFieldValueByBatch }) => {
    var dtDEPARTURETIME = ''
    var dtENTRYTIME = ''
    var dtStartTIME = ''
    if (stateData.Nav_NoticeRegister != null && stateData.Nav_NoticeRegister.Nav_User != null && stateData.Nav_NoticeRegister.Nav_User.DEPARTURETIME != '0001-01-01 00:00:00') {
      dtDEPARTURETIME = stateData.Nav_NoticeRegister?.Nav_User?.DEPARTURETIME.split(' ')[0]
    }
    if (stateData.Nav_NoticeRegister != null && stateData.Nav_NoticeRegister.Nav_User != null && stateData.Nav_NoticeRegister.Nav_User.ENTRYTIME != '0001-01-01 00:00:00') {
      dtENTRYTIME = stateData.Nav_NoticeRegister?.Nav_User?.ENTRYTIME.split(' ')[0]
    }

    if (stateData.Nav_NoticeRegister?.Nav_ExamBatch?.START_TIME != '0001-01-01 00:00:00') {
      dtStartTIME = stateData?.Nav_NoticeRegister?.Nav_ExamBatch?.START_TIME.split(' ')[0]
    }
    const temps = [];
    temps.push({ field: 'Nav_NoticeRegister.Nav_ExamBatch.BATCH', value: stateData.Nav_NoticeRegister.Nav_ExamBatch.BATCH })
    temps.push({ field: 'Nav_NoticeRegister.Nav_User.NAME', value: stateData.Nav_NoticeRegister.Nav_User.NAME })
    temps.push({ field: 'Nav_User.ID_CARD', value: stateData.Nav_User.ID_CARD })
    temps.push({ field: 'Nav_NoticeRegister.Nav_User.DEPARTURETIME', value: dtDEPARTURETIME })
    temps.push({ field: 'Nav_NoticeRegister.Nav_User.ENTRYTIME', value: dtENTRYTIME })
    temps.push({ field: 'Nav_NoticeRegister.Nav_ExamBatch.START_TIME', value: dtStartTIME })
    setFieldValueByBatch(temps);

  }
}
