import axios from "@/utils/request";
import request from "@/utils/request";

export function listPlan(query) {
  return axios({
    url:  '/purchase/contract/list',
    method: 'get',
    params: query
  })
}

export function listApplyDetail(query) {
  return axios({
    url:  '/purchase/contract/list/detail',
    method: 'get',
    params: query
  })
}

//更新pur
export function updateDetail(data) {
  return request({
    url:  "/purchase/contract/updateDetail",
    method: 'post',
    data: data
  })
}


// 添加详情表
export function addContractDetail(data) {
  return request({
    url:  "/purchase/contract/addContractDetail",
    method: 'post',
    data: data
  })
}

export function inserThrOrderWeb(query) {
  return axios({
    url:  "/purchase/contract/postOrder",
    method: "post",
    data: query
  });
}

// 添加puan
export function addContractId() {
  return request({
    url:  "/purchase/addContractDetail/add",
    method: 'post'
  })
}

// 查询详情表
export function selectContractDetail(query) {
  return request({
    url:  "/purchase/contract/list/detail",
    method: 'get',
    params: query
  })
}

//删除计划表和详情表
export function delContractDetailAll(data) {
  return request({
    url:  "/purchase/contract/delContractDetailAll",
    method: 'post',
    data: data
  })
}

// 删除pur
export function delApplyDetail(id) {
  return axios({
    url:  '/purchase/contract/detail/' + id,
    method: 'delete'
  })
}


// 导入计划
export function importPlan(data) {
  return axios({
    url:  "/purchase/contract/importPlan",
    method: 'post',
    data: data
  })
}


export function auditOrder(data) {
  return axios({
    url: '/purchase/contract/auditOrder',
    method: 'post',
    data: data
  })
}
