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
f50e7ad901d742b431512ca10d7fc7b01cf37f48
1 parent
5eaf03ed
js添加失败提示
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
9 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 @
f50e7ad
...
...
@@ -102,13 +102,18 @@ var addMObjType = function (nodeid, name) {
var
doAddType
=
function
()
{
var
pid
=
$
(
'#tx_type_id'
).
val
();
var
name
=
$
(
'#tx_new_type_name'
).
val
();
var
isleaf
=
1
;
var
isleaf
=
$
(
'#cb_new_type_isleaf'
).
prop
(
"checked"
)
==
true
?
1
:
0
;
$
.
get
(
"type/add"
,
{
"pid"
:
pid
,
"name"
:
name
,
"isleaf"
:
isleaf
},
function
(
data
,
state
)
{
$
.
toaster
(
'添加成功'
,
'添加'
,
'info'
);
refreshTypeTree
();
if
(
state
==
"success"
&&
data
.
code
==
200
)
{
$
.
toaster
(
'添加成功'
,
'提示'
,
'info'
);
refreshTypeTree
();
}
else
$
.
toaster
(
'添加失败'
+
data
.
code
,
'提示'
,
'warning'
);
}
);
).
fail
(
function
()
{
$
.
toaster
(
'添加失败:'
,
'提示'
,
'warning'
);
});
}
var
doUpdateType
=
function
()
{
var
id
=
$
(
'#tx_type_id'
).
val
();
...
...
@@ -119,7 +124,9 @@ var doUpdateType = function () {
$
.
toaster
(
'更新成功'
,
'更新'
,
'info'
);
refreshTypeTree
();
}
);
).
fail
(
function
()
{
$
.
toaster
(
'更新失败:'
,
'提示'
,
'warning'
);
});;
}
var
doDelType
=
function
()
{
var
id
=
$
(
'#tx_type_id'
).
val
();
...
...
@@ -128,7 +135,9 @@ var doDelType = function () {
function
(
data
,
state
)
{
$
(
'#jstree'
).
jstree
(
"delete_node"
,
$
(
"#"
+
id
));
}
);
).
fail
(
function
()
{
$
.
toaster
(
'删除失败:'
,
'提示'
,
'warning'
);
});;
}
...
...
@@ -216,9 +225,11 @@ $(function () {
"action"
:
function
(
obj
)
{
var
inst
=
jQuery
.
jstree
.
reference
(
obj
.
reference
);
var
clickedNode
=
inst
.
get_node
(
obj
.
reference
);
console
.
log
(
obj
);
console
.
log
(
clickedNode
);
console
.
log
(
"add operation--clickedNode's id is:"
+
clickedNode
.
id
);
console
.
log
(
"add operation--clickedNode's id is:"
+
clickedNode
.
id
+
" "
+
clickedNode
);
if
(
clickedNode
.
data
!=
0
)
{
$
.
toaster
(
'叶子节点无法添加子类型'
,
'提示'
,
'info'
);
return
;
}
addType
(
clickedNode
);
}
},
"UPDATE"
:
{
...
...
@@ -234,6 +245,10 @@ $(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
)
{
$
.
toaster
(
'无法直接删除还有子类型的节点'
,
'提示'
,
'info'
);
return
;
}
delType
(
clickedNode
.
id
);
}
},
"ADDM"
:
{
...
...
@@ -242,6 +257,10 @@ $(function () {
var
inst
=
jQuery
.
jstree
.
reference
(
obj
.
reference
);
var
clickedNode
=
inst
.
get_node
(
obj
.
reference
);
console
.
log
(
"add minfo--clickedNode's id is : "
+
clickedNode
.
id
);
if
(
clickedNode
.
data
!=
1
)
{
$
.
toaster
(
'非叶子节点无法添加子类型'
,
'提示'
,
'info'
);
return
;
}
addMObjType
(
clickedNode
.
id
,
clickedNode
.
text
);
}
}
...
...
Please
register
or
login
to post a comment