index.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { initData } from "@/common/methods";
  2. import { getThirdMenuData } from '@/common/setup/table/button';
  3. import { getToken } from "@/services/bus/token";
  4. import { serviceURL } from "@/services/request";
  5. import { ref } from "vue";
  6. import { IfameRouteParam } from "./interface";
  7. export function handleIfameRouter({ code, btnCodeList, tabIndex }: IfameRouteParam) {
  8. const token = getToken();
  9. const url = ref<string>('');
  10. // 获取当前tab页数据
  11. const list = getThirdMenuData();
  12. initData(() => {
  13. let resourcePCMenu = 'resourcepcmenu=';
  14. // const children = list[0].children;
  15. // console.log('获取当前tab页数据', children)
  16. const tabData = list.find((e) => e.code === code);
  17. if (tabData) {
  18. const fn = (code: string) => tabData.children.find((e) => e.code === code);
  19. // 权限按钮
  20. btnCodeList.forEach(el => {
  21. const { btnCode, urlCode } = el
  22. if (btnCode === 'info') {
  23. resourcePCMenu += `:${urlCode}`;
  24. } else if (fn(btnCode)) {
  25. resourcePCMenu += `:${urlCode}`;
  26. }
  27. });
  28. }
  29. url.value = `${serviceURL.pcMangerUrl}${list[0].url}?token=${token}&tabindex=${tabIndex}&${resourcePCMenu}`;
  30. });
  31. return { url };
  32. }