import { axios } from '@/utils/request'
import { stringify } from 'qs'

/**
 * page func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function getPurchaseContractMainListPage (parameter) {
    return axios({
        url: '/purchase/purchase-contract-main-lists/page?' + stringify(parameter),
        method: 'get',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

/**
 * add func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function addPurchaseContractMainList (parameter) {
    return axios({
        url: '/purchase/purchase-contract-main-lists',
        method: 'POST',
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json;charset=UTF-8'
        },
        data: parameter
    })
}

/**
 * update func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function updatePurchaseContractMainList (parameter) {
    return axios({
        url: '/purchase/purchase-contract-main-lists/' + parameter.id,
        method: 'PUT',
        data: parameter
    })
}

/**
 * fetch single func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function fetchPurchaseContractMainList (parameter) {
    return axios({
        url: '/purchase/purchase-contract-main-lists/' + parameter.id,
        method: 'get',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

/**
 * query list func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function queryPurchaseContractMainList (parameter) {
    return axios({
        url: '/purchase/purchase-contract-main-lists?' + stringify(parameter),
        method: 'get',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        }
    })
}

/**
 * delete batch func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function deletePurchaseContractMainLists (parameter) {
    return axios({
        url: '/purchase/purchase-contract-main-lists',
        method: 'DELETE',
        data: parameter
    })
}

/**
 * delete single func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function deletePurchaseContractMainList (parameter) {
    return axios({
        url: '/purchase/purchase-contract-main-lists/' + parameter.id,
        method: 'DELETE',
        data: parameter
    })
}


/**
 * export file
 * parameter: { }
 * @param parameter :
 * @returns {*}
 */
export function exportPurchaseContractMainList (parameter) {
    return axios({
        url: '/purchase/purchase-contract-main-lists/export?' + stringify(parameter),
        method: 'get',
        headers: {
            'Content-Type': 'application/json;charset=UTF-8'
        },
        responseType: 'blob'
    })
}
