[返回主目录](/doc)

<a name="menu">目录</a>
1. [添加](#saveOrg)
1. [负责人列表](#orgUsers)
1. [更新（暂不提供）](#updOrg)
1. [删除](#delOrg)
1. [列表(条件)](#listOrg)
1. [明细](#queryById)
1. [根据PID查询子目录](#byPid)
1. [结构树](#tree)

## **<a name="saveOrg"> 添加</a>**
[返回到目录](#menu)
##### URL
[/web/uc/orgCtl/saveOrg]
#### 参数格式  `JSON`
#### HTTP请求方式 `POST`

``` javascript

{
	"id": 1,                    // 组织机构id 空添加 非空修改
    "pid": 0,                   // 上级组织机构id
    "orgname": "公司宝",         // 组织机构名号曾
    "main_ids": "36, 22"        // 负责人id，多个以逗号分割
}
```

#### 返回结果
```javascript

{
  "status": 0,
  "msg": "操作成功",
  "data": {},
  "bizmsg": "empty",
  "requestid": "faf3871bc6a040d9b098ffa33d5a180a"
}

```


## **<a name="orgUsers"> 负责人列表</a>**
[返回到目录](#menu)
##### URL
[/web/uc/userCtl/orgUsers]
#### 参数格式  `JSON`
#### HTTP请求方式 `POST`

``` javascript

    {
      "id": 1,  // 传入当前修改的组织机构id
    }

```


#### 返回结果
```javascript

  {
    "status": 0,
    "msg": "success",
    "data": {
        "count": 8,
        "rows": [
            {
              "id": 17,                             // 编号
              "ucname": "guodegang10",              // 登录名
              "mobile": "1381231332312",            // 手机号
              "realName": "郭德纲11",                // 姓名
            },
        ]
    },
    "requestid": "defbe7aa7b1045c4b644e1c9eb58fd88"
}

```

## **<a name="delOrg"> 删除</a>**
[返回到目录](#menu)
##### URL
[/web/uc/orgCtl/delOrg]
#### 参数格式  `JSON`
#### HTTP请求方式 `POST`

``` javascript

    {
      "id": 1,  //记录ID  必传   
    }

```


## **<a name="listOrg"> 列表</a>**
[返回到目录](#menu)
##### URL
[/web/uc/orgCtl/listOrg]
#### 参数格式  `JSON`
#### HTTP请求方式 `POST`

``` javascript
  {
      "status": 0,
      "msg": "success",
      "data": {
          "id": 17,                             // id
          "ucname": "guodegang10",              // 登录名
          "uctype": 2,                          // 用户类型 1平台 2商户 3交付商 4个人
          "uctypeId": "",                       // 用户类型id
  
          "org_id": 3,                          // 组织机构id
          "isMain": 0,                          // 是否主管
          "isEnabled": 1,                       // 启用/禁用   0禁用 1启用
          "created_at": "2019-11-29 10:43:32",  // 创建时间
          "mobile": "1381231332312",            // 手机号
          "realName": "郭德纲11",                // 姓名
          "roles": [                            // 拥有角色
              {
                  "role_id": "1"                // 角色id
              },
              {
                  "role_id": "5"
              },
              {
                  "role_id": "6"
              }
          ]
      },
      "requestid": "dd2731bca15c446595170e1ccf0b2b00"
  }

```

#### 返回结果
```javascript
{
    "status": 0,
    "msg": "操作成功",
    "data": {
        "count": 2,
        "rows": [
            {
                "is_leaf": true,    //是否叶子结点
                "id": 3,            //ID
                "orgname": "sun",   //组织结构的名称
                "pid": 1,           //父结点
                "saas_id": 3,       //saasID  
                "path": "/root/sun",//路径
                "created_at": "2019-11-28T08:24:40.000Z",
                "updated_at": "2019-11-28T08:24:40.000Z",
                "deleted_at": null,
                "version": 0
            },
            {
                "id": 3,
                "orgname": "sun",
                "path": "/root/sun",
                "pid": 1,
                "saas_id": "3",
                "is_leaf": 1,
                "created_at": "2019-11-29T03:03:36.000Z",
                "updated_at": "2019-11-29T03:03:36.000Z",
                "deleted_at": null,
                "version": 0
            }
        ]
    },
    "bizmsg": "empty",
    "requestid": "e0584277b1d0490ba2c575ac79a1a813"
}

```

## **<a name="queryById"> 明细</a>**
[返回到目录](#menu)
##### URL
[/web/uc/orgCtl/queryById]
#### 参数格式  `JSON`
#### HTTP请求方式 `POST`

``` javascript

    {
      "id": 1,  //记录ID  必传   
    }

```

#### 返回结果
```javascript
{
  "status": 0,
  "msg": "操作成功",
  "data": {
      "is_leaf": true,    //是否叶子结点
      "id": 3,            //ID
      "orgname": "sun",   //组织结构的名称
      "pid": 1,           //父结点
      "saas_id": 3,       //saasID  
      "path": "/root/sun",//路径
      "created_at": "2019-11-28T08:24:40.000Z",
      "updated_at": "2019-11-28T08:24:40.000Z",
      "deleted_at": null,
      "version": 0
  },
  "bizmsg": "empty",
  "requestid": "488de0d85b1b425c94166cb3a653b86c"
}

```


## **<a name="byPid"> 根据PID查询子目录</a>**
[返回到目录](#menu)
##### URL
[/web/uc/orgCtl/byPid]
#### 参数格式  `JSON`
#### HTTP请求方式 `POST`

``` javascript

    {
      "pid": 1,  //记录ID  必传   
    }

```

#### 返回结果
```javascript
{
  "status": 0,
  "msg": "操作成功",
  "data": [
      {
          "is_leaf": true,    //是否叶子结点
          "id": 3,            //ID
          "orgname": "sun",   //组织结构的名称
          "pid": 1,           //父结点
          "saas_id": 3,       //saasID  
          "path": "/root/sun",//路径
          "created_at": "2019-11-29T03:03:36.000Z",
          "updated_at": "2019-11-29T03:03:36.000Z",
          "deleted_at": null,
          "version": 0
      }
  ],
  "bizmsg": "empty",
  "requestid": "34791671e8584672b302f0f5acda16fa"
}

```

## **<a name="tree"> 结构树</a>**
[返回到目录](#menu)
##### URL
[/web/uc/orgCtl/tree]
#### 参数格式  `JSON`
#### HTTP请求方式 `POST`

``` javascript

    {
      "pid": 1,  //记录ID  必传   
    }

```

#### 返回结果
```javascript
{
    "status": 0,
    "msg": "操作成功",
    "data": [
        {
            "id": 1,
            "orgname": "root",
            "path": "/root",
            "pid": 0,
            "is_leaf": 1,
            "saas_id": "2",
            "created_at": "2019-11-28T08:24:40.000Z",
            "updated_at": "2019-11-28T08:24:40.000Z",
            "deleted_at": null,
            "version": 0,
            "childs": [
                {
                    "id": 3,
                    "orgname": "sun",
                    "path": "/root/sun",
                    "pid": 1,
                    "is_leaf": 1,
                    "saas_id": "3",
                    "created_at": "2019-11-29T03:03:36.000Z",
                    "updated_at": "2019-11-29T03:03:36.000Z",
                    "deleted_at": null,
                    "version": 0,
                    "childs": []
                }
            ]
        }
    ],
    "bizmsg": "empty",
    "requestid": "72619d7a99cc437894b5880564b2847c"
}
```