import request from '@/utils/request'

// application/x-www-form-urlencoded表单形式
function urlencoded(data) {
  const newData = Object.keys(data).map((key) => {
    return `${key}=${encodeURIComponent(data[key])}`
  }).join('&')
  return newData
}

export function deleteTRVerifyCommon(data) {
  return request({
    url: '/verifyCommon/deleteTRVerifyCommon',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: urlencoded(data)
  })
}

export function saveTRVerifyCommon(data) {
  return request({
    url: '/verifyCommon/saveTRVerifyCommon',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: urlencoded(data)
  })
}

export function updateTRVerifyCommon(data) {
  return request({
    url: '/verifyCommon/updateTRVerifyCommon',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: urlencoded(data)
  })
}

export function verifyCommonList(data) {
  return request({
    url: '/verifyCommon/verifyCommonList',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: urlencoded(data)
  })
}

//
export function getAbnormal(data) {
  return request({
    url: '/task/getAbnormal',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: urlencoded(data)
  })
}
/**
 * 获取常用语菜单列表
 * @author Lee
 */
export function getCYY() {
  return request({
    url: '/constant/getCYY',
    method: 'get'
  })
}
