import {
  IdParam,
  EmployeeQueryParam,
  EmployeePageResult,
  EmployeeFormData,
  EmployeeDetail,
  ChangePwdParam
} from '@/types/api/system/employee';
import request from '@/utils/request';
import { AxiosPromise } from 'axios';

/**
 * "用户管理" => "用户查询"
 * @param data
 */
export function queryEmployee(data: EmployeeQueryParam): AxiosPromise<EmployeePageResult> {
  return request({
    url: 'admin/system/employee/page-query',
    method: 'post',
    params: data
  });
}

/**
 * "用户管理" => "新增或者修改用户"
 * @param data
 */
export function addAuditEmployee(data: EmployeeFormData): any {
  return request({
    url: 'admin/system/employee/merge',
    method: 'post',
    params: data
  });
}

/**
 * "用户管理" => "删除用户"
 * @param data
 */
export function delEmployee(ids: any): any {
  return request({
    url: 'admin/system/employee/deletes',
    method: 'post',
    params: ids
  });
}

/**
 * "用户管理" => "用户详情"
 * @param data
 */
export function employeeDetail(data: IdParam): AxiosPromise<EmployeeDetail> {
  return request({
    url: 'admin/system/employee/detail',
    method: 'post',
    params: data
  });
}


/**
 * "个人中心" => "修改密码"
 * @param data
 */
export function fixPersonalPW(data: ChangePwdParam): any {
  return request({
    url: 'admin/system/employee/update-password',
    method: 'post',
    params: data
  });
}
