combotree下拉树
var t;
$("#contractType").combotree({
url:“jsczxc/bibsccentercjgl/BibscCenterCjglController/operation/barContractDaftGettree/3/ContractTypeHigh”,
valueField : ‘id’,
multiple:true,
onlyLeafCheck : true,
onShowPanel : function(){
t = $("#contractType").combotree(“tree”);
var n = t.tree(‘getSelected’); // 获取选择的节点
alert(n.text);
t.tree(‘expandAll’);
var panelWidth = $(this).combotree(‘textbox’).parent().outerWidth(true);
$(this).combotree(‘panel’).panel(‘resize’,{width: panelWidth});
},
onHidePanel:function(){
KaTeX parse error: Expected 'EOF', got '#' at position 3: ("#̲contractTypeNam…("#contractType").combotree(‘getText’));
}
});
/**
* 只查询合同的类型
* @param level
* @param id
* @return
*/
@RequestMapping(value="/operation/barContractDaftGettree/{level}/{parentCode}")
@ResponseBody
public List getBarContractDaftByParentId(@PathVariable(value=“level”)int level,
@PathVariable(value=“parentCode”)String parentCode,@RequestParam(required=false) String id){
//SysListDictionaryDTO nodeByParentCodeNew = this.service.getNodeByParentCodeNew(parentCode);
if(id == null){
id = “-1”;
}else{
level=1;
}
return service.getSysListDictionaryByParentCode(id,level);
}
//按照父id查询数据
public List getSysListDictionaryByParentCode(String parentId,int level){
List tree = new ArrayList();
if (level == 0) {
return null;
}
level–;
String parenIdSql = "select (select count(1) from BIBSC_CENTER_CONTRACT_TYPE t1 where t.ID = t1.PARENT_ID) childCount,\n" +
" t.name,\n" +
" t.PARENT_ID,\n" +
" t.ID\n" +
" from BIBSC_CENTER_CONTRACT_TYPE t where t.PARENT_ID = '"+ parentId +"'";
List<Map<String, Object>> subTrees = dao.getSysListDictionaryByParentCode(parenIdSql);
for (Map<String, Object> map : subTrees) {
TreeNode node = new TreeNode();
node.set_parentId(map.get("PARENT_ID").toString());
String id = map.get("ID").toString();
node.setId(id);
node.setText(map.get("NAME").toString());
HashMap<String, Object> attr = new HashMap<String, Object>(1);
Integer count = Integer.valueOf(map.get("CHILDCOUNT").toString());
attr.put("count",count);
node.setAttributes(attr);
if (count > 0) {
if (level > 0) {
node.setState("open");
} else {
node.setState("closed");
}
node.setChildren(this.getSysListDictionaryByParentCode(id,level));
} else {
node.setState("open");
}
tree.add(node);
}
return tree;
}
public List<Map<String,Object>> getSysListDictionaryByParentCode(String idz);
${value}