import request from '@/utils/http/index';
function jsonToUrlParam(json) {
  return Object.keys(json)
    .map((key) => key + '=' + json[key])
    .join('&');
}
export const saveUser = (data) => {
  return request.post('/user/save', data);
};

export const getUserPage = (params) => {
  return request.get('/user/page', params, {cancel: false});
};

export const deleteUsers = (ids) => {
  return request.get('/user/batchDeleteByIds', { ids });
};
export const saveLeaderGroup = (data) => {
  return request.post('/leaderGroup/add?role=' + data.role, data);
};

export const getleaderGroupPage = (params) => {
  return request.get('/leaderGroup/page', params);
};

export const batchDeleteByIds = (ids) => {
  return request.get('/leaderGroup/batchDeleteByIds', { ids });
};
// 根据用户ID启用禁用
export const setStatus = (params) => {
  return request.get('/user/status', params);
};
// 修改密码
export const editPassword = (data) => {
  return request.post('/user/editPassword', data);
};
// 根据用户ID重置密码
export const restPassword = (params) => {
  return request.get('/user/restPassword', params);
};
