import { request } from 'umi';

export const queryContract = async (data) => {
  return await request('/api/contract/v1/contract', {
    method: 'POST',
    data,
  });
};

export const queryGetContractList = async (data) => {
  return await request('/api/contract/v1/contract', {
    params: data,
  });
};

export const queryApproval = async (data) => {
  return await request('/api/v2/approval/record', {
    params: data,
  });
};

export const querySupplierList = async (data) => {
  return await request('/api/supplier/v1/supplier/list', {
    method: 'POST',
    data,
  });
};

export const queryDepList = async (data) => {
  return await request('/api/v1/dep');
};

export const queryUploadAttach = async (data) => {
  return await request('/api/contract/v1/attach', {
    method: 'POST',
    data,
    headers: { 'Content-Type': 'multipart/form-data' },
  });
};
//审核合同
export const queryContractCheck = async (data) => {
  return await request('/api/contract/v1/contract-check', {
    method: 'POST',
    data,
  });
};

//作废发起
export const queryContractCancel = async (data) => {
  return await request('/api/contract/v1/contract-cancel', {
    method: 'POST',
    data,
  });
};

//作废审核
export const queryContractCancelCheck = async (data) => {
  return await request('/api/contract/v1/contract-cancel-check', {
    method: 'POST',
    data,
  });
};

//OA已审核过的
export const queryApprovedList = async (data) => {
  return await request('/api/v1/oa/audited/my/list', {
    params: data,
  });
};

//公司列表
export const queryCompany = async (data) => {
  const res = await request('/api/v2/company', {
    params: data,
  });
  return res?.data;
};
