import { message } from "antd/lib/index";
import { getPropertyData, extendInclude, extendRule, getDataFieldValue, setDataFieldValue, initFilter, empty } from "../../utils/common";
import { connect } from 'dva';
/**
 * @return {string}
 */
// 编辑
export default {
  onBeforeEdit: ({ isNew, stateData, setFieldEditable, setFieldVisible, setFieldRequired }) => {
    if (stateData.RISK_TYPE == 1) {
      setFieldRequired('LIMIT_UNIT', true);
      setFieldVisible('LIMIT_UNIT', true);
    } else {
      setFieldRequired('LIMIT_UNIT', false);
      setFieldVisible('LIMIT_UNIT', false);
    }
  },
  onChange: ({ value, colInfo, getFieldValue, setFieldVisible, setFieldValue, setFieldEditable, setFieldRequired, resetFields }) => {
    if (colInfo.FIELD_NAME == 'RISK_TYPE') {
      if (getFieldValue('RISK_TYPE') == 1) {
        setFieldRequired('LIMIT_UNIT', true);
        setFieldVisible('LIMIT_UNIT', true);
      } else {
        setFieldRequired('LIMIT_UNIT', false);
        setFieldVisible('LIMIT_UNIT', false);
      }
    }
  },
}
