Commit 0ef9f594 by cwq0219

Merge branch 'master' of http://192.168.3.233:8090/h5/account

2 parents 30b96497 123f86f6
...@@ -350,12 +350,12 @@ ...@@ -350,12 +350,12 @@
} else { } else {
console.log(11) console.log(11)
const arr = [] const arr = []
arr.push(merchantId) arr.push(+merchantId)
visibleMerchant = tree.create('visibleInferiorMerTree', res.data) visibleMerchant = tree.create('visibleInferiorMerTree', res.data, {checkedList: arr})
var node = visibleMerchant.getNodesByParam('id', merchantId, {checkedList: arr}) var node = visibleMerchant.getNodesByParam('id', merchantId)
// console.log(node, visibleMerchant) console.log(node, visibleMerchant)
// node.checked = true // node.checked = true
visibleMerchant.checkNode(node, true, true) // visibleMerchant.checkNode(node, true, true)
// visibleMerchant.updateNode(node) // visibleMerchant.updateNode(node)
all_nodes = visibleMerchant.getNodes() all_nodes = visibleMerchant.getNodes()
bindEvent() bindEvent()
......
...@@ -40,18 +40,23 @@ layui.define(['ztree'], function (exports) { ...@@ -40,18 +40,23 @@ layui.define(['ztree'], function (exports) {
// } // }
// }, 20) // }, 20)
// console.log(!treeNode.children) // console.log(!treeNode.children)
if (inst) { // if (inst) {
inst.updateNode(treeNode) // inst.updateNode(treeNode)
} else if(!treeNode.children) { // }
rootNoChildCheckedNode.push(treeNode) //else if (!treeNode.children) {
// console.log(rootNoChildCheckedNode, '==============') // rootNoChildCheckedNode.push(treeNode)
} // // console.log(rootNoChildCheckedNode, '==============')
// }
} }
} }
if (gtree.opt && gtree.opt.chkDisabled) { if (gtree.opt && gtree.opt.chkDisabled) {
treeNode.chkDisabled = true treeNode.chkDisabled = true
} }
} }
function zTreeOnExpand(event, treeId, treeNode) {
console.log(treeNode)
treeNode.check=true
}
var setting = { var setting = {
view: { view: {
selectedMulti: false, selectedMulti: false,
...@@ -70,7 +75,8 @@ layui.define(['ztree'], function (exports) { ...@@ -70,7 +75,8 @@ layui.define(['ztree'], function (exports) {
} }
}, },
callback: { callback: {
onNodeCreated: onNodeCreated onNodeCreated: onNodeCreated,
onExpand: zTreeOnExpand
} }
} }
var inst = null var inst = null
...@@ -84,11 +90,17 @@ layui.define(['ztree'], function (exports) { ...@@ -84,11 +90,17 @@ layui.define(['ztree'], function (exports) {
if (check == 0) setting.check.enable = false if (check == 0) setting.check.enable = false
inst = tree.init($treeDom, setting, nodes) inst = tree.init($treeDom, setting, nodes)
inst.expandAll(true) inst.expandAll(true)
// console.log(rootNoChildCheckedNode) if (opt && opt.checkedList) {
$.each(rootNoChildCheckedNode, function(index, item) { var nodes = inst.getCheckedNodes()
console.log(item, '============') var checked = opt.checkedList
inst.checkNode(item, true) $.each(nodes, function (index, item) {
}) if (checked.indexOf(item.id) == -1) {
item.checked = false
inst.updateNode(item)
}
})
}
// inst.refresh()
return inst return inst
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!