>[warning] 使用前必須引入**Organization**模型
use app\common\model\sys\Organization as OrgModel;
#### getAncestors()-獲取指定的組織機構的所有的祖輩節點信息
>[info] getAncestors($orgId,&$res=array(),$fields='*'){}
### 參數
* orgId:組織機構編號
* res:輸出參數
* fields:需要查詢返回的字段集合
>[success]說明
獲取數據時肯定是遞歸查詢會導致順序是從父親、爺爺、曾祖這樣的順序
,所以在獲取到數據后需要將順序反轉一次 得到 曾祖 爺爺 父親這樣的順序【**array_reverse**】。
>[success]示例代碼
```php
$this->model = new OrgModel;
$parentId ='';
$allParents =[];
if(!empty($parentId) && $parentId!='ALL'){
$this->model->getAncestors($parentId,$allParents,'*');
$allParents =array_reverse($allParents);
}
```
- 空白目錄
- 簡介
- 前端
- 組件
- 文件上傳
- 用戶選擇
- 組織機構選擇
- 角色崗位選擇
- 崗位選擇
- 用戶組選擇
- 高拍儀上傳
- 公共類庫
- 組織機構
- bindToOrg
- bindusertoremote
- getAncestors
- getAllChildIds
- getByOrgId
- getByThirdAppPkId
- getChilds
- getChildsCount
- getMasterOrg
- getOrgUserById
- getOrgUser
- getOrgRoleData
- getOrgRoleQuota
- getOrgRoleUserCount
- getParents
- getPosteritys
- getTreeArray
- getUserOrgs
- getUserOrgCount
- getUserOrgRoleInfo
- hasChild
- hasMasterOrg
- hasBind
- isOrgUser
- updateOrg
- 用戶管理
- getAuthorInfo
- getByDuty
- getByGroup
- getByMobile
- getByOrg
- getByUserId
- getByUserName
- getByRole
- getByToken
- getByThirdUserId
- getUserOrgs
- getUserRoles
- getUserList
- 統一待辦
- createTodo
- createHandle
- createRead
- removeTodo
- getTodoList
- setReaded