/* eslint-disable no-undef */

/**
 * @return {string}
 */

export default {
  onChange: ({ value, colInfo, getFieldValue, setFieldVisible, setFieldValue, setFieldEditable }) => {
    if (!(colInfo.FIELD_NAME == 'Nav_ApplianceType.NAME'))
      return;
    let AppTypeName = getFieldValue('Nav_ApplianceType.NAME')
    if (AppTypeName && AppTypeName.indexOf("电") != -1)//电表
    {
      setFieldVisible('MUTUAL_INDUCTANCE_RADIO', true);
      setFieldVisible('RATED_CAPACITY', true);
      setFieldVisible('RATED_CURRENT', true);
      setFieldVisible('INTFUSING_CURRENT', true);
    }
    else {
      setFieldVisible('MUTUAL_INDUCTANCE_RADIO', false);
      setFieldVisible('RATED_CAPACITY', false);
      setFieldVisible('RATED_CURRENT', false);
      setFieldVisible('INTFUSING_CURRENT', false);
    }
  },
  onBeforeEdit: ({ isNew, getFieldValue, setFieldVisible }) => {
    let AppTypeName = getFieldValue('Nav_ApplianceType.NAME')
    if (AppTypeName && AppTypeName.indexOf("电") != -1)//电表
    {
      setFieldVisible('MUTUAL_INDUCTANCE_RADIO', true);
      setFieldVisible('RATED_CAPACITY', true);
      setFieldVisible('RATED_CURRENT', true);
      setFieldVisible('INTFUSING_CURRENT', true);
    }
    else {
      setFieldVisible('MUTUAL_INDUCTANCE_RADIO', false);
      setFieldVisible('RATED_CAPACITY', false);
      setFieldVisible('RATED_CURRENT', false);
      setFieldVisible('INTFUSING_CURRENT', false);

    }
  },
  onBeforeSave: ({ data, getFieldValue, setFieldValue }) => {
  },
}
