shaogen1995 2 anni fa
parent
commit
021e6480c1
2 ha cambiato i file con 21 aggiunte e 16 eliminazioni
  1. 14 14
      src/pages/A4Role/A4Auth/index.tsx
  2. 7 2
      src/utils/http.ts

+ 14 - 14
src/pages/A4Role/A4Auth/index.tsx

@@ -140,7 +140,7 @@ function A4Auth({ mId, authColseFu, authEditFu }: Props) {
 
     const { flag2, txt2 } = r3Ref.current.sonRes();
     console.log(flag2);
-    
+
     // if (!flag2) return MessageFu.warning("至少勾选一个 内控文件权限 模块!");
 
     // 处理功能权限
@@ -164,11 +164,6 @@ function A4Auth({ mId, authColseFu, authEditFu }: Props) {
       }
     });
 
-    const obj1 = {
-      resources: tempArr,
-      roleId: mId,
-    };
-
     if (tempArr) {
       // 勾选了 项目管理 页面权限
       if (tempArr.includes("1000")) {
@@ -179,24 +174,29 @@ function A4Auth({ mId, authColseFu, authEditFu }: Props) {
       }
     }
 
-    const res1 = await A4_APIsave1(obj1);
+    const obj1 = {
+      id: mId,
+      dataScope: value,
+      scopeDept: txt,
+    };
+
+    const res1 = await A4_APIsave2(obj1);
 
     if (res1.code === 0) {
       const obj2 = {
-        id: mId,
-        dataScope: value,
-        scopeDept: txt,
+        roleId: mId,
+        attrId: txt2,
       };
 
-      const res2 = await A4_APIsave2(obj2);
-
+      const res2 = await A4_APIsave3(obj2);
       if (res2.code === 0) {
         const obj3 = {
+          resources: tempArr,
           roleId: mId,
-          attrId: txt2,
         };
 
-        const res3 = await A4_APIsave3(obj3);
+        const res3 = await A4_APIsave1(obj3);
+
         if (res3.code === 0) {
           MessageFu.success("授权成功!");
           authEditFu();

+ 7 - 2
src/utils/http.ts

@@ -89,9 +89,14 @@ http.interceptors.response.use(
           err.response.data &&
           err.response.data.msg &&
           err.response.data.msg.length < 30
-        )
+        ) {
           MessageFu.error(err.response.data.msg);
-        else MessageFu.error("响应错误,请联系管理员!");
+          // 没有权限
+          if (err.response.data.code === 5003) {
+            removeTokenInfo();
+            history.push("/login");
+          }
+        } else MessageFu.error("响应错误,请联系管理员!");
       }
     }, 100);