informat.dept Department Organization Operations
Overview
Use the informat.dept object for department-related operations
queryDeptList
Query department list
informat.dept.queryDeptList(query);| Parameter | Type | Description |
|---|---|---|
| query | Query | Query condition |
Return Value
Type: Array<Dept> Returns department list
Example 1 Query department list containing 'R&D' in name
informat.dept.queryDeptList({
pageSize: -1,
filter: {
conditionList: [{ fieldId: "name", opt: "contains", value: "R&D" }],
},
});[
{
"id": "yanfabu",
"name": "R&D Department",
"parentId": "root",
"remark": "The department responsible for researching and developing new products, technologies, or services.",
"rowNumber": 2,
"shortName": "R&D"
},
{
"id": "yanfa1zu",
"name": "R&D Group 1",
"parentId": "yanfabu",
"remark": "",
"rowNumber": 1,
"shortName": "R&D 1"
},
{
"id": "yanfa2zu",
"name": "R&D Group 2",
"parentId": "yanfabu",
"remark": "",
"rowNumber": 2,
"shortName": "R&D 2"
}
]Example 2 Query direct child departments under 'R&D Department'
informat.dept.queryDeptList({
pageSize: -1,
filter: {
conditionList: [{ fieldId: "parentId", opt: "eq", value: "yanfabu" }],
},
});[
{
"id": "yanfa1zu",
"name": "R&D Group 1",
"parentId": "yanfabu",
"remark": "",
"rowNumber": 1,
"shortName": "R&D 1"
},
{
"id": "yanfa2zu",
"name": "R&D Group 2",
"parentId": "yanfabu",
"remark": "",
"rowNumber": 2,
"shortName": "R&D 2"
}
]queryDeptListCount
Query department list count
informat.dept.queryDeptListCount(filter);| Parameter | Type | Description |
|---|---|---|
| filter | Filter | Query condition |
Return Value
Type: Integer Returns total number of departments
Example
informat.dept.queryDeptListCount({
conditionList: [{ fieldId: "name", opt: "contains", value: "R&D" }],
});1getDept
Query department information
informat.dept.getDept(id);| Parameter | Type | Description |
|---|---|---|
| id | String | Department identifier |
Return Value Type: Dept Returns department information, returns null if department doesn't exist
Example
informat.dept.getDept("yanfabu");{
"id": "yanfabu",
"name": "R&D Department",
"parentId": "root",
"remark": "The department responsible for researching and developing new products, technologies, or services.",
"rowNumber": 2,
"shortName": "R&D"
}getParentOfDept
Query all parent departments of a department
informat.dept.getParentOfDept(deptId);| Parameter | Type | Description |
|---|---|---|
| deptId | String | Department identifier |
Return Value Type: Array<Dept> Returns list of parent departments
Example
informat.dept.getParentOfDept("yanfabu");[
{
"id": "root",
"name": "INFORMAT",
"rowNumber": 1
}
]getChildrenOfDept
Query all child departments
informat.dept.getChildrenOfDept(deptId);| Parameter | Type | Description |
|---|---|---|
| deptId | String | Department identifier |
Return Value Type: Array<Dept> Returns all child departments
Example
informat.dept.getChildrenOfDept("yanfabu");[
{
"id": "yanfa1zu",
"name": "R&D Group 1",
"parentId": "yanfabu",
"rowNumber": 1
},
{
"id": "yanfa2zu",
"name": "R&D Group 2",
"parentId": "yanfabu",
"rowNumber": 2
}
]getDirectChildrenOfDept
Query direct child departments
informat.dept.getDirectChildrenOfDept(deptId);| Parameter | Type | Description |
|---|---|---|
| deptId | String | Department identifier |
Return Value Type: Array<Dept> Returns direct child departments
Example
informat.dept.getDirectChildrenOfDept("yanfabu");[
{
"id": "yanfa1zu",
"name": "R&D Group 1",
"parentId": "yanfabu",
"rowNumber": 1
},
{
"id": "yanfa2zu",
"name": "R&D Group 2",
"parentId": "yanfabu",
"rowNumber": 2
}
]addDept
Add department
informat.dept.addDept(dept);| Parameter | Type | Description |
|---|---|---|
| dept | Dept | Department information |
Return Value
Type: String Returns the identifier of the newly added department
Example
informat.dept.addDept({
id: "yanfabu",
name: "R&D Department",
shortName: "R&D",
parentId: "root",
ownerList: ["zhangsan"],
remark: "The department responsible for researching and developing new products, technologies, or services.",
});updateDept
Update department
informat.dept.updateDept(dept);| Parameter | Type | Description |
|---|---|---|
| dept | Dept | Department |
Example
informat.dept.updateDept({
id: "yanfabu",
name: "R&D Department",
shortName: "R&D",
parentId: "root",
ownerList: ["zhangsan", "lisi"],
remark: "The department responsible for researching and developing new products, technologies, or services.",
});deleteDept
Delete department
informat.dept.deleteDept(deptId);| Parameter | Type | Description |
|---|---|---|
| deptId | String | Department identifier |
Example
informat.dept.deleteDept("yanfabu");
