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/getNodeTableByCondition',
    method: 'get',
    params: {
      ...params,
      parentId,
      projectId,
      wbsId,
    }
  })
}

export const removeTableByCondition = (id,projectId,wbsId, params) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/removeTableByCondition',
    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/submitWbsTreePrivateTableSort',
    method: 'post',
    data:data
  })
}

export const getNodeTabAndParam = (parentId,projectId,wbsId, params) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/getNodeTabAndParam',
    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 = (parentId,projectId) => {
  return request({
    url: '/api/blade-manager/wbsPrivate/tab_Type_lazy-tree',
    method: 'get',
    params: {
      parentId,
      projectId
    }
  })
}
