useValidateParital.ts 612 Bytes
/**
 * 校验部分字段
 */
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();

export const validateValueRangeAndStep = (min, step, max) => {
  if (min > max) {
    createMessage.error('最大值必须大于最小值,整数型不能有小数位,单精度有效位为7,双精度为16');
    throw '最大值必须大于最小值,整数型不能有小数位,单精度有效位为7,双精度为16';
  }
  if (step > max - min) {
    createMessage.error('步长不能大于取值范围的差值');
    throw '步长不能大于取值范围的差值';
  }
};