Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
account
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0ef9f594
authored
Aug 19, 2021
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
http://192.168.3.233:8090/h5/account
2 parents
30b96497
123f86f6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
16 deletions
html/employee/add.html
js/gtree.js
html/employee/add.html
View file @
0ef9f59
...
...
@@ -350,12 +350,12 @@
}
else
{
console
.
log
(
11
)
const
arr
=
[]
arr
.
push
(
merchantId
)
visibleMerchant
=
tree
.
create
(
'visibleInferiorMerTree'
,
res
.
data
)
var
node
=
visibleMerchant
.
getNodesByParam
(
'id'
,
merchantId
,
{
checkedList
:
arr
}
)
//
console.log(node, visibleMerchant)
arr
.
push
(
+
merchantId
)
visibleMerchant
=
tree
.
create
(
'visibleInferiorMerTree'
,
res
.
data
,
{
checkedList
:
arr
}
)
var
node
=
visibleMerchant
.
getNodesByParam
(
'id'
,
merchantId
)
console
.
log
(
node
,
visibleMerchant
)
// node.checked = true
visibleMerchant
.
checkNode
(
node
,
true
,
true
)
//
visibleMerchant.checkNode(node, true, true)
// visibleMerchant.updateNode(node)
all_nodes
=
visibleMerchant
.
getNodes
()
bindEvent
()
...
...
js/gtree.js
View file @
0ef9f59
...
...
@@ -40,18 +40,23 @@ layui.define(['ztree'], function (exports) {
// }
// }, 20)
// console.log(!treeNode.children)
if
(
inst
)
{
inst
.
updateNode
(
treeNode
)
}
else
if
(
!
treeNode
.
children
)
{
rootNoChildCheckedNode
.
push
(
treeNode
)
// console.log(rootNoChildCheckedNode, '==============')
}
// if (inst) {
// inst.updateNode(treeNode)
// }
//else if (!treeNode.children) {
// rootNoChildCheckedNode.push(treeNode)
// // console.log(rootNoChildCheckedNode, '==============')
// }
}
}
if
(
gtree
.
opt
&&
gtree
.
opt
.
chkDisabled
)
{
treeNode
.
chkDisabled
=
true
}
}
function
zTreeOnExpand
(
event
,
treeId
,
treeNode
)
{
console
.
log
(
treeNode
)
treeNode
.
check
=
true
}
var
setting
=
{
view
:
{
selectedMulti
:
false
,
...
...
@@ -70,7 +75,8 @@ layui.define(['ztree'], function (exports) {
}
},
callback
:
{
onNodeCreated
:
onNodeCreated
onNodeCreated
:
onNodeCreated
,
onExpand
:
zTreeOnExpand
}
}
var
inst
=
null
...
...
@@ -84,11 +90,17 @@ layui.define(['ztree'], function (exports) {
if
(
check
==
0
)
setting
.
check
.
enable
=
false
inst
=
tree
.
init
(
$treeDom
,
setting
,
nodes
)
inst
.
expandAll
(
true
)
// console.log(rootNoChildCheckedNode)
$
.
each
(
rootNoChildCheckedNode
,
function
(
index
,
item
)
{
console
.
log
(
item
,
'============'
)
inst
.
checkNode
(
item
,
true
)
if
(
opt
&&
opt
.
checkedList
)
{
var
nodes
=
inst
.
getCheckedNodes
()
var
checked
=
opt
.
checkedList
$
.
each
(
nodes
,
function
(
index
,
item
)
{
if
(
checked
.
indexOf
(
item
.
id
)
==
-
1
)
{
item
.
checked
=
false
inst
.
updateNode
(
item
)
}
})
}
// inst.refresh()
return
inst
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment