// 权限中心-账号管理-分页查询
export const accountManage = {
  url: '/accountManage/page',
  method: 'GET',
  dealReqData: ({ accounts, uid, pageNum, pageSize }) => {
    return { account: accounts, uid, pageNum, pageSize }
  }
}

// 角色列表
export const accountRoleList = {
  url: '/accountManage/roleList',
  method: 'GET'

}
// 添加账户

export const addAccountManage = {
  url: '/accountManage/add',
  method: 'POST'
}

// 修改角色
export const repairRoleAccount = {
  url: '/accountManage/repairRole',
  method: 'PUT'
}

// 重置密码
export const resetPwdAccount = {
  url: '/accountManage/resetPwd',
  method: 'PUT'
}

// 删除账户
export const deleteAccountManage = {
  url: '/accountManage/delete',
  method: 'GET',
  dealUrl: (url, uid) => {
    return `${url}/${uid}`
  }
}

// 禁用账户
export const disableAccountManage = {
  url: '/accountManage/disable',
  method: 'GET',
  dealUrl: (url, uid) => {
    return `${url}/${uid}`
  }
}

// 启用账户
export const ableAccountManage = {
  url: '/accountManage/able',
  method: 'GET',
  dealUrl: (url, uid) => {
    return `${url}/${uid}`
  }
}

// 角色分页查询
export const roleManageList = {
  url: '/roleManage/page',
  method: 'GET'
}

// 全部权限
export const totalAuthRole = {
  url: '/roleManage/totalAuth',
  method: 'GET'
}

// 删除角色
export const deleteRoleManage = {
  url: '/roleManage/delete',
  method: 'GET',
  dealUrl: (url, roleId) => {
    return `${url}/${roleId}`
  }
}

// 添加角色
export const addRoleManage = {
  url: '/roleManage/add',
  method: 'POST',
  dealReqData: ({ authJson, remarks, roleName, type }) => {
    return { authJson: JSON.stringify(authJson.map((item) => {
      return item.menuIndex
    })),
    remarks,
    roleName,
    type }
  }
}

// 编辑角色
export const editRoleManage = {
  url: '/roleManage/edit',
  method: 'PUT',
  dealReqData: ({ authJson, remarks, roleId }) => {
    return { authJson: JSON.stringify(authJson.map((item) => {
      return item.menuIndex
    })),
    remarks,
    roleId }
  }
}
// 禁用角色
export const disableRoleManage = {
  url: '/roleManage/disable',
  method: 'GET',
  dealUrl: (url, roleId) => {
    return `${url}/${roleId}`
  }
}
// 启用角色
export const ableRoleManage = {
  url: '/roleManage/able',
  method: 'GET',
  dealUrl: (url, roleId) => {
    return `${url}/${roleId}`
  }
}

// 角色详情

export const detailRoleManage = {
  url: '/roleManage/detail',
  method: 'GET'
}

export const getAuthCatalogue = {
  url: '/functionManage/authCatalogue',
  method: 'GET'
}
