chenrui  1 vuosi sitten
vanhempi
commit
0754776d5f

+ 4 - 1
src/components/SimpleTable/index.vue

@@ -274,7 +274,10 @@ const computedColumnProps = computed(() => {
 const gueryRoles = async () => {
   const { code, returnData } = await Query({
     id: DATACONTENT_ID.allId,
-    dataContent: Object.values(dataContent.value),
+    dataContent: [
+      sessionStorage.getItem("auth-id"),
+      sessionStorage.getItem("User_Id"),
+    ],
   });
   conditon.value = returnData.listValues[0].query_col_conditon;
 };

+ 60 - 58
src/utils/axiosReq.ts

@@ -1,119 +1,121 @@
-import axios from 'axios'
-import router from '@/router'
-import { ElLoading, ElMessage, ElMessageBox } from 'element-plus'
-import { getToken, setToken, removeToken } from '@/utils/auth'
-import { AxiosConfigTy, AxiosReqTy, ObjTy } from '~/common'
-import { useUserStore } from '@/store/user'
-let reqConfig: any
-let loadingE: any
+import axios from "axios";
+import router from "@/router";
+import { ElLoading, ElMessage, ElMessageBox } from "element-plus";
+import { getToken, setToken, removeToken } from "@/utils/auth";
+import { AxiosConfigTy, AxiosReqTy, ObjTy } from "~/common";
+import { useUserStore } from "@/store/user";
+let reqConfig: any;
+let loadingE: any;
 
-const service: any = axios.create()
+const service: any = axios.create();
 
 // 请求拦截
 service.interceptors.request.use(
   (request: AxiosReqTy) => {
-    const authMap = useUserStore().authMap
-    const data = request.data!
+    const authMap = useUserStore().authMap;
+    const data = request.data!;
     if (data.btnAuth) {
       if (authMap[data.btnAuth]) {
-        request.headers['auth-id'] = authMap[data.btnAuth]
+        request.headers["auth-id"] = authMap[data.btnAuth];
+        sessionStorage.setItem("auth-id", authMap[data.btnAuth]);
       }
-      delete data.btnAuth
+      delete data.btnAuth;
     } else {
-      const route = router.currentRoute
+      const route = router.currentRoute;
       if (!data.id || data.id !== DATACONTENT_ID.loginId) {
-        const role = route.value.meta?.roles?.[0]
+        const role = route.value.meta?.roles?.[0];
         if (role && authMap[role]) {
-          request.headers['auth-id'] = authMap[role]
+          request.headers["auth-id"] = authMap[role];
+          sessionStorage.setItem("auth-id", authMap[role]);
         }
       }
     }
     // token setting
-    request.headers['token'] = getToken()
+    request.headers["token"] = getToken();
     /* download file*/
     if (request.isDownLoadFile) {
-      request.responseType = 'blob'
+      request.responseType = "blob";
     }
     /* upload file*/
     if (request.isUploadFile) {
-      request.headers['Content-Type'] = 'application/json'
+      request.headers["Content-Type"] = "application/json";
     }
-    reqConfig = request
+    reqConfig = request;
     if (request.bfLoading) {
       loadingE = ElLoading.service({
         lock: true,
-        text: '数据载入中',
+        text: "数据载入中",
         // spinner: 'el-icon-ElLoading',
-        background: 'rgba(0, 0, 0, 0.1)',
-      })
+        background: "rgba(0, 0, 0, 0.1)",
+      });
     }
     /*
      *params会拼接到url上
      * */
     if (request.isParams) {
-      request.params = request.data
-      request.data = {}
+      request.params = request.data;
+      request.data = {};
     }
-    return request
+    return request;
   },
   (err: any) => {
-    Promise.reject(err)
+    Promise.reject(err);
   }
-)
+);
 // 响应拦截
 service.interceptors.response.use(
   (response) => {
-    const res = response.data
+    const res = response.data;
     // if the custom code is not 20000, it is judged as an error.
-    if (res.code != '0') {
-      if (res.message && res.message.includes('Duplicate entry')) {
+    if (res.code != "0") {
+      if (res.message && res.message.includes("Duplicate entry")) {
         ElMessage({
-          message: '执行失败',
-          type: 'error',
+          message: "执行失败",
+          type: "error",
           duration: 5 * 1000,
-        })
+        });
       } else {
         ElMessage({
-          message: res.message ?? '执行失败',
-          type: 'error',
+          message: res.message ?? "执行失败",
+          type: "error",
           duration: 5 * 1000,
-        })
+        });
       }
-      return Promise.reject(res.message || res.returnData?.message || 'Error')
+      return Promise.reject(res.message || res.returnData?.message || "Error");
     } else {
-      return res
+      return res;
     }
   },
   (error) => {
-    const des500 = `${error}`.split(' ').includes('500')
+    const des500 = `${error}`.split(" ").includes("500");
     if (des500) {
       ElMessage({
-        message: '身份令牌过期或失效,即将重新登录',
-        type: 'error',
+        message: "身份令牌过期或失效,即将重新登录",
+        type: "error",
         duration: 3 * 1000,
         onClose: async () => {
-          sessionStorage.clear()
-          removeToken() // must remove  token  first
-          removeToken('codeToken')
-          removeToken('systemSet')
-          removeToken('userid')
+          sessionStorage.clear();
+          removeToken(); // must remove  token  first
+          removeToken("codeToken");
+          removeToken("systemSet");
+          removeToken("userid");
           // store.dispatch('app/toggleOutflag', false)
           // await store.dispatch('user/resetToken')
-          useUserStore().resetState()
-          router.push(`/login`)
-          location.reload()
+          useUserStore().resetState();
+          router.push(`/login`);
+          location.reload();
         },
-      })
+      });
     } else {
       ElMessage({
         message: error.message,
-        type: 'error',
+        type: "error",
         duration: 5 * 1000,
-      })
+      });
     }
