Merge branch 'master-mj-joke' into 'master-mj'
feat:采集器、域管理、指标过滤、ip视图、trap页面集成(可以打开,具体功能未测试) feat:采集器、域管理、指标过滤、ip视图、trap页面集成(可以打开,具体功能未测试) See merge request !1094
Showing
8 changed files
with
230 additions
and
75 deletions
@@ -203,8 +203,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -203,8 +203,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
203 | done: function (res) { | 203 | done: function (res) { |
204 | // 编辑事件 | 204 | // 编辑事件 |
205 | $('.link-collector-edit').unbind('click').click(function () { | 205 | $('.link-collector-edit').unbind('click').click(function () { |
206 | - if ($.inArray('back:collector:update', checkList) == -1) { | ||
207 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 206 | + if (!common.hasPermission('back:collector:update')){ |
208 | return; | 207 | return; |
209 | } | 208 | } |
210 | var collector = JSON.parse(JSON.stringify(res.data[$(this).data('index')])); | 209 | var collector = JSON.parse(JSON.stringify(res.data[$(this).data('index')])); |
@@ -217,8 +216,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -217,8 +216,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
217 | 216 | ||
218 | // 查看资源列表事件(绑定资源) | 217 | // 查看资源列表事件(绑定资源) |
219 | $('.link-collector-reslist').unbind('click').click(function () { | 218 | $('.link-collector-reslist').unbind('click').click(function () { |
220 | - if ($.inArray('back:collector:addResources', checkList) == -1) { | ||
221 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 219 | + if (!common.hasPermission('back:collector:addResources')){ |
222 | return; | 220 | return; |
223 | } | 221 | } |
224 | collectorId = $(this).data('collectorid'); | 222 | collectorId = $(this).data('collectorid'); |
@@ -239,8 +237,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -239,8 +237,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
239 | }); | 237 | }); |
240 | //下载采集器 | 238 | //下载采集器 |
241 | $("[collector-data-download]").unbind('click').on("click", function () { | 239 | $("[collector-data-download]").unbind('click').on("click", function () { |
242 | - if ($.inArray('back:collector:download', checkList) == -1) { | ||
243 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 240 | + if (!common.hasPermission('back:collector:download')){ |
244 | return; | 241 | return; |
245 | } | 242 | } |
246 | var collectorId = $(this).attr("collector-data-download"); | 243 | var collectorId = $(this).attr("collector-data-download"); |
@@ -277,8 +274,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -277,8 +274,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
277 | 274 | ||
278 | // 同步事件 | 275 | // 同步事件 |
279 | $('button[collector-data-sync]').unbind('click').on('click', function () { | 276 | $('button[collector-data-sync]').unbind('click').on('click', function () { |
280 | - if ($.inArray('back:collector:synchronization', checkList) == -1) { | ||
281 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 277 | + if (!common.hasPermission('back:collector:synchronization')){ |
282 | return; | 278 | return; |
283 | } | 279 | } |
284 | var collector = JSON.parse(JSON.stringify(res.data[$(this).attr('collector-data-sync')])); | 280 | var collector = JSON.parse(JSON.stringify(res.data[$(this).attr('collector-data-sync')])); |
@@ -360,8 +356,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -360,8 +356,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
360 | } | 356 | } |
361 | }); | 357 | }); |
362 | $(this).parents('tr').eq(0).addClass("tbody-tr-background-color"); | 358 | $(this).parents('tr').eq(0).addClass("tbody-tr-background-color"); |
363 | - if ($.inArray('back:collector:copy', checkList) == -1) { | ||
364 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 359 | + if (!common.hasPermission('back:collector:copy')){ |
365 | return; | 360 | return; |
366 | } | 361 | } |
367 | if (common.copyText($(this).attr('collector-data-copy'), 'collector-query-form')) { | 362 | if (common.copyText($(this).attr('collector-data-copy'), 'collector-query-form')) { |
@@ -395,8 +390,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -395,8 +390,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
395 | }); | 390 | }); |
396 | // 部署采集器 | 391 | // 部署采集器 |
397 | $('button[collector-data-deploy]').unbind('click').on('click', function () { | 392 | $('button[collector-data-deploy]').unbind('click').on('click', function () { |
398 | - if ($.inArray('back:collector:deploy', checkList) == -1) { | ||
399 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 393 | + if (!common.hasPermission('back:collector:deploy')){ |
400 | return; | 394 | return; |
401 | } | 395 | } |
402 | var collectorId = $(this).attr('collector-data-deploy'); | 396 | var collectorId = $(this).attr('collector-data-deploy'); |
@@ -404,8 +398,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -404,8 +398,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
404 | }); | 398 | }); |
405 | // 启动采集器 | 399 | // 启动采集器 |
406 | $('button[collector-data-start]').unbind('click').on('click', function () { | 400 | $('button[collector-data-start]').unbind('click').on('click', function () { |
407 | - if ($.inArray('back:collector:start', checkList) == -1) { | ||
408 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 401 | + if (!common.hasPermission('back:collector:start')){ |
409 | return; | 402 | return; |
410 | } | 403 | } |
411 | var collectorId = $(this).attr('collector-data-start'); | 404 | var collectorId = $(this).attr('collector-data-start'); |
@@ -464,8 +457,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -464,8 +457,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
464 | 457 | ||
465 | // 停止采集器 | 458 | // 停止采集器 |
466 | $('button[collector-data-stop]').unbind('click').on('click', function () { | 459 | $('button[collector-data-stop]').unbind('click').on('click', function () { |
467 | - if ($.inArray('back:collector:stop', checkList) == -1) { | ||
468 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 460 | + if (!common.hasPermission('back:collector:stop')){ |
469 | return; | 461 | return; |
470 | } | 462 | } |
471 | var collectorId = $(this).attr('collector-data-stop'); | 463 | var collectorId = $(this).attr('collector-data-stop'); |
@@ -474,8 +466,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -474,8 +466,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
474 | 466 | ||
475 | // 解绑全部资源 | 467 | // 解绑全部资源 |
476 | $('button[collector-data-unbindRes]').unbind('click').on('click',function (){ | 468 | $('button[collector-data-unbindRes]').unbind('click').on('click',function (){ |
477 | - if ($.inArray('back:collector:start', checkList) == -1) { | ||
478 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 469 | + if (!common.hasPermission('back:collector:start')){ |
479 | return; | 470 | return; |
480 | } | 471 | } |
481 | let collectorId = $(this).attr('collector-data-unbindRes'); | 472 | let collectorId = $(this).attr('collector-data-unbindRes'); |
@@ -562,16 +553,14 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -562,16 +553,14 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
562 | 553 | ||
563 | // 新增按钮事件 | 554 | // 新增按钮事件 |
564 | $('#btn-collector-add').unbind('click').click(function () { | 555 | $('#btn-collector-add').unbind('click').click(function () { |
565 | - if ($.inArray('back:collector:save', checkList) == -1) { | ||
566 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 556 | + if (!common.hasPermission('back:collector:save')){ |
567 | return; | 557 | return; |
568 | } | 558 | } |
569 | saveCollector('insert', '新增'); | 559 | saveCollector('insert', '新增'); |
570 | }); | 560 | }); |
571 | // 创建采集器 | 561 | // 创建采集器 |
572 | $('#btn-collector-generate').unbind('click').click(function () { | 562 | $('#btn-collector-generate').unbind('click').click(function () { |
573 | - if ($.inArray('back:collector:generate', checkList) === -1) { | ||
574 | - layer.msg('暂无权限!', {icon: 0}); | 563 | + if (!common.hasPermission('back:collector:generate')){ |
575 | return; | 564 | return; |
576 | } | 565 | } |
577 | common.openWin("/baseconfig/collector/generate", '<a class="layui-icon layui-icon-edit win_title_icon"></a>创建采集器', null, ['创建', '取消'], function () { | 566 | common.openWin("/baseconfig/collector/generate", '<a class="layui-icon layui-icon-edit win_title_icon"></a>创建采集器', null, ['创建', '取消'], function () { |
@@ -594,8 +583,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -594,8 +583,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
594 | 583 | ||
595 | // 删除按钮事件 | 584 | // 删除按钮事件 |
596 | $('#btn-collector-delete').unbind('click').click(function () { | 585 | $('#btn-collector-delete').unbind('click').click(function () { |
597 | - if ($.inArray('back:collector:delete', checkList) == -1) { | ||
598 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 586 | + if (!common.hasPermission('back:collector:delete')){ |
599 | return; | 587 | return; |
600 | } | 588 | } |
601 | var checks = getSelectedCollectorData(); | 589 | var checks = getSelectedCollectorData(); |
@@ -632,8 +620,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -632,8 +620,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
632 | 620 | ||
633 | // 批量同步 | 621 | // 批量同步 |
634 | $('#btn-collector-sync').unbind('click').on('click', function () { | 622 | $('#btn-collector-sync').unbind('click').on('click', function () { |
635 | - if ($.inArray('back:collector:synchronization', checkList) == -1) { | ||
636 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 623 | + if (!common.hasPermission('back:collector:synchronization')){ |
637 | return; | 624 | return; |
638 | } | 625 | } |
639 | var $btn = $(this); | 626 | var $btn = $(this); |
@@ -710,8 +697,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -710,8 +697,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
710 | 697 | ||
711 | // 发送采集器(部署) | 698 | // 发送采集器(部署) |
712 | $('#btn-collector-deploy').unbind('click').on('click', function () { | 699 | $('#btn-collector-deploy').unbind('click').on('click', function () { |
713 | - if ($.inArray('back:collector:deploy', checkList) == -1) { | ||
714 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 700 | + if (!common.hasPermission('back:collector:deploy')){ |
715 | return; | 701 | return; |
716 | } | 702 | } |
717 | var checks = getSelectedCollectorData(); | 703 | var checks = getSelectedCollectorData(); |
@@ -799,8 +785,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -799,8 +785,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
799 | 785 | ||
800 | // 上传采集器模板 | 786 | // 上传采集器模板 |
801 | $('#btn-collector-upload').unbind('click').on('click', function () { | 787 | $('#btn-collector-upload').unbind('click').on('click', function () { |
802 | - if ($.inArray('back:collector:uploading', checkList) == -1) { | ||
803 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 788 | + if (!common.hasPermission('back:collector:uploading')){ |
804 | return; | 789 | return; |
805 | } | 790 | } |
806 | layer.prompt({ | 791 | layer.prompt({ |
@@ -845,8 +830,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -845,8 +830,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
845 | 830 | ||
846 | // 启动采集器 | 831 | // 启动采集器 |
847 | $('#btn-collector-start').unbind('click').on('click', function () { | 832 | $('#btn-collector-start').unbind('click').on('click', function () { |
848 | - if ($.inArray('back:collector:start', checkList) == -1) { | ||
849 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 833 | + if (!common.hasPermission('back:collector:start')){ |
850 | return; | 834 | return; |
851 | } | 835 | } |
852 | var $btn = $(this); | 836 | var $btn = $(this); |
@@ -923,8 +907,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | @@ -923,8 +907,7 @@ layui.define(['table', 'form', 'sessions', 'common', 'view', 'admin', 'upload', | ||
923 | 907 | ||
924 | // 停止采集器 | 908 | // 停止采集器 |
925 | $('#btn-collector-stop').unbind('click').on('click', function () { | 909 | $('#btn-collector-stop').unbind('click').on('click', function () { |
926 | - if ($.inArray('back:collector:stop', checkList) == -1) { | ||
927 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 910 | + if (!common.hasPermission('back:collector:stop')){ |
928 | return; | 911 | return; |
929 | } | 912 | } |
930 | var checks = getSelectedCollectorData(); | 913 | var checks = getSelectedCollectorData(); |
@@ -4382,6 +4382,16 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele | @@ -4382,6 +4382,16 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele | ||
4382 | // ,function () { | 4382 | // ,function () { |
4383 | // layer.close(detailTips); | 4383 | // layer.close(detailTips); |
4384 | // } | 4384 | // } |
4385 | + }, | ||
4386 | + openResDetail: function(resId, name) { | ||
4387 | + //统一平台详情页 | ||
4388 | + let win = window.parent; | ||
4389 | + if (win) { | ||
4390 | + window.parent.postMessage({ | ||
4391 | + type: 'resDetail', | ||
4392 | + message: {'params':{'resId':resId},'title':name} | ||
4393 | + }, '*') | ||
4394 | + } | ||
4385 | } | 4395 | } |
4386 | }; | 4396 | }; |
4387 | 4397 |
@@ -30,8 +30,7 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', | @@ -30,8 +30,7 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', | ||
30 | }); | 30 | }); |
31 | //新增 | 31 | //新增 |
32 | $("#adddomainManage").unbind().on("click", function () { | 32 | $("#adddomainManage").unbind().on("click", function () { |
33 | - if ($.inArray('back:menus:save', checkList) == -1) { | ||
34 | - layer.msg('暂无权限!', {icon: 7, time: 3000}); | 33 | + if (!common.hasPermission('back:menus:save')){ |
35 | return; | 34 | return; |
36 | } | 35 | } |
37 | openAddHtml(); | 36 | openAddHtml(); |
@@ -130,10 +129,10 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', | @@ -130,10 +129,10 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', | ||
130 | 129 | ||
131 | function setDefaultMenu(domainManageId) { | 130 | function setDefaultMenu(domainManageId) { |
132 | var setIndex = layer.load(2); | 131 | var setIndex = layer.load(2); |
133 | - $.ajax({ | 132 | + admin.req({ |
134 | type: 'get', | 133 | type: 'get', |
135 | - url: domainName + '/api-user/menus/findDefaultMenusBydomainManageId/' + domainManageId + '?access_token=' + accessToken, | ||
136 | - success: function (data) { | 134 | + url: domainName + '/api-user/menus/findDefaultMenusBydomainManageId/' + domainManageId, |
135 | + }).done(function (data) { | ||
137 | layer.close(setIndex); | 136 | layer.close(setIndex); |
138 | var _html = "<div style='text-align:center;height: 120px;width: 500px;position: relative;color: black;'>" + | 137 | var _html = "<div style='text-align:center;height: 120px;width: 500px;position: relative;color: black;'>" + |
139 | "<div style='margin: 40px auto'>" + | 138 | "<div style='margin: 40px auto'>" + |
@@ -171,30 +170,87 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', | @@ -171,30 +170,87 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', | ||
171 | layer.close(index); | 170 | layer.close(index); |
172 | } | 171 | } |
173 | }); | 172 | }); |
174 | - }, | ||
175 | - error: function (xhr, exp) { | 173 | + }).error(function (error) { |
176 | layer.close(setIndex); | 174 | layer.close(setIndex); |
177 | layer.msg("接口请求异常!", {icon: 7, time: 3000}); | 175 | layer.msg("接口请求异常!", {icon: 7, time: 3000}); |
178 | - } | ||
179 | }); | 176 | }); |
177 | + // $.ajax({ | ||
178 | + // type: 'get', | ||
179 | + // url: domainName + '/api-user/menus/findDefaultMenusBydomainManageId/' + domainManageId + '?access_token=' + accessToken, | ||
180 | + // success: function (data) { | ||
181 | + // layer.close(setIndex); | ||
182 | + // var _html = "<div style='text-align:center;height: 120px;width: 500px;position: relative;color: black;'>" + | ||
183 | + // "<div style='margin: 40px auto'>" + | ||
184 | + // " <select style='text-align: center;text-align-last: center;height: 40px;width: 80%' id='selectFlow'>"; | ||
185 | + // _html += '<option value ="">=默认首页=</option>'; | ||
186 | + // if (data && data.data) { | ||
187 | + // var result = data.data; | ||
188 | + // var defaultMenu = data.object; | ||
189 | + // var defaultMenuId = ''; | ||
190 | + // if (defaultMenu != null) { | ||
191 | + // defaultMenuId = defaultMenu.id; | ||
192 | + // } | ||
193 | + // $.each(result, function (i, e) { | ||
194 | + // if (e.id === defaultMenuId) { | ||
195 | + // _html += '<option style="height: 100px" value ="' + e.id + '" selected = "selected">' + e.name + '</option>'; | ||
196 | + // } else { | ||
197 | + // _html += '<option style="height: 100px" value ="' + e.id + '">' + e.name + '</option>'; | ||
198 | + // } | ||
199 | + // }) | ||
200 | + // } | ||
201 | + // _html += "</select></div></div>"; | ||
202 | + // layer.open({ | ||
203 | + // type: 1, | ||
204 | + // title: "设置默认首页", //标题 | ||
205 | + // area: ['auto', 'auto'], //宽高 | ||
206 | + // content: _html, | ||
207 | + // btn: ['确定', '取消'] | ||
208 | + // , yes: function (index) { | ||
209 | + // var menuId = $('#selectFlow').val(); | ||
210 | + // if (menuId === '') { | ||
211 | + // layer.msg("请选择默认首页", {icon: 7, time: 3000}); | ||
212 | + // return; | ||
213 | + // } | ||
214 | + // saveDefaultMenu(domainManageId, menuId); | ||
215 | + // layer.close(index); | ||
216 | + // } | ||
217 | + // }); | ||
218 | + // }, | ||
219 | + // error: function (xhr, exp) { | ||
220 | + // layer.close(setIndex); | ||
221 | + // layer.msg("接口请求异常!", {icon: 7, time: 3000}); | ||
222 | + // } | ||
223 | + // }); | ||
180 | } | 224 | } |
181 | 225 | ||
182 | function saveDefaultMenu(domainManageId, menuId) { | 226 | function saveDefaultMenu(domainManageId, menuId) { |
183 | var loadIndex = layer.load(2); | 227 | var loadIndex = layer.load(2); |
184 | - $.ajax({ | 228 | + admin.req({ |
185 | type: 'get', | 229 | type: 'get', |
186 | - url: domainName + '/api-user/menus/saveOrUpdateDefaultMenu?access_token=' + accessToken + '&domainManageId=' + domainManageId + '&menuId=' + menuId, | ||
187 | - success: function (data) { | 230 | + url: domainName + '/api-user/menus/saveOrUpdateDefaultMenu?domainManageId=' + domainManageId + '&menuId=' + menuId, |
231 | + }).done(function (data) { | ||
188 | layer.close(loadIndex); | 232 | layer.close(loadIndex); |
189 | if (data) { | 233 | if (data) { |
190 | layer.msg(data.msg); | 234 | layer.msg(data.msg); |
191 | } | 235 | } |
192 | - }, | ||
193 | - error: function (xhr, ex) { | 236 | + }).error(function (error) { |
194 | layer.msg('操作失败'); | 237 | layer.msg('操作失败'); |
195 | layer.close(loadIndex); | 238 | layer.close(loadIndex); |
196 | - } | ||
197 | }); | 239 | }); |
240 | + // $.ajax({ | ||
241 | + // type: 'get', | ||
242 | + // url: domainName + '/api-user/menus/saveOrUpdateDefaultMenu?access_token=' + accessToken + '&domainManageId=' + domainManageId + '&menuId=' + menuId, | ||
243 | + // success: function (data) { | ||
244 | + // layer.close(loadIndex); | ||
245 | + // if (data) { | ||
246 | + // layer.msg(data.msg); | ||
247 | + // } | ||
248 | + // }, | ||
249 | + // error: function (xhr, ex) { | ||
250 | + // layer.msg('操作失败'); | ||
251 | + // layer.close(loadIndex); | ||
252 | + // } | ||
253 | + // }); | ||
198 | } | 254 | } |
199 | 255 | ||
200 | 256 |
@@ -80,12 +80,12 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | @@ -80,12 +80,12 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | ||
80 | bean['options'] = optionsSelect; | 80 | bean['options'] = optionsSelect; |
81 | delete bean.select; | 81 | delete bean.select; |
82 | var loading = layer.load(2); | 82 | var loading = layer.load(2); |
83 | - $.ajax({ | 83 | + admin.req({ |
84 | type: 'post', | 84 | type: 'post', |
85 | - url: common.domainName + '/api-web/manage/domain/save?access_token=' + accessToken, | 85 | + url: common.domainName + '/api-web/manage/domain/save', |
86 | contentType: "application/json; charset=utf-8", | 86 | contentType: "application/json; charset=utf-8", |
87 | data: JSON.stringify(bean), | 87 | data: JSON.stringify(bean), |
88 | - success: function (res) { | 88 | + }).done(function (data) { |
89 | layer.close(loading); | 89 | layer.close(loading); |
90 | layer.msg(res.msg, { | 90 | layer.msg(res.msg, { |
91 | offset: '15px' | 91 | offset: '15px' |
@@ -97,8 +97,29 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | @@ -97,8 +97,29 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | ||
97 | table.reload('domainManage_table', {}); | 97 | table.reload('domainManage_table', {}); |
98 | } | 98 | } |
99 | }) | 99 | }) |
100 | - } | 100 | + }).error(function (error) { |
101 | + layer.close(loading); | ||
102 | + console.error(error); | ||
101 | }); | 103 | }); |
104 | + // $.ajax({ | ||
105 | + // type: 'post', | ||
106 | + // url: common.domainName + '/api-web/manage/domain/save?access_token=' + accessToken, | ||
107 | + // contentType: "application/json; charset=utf-8", | ||
108 | + // data: JSON.stringify(bean), | ||
109 | + // success: function (res) { | ||
110 | + // layer.close(loading); | ||
111 | + // layer.msg(res.msg, { | ||
112 | + // offset: '15px' | ||
113 | + // , icon: 1 | ||
114 | + // , time: 2000 | ||
115 | + // }, function () { | ||
116 | + // if (res.success === true) { | ||
117 | + // layer.closeAll(); | ||
118 | + // table.reload('domainManage_table', {}); | ||
119 | + // } | ||
120 | + // }) | ||
121 | + // } | ||
122 | + // }); | ||
102 | return false; | 123 | return false; |
103 | }) | 124 | }) |
104 | 125 |
@@ -61,10 +61,9 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | @@ -61,10 +61,9 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | ||
61 | } | 61 | } |
62 | }); | 62 | }); |
63 | if (id) { | 63 | if (id) { |
64 | - $.ajax({ | ||
65 | - url: common.domainName + '/api-web/manage/domain/findById?id=' + id + '&access_token=' + accessToken, | ||
66 | - type: 'get', | ||
67 | - success: function (res) { | 64 | + admin.req({ |
65 | + url: common.domainName + '/api-web/manage/domain/findById?id=' + id | ||
66 | + , success: function (res) { | ||
68 | var bean = res.object; | 67 | var bean = res.object; |
69 | var $form = $("#domainupdAddForm"); | 68 | var $form = $("#domainupdAddForm"); |
70 | $form.find("input[name='id']").val(bean.id) | 69 | $form.find("input[name='id']").val(bean.id) |
@@ -83,7 +82,30 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | @@ -83,7 +82,30 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | ||
83 | } | 82 | } |
84 | form.render(); | 83 | form.render(); |
85 | } | 84 | } |
86 | - }) | 85 | + }); |
86 | + // $.ajax({ | ||
87 | + // url: common.domainName + '/api-web/manage/domain/findById?id=' + id + '&access_token=' + accessToken, | ||
88 | + // type: 'get', | ||
89 | + // success: function (res) { | ||
90 | + // var bean = res.object; | ||
91 | + // var $form = $("#domainupdAddForm"); | ||
92 | + // $form.find("input[name='id']").val(bean.id) | ||
93 | + // $form.find("input[name='domainName']").val(bean.domainName) | ||
94 | + // // $form.find("input[name='options']").val(bean.options) | ||
95 | + // $form.find("input[name='addr']").val(bean.addr) | ||
96 | + // $form.find("input[name='sort']").val(bean.sort) | ||
97 | + // //下拉框回选 | ||
98 | + // domainView.setValue([bean.options]); | ||
99 | + // if (res.data && res.data.length > 0) { | ||
100 | + // var tips = '域下IP段为:'; | ||
101 | + // $.each(res.data, function (i, e) { | ||
102 | + // tips += '</br>' + e.ip | ||
103 | + // }) | ||
104 | + // $('input[name="addr"]').attr('lay-tips', tips); | ||
105 | + // } | ||
106 | + // form.render(); | ||
107 | + // } | ||
108 | + // }) | ||
87 | } | 109 | } |
88 | form.on('submit(domainupd-add-submit)', function (data) { | 110 | form.on('submit(domainupd-add-submit)', function (data) { |
89 | var bean = data.field; | 111 | var bean = data.field; |
@@ -104,12 +126,12 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | @@ -104,12 +126,12 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | ||
104 | } | 126 | } |
105 | delete bean.select; | 127 | delete bean.select; |
106 | var loading = layer.load(2); | 128 | var loading = layer.load(2); |
107 | - $.ajax({ | 129 | + admin.req({ |
108 | type: 'post', | 130 | type: 'post', |
109 | - url: common.domainName + '/api-web/manage/domain/save?access_token=' + accessToken, | ||
110 | contentType: "application/json; charset=utf-8", | 131 | contentType: "application/json; charset=utf-8", |
111 | data: JSON.stringify(bean), | 132 | data: JSON.stringify(bean), |
112 | - success: function (res) { | 133 | + url: common.domainName + '/api-web/manage/domain/save' |
134 | + , success: function (res) { | ||
113 | layer.close(loading); | 135 | layer.close(loading); |
114 | layer.msg(res.msg, { | 136 | layer.msg(res.msg, { |
115 | offset: '15px' | 137 | offset: '15px' |
@@ -123,6 +145,25 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | @@ -123,6 +145,25 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'xmSelect', 'lay | ||
123 | }) | 145 | }) |
124 | } | 146 | } |
125 | }); | 147 | }); |
148 | + // $.ajax({ | ||
149 | + // type: 'post', | ||
150 | + // url: common.domainName + '/api-web/manage/domain/save?access_token=' + accessToken, | ||
151 | + // contentType: "application/json; charset=utf-8", | ||
152 | + // data: JSON.stringify(bean), | ||
153 | + // success: function (res) { | ||
154 | + // layer.close(loading); | ||
155 | + // layer.msg(res.msg, { | ||
156 | + // offset: '15px' | ||
157 | + // , icon: 1 | ||
158 | + // , time: 2000 | ||
159 | + // }, function () { | ||
160 | + // if (res.success === true) { | ||
161 | + // layer.closeAll(); | ||
162 | + // table.reload('domainManage_table', {}); | ||
163 | + // } | ||
164 | + // }) | ||
165 | + // } | ||
166 | + // }); | ||
126 | 167 | ||
127 | }) | 168 | }) |
128 | 169 |
@@ -121,7 +121,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'commonDe | @@ -121,7 +121,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'commonDe | ||
121 | var resName = $(this).data("resname") && $(this).data("resname")!=undefined && $(this).data("resname")!='undefined'?$(this).data("resname"):''; | 121 | var resName = $(this).data("resname") && $(this).data("resname")!=undefined && $(this).data("resname")!='undefined'?$(this).data("resname"):''; |
122 | var resTypeName = $(this).data("resTypeName") && $(this).data("resTypeName")!=undefined && $(this).data("resTypeName")!='undefined'?$(this).data("resTypeName"):''; | 122 | var resTypeName = $(this).data("resTypeName") && $(this).data("resTypeName")!=undefined && $(this).data("resTypeName")!='undefined'?$(this).data("resTypeName"):''; |
123 | var title = resName + (resTypeName?'|' + resTypeName:'') + (ip?'|' + ip:'');//名称,类型,及ip | 123 | var title = resName + (resTypeName?'|' + resTypeName:'') + (ip?'|' + ip:'');//名称,类型,及ip |
124 | - commonDetail.openDetail(resId, resType, title); | 124 | + // commonDetail.openDetail(resId, resType, title); |
125 | + commonDetail.openResDetail(resId,resName); | ||
125 | }); | 126 | }); |
126 | 127 | ||
127 | $('[filter-data-delete]').unbind().bind('click', function () { | 128 | $('[filter-data-delete]').unbind().bind('click', function () { |
@@ -196,13 +196,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'laytpl', | @@ -196,13 +196,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'laytpl', | ||
196 | } else { //否则进入监控详情页面 | 196 | } else { //否则进入监控详情页面 |
197 | // commonDetail.openDetail(resId, resType, name); | 197 | // commonDetail.openDetail(resId, resType, name); |
198 | //统一平台详情页 | 198 | //统一平台详情页 |
199 | - let win = window.parent; | ||
200 | - if (win) { | ||
201 | - window.parent.postMessage({ | ||
202 | - type: 'resDetail', | ||
203 | - message: {'params':{'resId':resId},'title':name} | ||
204 | - }, '*') | ||
205 | - } | 199 | + commonDetail.openResDetail(resId,name); |
206 | } | 200 | } |
207 | } | 201 | } |
208 | }); | 202 | }); |
@@ -200,9 +200,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | @@ -200,9 +200,9 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | ||
200 | form.on('submit(edit-trapoid-submit)', function (data) { | 200 | form.on('submit(edit-trapoid-submit)', function (data) { |
201 | var bean = data.field; | 201 | var bean = data.field; |
202 | loading = layer.load(2); | 202 | loading = layer.load(2); |
203 | - $.ajax({ | ||
204 | - url: domainName + '/api-web/trapoid/saveOrUpdate?access_token=' + accessToken, | ||
205 | - type: 'post', | 203 | + admin.req({ |
204 | + url: domainName + '/api-web/trapoid/saveOrUpdate', | ||
205 | + method: 'post', | ||
206 | data: JSON.stringify(bean), | 206 | data: JSON.stringify(bean), |
207 | contentType: "application/json;charset=utf-8", | 207 | contentType: "application/json;charset=utf-8", |
208 | success: function (res) { | 208 | success: function (res) { |
@@ -220,14 +220,41 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | @@ -220,14 +220,41 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | ||
220 | return false; | 220 | return false; |
221 | }) | 221 | }) |
222 | } | 222 | } |
223 | - | ||
224 | }, | 223 | }, |
225 | - error: function (err) { | 224 | + error: function () { |
226 | layer.closeAll(); | 225 | layer.closeAll(); |
227 | console.log(JSON.stringify(err)); | 226 | console.log(JSON.stringify(err)); |
228 | return false; | 227 | return false; |
229 | } | 228 | } |
230 | }) | 229 | }) |
230 | + // $.ajax({ | ||
231 | + // url: domainName + '/api-web/trapoid/saveOrUpdate?access_token=' + accessToken, | ||
232 | + // type: 'post', | ||
233 | + // data: JSON.stringify(bean), | ||
234 | + // contentType: "application/json;charset=utf-8", | ||
235 | + // success: function (res) { | ||
236 | + // layer.closeAll(); | ||
237 | + // if (res) { | ||
238 | + // var iconNum = 2; | ||
239 | + // if (res.success) { | ||
240 | + // iconNum = 1; | ||
241 | + // } | ||
242 | + // layer.msg(res.msg, {offset: '15px', icon: iconNum, time: 2000}, | ||
243 | + // function () { | ||
244 | + // if (res.success) { | ||
245 | + // reloadTable(); | ||
246 | + // } | ||
247 | + // return false; | ||
248 | + // }) | ||
249 | + // } | ||
250 | + // | ||
251 | + // }, | ||
252 | + // error: function (err) { | ||
253 | + // layer.closeAll(); | ||
254 | + // console.log(JSON.stringify(err)); | ||
255 | + // return false; | ||
256 | + // } | ||
257 | + // }) | ||
231 | }); | 258 | }); |
232 | } | 259 | } |
233 | , yes(index, dom) { | 260 | , yes(index, dom) { |
@@ -308,8 +335,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | @@ -308,8 +335,8 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | ||
308 | } | 335 | } |
309 | layer.confirm('删除后不可恢复,请确认', {icon: 3}, function (index) { | 336 | layer.confirm('删除后不可恢复,请确认', {icon: 3}, function (index) { |
310 | layer.load(2); | 337 | layer.load(2); |
311 | - $.ajax({ | ||
312 | - url: common.domainName + '/api-web/trapoid/deleteByIds?access_token=' + accessToken, | 338 | + admin.req({ |
339 | + url: common.domainName + '/api-web/trapoid/deleteByIds', | ||
313 | type: 'POST', | 340 | type: 'POST', |
314 | data: JSON.stringify(ids), | 341 | data: JSON.stringify(ids), |
315 | contentType: "application/json;charset=UTF-8", | 342 | contentType: "application/json;charset=UTF-8", |
@@ -324,8 +351,30 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | @@ -324,8 +351,30 @@ layui.define(['table', 'form', 'admin', 'layer', 'common', 'sessions', 'treeTabl | ||
324 | 351 | ||
325 | }); | 352 | }); |
326 | } | 353 | } |
354 | + }, | ||
355 | + error: function () { | ||
356 | + layer.closeAll(); | ||
357 | + console.log(JSON.stringify(err)); | ||
327 | } | 358 | } |
328 | }) | 359 | }) |
360 | + // $.ajax({ | ||
361 | + // url: common.domainName + '/api-web/trapoid/deleteByIds?access_token=' + accessToken, | ||
362 | + // type: 'POST', | ||
363 | + // data: JSON.stringify(ids), | ||
364 | + // contentType: "application/json;charset=UTF-8", | ||
365 | + // success: function (res) { | ||
366 | + // layer.closeAll("loading") | ||
367 | + // if (res.success) { | ||
368 | + // layer.msg('操作成功', {offset: '15px', icon: 1, time: 2000}, function () { | ||
369 | + // reloadTable(); | ||
370 | + // }); | ||
371 | + // } else { | ||
372 | + // layer.msg("操作失败", {offset: '15px', icon: 2, time: 2000}, function () { | ||
373 | + // | ||
374 | + // }); | ||
375 | + // } | ||
376 | + // } | ||
377 | + // }) | ||
329 | }); | 378 | }); |
330 | } | 379 | } |
331 | 380 |
-
Please register or login to post a comment