import request from '@/utils/request'

export const fileUp = (url, data) => {
  return request({
    url,
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

export const requirementReported = (data) => {
  return request({
    url: '/workflow/mosr/requirement/reported',
    method: "post",
    data: data
  });
};
//需求汇总-征集名称关键词匹配
export const getRequirementName = (requirementName) => {
  return request({
    url: `/workflow/mosr/requirement/collect/project/match/${requirementName}`,
    method: "get"
  });
};
//获取需求上报 流程信息
export const getProcessInfo = (specialFund) => {
  return request({
    url: `/workflow/mosr/requirement/collect/process/${specialFund}`,
    method: "get"
  });
};
export const getDetail = (projectId) => {
  return request({
    url: `/workflow/mosr/requirement/collect/info/${projectId}`,
    method: "get"
  });
};

export const resubmitReported = (data) => {
  return request({
    url: '/workflow/mosr/requirement/collect/resubmit',
    method: "post",
    data: data
  });
};

export const getCollectAttachment = (params) => {
  return request({
    url: '/workflow/mosr/requirement/collect/attachments',
    method: "get",
    params:params
  });
};
export const uploadCollectAttachment= (data) => {
  return request({
    url: '/workflow/mosr/requirement/collect/upload',
    method: "post",
    data: data
  });
};
// 年度计划
export const addPlan= (data) => {
  return request({
    url: '/workflow/annual/plan',
    method: "post",
    data: data
  });
};
export const editPlan= (data) => {
  return request({
    url: '/workflow/annual/plan',
    method: "put",
    data: data
  });
};
export const getPlan= (annualPlanId) => {
  return request({
    url: `/workflow/annual/plan/info/${annualPlanId}`,
    method: "get"
  });
};
export const deletePlan= (annualPlanId) => {
  return request({
    url: `/workflow/annual/plan/${annualPlanId}`,
    method: "delete"
  });
};
export const approvePlan= (data) => {
  return request({
    url: '/workflow/annual/plan/approve',
    method: "post",
    data: data
  });
};


export const getProjectOption = () => {
  return request({
    url: '/workflow/mosr/requirement/master',
    method: "get"
  });
};
