logs.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. (function(){
  2. var myDate = new Date(); //获取今天日期
  3. //myDate.setDate(myDate.getDate() - 5);
  4. //window.ED = getTime();
  5. window.SD = myDate.getFullYear() + '-' + (myDate.getMonth()+1) + '-' + myDate.getDate();
  6. })();
  7. var app = new Vue({
  8. el:'#outer',
  9. data:{
  10. searchParam:{
  11. startTime : SD+' 00:00:00',
  12. endTime : SD+' 23:59:59',
  13. app : '',
  14. action : '',
  15. post : '',
  16. get : '',
  17. name : '',
  18. controller : '',
  19. ip : ''
  20. },
  21. searchTime:SD,
  22. pagination:{
  23. page_total: 1,
  24. page_rows:20,
  25. p:1,
  26. nowPage:1,
  27. },
  28. tableData : [],//表格数据
  29. result : '',
  30. modelTitle : '',
  31. modelValue : '',
  32. appList : [],
  33. },
  34. created: function(){
  35. },
  36. components:{
  37. 'Selectd': componentSelect,
  38. 'Options': componentOption,
  39. 'Pagination': componentPage,
  40. },
  41. methods: {
  42. init: function(){
  43. showLoading();
  44. var _this = this;
  45. this.searchParam.startTime = $('input[name="start"]').val()
  46. this.searchParam.endTime = $('input[name="end"]').val()
  47. var data = {
  48. start_time : this.searchParam.startTime,
  49. stop_time : this.searchParam.endTime,
  50. app : this.searchParam.app,
  51. action : $.trim(this.searchParam.action),
  52. post : this.searchParam.post,
  53. get : this.searchParam.get,
  54. name : $.trim(this.searchParam.name),
  55. controller : $.trim(this.searchParam.controller),
  56. ip : $.trim(this.searchParam.ip),
  57. page : this.pagination.p,
  58. };
  59. if(new Date(this.searchParam.startTime).getTime() == new Date(this.searchParam.endTime).getTime()){
  60. weile.F.alert('开始时间和结束时间相同不能进行查询');
  61. hideLoading();
  62. return ;
  63. }
  64. getAjax(data, 'post', '/api/getlog', function(result){
  65. _this.result = result;
  66. _this.tableData = result.data;
  67. _this.pagination.page_total = result.page.count * 1
  68. hideLoading();
  69. });
  70. },
  71. /**
  72. * 晴空筛选
  73. */
  74. searchRefresh: function(){
  75. this.searchParam = {
  76. startTime : SD+' 00:00:00',
  77. endTime : SD+' 23:59:59',
  78. app : '',
  79. action : '',
  80. post : '',
  81. get : '',
  82. name : '',
  83. controller : '',
  84. ip : ''
  85. }
  86. this.init();
  87. },
  88. // 分野
  89. nowPage:function(page, page_rows){
  90. this.pagination.p = page;
  91. this.pagination.page_rows = page_rows;
  92. this.init();
  93. },
  94. /**
  95. * 查看详情
  96. * @param {[string]} title [标题]
  97. * @param {[string]} value [内容]
  98. */
  99. lookmore:function(title,value){
  100. $('#details_modal').modal('show');
  101. this.modelTitle= title;
  102. this.modelValue = value;
  103. },
  104. splitTime(value){
  105. var str = '';
  106. return value.split(' ')[0] + '<br>' + value.split(' ')[1]
  107. },
  108. splitJson:function(json,type){
  109. var str = '';
  110. for(var k in json){
  111. str += '<span>'+k+' : </span><span>'+JSON.stringify(json[k])+'</span><br>'
  112. }
  113. return str
  114. },
  115. unescapeHTML:function(a){
  116. a = "" + a;
  117. return a.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&nbsp;/g," ");
  118. },
  119. /**
  120. *
  121. */
  122. setValClick:function(event, item, k){
  123. var ele = event.target || event.srcElement;
  124. var val = ele.value;
  125. item[k] = val;
  126. },
  127. },
  128. mounted: function(){
  129. //api/getapp
  130. var _this = this;
  131. getAjax({}, 'post', '/api/getapp', function(result){
  132. _this.appList = result.data;
  133. console.log(result)
  134. });
  135. this.init();
  136. },
  137. directives:{
  138. 'time':{
  139. inserted: function(el, binding){
  140. bindFast($(el), 'timer')
  141. }
  142. },
  143. },
  144. })