import http from '@/api'

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

/**
 * @name 查询字典类型详细
 * @param dictId dictId
 * @returns returns
 */
export const getDictApi = (dictId: any) => {
  return http.get<any>(`/system/dict/type/${dictId}`)
}

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

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

/**
 * @name 删除字典类型
 * @param dictId dictId
 * @returns returns
 */
export const delDictApi = (id: any) => {
  return http.delete<any>(`/system/dict/type/${id}`)
}

/**
 * @name 下载模板
 * @returns returns
 */
export const importTemplateApi = () => {
  return http.downloadPost('/system/dict/type/importTemplate', {})
}

/**
 * @name 导入数据
 * @returns returns
 */
export const importDataApi = (data: any) => {
  return http.post('/system/dict/type/importData', data)
}

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

/**
 * @name 获取字典选择框列表
 * @returns returns
 */
export const optionSelectApi = () => {
  return http.get<any>(`/system/dict/type/option/select`)
}
