💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
``` var searchbtn = $("#admin-personnel-left-search-btn"), foundkey, foundarr, i; searchbtn.click(function () { var searchcontent = $("#admin-personnel-left-search-content").val(); if (searchcontent != "") { var id; /* var searchcontent = $("#admin-personnel-left-search-content").val(); */ if (foundkey === searchcontent) { id = foundarr[i++].id } else { foundarr = []; i = 0; tree.getNodesByName(searchcontent, foundarr); id = foundarr[i++].id foundkey = searchcontent; } // var id = tree.findNodeByName(searchcontent, foundid).id; $('#admin-personnel-people .highlight').removeClass('highlight'); var elm = $('[data-id="' + id + '"]>div>a>cite'); elm.addClass('highlight'); var wraper = $('#admin-personnel-left'); //当前可视窗的高 wraper.scrollTop(wraper.scrollTop() + elm.offset().top - 400); } else { $('#admin-personnel-people .highlight').removeClass('highlight'); } }) ``` ``` //查询到对应的值 Atree.prototype.getNodesByName = function (name, arr, node){ if(!node){ node = {}; node.children = this.$options.nodes; } // 相似记录 到 arr 中 if(node[this.nameKey]&&node[this.nameKey].indexOf(name) != -1){ arr.push(node); } // 检查是否有 子集, 有则遍历子, 无则返回 var children = node.children, len = children&&children.length; if(len){ for(var i = 0; i < len; i++){ this.getNodesByName(name, arr, children[i]); } }else{ return; } } ```