// 系统api
import request from "@/utils/request";
/**
 *  系统参数
 */
// 获取系统参数列表
export const getParamList = (data) => {
  return request({
    url: `/sampleform/param/list`,
    method: "post",
    data,
  });
};
// 查看系统参数
export const getParamInfo = (params) => {
  return request({
    url: `/sampleform/param/info`,
    method: "get",
    params,
  });
};
// 保存编辑系统参数
export const saveParam = (data) => {
  return request({
    url: `/sampleform/param/save`,
    method: "post",
    data,
  });
};
// 删除系统参数
export const delParam = (params) => {
  return request({
    url: `/sampleform/param/delete`,
    method: "get",
    params,
  });
};

/**
 *  任务信息
 */
// 获取任务信息列表
export const getTaskList = (data) => {
  return request({
    url: `/sampleform/task/list`,
    method: "post",
    data,
  });
};
// 查看任务信息
export const getTaskInfo = (params) => {
  return request({
    url: `/sampleform/task/info`,
    method: "get",
    params,
  });
};
// 保存编辑任务信息
export const saveTask = (data) => {
  return request({
    url: `/sampleform/task/save`,
    method: "post",
    data,
  });
};
// 删除任务信息
export const delTask = (params) => {
  return request({
    url: `/sampleform/task/delete`,
    method: "get",
    params,
  });
};

/**
 *  操作日志
 */

// 获取操作日志
export const getlogsList = (data) => {
  return request({
    url: `/sampleform/oper/log/list`,
    method: "post",
    data,
  });
};
// 查看操作日志
export const getlog = (params) => {
  return request({
    url: `/sampleform/oper/log/info`,
    method: "get",
    params,
  });
};

/**
 *  资源信息
 */

// 获取资源信息列表
export const getResourceList = (data) => {
  return request({
    url: `/sampleform/resource/list`,
    method: "post",
    data,
  });
};
// 获取资源信息详情
export const getResourceDetail = (params) => {
  return request({
    url: `/sampleform/resource/info`,
    method: "get",
    params,
  });
};
// 添加资源信息
export const saveResource = (data) => {
  return request({
    url: `/sampleform/resource/save`,
    method: "post",
    data,
  });
};
// 删除资源信息
export const deleteResource = (params) => {
  return request({
    url: `/sampleform/resource/delete`,
    method: "get",
    params,
  });
};
// 刷新资源
export const refreshResource = (data) => {
  return request({
    url: `/sampleform/resource/refreshUrl`,
    method: "post",
    data,
  });
};
// 资源分组
export const getResourceGroup = (data) => {
  return request({
    url: `/sampleform/resource/group`,
    method: "post",
    data,
  });
};

/**
 *  角色
 */

// 获取角色列表
export const getRoleList = (data) => {
  return request({
    url: `/sampleform/role/list`,
    method: "post",
    data,
  });
};
// 获取角色详情
export const getRole = (params) => {
  return request({
    url: `/sampleform/role/get`,
    method: "get",
    params,
  });
};
// 保存角色
export const addRole = (data) => {
  return request({
    url: `/sampleform/role/save`,
    method: "post",
    data,
  });
};
// 删除角色
export const deleteRole = (params) => {
  return request({
    url: `/sampleform/role/delete`,
    method: "get",
    params,
  });
};
// 获取角色资源列表
export const getRoleResourceList = (data) => {
  return request({
    url: `/sampleform/role/auth/list`,
    method: "post",
    data,
  });
};
// 添加角色资源
export const addRoleResource = (data) => {
  return request({
    url: `/sampleform/role/auth/distributionSource`,
    method: "post",
    data,
  });
};

// 添加角色菜单
export const addRoleMenu = (data) => {
  return request({
    url: `/sampleform/role/auth/distributionMenu`,
    method: "post",
    data,
  });
};

// 获取角色菜单
export const getRoleMenuList = (data) => {
  return request({
    url: `/sampleform/role/auth/editMenu`,
    method: "post",
    data,
  });
};

/**
 *  用户管理
 */
// 获取用户列表
export const getUserList = (data) => {
  return request({
    url: `/sampleform/user/list`,
    method: "post",
    data,
  });
};
// 获取用户信息
export const getUserInfo = (params) => {
  return request({
    url: `/sampleform/user/info`,
    method: "get",
    params,
  });
};
// 保存用户
export const saveUser = (data) => {
  return request({
    url: `/sampleform/user/save`,
    method: "post",
    data,
  });
};
// 删除用户
export const deleteUser = (params) => {
  return request({
    url: `/sampleform/user/delete`,
    method: "get",
    params,
  });
};

/**
 * 菜单管理
 */

// 获取菜单列表
export const getMenuList = (data) => {
  return request({
    url: `/sampleform/menu/list`,
    method: "post",
    data,
  });
};
// 获取菜单信息
export const getMenuInfo = (params) => {
  return request({
    url: `/sampleform/menu/info`,
    method: "get",
    params,
  });
};
// 保存菜单
export const saveMenu = (data) => {
  return request({
    url: `/sampleform/menu/save`,
    method: "post",
    data,
  });
};
// 删除菜单
export const deleteMenu = (params) => {
  return request({
    url: `/sampleform/menu/delete`,
    method: "get",
    params,
  });
};

// 改变菜单排序
export const changeMenuSort = (data) => {
  return request({
    url: `/sampleform/menu/upOrDown`,
    method: "post",
    data,
  });
};

// 获取菜单树列表
export const getMenuTreeselect = (data) => {
  return request({
    url: `/sampleform/menu/treeselect`,
    method: "post",
    data,
  });
};

// 获取个人菜单树
export const getMenuTree = (data) => {
  return request({
    url: `/sampleform/login/index`,
    method: "post",
    data,
  });
};
