沈丘营商办后台前端项目
346149741
2024-06-18 9fb6a0ff49c2af567be2e3adaf93c4c301b3f102
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import useTagsViewStore from "@/store/modules/tagsView";
import router from "@/router";
 
export default {
  // 刷新当前tab页签
  async refreshPage(obj: any) {
    const { path, matched }: any = router.currentRoute;
    if (obj === undefined) {
      matched.forEach((m: { components: { default: { name: string } } }) => {
        // prettier-ignore
        if (m.components && m.components.default && m.components.default.name) {
                    if (!["Layout", "ParentView"].includes(m.components.default.name)) {
                        obj = { name: m.components.default.name, path: path };
                    }
                }
      });
    }
    await useTagsViewStore().delCachedView(obj);
    const { path: path_1 } = obj;
    router.replace({
      path: "/redirect" + path_1,
    });
  },
  // 关闭当前tab页签,打开新页签
  closeOpenPage(obj: any) {
    const viewStore = useTagsViewStore();
    viewStore.delView(router.currentRoute.value);
    if (obj !== undefined) {
      return router.push(obj);
    }
  },
  // 关闭指定tab页签
  async closePage(obj: any) {
    if (obj === undefined) {
      // prettier-ignore
      const lastPath = await useTagsViewStore().delView(router.currentRoute) as any;
      return await router.push(lastPath || "/");
    }
    return useTagsViewStore().delView(obj);
  },
  // 关闭所有tab页签
  closeAllPage() {
    return useTagsViewStore().delAllViews();
  },
  // 关闭左侧tab页签
  closeLeftPage(obj: any) {
    // prettier-ignore
    return useTagsViewStore().delLeftTags(obj || router.currentRoute);
  },
  // 关闭右侧tab页签
  closeRightPage(obj: any) {
    // prettier-ignore
    return useTagsViewStore().delRightTags( obj || router.currentRoute);
  },
  // 关闭其他tab页签
  closeOtherPage(obj: any) {
    // prettier-ignore
    return useTagsViewStore().delOthersViews(obj || router.currentRoute);
  },
  // 添加tab页签
  openPage(title: any, url: any) {
    var obj = { path: url, meta: { title: title } };
    useTagsViewStore().addView(obj);
    return router.push(url);
  },
  // 修改tab页签
  updatePage(obj: any) {
    return useTagsViewStore().updateVisitedView(obj);
  },
};