// 搜索
import router from "@/router/index";
// 跳转搜索详情页
export const goToSearch = (tabName, areaName, billSearchType) => {
  window.sessionStorage.setItem("curTabName", `搜索-${tabName}`);

  let selectParam
  if (billSearchType) {
    selectParam = {
      searchText: tabName,
      areaName: areaName,
      billSearchType: billSearchType
    }
  } else {
    selectParam = {
      searchText: tabName,
      areaName: areaName,
    }
  }
  // const codeParam = new URLSearchParams(selectParam)
  const jsonStr = JSON.stringify(selectParam);
  const base64 = btoa(encodeURIComponent(jsonStr));

  const curRoute = router.resolve({
    path: "/searchResults",
    query: {
      data: base64
    }
  });
  window.open(curRoute.href, "_blank");

  // const codeParam = new URLSearchParams(selectParam)

}