import request from '@/router/axios';

export const getLazytree = (wbsId,parentId,tenantId,projectId,params) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/lazy-tree',
    method: 'get',
    params: {
      ...params,
      wbsId,
      parentId,
      tenantId,
      projectId,
    }
  })
}

export const getDetail = (id,wbsId,projectId) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/detail',
    method: 'get',
    params: {
      id,
      wbsId,
      projectId
    }
  })
}

export const update = (row) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/submit',
    method: 'post',
    data: row
  })
}

export const findNodeTableByCondition = (parentId,projectId,wbsId, params) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/get-node-tables',
    method: 'get',
    params: {
      ...params,
      parentId,
      projectId,
      wbsId,
    }
  })
}

export const removeTableByCondition = (id,projectId,wbsId, params) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/remove-table',
    method: 'get',
    params: {
      ...params,
      id,
      projectId,
      wbsId,
    }
  })
}

export const removePrivateTreeNode = (pKeyId) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/remove',
    method: 'post',
    params: {
      pKeyId,
    }
  })
}

export const wbsTreePrivateTableSort = (data) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/submit-table-sort',
    method: 'post',
    data:data
  })
}

export const getNodeTabAndParam = (parentId,projectId,wbsId, params) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/get-node-table-param',
    method: 'get',
    params: {
      ...params,
      parentId,
      projectId,
      wbsId,
    }
  })
}

export const privateSubmitFullName = (pKeyId,fullNames) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/submit-full-name',
    method: 'post',
    params: {
      pKeyId,
      fullNames
    }
  })
}

export const syncNodeParam = (projectId) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/sync-node-param',
    method: 'post',
    params: {
      projectId
    }
  })
}

export const syncNodeTable = (primaryKeyId) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/sync-node-table',
    method: 'post',
    params: {
      primaryKeyId
    }
  })
}



//清表树
export const tabTypeLazyTree = (params) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/tab-Type-lazy-tree',
      method: 'get',
      params
  })
};

export const tabTypeLazyTreeAll = (params) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/tab-Type-lazy-tree-all',
      method: 'get',
      params
  })
}
//后管-添加元素到项目
// export const projecttabInfo = (data) => {
//   return request({
//     url: '/api/blade-manager/wbsPrivate/add-projecttab-info',
//     method: 'post',
//     data:data
//   })
// }
export const projecttabInfo = (primaryKeyIds,projectId) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/add-projecttab-info',
    method: 'post',
    params: {
      primaryKeyIds,
      projectId
    }
  })
}
//后管-删除元素表
export const delTabInfoAll = (pKeyId) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/del-tab-info-all',
    method: 'post',
    params: {
      pKeyId,
    }
  })
}
//后管-删除项目表单
export const delAprojectTab = (primaryKeyIds,projectId) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/del-aprojecttab-info',
    method: 'post',
    params: {
      primaryKeyIds,
      projectId
    }
  })
}