import request from '@/utils/request'

// 字典
export function getDictList(data: any) {
  return request.post('/sys/dict/data', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
}
export function saveDict(data: any) {
  return request.post('/sys/dict/save', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
}
export function deleteDict(data: any) {
  return request.get('/sys/dict/deleteAll', {
    params: data
  })
}

// 字典值
export function getDictValue(dictTypeId: string | number) {
  return request.get(`/sys/dict/getDictValue?dictTypeId=${dictTypeId}`)
}
export function saveDictValue(data: any) {
  return request.post('/sys/dict/saveDictValue', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })
}
export function deleteDictValue(data: any) {
  return request.get('/sys/dict/deleteDictValue', {
    params: data
  })
}

export function getDictByType(data: any) {
  return request.get('/commonApi/dict/listByType', {
    params: data
  })
}
