Home > LIB_Classification > getAllClassificationTree
LIB_Classification.getAllClassificationTree() method
This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Warning: This API is now obsolete.
since EDA v3.2; dropped EDA v3.3
Get the tree composed of all classification information
Signature
typescript
function getAllClassificationTree(
libraryUuid: string,
libraryType: ELIB_LibraryType,
): Promise<
Array<{ name: string; uuid: string; children?: undefined | { name: string; uuid: string }[] }>
>;1
2
3
4
5
6
2
3
4
5
6
Parameters
Parameter | Type | Description |
|---|---|---|
libraryUuid | string | Library UUID |
libraryType | Library type |
Returns
Promise<Array<{ name: string; uuid: string; children?: undefined | { name: string; uuid: string }[] }>>
Tree structure data composed of classification information
Example
javascript
// 1. 获取个人库 UUID
const libraryUuid = await eda.lib_LibrariesList.getPersonalLibraryUuid();
// 2. 创建一个测试分类,让树里有可见数据(复用模块库,ELIB_LibraryType.CBB = '1')
const name = `嘉立创示例_树查询_${Date.now()}`;
const index = await eda.lib_Classification.createPrimary(libraryUuid, '1', name);
// 3. 读取完整分类树
const tree = await eda.lib_Classification.getAllClassificationTree(libraryUuid, '1');
// 4. 清理测试分类(查询类需要清理)
await eda.lib_Classification.deleteByUuid(libraryUuid, index.primaryClassificationUuid);
// 5. 输出树结构
console.log('total:', tree.length);
tree.forEach((node, i) => {
console.log(`[${i}] name:`, node.name, 'uuid:', node.uuid, 'children:', (node.children || []).length);
});1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18