// 数据资源库
import router from "@/router/index";

// 跳转数据资源库-国家法案
export const goToDataCountryBill = (selectParam) => {
  // const codeParam = new URLSearchParams(selectParam)
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/countryBill",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}

// 跳转数据资源库-政令
export const goToDataDecree = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/dataDecree",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}

// 跳转数据资源库-智库
export const goToDataThinkTank = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/dataThinkTank",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}

// 跳转数据资源库-出口管制-实体清单
export const goToDataEntityList = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/dataEntityList",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}

// 跳转数据资源库-出口管制-商业管制清单
export const goToDataCCLList = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/dataCommerceControlList",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}

// 跳转数据资源库-出口管制-实体清单事件
export const goToDataSingleEntityEvent = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/dataEntityListEvent",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}

// 跳转数据资源库-出口管制-商业管制清单事件
export const goToDataSingleCCLEvent = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/dataCommerceControlListEvent",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}


// 跳转数据资源库-投融资限制-SDN清单
export const goToDataSDNList = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/sDNList",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}

// 跳转数据资源库-投融资限制-涉军企业清单
export const goToDataMREList = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/mREList",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}

// 跳转数据资源库-投融资限制-SDN清单事件
export const goToDataSingleSDNEvent = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/sDNListEvent",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}

// 跳转数据资源库-投融资限制-涉军企业清单事件
export const goToDataSingleMREEvent = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/mREListEvent",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}

// 跳转数据资源库-科技人物
export const goToDataTechnologyFigures = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/dataTechnologyFigures",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}

// 跳转数据资源库-重要实体-科技企业
export const goToDataCompany = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/dataCompany",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}

// 跳转数据资源库-重要实体-机构
export const goToDataInstitution = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/dataInstitution",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}

// 跳转数据资源库-新闻
export const goToDataNews = (selectParam) => {
  // JSON -> Base64
  const jsonStr = JSON.stringify(selectParam);
  // 处理中文：先 encodeURIComponent
  const base64 = btoa(encodeURIComponent(jsonStr));
  const route = router.resolve({
    path: "/dataLibrary/dataNews",
    query: {
      data: base64
    }
  });
  window.open(route.href, "_blank");
}