import { useRouter } from "vue-router";
const router = useRouter()

// 跳转法案详情
export const goToBill = (id, tabName) => {
  window.sessionStorage.setItem("billId", id);
  window.sessionStorage.setItem("curTabName", tabName);
  const route = router.resolve({
    path: "/billLayout",
    query: {
      billId: id
    }
  });
  window.open(route.href, "_blank");
};

// 跳转政令详情
export const goToDecree = (id, tabName) => {
  window.sessionStorage.setItem("decreeId", id);
  window.sessionStorage.setItem("curTabName", tabName);
  const route = router.resolve({
    path: "/decreeLayout",
    query: {
      id: id
    }
  });
  window.open(route.href, "_blank");
};

// 跳转智库
export const goToThinkTank = (id, tabName) => {
  window.sessionStorage.setItem("curTabName", tabName);
  const route = router.resolve({
    name: "ReportDetail",
    params: {
      id: id
    }
  });
  window.open(route.href, "_blank");
}

// 跳转机构详情
export const goToInstitution = (id, tabName) => {
  window.sessionStorage.setItem('curTabName', tabName)
  const curRoute = router.resolve({
    path: "/institution",
    query: {
      id: id
    }
  });
  window.open(curRoute.href, "_blank");
}