import request from '@/utils/request';

/**
 * 获取项目详情
 * @param {*} params
 * @returns
 */
export const getProjectDetailApi = (params = {}) => request({
  url: "",
  method: "get",
  params
});

//校验项目编码是否存在
export function checkProjectCodeExist(data) {
  return request({
    url: '/cbProjectRecord/checkProjectCodeExist/' + data,
    method: 'get',
  });
}
//新增项目
export function addProject(data) {
  return request({
    url: '/cbProjectRecord/addProject',
    method: 'post',
    data: data,
  });
}
//修改项目
export function editProjectInfo(data) {
  return request({
    url: '/cbProjectRecord/editProjectInfo',
    method: 'PUT',
    data: data,
  });
}
//删除项目
export function batchDeleteProject(ids) {
  return request({
    url: '/cbProjectRecord/batchDeleteProject/'+ids,
    method: 'Delete',
  });
}
//新增新阶段项目
export function addNewStageProject(data) {
  return request({
    url: '/cbProjectRecord/addNewStageProject',
    method: 'POST',
    data: data,
  });
}
//获取当前项目文件上传
export function getProjectFileUploadDetail(projectId) {
  return request({
    url: '/cbProjectFile/getProjectFileUploadDetail/' + projectId,
    method: 'get',
  });
}

//获取草稿箱列表
export function getDraftDialogList(projectId) {
  return request({
    url: '/cbProjectRecord/getDraftDialogList',
    method: 'get',
  });
}

//上传文件
export function uploadCbProjectFile(data) {
  return request({
    url: '/cbProjectFile/uploadCbProjectFile',
    method: 'post',
    data
  });
}
//删除文件
export function deleteCbProjectFile(fileId) {
  return request({
    url: '/cbProjectFile/deleteCbProjectFile/' + fileId,
    method: 'Delete',
  });
}

//删除草稿
export function deleteDraft(projectId) {
  return request({
    url: '/cbProjectRecord/deleteDraft/' + projectId,
    method: 'Delete',
  });
}

//查询当前项目可删除成本阶段
export function getProjectCbStageNotDraft(relatedId) {
  return request({
    url: '/cbProjectRecord/getProjectCbStageNotDraft/' + relatedId,
    method: 'get',
  });
}

//查询当前项目可删除成本阶段
export function getProjectList(data) {
  return request({
    url: '/cbProjectRecord/getProjectList',
    method: 'get',
    params:data
  });
}

//盈亏分析对比 左侧菜单
export const getProfitLossMenuTreeApi = (params = {}) => request({
  url: "/cbSummary/cbNameList",
  method: "get",
  params
})


// 工料汇总

/**
 * 获取供料汇总左侧菜单
 * @param {*} params
 * @returns
 */
export const getFeedSummaryMenuTreeApi = (params = {}) => request({
  url: "/cb/quantity/summary/subjectTree",
  method: "get",
  params
})


