Ver Fonte

refactor: 生产和测试环境的根部门不同,分别调整

wuwenyi há 4 dias atrás
pai
commit
aa06412f88
1 ficheiros alterados com 3 adições e 2 exclusões
  1. 3 2
      src/api/wecom.ts

+ 3 - 2
src/api/wecom.ts

@@ -13,8 +13,9 @@ export interface WecomMember {
   departmentId: number
 }
 
-export function listSubDepartments(parentId: number = 1): Promise<WecomDepartment[]> {
-  return http.get('/wecom/contact/departments', { params: { parentId } })
+/** 获取部门列表,不传 parentId 时使用后端配置的根部门(测试 0 / 生产 1) */
+export function listSubDepartments(parentId?: number): Promise<WecomDepartment[]> {
+  return http.get('/wecom/contact/departments', parentId != null ? { params: { parentId } } : {})
 }
 
 export function listDepartmentMembers(departmentId: number): Promise<WecomMember[]> {