Merge branch 'master' of http://git.yoho.cn/ops/monitor-ui
Showing
2 changed files
with
29 additions
and
21 deletions
@@ -69,11 +69,27 @@ | @@ -69,11 +69,27 @@ | ||
69 | 69 | ||
70 | <script type="text/javascript"> | 70 | <script type="text/javascript"> |
71 | function clickMenuToPage(page){ | 71 | function clickMenuToPage(page){ |
72 | - var g = page.replace(/\//g,"").replace(".",""); | ||
73 | - $("#"+g).addClass("active").siblings().removeClass("active"); | ||
74 | - //加载左侧内容 | ||
75 | - $("#content").load(contextPath+page); | ||
76 | - } | 72 | + var g = page.replace(/\//g,"").replace(".",""); |
73 | + $("#"+g).addClass("active").siblings().removeClass("active"); | ||
74 | + //加载左侧内容 | ||
75 | + $("#content").load(contextPath+page); | ||
76 | + } | ||
77 | + | ||
78 | + function localAlert(title,message){ | ||
79 | + var dialog = $("<div>").appendTo($("body")); | ||
80 | + dialog.dialog({ | ||
81 | + title : title, | ||
82 | + backdrop : "static", | ||
83 | + content : message, | ||
84 | + buttons : [{ | ||
85 | + text : "确定", | ||
86 | + className : "btn-danger", | ||
87 | + onclick : function() { | ||
88 | + $(dialog).dialog("hide"); | ||
89 | + } | ||
90 | + }] | ||
91 | + }); | ||
92 | + } | ||
77 | </script> | 93 | </script> |
78 | </body> | 94 | </body> |
79 | </html> | 95 | </html> |
@@ -134,11 +134,15 @@ | @@ -134,11 +134,15 @@ | ||
134 | data: param, | 134 | data: param, |
135 | dataType: 'json', | 135 | dataType: 'json', |
136 | success: function (data) { | 136 | success: function (data) { |
137 | - $("#myModal").modal('hide'); | ||
138 | - $("#hostGroupTable").table("load"); | 137 | + if (!data || data.code != 200) { |
138 | + localAlert('删除失败',data.message); | ||
139 | + }else{ | ||
140 | + $("#myModal").modal('hide'); | ||
141 | + $("#hostGroupTable").table("load"); | ||
142 | + } | ||
139 | }, | 143 | }, |
140 | error: function (data) { | 144 | error: function (data) { |
141 | - layer.msg("系统异常", {icon: 2}); | 145 | + localAlert('系统异常',data.message); |
142 | } | 146 | } |
143 | }); | 147 | }); |
144 | } | 148 | } |
@@ -171,19 +175,7 @@ | @@ -171,19 +175,7 @@ | ||
171 | dataType : "json", | 175 | dataType : "json", |
172 | success : function(data) { | 176 | success : function(data) { |
173 | if (!data || data.code != 200) { | 177 | if (!data || data.code != 200) { |
174 | - var dialog = $("<div>").appendTo($("body")); | ||
175 | - dialog.dialog({ | ||
176 | - title : "删除失败", | ||
177 | - backdrop : "static", | ||
178 | - content : '系统异常', | ||
179 | - buttons : [{ | ||
180 | - text : "确定", | ||
181 | - className : "btn-danger", | ||
182 | - onclick : function() { | ||
183 | - $(dialog).dialog("hide"); | ||
184 | - } | ||
185 | - }] | ||
186 | - }); | 178 | + localAlert('删除失败',data.message); |
187 | } | 179 | } |
188 | $("#hostGroupTable").table("load"); | 180 | $("#hostGroupTable").table("load"); |
189 | } | 181 | } |
-
Please register or login to post a comment