Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ops
/
monitor-ui
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
FengRuwei
9 years ago
Commit
d4abee757fcbe3dd679b9e10fdc2448b4481e443
1 parent
f50e7ad9
同步更新页面
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
monitor-ui-web/src/main/webapp/script/yoho.type.tree.js
monitor-ui-web/src/main/webapp/script/yoho.type.tree.js
View file @
d4abee7
...
...
@@ -105,11 +105,21 @@ var doAddType = function () {
var
isleaf
=
$
(
'#cb_new_type_isleaf'
).
prop
(
"checked"
)
==
true
?
1
:
0
;
$
.
get
(
"type/add"
,
{
"pid"
:
pid
,
"name"
:
name
,
"isleaf"
:
isleaf
},
function
(
data
,
state
)
{
if
(
state
==
"success"
&&
data
.
code
==
200
)
{
var
repjson
=
JSON
.
parse
(
data
);
if
(
state
==
"success"
&&
repjson
.
code
==
200
)
{
$
.
toaster
(
'添加成功'
,
'提示'
,
'info'
);
refreshTypeTree
();
console
.
log
(
repjson
.
data
);
var
newNode
=
repjson
.
data
;
$
(
'#jstree'
).
jstree
().
create_node
(
"#node_"
+
newNode
.
typeParentId
,
{
'id'
:
"node_"
+
newNode
.
typeId
,
'text'
:
newNode
.
typeName
,
'parent'
:
"#node_"
+
newNode
.
typeParentId
,
'data'
:
newNode
.
typeIsLeaf
}
,
'last'
);
}
else
$
.
toaster
(
'添加失败'
+
data
.
code
,
'提示'
,
'warning'
);
$
.
toaster
(
'添加失败'
+
repjson
.
code
,
'提示'
,
'warning'
);
}
).
fail
(
function
()
{
$
.
toaster
(
'添加失败:'
,
'提示'
,
'warning'
);
...
...
@@ -122,11 +132,12 @@ var doUpdateType = function () {
$
.
get
(
"type/update"
,
{
"id"
:
id
,
"name"
:
name
},
function
(
data
,
state
)
{
$
.
toaster
(
'更新成功'
,
'更新'
,
'info'
);
refreshTypeTree
(
);
$
(
"#jstree"
).
jstree
(
'set_text'
,
'#node_'
+
id
,
name
);
}
).
fail
(
function
()
{
$
.
toaster
(
'更新失败:'
,
'提示'
,
'warning'
);
});;
});
;
}
var
doDelType
=
function
()
{
var
id
=
$
(
'#tx_type_id'
).
val
();
...
...
@@ -137,7 +148,8 @@ var doDelType = function () {
}
).
fail
(
function
()
{
$
.
toaster
(
'删除失败:'
,
'提示'
,
'warning'
);
});;
});
;
}
...
...
@@ -212,6 +224,7 @@ $(function () {
"plugins"
:
[
"themes"
,
"checkbox"
,
"contextmenu"
,
"ui"
,
"types"
,
"crrm"
,
"core"
,
"status"
],
'core'
:
{
"themes"
:
{
"theme"
:
"proton"
,
"icons"
:
false
},
'data'
:
treeData
,
...
...
@@ -245,7 +258,8 @@ $(function () {
var
inst
=
jQuery
.
jstree
.
reference
(
obj
.
reference
);
var
clickedNode
=
inst
.
get_node
(
obj
.
reference
);
console
.
log
(
"del operation--clickedNode's id is:"
+
clickedNode
.
id
);
if
(
clickedNode
.
chindlen
.
size
()
>
0
)
{
console
.
log
(
clickedNode
.
children
);
if
(
clickedNode
.
children
.
length
>
0
)
{
$
.
toaster
(
'无法直接删除还有子类型的节点'
,
'提示'
,
'info'
);
return
;
}
...
...
Please
register
or
login
to post a comment