Appearance
informat.dept 部门组织架构操作
概述
使用informat.dept
对象进行部门相关操作
queryDeptList
查询部门列表
javascript
informat.dept.queryDeptList(query)
参数 | 类型 | 描述 |
---|---|---|
query | Query | 查询条件 |
返回值
类型为Array<Dept> 返回部门列表
示例1 查询名称包含研发的部门列表
javascript
informat.dept.queryDeptList({
pageSize: -1,
filter: {
conditionList: [
{ "fieldId": "name", "opt": "contains", "value": "研发" }
]
}
});
json
[
{
"id": "yanfabu",
"name": "研发部",
"parentId": "root",
"remark": "负责研究和开发新产品、技术或服务的部门",
"rowNumber": 2,
"shortName": "研发部"
},
{
"id": "yanfa1zu",
"name": "研发1组",
"parentId": "yanfabu",
"remark": "",
"rowNumber": 1,
"shortName": "研发1组"
},
{
"id": "yanfa2zu",
"name": "研发2组",
"parentId": "yanfabu",
"remark": "",
"rowNumber": 2,
"shortName": "研发2组"
}
]
示例2 查询研发部下的子部门列表(不递归)
javascript
informat.dept.queryDeptList({
pageSize: -1,
filter: {
conditionList: [
{ "fieldId": "parentId", "opt": "eq", "value": "yanfabu" }
]
}
});
json
[
{
"id": "yanfa1zu",
"name": "研发1组",
"parentId": "yanfabu",
"remark": "",
"rowNumber": 1,
"shortName": "研发1组"
},
{
"id": "yanfa2zu",
"name": "研发2组",
"parentId": "yanfabu",
"remark": "",
"rowNumber": 2,
"shortName": "研发2组"
}
]
queryDeptListCount
查询部门列表总数
javascript
informat.dept.queryDeptListCount(filter)
参数 | 类型 | 描述 |
---|---|---|
filter | Filter | 查询条件 |
返回值
类型为Integer
返回部门列表总数
示例
javascript
informat.dept.queryDeptListCount({
conditionList: [
{ "fieldId": "name", "opt": "contains", "value": "研发" }
]
});
text
1
getDept
查询部门信息
javascript
informat.dept.getDept(id)
参数 | 类型 | 描述 |
---|---|---|
id | String | 部门标识符 |
返回值 类型为Dept 返回部门信息,如果部门不存在返回null
示例
javascript
informat.dept.getDept('yanfabu');
json
{
"id": "yanfabu",
"name": "研发部",
"parentId": "root",
"remark": "负责研究和开发新产品、技术或服务的部门",
"rowNumber": 2,
"shortName": "研发部"
}
getParentOfDept
查询部门的所有上级部门
javascript
informat.dept.getParentOfDept(deptId)
参数 | 类型 | 描述 |
---|---|---|
deptId | String | 部门标识符 |
返回值 类型为Array<Dept> 返回上级部门列表
示例
javascript
informat.dept.getParentOfDept('yanfabu');
json
[
{
"id": "root",
"name": "INFORMAT",
"rowNumber": 1
}
]
getChildrenOfDept
查询所有的下级部门
javascript
informat.dept.getChildrenOfDept(deptId)
参数 | 类型 | 描述 |
---|---|---|
deptId | String | 部门标识符 |
返回值 类型为Array<Dept> 返回所有的下级部门
示例
javascript
informat.dept.getChildrenOfDept('yanfabu');
json
[
{
"id": "yanfa1",
"name": "研发1组",
"parentId": "yanfabu",
"rowNumber": 1
},
{
"id": "yanfa2",
"name": "研发2组",
"parentId": "yanfabu",
"rowNumber": 2
}
]
getDirectChildrenOfDept
查询直接下级部门
javascript
informat.dept.getDirectChildrenOfDept(deptId)
参数 | 类型 | 描述 |
---|---|---|
deptId | String | 部门标识符 |
返回值
类型为Array<Dept> 返回直接下级部门
示例
javascript
informat.dept.getDirectChildrenOfDept('yanfabu');
json
[
{
"id": "yanfa1",
"name": "研发1组",
"parentId": "yanfabu",
"rowNumber": 1
},
{
"id": "yanfa2",
"name": "研发2组",
"parentId": "yanfabu",
"rowNumber": 2
}
]
addDept
新增部门
javascript
informat.dept.addDept(dept)
参数 | 类型 | 描述 |
---|---|---|
dept | Dept | 部门信息 |
返回值
类型为String
返回新增的部门标识符
示例
javascript
informat.dept.addDept({
'id': 'yanfabu',
'name': '研究开发部',
'shortName': '研发部',
'parentId': 'root',
'ownerList': ['zhangsan'],
'remark': '负责研究和开发新产品、技术或服务的部门'
});
updateDept
更新部门
javascript
informat.dept.updateDept(dept)
参数 | 类型 | 描述 |
---|---|---|
dept | Dept | 部门 |
示例
javascript
informat.dept.updateDept({
'id': 'yanfabu',
'name': '研究开发部',
'shortName': '研发部',
'parentId': 'root',
'ownerList': ['zhangsan', 'lisi'],
'remark': '负责研究和开发新产品、技术或服务的部门'
});
deleteDept
删除部门
javascript
informat.dept.deleteDept(deptId)
参数 | 类型 | 描述 |
---|---|---|
deptId | String | 部门标识符 |
示例
javascript
informat.dept.deleteDept('yanfabu');