import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SysScaleFactorVO, SysScaleFactorForm, SysScaleFactorQuery } from '@/api/scale/SysScaleFactor/types';

/**
 * 查询测评因子列表
 * @param query
 * @returns {*}
 */
export const pageSysScaleFactor = (query?: SysScaleFactorQuery): AxiosPromise<SysScaleFactorVO[]> => {
  return request({
    url: '/scale/factor/pageList',
    method: 'get',
    params: query
  });
};



export const listSysScaleFactor = (query?: SysScaleFactorQuery): AxiosPromise<SysScaleFactorVO[]> => {
  return request({
    url: '/scale/factor/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询测评因子详细
 * @param factorId
 */
export const getSysScaleFactor = (factorId: string | number): AxiosPromise<SysScaleFactorVO> => {
  return request({
    url: '/scale/factor/' + factorId,
    method: 'get'
  });
};

/**
 * 新增测评因子
 * @param data
 */
export const addSysScaleFactor = (data: SysScaleFactorForm) => {
  return request({
    url: '/scale/factor',
    method: 'post',
    data: data
  });
};

/**
 * 修改测评因子
 * @param data
 */
export const updateSysScaleFactor = (data: SysScaleFactorForm) => {
  return request({
    url: '/scale/factor',
    method: 'put',
    data: data
  });
};

/**
 * 删除测评因子
 * @param factorId
 */
export const delSysScaleFactor = (factorId: string | number | Array<string | number>) => {
  return request({
    url: '/scale/factor/' + factorId,
    method: 'delete'
  });
};
