import { message } from "antd/lib/index";
import { getPropertyData, extendInclude, extendRule, getDataFieldValue, setDataFieldValue, initFilter, guid } from "../../utils/common";
import moment from 'moment';
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("_"));
  },
  onBeforeEdit(params) {
    const { stateData,saveRowRecord,setFieldEditable,setFieldRequired} = params ? params : {};
    if(stateData.IS_PLAN == true)
    {
      setFieldRequired('Nav_PlanResources', true);
      setFieldRequired('Nav_PlanFiles', true);
      setFieldEditable('Nav_PlanResources', true);
      setFieldEditable('Nav_PlanFiles', true);
    } else {
      setFieldRequired('Nav_PlanResources', false);
      setFieldRequired('Nav_PlanFiles', false);
      setFieldEditable('Nav_PlanResources', false);
      setFieldEditable('Nav_PlanFiles', false);
    }
  },
  onChange: ({ value, colInfo, getFieldValue, setFieldVisible, setFieldValue, setFieldEditable, setFieldRequired, resetFields }) => {
    if (colInfo.FIELD_NAME == 'IS_PLAN') {
      if (getFieldValue('IS_PLAN') == true) {
        setFieldRequired('Nav_PlanResources', true);
        setFieldRequired('Nav_PlanFiles', true);
        setFieldEditable('Nav_PlanResources', true);
        setFieldEditable('Nav_PlanFiles', true);
      } else {
        setFieldRequired('Nav_PlanResources', false);
        setFieldRequired('Nav_PlanFiles', false);
        setFieldEditable('Nav_PlanResources', false);
        setFieldEditable('Nav_PlanFiles', false);
      }
    }
  },
}
