/**
 * 格式化后台规则表达式
 * @param {String} operator 规则中阈值表达式,后端规则配置中子规则中的operator值
 * @param {Number} threshold 规则阈值,后端规则配置中子规则中的threshold值
 * @param {Number} value 指标的值
 * @return {object} {label：{des,ope},result:boolean}
 * @function fromatRuleOperator
 * @static
 * @example 01 获取阈值文本显示
 * --------------------------------------------------------------------------
 *  import {fromatRuleOperator} from '@riil-frontend/utils';
 *  fromatRuleOperator({'equals',threshold:0.7});// return {label:{des:'等于0.7',ope:'=0.7'},result:null}
 * @example 02 获取阈值文本显示以及比较后结果
 * --------------------------------------------------------------------------
 *  import {fromatRuleOperator} from '@riil-frontend/utils';
 *  fromatRuleOperator({'equals',threshold:0.7,value:1});// return {label:{des:'等于0.7',ope:'=0.7'},result:false}
 */
export var fromatRuleOperator = function fromatRuleOperator(operator, threshold, value) {
  var label = null;
  var result = null;

  if (operator === 'equals') {
    result = value === threshold;
    label = {
      des: "\u7B49\u4E8E".concat(threshold),
      ope: '='.concat(threshold)
    };
  } else if (operator === 'gt') {
    result = value > threshold;
    label = {
      des: "\u5927\u4E8E".concat(threshold),
      ope: '>'.concat(threshold)
    };
  } else if (operator === 'lt') {
    result = value < threshold;
    label = {
      des: "\u5C0F\u4E8E".concat(threshold),
      ope: '<'.concat(threshold)
    };
  }

  return {
    label: label,
    result: result
  };
};