quanxianmanagement.js 1.97 KB
import request from "@/utils/request";
import SERVER from "./config";
import { getParams } from './util'
import {
  api,
  getAction,
  postAction,
  deleteAction,
  putAction
} from './manageApi'

/** 角色管理开始 */
// 获取角色列表 categoryId
export const getRolesById = categoryId => {
  const conditionGroup = {
    conditions: [
      {
        property: 'category',
        value:categoryId,
        operator: 'EQ'
      }
    ],
    queryRelation: 'AND'
  }
  const params = getParams(conditionGroup);
  return getAction(api.roles, params)
}
// 人员列表
export const getUserRoles = (id) => {
  return getAction(`${api.userRoles}/${id}/users`)
}
// 更新人员
export const updateUser = (id, data) => {
  return putAction(`${api.userRoles}/${id}/users`, data)
}
// 根据条件获取用户
export const getUserList = (params) => {
  return getAction(api.users, params)
}
// 导出用户列表
export const exportUserList = (params) => {
  return getAction(api.users + '/export', params)
}
// 更新用户状态
export const updateStatus = (id, status) => {
  return putAction(`${api.users}/${id}/${status}/status`)
}
// 更新用户解锁状态
export const updateLock = (id) => {
  return putAction(`${api.users}/${id}/lock`)
}
// 重置用户密码
// export const resetPassword = id => {
//   return putAction(`${api.users}/${id}/reset-password`)
// }

// 重置用户密码
export const resetPassword = (ids) => {
  return putAction(`${api.users}/reset-passwords?ids=${ids}`)
}

// 删除人员
export const delUser = (id, data) => {
  return deleteAction(`${api.userRoles}/${id}/users`, data)
}
// 获取父级菜单
export const getParentMenuListAction = (id) => {
  let conditionGroup = {}
  if (id && id !== '') {
    conditionGroup = {
      conditions: [
        {
          property: 'productId',
          value: id,
          operator: 'EQ'
        }
      ],
      queryRelation: 'AND'
    }
  }
  const params = getParams(conditionGroup)
  return getAction(api.menus, params)
}