/*
 *    Copyright (c) 2018-2025, cyweb All rights reserved.
 *
 */

import request from '/@/utils/request';

/**
 * 分页查询
 * @param params 查询参数
 */
export function getPage(params?: any) {
	return request({
		url: '/purchase/purchasingcontract/page',
		method: 'get',
		params,
	});
}

/**
 * 通过id查询
 * @param id ID
 */
export function getObj(id: string | number) {
	return request({
		url: '/purchase/purchasingcontract/' + id,
		method: 'get',
	});
}

/**
 * 新增采购合同
 * @param obj 对象数据
 */
export function addObj(obj: any) {
	return request({
		url: '/purchase/purchasingcontract',
		method: 'post',
		data: obj,
	});
}

/**
 * 修改采购合同
 * @param obj 对象数据
 */
export function editObj(obj: any) {
	return request({
		url: '/purchase/purchasingcontract/edit',
		method: 'post',
		data: obj,
	});
}

/**
 * 删除采购合同
 * @param id ID
 */
export function delObj(id: number) {
	return request({
		url: '/purchase/purchasingcontract/delete',
		method: 'post',
		data: id,
	});
}

/**
 * 根据采购申请ID查询合同
 * @param purchaseId 采购申请ID
 */
export function getByPurchaseId(purchaseId: string | number) {
	return request({
		url: '/purchase/purchasingcontract/by-purchase/' + purchaseId,
		method: 'get',
	});
}
