This commit is contained in:
@@ -15,6 +15,11 @@ export const DictEnum = {
|
||||
WF_FORM_TYPE: 'wf_form_type', // 表单类型
|
||||
WF_TASK_STATUS: 'wf_task_status', // 任务状态
|
||||
WY_SF: 'wy_sf',
|
||||
wy_sqlx: 'wy_sqlx', // 社区类型
|
||||
sys_build_use_type: 'sis_build_use_type', // 建筑用途
|
||||
wy_room_type: 'room_type', // 房间类型
|
||||
wy_fjzt: 'wy_fjzt', // 房间状态
|
||||
wy_direction_towards: 'direction_towards', // 房间朝向
|
||||
|
||||
SIS_ACCESS_CONTROL_DEVICE_TYPE: 'sis_access_control_device_type',
|
||||
SIS_LIB_TYPE: 'sis_lib_type',
|
||||
|
@@ -276,6 +276,43 @@ export function addFullName(
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 添加全名 如 祖先节点-父节点-子节点
|
||||
* @param treeData 已经是tree数据
|
||||
* @param labelName 标签的字段名称
|
||||
* @param splitStr 分隔符
|
||||
* @param callback 回调函数
|
||||
* @returns void 无返回值 会修改原始数据
|
||||
*/
|
||||
export function handleNode(
|
||||
treeData: any[],
|
||||
labelName = 'label',
|
||||
splitStr = '-',
|
||||
callback: Function,
|
||||
) {
|
||||
function addFullNameProperty(
|
||||
node: any,
|
||||
parentNames: any[] = [],
|
||||
parentNode: any = null,
|
||||
) {
|
||||
const fullNameParts = [...parentNames, node[labelName]];
|
||||
node.fullName = fullNameParts.join(splitStr);
|
||||
if (callback) {
|
||||
callback(node, parentNode);
|
||||
}
|
||||
if (node.children && node.children.length > 0) {
|
||||
node.children.forEach((childNode: any) => {
|
||||
addFullNameProperty(childNode, fullNameParts, node);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
treeData.forEach((item: any) => {
|
||||
addFullNameProperty(item);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* https://blog.csdn.net/Web_J/article/details/129281329
|
||||
* 给出节点nodeId 找到所有父节点ID
|
||||
|
Reference in New Issue
Block a user