import request from '@/utils/request'

// 查询子模块列表
export function listSubmodule(query) {
  return request({
    url: '/project/submodule/list',
    method: 'get',
    params: query
  })
}

// 按模块查询子模块
export function listSubmoduleByModule(moduleId, query) {
  return request({
    url: '/project/submodule/byModule/' + moduleId,
    method: 'get',
    params: query
  })
}

// 获取子模块详情
export function getSubmodule(subId) {
  return request({
    url: '/project/submodule/' + subId,
    method: 'get'
  })
}

// 新增子模块
export function addSubmodule(data) {
  return request({
    url: '/project/submodule',
    method: 'post',
    data: data
  })
}

// 修改子模块
export function updateSubmodule(data) {
  return request({
    url: '/project/submodule',
    method: 'put',
    data: data
  })
}

// 删除子模块（软删）
export function delSubmodule(subIds) {
  return request({
    url: '/project/submodule/' + subIds,
    method: 'delete'
  })
}

// 接取子模块
export function receiveSubmodule(subId) {
  return request({
    url: '/project/submodule/receive/' + subId,
    method: 'post'
  })
}

// 完成子模块
export function completeSubmodule(subId) {
  return request({
    url: '/project/submodule/complete/' + subId,
    method: 'post'
  })
}

// 管理员查看项目下模块及子模块树
export function treeByProject(projectId) {
  return request({
    url: '/project/submodule/treeByProject/' + projectId,
    method: 'get'
  })
}


