import server from '@/utils/request'


//查询字典类型

interface Dictypequery{
  pageSize:String|Number	    //每页条数
  pageNo:Number	            //页数
  typeName?:String	          //类型名称
  typeCode?:String	          //类型编码
}

export function getdicttype(params:Dictypequery) {
  return server.request({
    url: '/resource/dict/listtype',
    method: 'get',
    params
  });
}


//新增字典类型
interface Dicttype {
  pkId:String
  typeName:String    //类型名称
  typeCode:String	   //类型编码
  mark?:String	      //描述
}

export function adddicttype(data:Dicttype) {
  return server.request({
    url: '/resource/dict/addtype',
    method: 'post',
    data
  })
}

//修改字典类型
export function updatetype(data:Dicttype) {
  return server.request({
    url: '/resource/dict/updatetype',
    method: 'post',
    data
  })
}

//删除字典类型
export function deltype(typeId:String) {
  return server.request({
    url: '/resource/dict/deltype',
    method: 'post',
    data:{
      typeId
    }
  })
}

//查询字典值
interface Dictval{
  typeId?:String	        //字典类型id
  typeName?:String	      //字典类型名
  typeCode?:String	      //字典类型编码
  dictId?:String	        //字典id
  dictName?:String	      //字典名
  dictCode?:String	      //字典编码
  dictValue?:String	      //字典值
}
export function getdict(params?:Dictval) {
    return server.request({
      url: '/resource/dict/listdict',
      method: 'get',
      params
    })
}

interface Dictqs {
  typeId:string	          //类型ID
  dictName:string	        //字典名称
  dictCode:string	        //字典编码
  dictValue:string	        //字典值
  sort?:string|Number	      //排序
  typeCode?:string	
 }

//新增字典值
export function adddict(data:Dictqs) {
  return server.request({
    url: '/resource/dict/adddict',
    method: 'post',
    data
  })
}

//新增字典值
export function updatedict(data:Dictqs) {
  return server.request({
    url: '/resource/dict/updatedict',
    method: 'post',
    data
  })
}

//删除字典值
export function dedictval(dictId:String|Number) {
  return server.request({
    url: '/resource/dict/deldict',
    method: 'post',
    data:{
      dictId
    }
  })
}
