无人机管理后台前端(已迁走)
zrj
2024-07-19 f8c9a8c7e4e99d329aa0bc78ec3407320571da5b
src/store/modules/user.js
@@ -18,6 +18,7 @@
  refreshToken,
  getButtons,
  registerUser,
  getParentDeptInfo
} from '@/api/user';
import { getRoutes, getTopMenu } from '@/api/system/menu';
import { formatPath } from '@/router/avue-router';
@@ -36,6 +37,7 @@
    menuAll: getStore({ name: 'menuAll' }) || [],
    token: getStore({ name: 'token' }) || '',
    refreshToken: getStore({ name: 'refreshToken' }) || '',
    parentDeptInfo: getStore({ name: 'parentDeptInfo' }) || '',
  },
  actions: {
    //根据用户名登录
@@ -63,6 +65,7 @@
              commit('SET_REFRESH_TOKEN', data.refresh_token);
              commit('SET_TENANT_ID', data.tenant_id);
              commit('SET_USER_INFO', data);
              commit('SET_PARENT_DEPT_INFO', data.dept_id);
              commit('DEL_ALL_TAG');
              commit('CLEAR_LOCK');
            }
@@ -288,6 +291,13 @@
    },
  },
  mutations: {
    SET_PARENT_DEPT_INFO(state, deptId){
      getParentDeptInfo({deptId:deptId}).then(res=>{
        const data = res.data.data;
        state.parentDeptInfo = data;
        setStore({ name: 'parentDeptInfo', content: data });
      })
    },
    SET_TOKEN: (state, token) => {
      setToken(token);
      state.token = token;