code review:商品管理

This commit is contained in:
YunaiV
2023-06-03 20:50:07 +08:00
parent 541b23c8c1
commit 158585670c
7 changed files with 29 additions and 11 deletions

View File

@ -306,11 +306,14 @@ export const handleTree2 = (data, id, parentId, children, rootId) => {
})
return treeData !== '' ? treeData : data
}
/**
* 校验选中的节点,是否为指定 level
*
* @param tree 要操作的树结构数据
* @param nodeId 需要判断在什么层级的数据
* @param level 检查的级别, 默认检查到二级
* @return true 是false 否
*/
export const checkSelectedNode = (tree: any[], nodeId: any, level = 2): boolean => {
if (typeof tree === 'undefined' || !Array.isArray(tree) || tree.length === 0) {