/**
 * @Description : 固定值转换
 * @Author      : jinxin
 * @Date        : 2023-2-03 17:36:43
 */

function getFixedName(val, type, list) {
  let name = ''
  let templist = []

  if (type == 'whether') {
    if (val) name = '是'
    else name = '否'
  } else if (type == 'switch') {
    if (val) name = '开'
    else name = '关'
  } else if (type == 'select') {
    templist = list.filter(it => it.id == val)
    if (templist.length > 0) name = templist[0].name
    else name = ''
  } else if (type == 'mh_sel') {
    if (val) {
      templist = list.filter(it => it.id == val)
      if (templist.length > 0) name = templist[0].name
      else name = ''
    } else {
      name = ''
    }
  }

  return name
}

export default getFixedName
