$("#selClassify").combotree({
url: "/SupplierManager/GoodsMgr/GetAllSupMatClsTree",
required: "",
loadFilter: function (data) {
if (data.IsSuccess) {
$("#selClassify").combotree("setValue",@Model.MatClassId);
return ztreeDataUpdate(data.Data)
} else {
return [];
}
}
});
function ztreeDataUpdate(data) {
data.forEach(function (r, i) {
console.log(JSON.stringify(r));
r.text = r.Name;
r.id = r.Id;
r.children = r.Childs;
if (r.children && r.children.length > 0) {
ztreeDataUpdate(r.children);
}
});
return data;
}
{"Data":[{"Id":100,"Name":"蔬菜","Count":1,"Childs":[{"Id":105,"Name":"叶菜","Count":0,"Childs":[]}]},{"Id":101,"Name":"肉禽蛋品","Count":4,"Childs":[{"Id":106,"Name":"猪肉","Count":0,"Childs":[]},{"Id":107,"Name":"牛肉","Count":0,"Childs":[]},{"Id":108,"Name":"羊肉","Count":0,"Childs":[]},{"Id":109,"Name":"鸡鸭兔","Count":0,"Childs":[]}]},{"Id":102,"Name":"粮油干杂","Count":2,"Childs":[{"Id":110,"Name":"大米","Count":0,"Childs":[]},{"Id":111,"Name":"食用油","Count":0,"Childs":[]}]},{"Id":103,"Name":"调味品","Count":0,"Childs":[]},{"Id":113,"Name":"大分类","Count":0,"Childs":[]}],"IsSuccess":true,"Code":0,"Message":null}