-    return Promise.reject(error)
+    return Promise.reject(error);
   }
-)
+);
 
 export function axiosReq({
   url,
@@ -131,7 +133,7 @@ export function axiosReq({
 }: AxiosConfigTy): any {
   return service({
     url: url,
-    method: method ?? 'get',
+    method: method ?? "get",
     data: data ?? {},
     headers: headers ?? {},
     isParams: isParams ?? false,
@@ -143,7 +145,7 @@ export function axiosReq({
     // baseURL: baseURL ?? import.meta.env.VITE_APP_BASE_URL,
     baseURL: baseURL ?? PLATFROM_CONFIG.baseNewUrl,
     timeout: timeout ?? 15000,
-  })
+  });
 }
 
-export default axiosReq
+export default axiosReq;

+ 4 - 2
src/views/BasicsData/airlineCompany/index.vue

@@ -263,8 +263,10 @@ const delRest = () => {
 const gueryRoles = async () => {
   const { code, returnData } = await Query({
     id: DATACONTENT_ID.allId,
-    needPage: ++page.value,
-    dataContent: Object.values(dataContent.value),
+    dataContent: [
+      sessionStorage.getItem("auth-id"),
+      sessionStorage.getItem("User_Id"),
+    ],
   });
   conditon.value = returnData.listValues[0].query_col_conditon;
   getQuery();

+ 4 - 2
src/views/BasicsData/airportCompany/index.vue

@@ -268,8 +268,10 @@ const getSelectData = async (id?, name?) => {
 const gueryRoles = async () => {
   const { code, returnData } = await Query({
     id: DATACONTENT_ID.allId,
-    needPage: ++page.value,
-    dataContent: Object.values(dataContent.value),
+    dataContent: [
+      sessionStorage.getItem("auth-id"),
+      sessionStorage.getItem("User_Id"),
+    ],
   });
   conditon.value = returnData.listValues[0].query_col_conditon;
   getQuery();

+ 4 - 2
src/views/BasicsData/airportInfo/index.vue

@@ -491,8 +491,10 @@ const handleNodeClick = (data) => {
 const gueryRoles = async () => {
   const { code, returnData } = await Query({
     id: DATACONTENT_ID.allId,
-    needPage: ++page.value,
-    dataContent: Object.values(dataContent.value),
+    dataContent: [
+      sessionStorage.getItem("auth-id"),
+      sessionStorage.getItem("User_Id"),
+    ],
   });
   conditon.value = returnData.listValues[0].query_col_conditon;
   getQuery();

+ 4 - 2
src/views/BasicsData/cargoInformation/index.vue

@@ -242,8 +242,10 @@ const btnClick = (row, index, param) => {
 const gueryRoles = async () => {
   const { code, returnData } = await Query({
     id: DATACONTENT_ID.allId,
-    needPage: ++page.value,
-    dataContent: Object.values(dataContent.value),
+    dataContent: [
+      sessionStorage.getItem("auth-id"),
+      sessionStorage.getItem("User_Id"),
+    ],
   });
   conditon.value = returnData.listValues[0].query_col_conditon;
   getQuery();

+ 4 - 2
src/views/BasicsData/deployNode/index.vue

@@ -210,8 +210,10 @@ const btnClick = (row, index, param) => {
 const gueryRoles = async () => {
   const { code, returnData } = await Query({
     id: DATACONTENT_ID.allId,
-    needPage: ++page.value,
-    dataContent: Object.values(dataContent.value),
+    dataContent: [
+      sessionStorage.getItem("auth-id"),
+      sessionStorage.getItem("User_Id"),
+    ],
   });
   conditon.value = returnData.listValues[0].query_col_conditon;
   getQuery();

+ 4 - 2
src/views/BasicsData/specialCargoMaintenance/index.vue

@@ -243,8 +243,10 @@ const btnClick = (row, index, param) => {
 const gueryRoles = async () => {
   const { code, returnData } = await Query({
     id: DATACONTENT_ID.allId,
-    needPage: ++page.value,
-    dataContent: Object.values(dataContent.value),
+    dataContent: [
+      sessionStorage.getItem("auth-id"),
+      sessionStorage.getItem("User_Id"),
+    ],
   });
   conditon.value = returnData.listValues[0].query_col_conditon;
   getQuery();

+ 4 - 2
src/views/dataQuery/components/DataQueryView/index.vue

@@ -409,8 +409,10 @@ const { tableColumns, tableData, getTableData } = useTable(
 const gueryRoles = async () => {
   const { code, returnData } = await Query({
     id: DATACONTENT_ID.allId,
-    needPage: ++page.value,
-    dataContent: Object.values(dataContent.value),
+    dataContent: [
+      sessionStorage.getItem("auth-id"),
+      sessionStorage.getItem("User_Id"),
+    ],
   });
   conditon.value = returnData.listValues[0].query_col_conditon;
   tableCols.value = [];

+ 1 - 1
src/views/userManagement/account/index.vue

@@ -221,7 +221,7 @@ const getGroup = async () => {
 };
 const gueryRoles = async () => {
   const res = await table.getTable(DATACONTENT_ID.allId, [
-    searchInfo.value,
+    sessionStorage.getItem("auth-id"),
     sessionStorage.getItem("User_Id"),
   ]);
   conditon.value = res.tableData.value[0].query_col_conditon;

+ 1 - 1
src/views/userManagement/accountGroup/index.vue

@@ -114,7 +114,7 @@ onBeforeMount(() => {
 });
 const gueryRoles = async () => {
   const res = await table.getTable(DATACONTENT_ID.allId, [
-    searchInfo.value,
+    sessionStorage.getItem("auth-id"),
     sessionStorage.getItem("User_Id"),
   ]);
   conditon.value = res.tableData.value[0].query_col_conditon;

+ 1 - 1
src/views/userManagement/application/index.vue

@@ -149,7 +149,7 @@ onBeforeMount(() => {
 });
 const gueryRoles = async () => {
   const res = await table.getTable(DATACONTENT_ID.allId, [
-    searchInfo.value,
+    sessionStorage.getItem("auth-id"),
     sessionStorage.getItem("User_Id"),
   ]);
   conditon.value = res.tableData.value[0].query_col_conditon;

+ 2 - 1
src/views/userManagement/role/index.vue

@@ -152,8 +152,9 @@ onBeforeMount(() => {
 });
 
 const gueryRoles = async () => {
+  console.log(sessionStorage.getItem("auth-id"));
   const res = await table.getTable(DATACONTENT_ID.allId, [
-    searchInfo.value,
+    sessionStorage.getItem("auth-id"),
     sessionStorage.getItem("User_Id"),
   ]);
   conditon.value = res.tableData.value[0].query_col_conditon;