import http from '@/api'

/**
 * @name 查询字典数据列表
 * @param query 参数
 * @returns 返回列表
 */
export const listDataApi = (query: any) => {
  return http.get<any>('/system/dict/data/list', query, { loading: true })
}

/**
 * @name 查询字典数据详细
 * @param dictCode dictCode
 * @returns returns
 */
export const getDataApi = (dictCode: any) => {
  return http.get<any>(`/system/dict/data/${dictCode}`)
}

/**
 * @name 根据字典类型查询字典数据信息
 * @param dictType dictType
 * @returns returns
 */
export const getDictsApi = (dictType: string) => {
  return http.get<any>(`/system/dict/data/type/${dictType}`)
}

/**
 * @name 新增字典数据
 * @param data data
 * @returns returns
 */
export const addDataApi = (data: any) => {
  return http.post<any>('/system/dict/data', data, { loading: false })
}

/**
 * @name 修改字典数据
 * @param data data
 * @returns returns
 */
export const updateDataApi = (data: any) => {
  return http.put<any>('/system/dict/data', data, { loading: false })
}

/**
 * @name 删除字典数据
 * @param dictCode dictCode
 * @returns returns
 */
export const delDataApi = (id: any) => {
  return http.delete<any>(`/system/dict/data/${id}`)
}

/**
 * @name 导出数据
 * @returns returns
 */
export const exportApi = (data: any) => {
  return http.downloadPost('/system/dict/data/export', data)
}
