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';
import config from "../../config.js"
import { Button, Row, Col, Form, Input, Select, Upload, Icon, Modal, Spin } from 'antd';
import storage from '../../utils/storage'

/**
 * @return {string}
 */
// 编辑  勘察记录
export default {
  onBeforeSaveHandleRecord(params) {
    params.record.TaskID = params.data.TaskID    //TaskID传递消息表ID
    params.record.STATUS = params.customParams;
    // onBeforeSaveHandleRecordLog(params, 'AE018', '事故事件调查结果填报前端日志')
  },

  onBeforeEdit: ({ isNew, setFieldValueByBatch, setFieldEditable, login, stateData, setFieldValue }) => {
    if (isNew) {
      const temps = [];
      temps.push({ field: 'DEPARTMENT_ID', value: login.user.Nav_Department.ID })
      temps.push({ field: 'Nav_Department.NAME', value: login.user.Nav_Department.NAME })
      temps.push({ field: 'USER_ID', value: login.user.ID })
      temps.push({ field: 'Nav_User.NAME', value: login.user.NAME })
      temps.push({ field: 'LAUNCH_TIME', value: (new Date()).Format("yyyy-MM-dd") })
      setFieldValueByBatch(temps);
    } else if (!stateData.LAUNCH_TIME) {
      setFieldValue('LAUNCH_TIME', (new Date()).Format("yyyy-MM-dd"))
    }

    if (stateData.Nav_Accident?.CODE.length > 0) {
      setFieldEditable("Nav_Accident.CODE", false)
    }
  },

}
