personnelManage.js 1.94 KB
/*
 * @Author: xiaomiao 1158771342@qq.com
 * @Date: 2023-03-09 15:24:53
 * @LastEditors: xiaomiao 1158771342@qq.com
 * @LastEditTime: 2023-03-20 09:21:04
 * @FilePath: \上报\bdcjg-web\src\api\personnelManage.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import {
  api,
  getAction,
  deleteAction,
  putAction
} from './manageApi'
import { getParams } from './util'

export const updateUserPassword = (data) => {
  return putAction(`${api.users}/update-password`, data)
}

// 根据条件获取用户
export const getUserList = (params) => {
  return getAction(api.users, params)
}
export const getUserLists = (queryParam) => {
  const conditionGroup = {
    conditions: [{
      property: 'code',
      value: queryParam.code ? queryParam.code : null,
      operator: 'LIKE'
    },
    {
      property: 'name',
      value: queryParam.name ? queryParam.name : null,
      operator: 'LIKE'
    }
      ,
    {
      property: 'loginName',
      value: queryParam.loginName ? queryParam.loginName : null,
      operator: 'LIKE'
    },
    {
      property: 'organizationId',
      value: queryParam.organizationId,
      operator: 'IN'
    }
      ,
    {
      property: 'departmentId',
      value: queryParam.departmentId,
      operator: 'IN'
    }
    ],
    queryRelation: 'AND',
  }
  const params = getParams(conditionGroup)
  return getAction(api.users, params)
}
// 重置用户密码
// 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 getUserRoles = (id) => {
  return getAction(`${api.userRoles}/${id}/users`)
}
// 更新人员
export const updateUser = (id, data) => {
  return putAction(`${api.userRoles}/${id}/users`, data)
}