import request from "@/util/oaRequest"

// 查询项目管理列表
export function listProject(query) {
  return request({
    url: '/oa/project/list',
    method: 'get',
    params: query
  })
}


// 查询项目管理列表
export function listWareProject(query) {
  return request({
    url: '/oa/project/ware-list',
    method: 'get',
    params: query
  })
}


// 查询项目管理列表
export function filesProject(query) {
  return request({
    url: '/oa/project/files',
    method: 'get',
    params: query
  })
}

// 查询项目管理详细
export function getProject(projectId) {
  return request({
    url: '/oa/project/' + projectId,
    method: 'get'
  })
}
// 查询项目管理详细
export function projectData(date) {
  return request({
    url: '/oa/project/projectDataByMonth/'+date,
    method: 'get',
  })
}

export function projectData2(date){
  return request({
    url: '/oa/project/projectData',
    method: 'get',
    params: { date }
  });
}

// 查询项目管理详细
export function projectDataByMonthAndDate() {
  return request({
    url: '/oa/project/projectDataByMonthAndDate',
    method: 'get'
  })
}

// 新增项目管理
export function addProject(data) {
  return request({
    url: '/oa/project',
    method: 'post',
    data: data
  })
}

// 修改项目管理
export function updateProject(data) {
  return request({
    url: '/oa/project',
    method: 'put',
    data: data
  })
}

// 删除项目管理
export function delProject(projectId) {
  return request({
    url: '/oa/project/' + projectId,
    method: 'delete'
  })
}

export function getProjectList(query) {
  return request({
    url: '/oa/project/progress-list',
    method: 'get',
    params: query
  })
}



/**
 * 获取外贸中心仪表盘四项指标
 * @param {Object} query 传参示例：{ start: '2024/01/01', end: '2024/01/18' }
 */
export function getDashboardMetrics(query) {
  return request({
    url: '/oa/project/metrics',
    method: 'get',
    params: query
  })
}

/**
 * 获取外贸中心三张图表数据（折线、饼图、柱状）
 * @param {Object} query 传参示例：{ start: '2024/01/01', end: '2024/01/18' }
 */
export function getDashboardCharts(query) {
  return request({
    url: '/oa/project/charts',
    method: 'get',
    params: query
  })
}

/**
 * 获取外贸中心临期项目列表
 * @param {Object} query 传参示例：{ days: 7 }
 */
export function listExpiringProjects(query) {
  return request({
    url: '/oa/project/expiring',
    method: 'get',
    params: query
  })
}
