Przeglądaj źródła

feat: 登录接口新增获取部门父级列表功能

yusheng 7 miesięcy temu
rodzic
commit
706fbeedcc
2 zmienionych plików z 24 dodań i 2 usunięć
  1. 15 1
      src/api/login/index.js
  2. 9 1
      src/views/login/index.vue

+ 15 - 1
src/api/login/index.js

@@ -28,7 +28,9 @@ export async function getLoginUser(data) {
  */
 
 export async function getExpiryDate(accountId) {
-  const res = await request.get(`/system/account/checkPasswordPeriod/${accountId}`);
+  const res = await request.get(
+    `/system/account/checkPasswordPeriod/${accountId}`
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -91,3 +93,15 @@ export async function getLatestVersion() {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+/**
+ * 获取部门所有父级
+ *
+ */
+export async function getParentIdListByDeptId(id) {
+  const res = await request.get(`/main/group/getParentIdListById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 9 - 1
src/views/login/index.vue

@@ -116,7 +116,12 @@
 <script>
   import I18nIcon from '@/layout/components/i18n-icon.vue';
   import { getToken } from '@/utils/token-util';
-  import { login, getCaptcha, getLatestVersion } from '@/api/login';
+  import {
+    login,
+    getCaptcha,
+    getLatestVersion,
+    getParentIdListByDeptId
+  } from '@/api/login';
   import xyy from '@/assets/xyy.jpg';
   import { getPathAddress } from '@/api/system/file';
   import { setCurrentUser } from '@/utils/token-util';
@@ -234,6 +239,9 @@
                   this.form.remember
                 );
               }
+              res.data.groupIdList = await getParentIdListByDeptId(
+                res.data.groupId
+              );
               const filePath = await getPathAddress();
               res.data.avatarAddress =
                 res.data.avatar && res.data.avatar.length