import request from '@/utils/request'

// 根据url直接获取type
function getTypeFromUrl(url) {
  // 使用正则表达式或其他方法从 URL 中提取 type 参数
  const params = new URLSearchParams(url.split('?')[1]);
  return params.get('type');
}

export function getEngineeIndustryList(sata) {
  sata.type = getTypeFromUrl(window.location.href)
  return request({
    url: `/zdsz/engineeringIndustry/list`,
    method: 'get',
    params:sata
  })
}

export function addEngineeEngineeIndustry(data) {
  return request({
    url: '/zdsz/engineeringIndustry',
    method: 'post',
    data
  })
}

export function putEngineeEngineeIndustry(id) {
  return request({
    url: `/zdsz/engineeringIndustry/${id}`,
    method: 'get',

  })
}

export function EditEngineeEngineeIndustry(data) {
  return request({
    url: '/zdsz/engineeringIndustry',
    method: 'put',
    data
  })
}

export function DelEngineeEngineeIndustry(id) {
  return request({
    url: `/zdsz/engineeringIndustry/${id}`,
    method: 'delete',
  })
}

export function QueryEngineeIndustry({id}) {
  return request({
    url: `/zdsz/engineeringIndustry/${id}/1`,
    method: 'get',
  })
}

export function UpdateEngineeIndustry(data) {
  return request({
    url: '/zdsz/engineeringIndustry/updateNodeByBo',
    method: 'put',
    data
  })
}


