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 { isNew,stateData,saveRowRecord,setFieldValue,setFieldVisible,setFieldRequired} = params ? params : {};
    if(!isNew)
    {
      setFieldValue("Nav_Department.NAME", stateData.Nav_Department?.NAME)
      setFieldValue("Nav_User.NAME", stateData.Nav_User?.NAME)
    }
  },
  onSubChange: ({ row, pageCode, record, colInfo, dispatch, stateData, setFieldEditable,setFieldValueByBatch, props }) => {
    if (colInfo.FIELD_NAME === 'RESULT_SCORE') {
      let standScore = getDataFieldValue(record, 'STANDARDIZED_SCORE');
      let resultScore = getDataFieldValue(record, 'RESULT_SCORE');
      standScore===null?0:standScore;
      resultScore===null?0:resultScore;
      if(resultScore>standScore)
      {
        message.error("实得分不能大于标准分!")
      }
    }
  },
}
