Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
luna
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
luna
Commits
287b37d8
Commit
287b37d8
authored
Jun 06, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 优化树搜索展示
parent
ddc798b2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
asset-tree.component.ts
src/app/elements/asset-tree/asset-tree.component.ts
+22
-5
No files found.
src/app/elements/asset-tree/asset-tree.component.ts
View file @
287b37d8
...
...
@@ -4,6 +4,7 @@ import {AppService, LogService} from '../../app.service';
import
{
MAT_DIALOG_DATA
,
MatDialog
,
MatDialogRef
}
from
'@angular/material'
;
import
{
FormControl
,
Validators
}
from
'@angular/forms'
;
import
{
BehaviorSubject
}
from
'rxjs/BehaviorSubject'
;
import
{
forEach
}
from
'@angular-devkit/schematics'
;
declare
var
$
:
any
;
...
...
@@ -32,6 +33,7 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
},
};
hiddenNodes
:
any
;
expandNodes
:
any
;
onCzTreeOnClick
(
event
,
treeId
,
treeNode
,
clickFlag
)
{
if
(
treeNode
.
isParent
)
{
...
...
@@ -221,10 +223,18 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
const
_keywords
=
this
.
query
;
const
nodes
=
zTreeObj
.
transformToArray
(
zTreeObj
.
getNodes
());
if
(
!
_keywords
)
{
zTreeObj
.
showNodes
(
nodes
);
zTreeObj
.
expandAll
(
false
);
const
root
=
zTreeObj
.
getNodes
()[
0
];
zTreeObj
.
expandNode
(
root
);
if
(
this
.
hiddenNodes
)
{
zTreeObj
.
showNodes
(
this
.
hiddenNodes
);
this
.
hiddenNodes
=
null
;
}
if
(
this
.
expandNodes
)
{
this
.
expandNodes
.
forEach
((
node
)
=>
{
if
(
node
.
id
!==
nodes
[
0
].
id
)
{
zTreeObj
.
expandNode
(
node
,
false
);
}
});
this
.
expandNodes
=
null
;
}
return
null
;
}
let
shouldShow
=
[];
...
...
@@ -235,9 +245,16 @@ export class ElementAssetTreeComponent implements OnInit, OnChanges {
shouldShow
=
[...
shouldShow
,
...
parents
,
...
children
,
node
];
}
});
this
.
hiddenNodes
=
nodes
;
this
.
expandNodes
=
shouldShow
;
zTreeObj
.
hideNodes
(
nodes
);
zTreeObj
.
showNodes
(
shouldShow
);
zTreeObj
.
expandAll
(
true
);
shouldShow
.
forEach
((
node
)
=>
{
if
(
node
.
isParent
)
{
zTreeObj
.
expandNode
(
node
,
true
);
}
});
// zTreeObj.expandAll(true);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment