import { message } from "antd/lib/index";
import { getPropertyData, extendInclude, extendRule, getDataFieldValue, setDataFieldValue, initFilter, guid } from "../../utils/common";
export default {
  onBeforeSaveHandleRecord(params) {
    params.record.TaskID = params.data.TaskID    //TaskID传递消息表ID
    params.record.PUBLISH = params.customParams;
  },
  onSubChange: ({ row, pageCode, record, colInfo, dispatch, stateData, saveRowRecord, setDataState, setFieldValueByBatch }) => {
    if (colInfo.FIELD_NAME == 'Nav_Users') {
      if(record.Nav_Users.length > 0){
      let recoderName = record.Nav_Users[0].Nav_User.NAME;
      let recoderId = record.Nav_Users[0].USER_ID;
      let recoder = {
        NAME: recoderName,
      }
      record["Nav_User"] = recoder;
      record["RECORD_USER_ID"] = recoderId;
    }else{
      record["Nav_User"] = null;
      record["RECORD_USER_ID"] = null;
    }
      saveRowRecord(record)
    }
  },
  onBeforeEdit: ({ isNew, stateData, setFieldEditable, setFieldRequired }) => {
    if (isNew||stateData.STATUS ==0) {
      setFieldEditable('START_TIME', true);
      setFieldEditable('END_TIME', true);
      setFieldEditable('LEVEL', true);
      setFieldEditable('Nav_Areas', true);
      setFieldEditable('Nav_Identifyings', true);
    }
    if(stateData.STATUS >0){
      setFieldEditable('Nav_Files', false);
    }
  }
}
