import { message, Checkbox, Radio } from "antd/lib/index";
import { getPropertyData, extendInclude, extendRule, getDataFieldValue, setDataFieldValue, initFilter, empty, onBeforeSaveHandleRecordLog, guid } from "../../utils/common";
import { connect } from 'dva';
import moment from 'moment';
/**
 * @return {string}
 */
// 编辑  制定任务
export default {
  onBeforeSaveHandleRecord(params) {
    params.record.TaskID = params.data.TaskID    //TaskID传递消息表ID
    params.record.PUBLISH = params.customParams;
  },
  onBeforeEdit: ({ isNew, stateData, setFieldValue, login }) => {
    let law = 0;
    for (let i = 0; i < stateData.Nav_IntegrateUpdateDetail?.length; i++) {
      if (stateData.Nav_IntegrateUpdateDetail[i].UPDATE_STATUS == 0) {
        law++;
      }
    }
    setFieldValue('RATE', ((1-(law / stateData.Nav_IntegrateUpdateDetail?.length)) * 100).toFixed(2) + '%');
  },
  onSubChange: ({ colInfo, stateData, setFieldValue }) => {
    if (colInfo.FIELD_NAME == 'UPDATE_STATUS') {
      let law = 0;
      for (let i = 0; i < stateData.Nav_IntegrateUpdateDetail?.length; i++) {
        if (stateData.Nav_IntegrateUpdateDetail[i].UPDATE_STATUS == 0) {
          law++;
        }
      }
      stateData.RATE = ((1-(law / stateData.Nav_IntegrateUpdateDetail?.length)) * 100).toFixed(2) + '%';
    }
  }
}
