index.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // 查看详细数据
  2. function bindQueryDataEvent() {
  3. $(".metaDataList .queryData").click(function () {
  4. var json = $(this).attr("json");
  5. var html = '<div class="row driver_break_word">' + json + '</div>';
  6. BootstrapDialog.show({
  7. title: "注意信息安全",
  8. type: BootstrapDialog.TYPE_INFO,
  9. message: html,
  10. size: BootstrapDialog.SIZE_NORMAL,
  11. buttons: [{
  12. label: "关闭",
  13. action: function (dialog) {
  14. dialog.close();
  15. }
  16. }]
  17. });
  18. });
  19. }
  20. // 清空数据
  21. function bindClearEvent($btn, $title, $msg, $url){
  22. $btn.click(function () {
  23. var $id = $(this).attr("id");
  24. var data = {"id": $id};
  25. BootstrapDialog.show({
  26. title: "警告",
  27. type: BootstrapDialog.TYPE_DANGER,
  28. message: $title,
  29. size: BootstrapDialog.SIZE_NORMAL,
  30. buttons: [{
  31. label: "确定",
  32. action: function (dialog) {
  33. doPoster($url, data, function (data) {
  34. if (data.success == true) {
  35. bootGrowl($msg, "success");
  36. $initContainer.load('/monitor?id=' + $id);
  37. } else {
  38. bootGrowl(data.resultValue, "danger");
  39. }
  40. });
  41. dialog.close();
  42. }
  43. }, {
  44. label: "取消",
  45. action: function (dialog) {
  46. dialog.close();
  47. }
  48. }]
  49. });
  50. });
  51. }
  52. $(function () {
  53. // 初始化select2插件
  54. $(".select-control").select2({
  55. width: "100%",
  56. theme: "classic"
  57. });
  58. //连接器类型切换事件
  59. $("select[name='metaData']").change(function () {
  60. var $id = $(this).val();
  61. $initContainer.load('/monitor?id=' + $id);
  62. });
  63. bindQueryDataEvent();
  64. bindClearEvent($(".clearDataBtn"), "确认清空数据?", "清空数据成功!", "/monitor/clearData");
  65. bindClearEvent($(".clearLogBtn"), "确认清空日志?", "清空日志成功!", "/monitor/clearLog");
  66. });