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 c20f63dc
authored
Aug 19, 2021
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
tijao
1 parent
a52cdeef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
17 deletions
html/employee/add.html
js/gtree.js
html/employee/add.html
View file @
c20f63d
...
@@ -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
()
...
...
js/gtree.js
View file @
c20f63d
...
@@ -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
}
}
}
}
...
...
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