import { config, networkUtils } from '../../utils';

const { request } = networkUtils;
const { api } = config;
const { item,common } = api;
const { trial } = item;
const { trans } = common;

export async function query(params) {
  return request({
    url: `${trial}/view`,
    method: 'get',
    data: params,
  });
}

export async function getSingle(id) {
  return request({
    url: `${trial}/${id}`,
    method: 'get',
  });
}

export async function newTrial(id) {
  return request({
    url: `${trial}/newTrial/${id}`,
    method: 'get',
  });
}

export async function create(params) {
  return request({
    url: trial,
    method: 'post',
    data: params,
  });
}

export async function remove(id) {
  return request({
    url: `${trial}/del/${id}`,
    method: 'post',
  });
}

export async function cancel(id) {
  return request({
    url: `${trial}/cancel/${id}`,
    method: 'post',
  });
}

export async function update(params) {
  return request({
    url: trial,
    method: 'put',
    data: params,
  });
}

export async function isExsit(params) {
  return request({
    url: `${trial}/item/isExsit`,
    method: 'get',
    data:params
  });
}

export async function supplier(id) {
  return request({
    url: `${trial}/supplier/${id}`,
    method: 'get',
  });
}

export async function remoteCfg(params) {
  return request({
    url: `${trial}/config`,
    method: 'get',
    data: params,
  });
}

export async function getUserDepartment(id) {
  return request({
    url: `${trial}/department/${id}`,
    method: 'get',
  });
}

export async function transCHToEn(params) {
  return request({
    url: trans.firstLetter,
    method: 'get',
    data: params,
  });
}
