import request from '@/utils/request'

const dictionaryItemApi = {
  add: 'sys/dictionary/item/add',
  update: 'sys/dictionary/item/edit',
  del: 'sys/dictionary/item/del',
  page: 'sys/dictionary/item/pageList',
  dropDown: 'sys/dictionary/item/dropDown'
}

export function dictionaryItemAdd (params) {
  return request({
    url: dictionaryItemApi.add,
    method: 'post',
    data: params
  })
}
export function dictionaryItemUpdate (params) {
  return request({
    url: dictionaryItemApi.update,
    method: 'post',
    data: params
  })
}
export function dictionaryItemDel (params) {
  return request({
    url: dictionaryItemApi.del,
    method: 'post',
    params: params
  })
}
export function dictionaryItemPage (params) {
  return request({
    url: dictionaryItemApi.page,
    method: 'get',
    params: params
  })
}
/**
 * 获取字典类型下所有字典，举例，返回格式为：[{value:"M",name:"男"},{code:"F",name:"女"}]
 */
export function dictionaryDropDown (params) {
  return request({
    url: dictionaryItemApi.dropDown,
    method: 'get',
    params: params
  })
}
