import { request } from '../../boot/axios';
import { Pagination } from '../class';
import { DictDataSearchEntity } from './model/dict';

//字典接口调用
class DictDataApi {
  //获取字典数据列表
  getPage = (val: Pagination<DictDataSearchEntity>) => {
    return request.postForPage('dict/data/page', val);
  };
  //添加字典数据
  add = (val: any) => {
    return request.post('dict/data/add', val);
  };
  //修改字典数据
  edit = (val: any) => {
    return request.put('dict/data/edit', val);
  };
  //删除字典数据
  remove = (id: string) => {
    return request.delete('dict/data/remove/' + id);
  };

  getList = (val: string) => {
    return request.get('dict/type/' + val);
  };
  // 根据 字典编码 查询
  getDictType = (val: string) => {
    return request.get('dict/data/' + val);
  };
}
const dictDataApi = new DictDataApi();
export { dictDataApi };
