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

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

export function auditListPlan(query) {
  return axios({
    url: '/purchase/plan/auditList',
    method: 'get',
    params: query
  })
}


export function selectApprovedList(query) {
  return axios({
    url: '/purchase/plan/selectApprovedList',
    method: 'get',
    params: query
  })
}


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

export function getApply(id) {
  return axios({
    url: '/purchase/plan/' + id,
    method: 'get'
  })
}

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


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


// 修改pur
export function updateApply(data) {
  return axios({
    url: '/purchase/plan',
    method: 'put',
    data: data
  })
}

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

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


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

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

// 添加puan
export function addPlanDetailByWarlockBag(data) {
  return request({
    url: "/purchase/plan/addDetailByWarlockBag",
    method: 'post',
    data: data
  })
}

// 根据申购单添加详情表
export function addPlanDetailAndApply(data) {
  return request({
    url: "/purchase/plan/addPlanDetailAndApply",
    method: 'post',
    data: data
  })
}

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

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

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

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

export function getDetailList(params) {
  return axios({
    url: "/purchase/plan/list/getDetailList",
    method: "get",
    params: params
  });
}


