yanghao 2 tygodni temu
rodzic
commit
3420381f51
1 zmienionych plików z 32 dodań i 5 usunięć
  1. 32 5
      src/views/drive/index.vue

+ 32 - 5
src/views/drive/index.vue

@@ -15,7 +15,7 @@
           :key="card.title"
           type="button"
           class="drive-card"
-          @click="openDrive(card.url)"
+          @click="openDrive(card)"
         >
           <div class="drive-card__icon">
             <Icon :icon="card.icon" />
@@ -40,6 +40,12 @@ import Header from "@components/home/header.vue";
 import Footer from "@components/home/Footer.vue";
 import { Icon } from "@iconify/vue";
 
+import { getMCSsoToken } from "@/api/user";
+import { useUserStore } from "@/stores/useUserStore";
+import { getAccessToken } from "@/utils/auth";
+
+const userStore = useUserStore();
+
 type DriveCard = {
   title: string;
   description: string;
@@ -52,18 +58,39 @@ const driveCards: DriveCard[] = [
     title: "生产驾驶舱",
     description: "查看生产运营态势、核心指标与执行情况。",
     icon: "mdi:factory",
-    url: "http://172.21.10.42:1080/webroot/decision/v10/entry/access/dbc9cf73-81ce-43f1-9923-45cdfa5d5d3a?preview=true&page_number=1",
+    url: "https://report.deepoil.cc/webroot/decision/v10/entry/access/dbc9cf73-81ce-43f1-9923-45cdfa5d5d3a?preview=true&page_number=1",
   },
   {
     title: "财务驾驶舱",
     description: "查看财务分析、预算执行与经营数据表现。",
     icon: "mdi:finance",
-    url: "http://172.21.10.42:1080/webroot/decision/v10/entry/access/e836fb5b-092c-4d64-a324-3beeb4fac0cc?preview=true&page_number=1",
+    url: "https://report.deepoil.cc/webroot/decision/v10/entry/access/e836fb5b-092c-4d64-a324-3beeb4fac0cc?preview=true&page_number=1",
+  },
+  {
+    title: "经营驾驶舱",
+    description: "查看经营分析、经营指标与执行情况。",
+    icon: "mdi:business",
+    url: "https://report.deepoil.cc/webroot/decision/v10/entry/access/9fb42908-894a-4373-a6be-ce046a42851d?preview=true&page_number=1",
   },
 ];
 
-const openDrive = (url: string) => {
-  window.open(url, "_blank");
+const openDrive = async (option: DriveCard) => {
+  if (userStore.getUser.username && getAccessToken()) {
+    const res = await getMCSsoToken();
+    if (res) {
+      if (option.title === "生产驾驶舱") {
+        window.open(`${option.url}&ssoToken=${res}`, "_blank");
+      }
+
+      if (option.title === "财务驾驶舱") {
+        window.open(`${option.url}&ssoToken=${res}`, "_blank");
+      }
+
+      if (option.title === "经营驾驶舱") {
+        window.open(`${option.url}&ssoToken=${res}`, "_blank");
+      }
+    }
+  }
 };
 </script>