yanghao 4 дней назад
Родитель
Сommit
3325acb465
4 измененных файлов с 77 добавлено и 85 удалено
  1. 1 1
      src/api/user.ts
  2. 37 41
      src/views/flow/srmDone.vue
  3. 37 41
      src/views/flow/srmTodo.vue
  4. 2 2
      src/views/login.vue

+ 1 - 1
src/api/user.ts

@@ -51,7 +51,7 @@ export const ssoLogin = (data: any) => {
 // SRM SSO登录
 export const srmLogin = (data: any) => {
   return request.post({
-    url: "/admin-api/system/auth/ehrLogin",
+    url: "/admin-api/system/auth/srm-sso-token",
     headers: { "Content-Type": "application/json" },
     data,
   });

+ 37 - 41
src/views/flow/srmDone.vue

@@ -112,7 +112,7 @@
 import Header from "@components/home/header.vue";
 import * as dd from "dingtalk-jsapi";
 import { ref, onMounted } from "vue";
-import { getSRMTasks, ssoLogin } from "@/api/user";
+import { getSRMTasks, srmLogin } from "@/api/user";
 import { useUserStore } from "@/stores/useUserStore";
 import { Icon } from "@iconify/vue";
 import router from "@/router";
@@ -129,46 +129,42 @@ const pagination = ref({
 });
 
 const goBackPage = async (row) => {
-  // const res = await ssoLogin({
-  //   username: userStore.getUser.username,
-  // });
-  // if (res) {
-  //   const ua = window.navigator.userAgent.toLowerCase();
-  //   if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
-  //     dd.biz.util.openLink({
-  //       url:
-  //         "https://yfoa.keruioil.com/wui/index.html" +
-  //         "?ssoToken=" +
-  //         res +
-  //         "#/main",
-  //       onSuccess: () => {
-  //         setTimeout(() => {
-  //           dd.biz.util.openLink({
-  //             url: `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`,
-  //           });
-  //         }, 100);
-  //       },
-  //     });
-  //   } else {
-  //     const loading = ElLoading.service({
-  //       lock: true,
-  //       text: "正在跳转,请稍候...",
-  //       background: "rgba(0, 0, 0, 0.7)",
-  //     });
-  //     const newTab = window.open("", "_blank");
-  //     newTab.location.href =
-  //       "https://yfoa.keruioil.com/wui/index.html" +
-  //       "?ssoToken=" +
-  //       res +
-  //       "#/main";
-  //     setTimeout(function () {
-  //       newTab.location.href = `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`;
-  //       setTimeout(() => {
-  //         loading.close();
-  //       }, 500);
-  //     }, 100);
-  //   }
-  // }
+  const res = await srmLogin({
+    username: userStore.getUser.username,
+  });
+  if (JSON.parse(res).msg === "账号未授权") {
+    dialogVisible.value = true;
+    return;
+  }
+  if (res) {
+    const ua = window.navigator.userAgent.toLowerCase();
+    if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+      dd.biz.util.openLink({
+        url: `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`,
+        onSuccess: () => {
+          setTimeout(() => {
+            dd.biz.util.openLink({
+              url: `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`,
+            });
+          }, 100);
+        },
+      });
+    } else {
+      const loading = ElLoading.service({
+        lock: true,
+        text: "正在跳转,请稍候...",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      const newTab = window.open("", "_blank");
+      newTab.location.href = `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`;
+      setTimeout(function () {
+        newTab.location.href = `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`;
+        setTimeout(() => {
+          loading.close();
+        }, 500);
+      }, 500);
+    }
+  }
 };
 
 const handleCurrentChange = async (page) => {

+ 37 - 41
src/views/flow/srmTodo.vue

@@ -112,7 +112,7 @@
 import Header from "@components/home/header.vue";
 import * as dd from "dingtalk-jsapi";
 import { ref, onMounted } from "vue";
-import { getSRMTasks, ssoLogin } from "@/api/user";
+import { getSRMTasks, srmLogin } from "@/api/user";
 import { useUserStore } from "@/stores/useUserStore";
 import { Icon } from "@iconify/vue";
 import router from "@/router";
@@ -129,46 +129,42 @@ const pagination = ref({
 });
 
 const goBackPage = async (row) => {
-  // const res = await ssoLogin({
-  //   username: userStore.getUser.username,
-  // });
-  // if (res) {
-  //   const ua = window.navigator.userAgent.toLowerCase();
-  //   if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
-  //     dd.biz.util.openLink({
-  //       url:
-  //         "https://yfoa.keruioil.com/wui/index.html" +
-  //         "?ssoToken=" +
-  //         res +
-  //         "#/main",
-  //       onSuccess: () => {
-  //         setTimeout(() => {
-  //           dd.biz.util.openLink({
-  //             url: `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`,
-  //           });
-  //         }, 100);
-  //       },
-  //     });
-  //   } else {
-  //     const loading = ElLoading.service({
-  //       lock: true,
-  //       text: "正在跳转,请稍候...",
-  //       background: "rgba(0, 0, 0, 0.7)",
-  //     });
-  //     const newTab = window.open("", "_blank");
-  //     newTab.location.href =
-  //       "https://yfoa.keruioil.com/wui/index.html" +
-  //       "?ssoToken=" +
-  //       res +
-  //       "#/main";
-  //     setTimeout(function () {
-  //       newTab.location.href = `https://yfoa.keruioil.com/spa/workflow/static4form/index.html?_rdm=1776063595284#/main/workflow/req?requestid=${row.requestId}`;
-  //       setTimeout(() => {
-  //         loading.close();
-  //       }, 500);
-  //     }, 100);
-  //   }
-  // }
+  const res = await srmLogin({
+    username: userStore.getUser.username,
+  });
+  if (JSON.parse(res).msg === "账号未授权") {
+    dialogVisible.value = true;
+    return;
+  }
+  if (res) {
+    const ua = window.navigator.userAgent.toLowerCase();
+    if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
+      dd.biz.util.openLink({
+        url: `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`,
+        onSuccess: () => {
+          setTimeout(() => {
+            dd.biz.util.openLink({
+              url: `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`,
+            });
+          }, 100);
+        },
+      });
+    } else {
+      const loading = ElLoading.service({
+        lock: true,
+        text: "正在跳转,请稍候...",
+        background: "rgba(0, 0, 0, 0.7)",
+      });
+      const newTab = window.open("", "_blank");
+      newTab.location.href = `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`;
+      setTimeout(function () {
+        newTab.location.href = `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`;
+        setTimeout(() => {
+          loading.close();
+        }, 500);
+      }, 500);
+    }
+  }
 };
 
 const handleCurrentChange = async (page) => {

+ 2 - 2
src/views/login.vue

@@ -21,7 +21,7 @@
         <h1 class="text-2xl font-bold text-center text-black/90">登录</h1>
 
         <!-- 用户名密码登陆 -->
-        <!-- <div>
+        <div>
           <el-form
             :model="form"
             :rules="rules"
@@ -62,7 +62,7 @@
               >
             </div>
           </div>
-        </div> -->
+        </div>
 
         <!-- 钉钉登陆 -->
         <div class="text-center">