import request from "@/utils/request";
const api = "/mosty-api/mosty-base";
/*
 * 登录
 *  return promise 实例对象
 */
export const login = (data) => {
  return request({
    url: api + "/sys/login",
    method: "POST",
    data
  });
};

/*
 * 分页查询所有字典信息
 *
 */
export const getAllSysDict = (params) => {
  return request({
    url: api + "/sysDict/selectPage",
    method: "GET",
    params
  });
};

/*
 * 根据字典组件枚举，查询字典信息
 *
 */
export const getDictInfoByDictEnum = (params) => {
  return request({
    url: api + `/sysDict/getElementSysDict`,
    method: "GET",
    params
  });
};
/**
 * 查询普通树形接口字典
 * @param {params} params 
 * @returns 
 */
export const getDictTree = (params) => {
  return request({
    url: api + `/sysDict/getDictTree`,
    method: "GET",
    params
  });
};
/*
 * 修改字典信息
 *
 */
export const updateSysDict = (data) => {
  return request({
    url: api + `/sysDict/updateSysDict`,
    method: "POST",
    data
  });
};

/*
 * 新增字典信息
 *
 */
export const addSysDict = (data) => {
  return request({
    url: api + `/sysDict/addSysDict`,
    method: "POST",
    data
  });
};
/*
 * 删除字典信息
 *
 */
export const deleteSysDict = (data) => {
  return request({
    url: api + `/sysDict/deleteSysDict`,
    method: "POST",
    data
  });
};

/*
 *
根据字典明细编号，查询所有子字典明细信息
 *
 */
export const getAllChildItemByCode = (params) => {
  return request({
    url: api + "/sys-dict-item/getAllChildItemByCode",
    method: "GET",
    params
  });
};

/*
 * 根据字典明细编号查询子字典明细信息
 *
 */
export const getChildItemByCode = (params) => {
  return request({
    url: api + "/sys-dict-item/getChildItemByCode",
    method: "GET",
    params
  });
};

/*
 * 根据字典编号查询字典信息
 *
 */
export const getSysDictByCode = (params) => {
  return request({
    url: api + "/sysDict/getSysDictByCode",
    method: "GET",
    params
  });
};

/*
 * 修改字典明细信息
 *
 */
export const updateSysDictItem = (data) => {
  return request({
    url: api + "/sys-dict-item/updateSysDictItem",
    method: "POST",
    data
  });
};
/*
 *
  添加字典明细信息 item
 *
 */
export const addSysDictItem = (data) => {
  return request({
    url: api + `/sys-dict-item/addSysDictItem`,
    method: "POST",
    data
  });
};

/*
 * 删除字典信息
 *
 */
export const deleteSysDictItem = (data) => {
  return request({
    url: api + `/sys-dict-item/deleteSysDictItem`,
    method: "POST",
    data
  });
};
