在绑值的时候设置
$(function () { loadCarBsmTreeData(); }) //加载品牌 车型 车款 var carBsmSetting = { check: { enable: true, chkStyle: "radio", radioType: "all" }, data: { simpleData: { enable: true } }, callback: { //beforeCheck: zTreeBeforeCheck, onCheck: onCarBsmCheck } }; //function zTreeBeforeCheck(treeId, treeNode) { // if (treeNode.isParent) { // treeNode.nocheck = true; // return false; // } else { // treeNode.nocheck = true; // return true; // } //}; //加载品牌 车型 车款 function loadCarBsmTreeData() { $.ajax({ type: 'POST', url: "/common/CarBsm/CarBsm?t=" + Math.random(), data: {}, async: true, dataType: "json", success: function (msg) { if (msg.status.code == 1) { $.fn.zTree.init($("#CarBsmRadioTailTree"), carBsmSetting, $.parseJSON(msg.status.sub_msg)); var zTree = $.fn.zTree.getZTreeObj("CarBsmRadioTailTree"), // 获取ztree对象 node = zTree.getNodes(), //获取根节点 nodes = zTree.transformToArray(node); //遍历所有节点 if (nodes.length > 0) { for (var i = 0; i < nodes.length; i++) { if (nodes[i].isParent) { nodes[i].nocheck = true; } else { nodes[i].nocheck = false; } zTree.updateNode(nodes[i]); } } //zTree.setting.callback.onCheck(zTree, zTree.setting.treeId, node); // 调用回调 //zTree.setting.callback.beforeCheck(zTree.setting.treeId, node); } }, error: function (a, b, c) { } }); } //配件车型树 选择事件 function onCarBsmCheck(e, treeId, treeNode) { var code = treeNode.id; var name = treeNode.name; window.parent.CarBsmRadio_CallBack(code, name, $("#code").val(), $("#name").val(), $("#type").val()); } function clearWindow() { window.parent.CarBsmRadio_CallBack("", "", $("#code").val(), $("#name").val(), $("#type").val()); } function setCarBsm() { window.parent.closeWindowtwo(); }