import request from "@/utils/request";

//分页查询用户列表
export function getList(params) {
  return request({
    method: "POST",
    url: `/system/user/list`,
    data: params,
  });
}

//获取部门树列表
export function getDeptTree() {
  return request({
    method: "get",
    url: `/system/user/deptTree`,
  });
}

//获取用户详细信息
export function userInformation(userId) {
  return request({
    method: "get",
    url: `/system/user/${userId}`,
  });
}

//新增用户
export function addUser(params) {
  return request({
    method: "post",
    url: "/system/user/add",
    data: params,
  });
}
//修改用户
export function updateUser(params) {
  return request({
    method: "post",
    url: "/system/user/edit",
    data: params,
  });
}
//删除用户
export function delUser(userIds) {
  return request({
    method: "get",
    url: `/system/user/remove/${userIds}`,
  });
}

//分页查询角色数据
export function roleList(params) {
  return request({
    method: "post",
    url: "/system/role/list",
    data: params,
  });
}

//获取角色选择框列表
export function getOptionSelect() {
  return request({
    method: "get",
    url: "/system/role/optionselect",
  });
}
//新增角色
export function addRole(params) {
  return request({
    method: "post",
    url: "/system/role",
    data: params,
  });
}
//删除角色
export function delRole(roleId) {
  return request({
    method: "get",
    url: `/system/role/remove/${roleId}`,
  });
}
//查看角色详情
export function roleDetaile(roleId) {
  return request({
    method: "get",
    url: `/system/role/${roleId}`,
  });
}
//修改角色
export function editRole(params) {
  return request({
    method: "post",
    url: `/system/role/edit`,
    data: params,
  });
}
//获取菜单下拉树列表
export function getMenuTree() {
  return request({
    method: "get",
    url: `/system/menu/treeselect`,
  });
}

//删除菜单
export function delMenu(id) {
  return request({
    method: "get",
    url: `/system/menu/remove/${id}`,
  });
}
//用户管理下载模板
export function getExcel(url) {
  return request({
    method: "get",
    url: url,
    responseType: "blob",
  });
}
//用户信息导出
export function exportUserList(data) {
  return request({
    url: "/system/user/export",
    method: "post",
    responseType: "blob",
    data,
  });
}
//导入用户
export function importUser(params) {
  return request({
    method: "post",
    url: "/system/user/importData",
    data: params,
  });
}
//根据字典类型查询字典数据信息
export function dictionaryList(dictType) {
  return request({
    method: "get",
    url: `/system/dict/data/type/${dictType}`,
  });
}
//数据权限分配
export function dataPermission(id, dataPermission) {
  return request({
    method: "get",
    url: `/system/user/dataPermission/${id}/${dataPermission}`,
  });
}

//获取部门列表
export function getDeptList(params) {
  return request({
    method: "get",
    // url: '/system/dept/list',
    url: "/system/dept/listAll",
    params: params,
  });
}
//删除部门
export function delDept(deptId) {
  return request({
    method: "get",
    url: `/system/dept/remove/${deptId}`,
  });
}
//修改部门信息
export function updateDept(params) {
  return request({
    method: "post",
    url: `/system/dept/edit`,
    data: params,
  });
}
//部门信息导出
export function exportDeptList(data) {
  return request({
    method: "post",
    url: "/system/dept/export",
    responseType: "blob",
    data,
  });
}
//获取菜单列表
export function getMenuList(params) {
  return request({
    method: "get",
    url: `/system/menu/list`,
    params: params,
  });
}
//新增菜单
export function addMenu(params) {
  return request({
    method: "post",
    url: "/system/menu",
    data: params,
  });
}
//修改菜单
export function editMenu(params) {
  return request({
    method: "post",
    url: "/system/menu/edit",
    data: params,
  });
}
//菜单导出
export function exportMenuExcel(url) {
  return request({
    method: "post",
    url: url,
    responseType: "blob",
    data: {
      deptName: "",
      status: "",
    },
  });
}
//新增单位
export function addDept(params) {
  return request({
    method: "post",
    url: "/system/dept/",
    data: params,
  });
}
//重置密码
export function resetPwd(id) {
  return request({
    method: "get",
    url: `/system/user/resetPwd/${id}`,
  });
}
//修改密码
export function updatepwd(params) {
  return request({
    method: "post",
    url: "/system/user/updatePassWord",
    data: params,
  });
}

//获取机车行驶日志分页列表
export function getLogList(params) {
  return request({
    method: "post",
    url: "/monitor/vehicleposition/list",
    data: params,
  });
}
//机车行驶日志导出
export function exportVehicleLog(url, params) {
  return request({
    method: "post",
    url: url,
    responseType: "blob",
    data: params,
  });
}
//终端忽略报警信息导出
export function exportIgnoreList(url, params) {
  return request({
    method: "post",
    url: url,
    responseType: "blob",
    data: params,
  });
}
//忽略行驶表列表数据
export function getIgnoreList(params) {
  return request({
    method: "post",
    url: "/terminal/ignore/list",
    data: params,
  });
}
//获取机车名称
export function listNoPage() {
  return request({
    method: "post",
    // url:'/baseVehicle/vehicleAll',
    url: "/monitor/vehicleposition/listNoPage",
  });
}
//获取终端信息
export function terminalAll() {
  return request({
    method: "post",
    url: "/baseVehicleTerminal/terminalAll",
  });
}
//查询终端忽略报警信息详情
export function getDetail(params) {
  return request({
    method: "post",
    url: "/terminal/ignore/detail",
    data: params,
  });
}
//可用的角色选择
export function getAvailableRoleList(data) {
  return request({
    method: "post",
    url: "/system/role/optionselect",
    data,
  });
}
