import { message } from "antd/lib/index";
import { getPropertyData, extendInclude, extendRule, getDataFieldValue, setDataFieldValue, initFilter, guid } from "../../utils/common";
import moment from 'moment';
import config from "../../config.js"
import storage from '../../utils/storage'
import { Button, Row, Col, Form, Input, Select, Upload, Icon, Modal, Spin,Table } from 'antd';
/**
 * @return {string}
 */
// 编辑
export default {
  onBeforeSaveHandleRecord(params) {
    params.record.TaskID = params.data.TaskID    //TaskID传递消息表ID
    params.record.PUBLISH = params.customParams;
    // params.record.FORM_CODE = params.data.reloadKey.substring(0,params.data.reloadKey.indexOf("_"));
  },
  onSubChange: ({ value, colInfo, stateData,record, setFieldEditable, setFieldValueByBatch, resetFields }) => {
    if (colInfo.FIELD_NAME === 'RETURN_TIME') {
        let nowDate= new Date();
        let returnTime = new Date(getDataFieldValue(record, 'RETURN_TIME'));
        let day=(returnTime - nowDate) / (1 * 24 * 60 * 60 * 1000) +1;
        setDataFieldValue(record, 'DAY', Math.round(day));
        stateData.Nav_Details.map((v, i) => {
            if (v.ID == record.ID) {
              v.DAY = record.DAY;
            }
          });
        setFieldValueByBatch(stateData.Nav_Details);
    }
  },
}
