123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- (function(){
- var myDate = new Date(); //获取今天日期
- //myDate.setDate(myDate.getDate() - 5);
- //window.ED = getTime();
- window.SD = myDate.getFullYear() + '-' + (myDate.getMonth()+1) + '-' + myDate.getDate();
- })();
- var app = new Vue({
- el:'#outer',
- data:{
- searchParam:{
- startTime : SD+' 00:00:00',
- endTime : SD+' 23:59:59',
- app : '',
- action : '',
- post : '',
- get : '',
- name : '',
- controller : '',
- ip : ''
- },
- searchTime:SD,
- pagination:{
- page_total: 1,
- page_rows:20,
- p:1,
- nowPage:1,
- },
- tableData : [],//表格数据
- result : '',
- modelTitle : '',
- modelValue : '',
- appList : [],
- },
- created: function(){
- },
- components:{
- 'Selectd': componentSelect,
- 'Options': componentOption,
- 'Pagination': componentPage,
- },
- methods: {
- init: function(){
- showLoading();
- var _this = this;
- this.searchParam.startTime = $('input[name="start"]').val()
- this.searchParam.endTime = $('input[name="end"]').val()
- var data = {
- start_time : this.searchParam.startTime,
- stop_time : this.searchParam.endTime,
- app : this.searchParam.app,
- action : $.trim(this.searchParam.action),
- post : this.searchParam.post,
- get : this.searchParam.get,
- name : $.trim(this.searchParam.name),
- controller : $.trim(this.searchParam.controller),
- ip : $.trim(this.searchParam.ip),
- page : this.pagination.p,
- };
- if(new Date(this.searchParam.startTime).getTime() == new Date(this.searchParam.endTime).getTime()){
- weile.F.alert('开始时间和结束时间相同不能进行查询');
- hideLoading();
- return ;
- }
- getAjax(data, 'post', '/api/getlog', function(result){
- _this.result = result;
- _this.tableData = result.data;
- _this.pagination.page_total = result.page.count * 1
- hideLoading();
- });
- },
- /**
- * 晴空筛选
- */
- searchRefresh: function(){
- this.searchParam = {
- startTime : SD+' 00:00:00',
- endTime : SD+' 23:59:59',
- app : '',
- action : '',
- post : '',
- get : '',
- name : '',
- controller : '',
- ip : ''
- }
- this.init();
- },
- // 分野
- nowPage:function(page, page_rows){
- this.pagination.p = page;
- this.pagination.page_rows = page_rows;
- this.init();
- },
- /**
- * 查看详情
- * @param {[string]} title [标题]
- * @param {[string]} value [内容]
- */
- lookmore:function(title,value){
- $('#details_modal').modal('show');
- this.modelTitle= title;
- this.modelValue = value;
- },
- splitTime(value){
- var str = '';
- return value.split(' ')[0] + '<br>' + value.split(' ')[1]
- },
- splitJson:function(json,type){
- var str = '';
- for(var k in json){
- str += '<span>'+k+' : </span><span>'+JSON.stringify(json[k])+'</span><br>'
-
- }
- return str
-
- },
- unescapeHTML:function(a){
- a = "" + a;
- return a.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/"/g, '"').replace(/'/g, "'").replace(/ /g," ");
- },
- /**
- *
- */
- setValClick:function(event, item, k){
- var ele = event.target || event.srcElement;
- var val = ele.value;
- item[k] = val;
- },
- },
- mounted: function(){
- //api/getapp
- var _this = this;
- getAjax({}, 'post', '/api/getapp', function(result){
- _this.appList = result.data;
- console.log(result)
- });
- this.init();
- },
- directives:{
- 'time':{
- inserted: function(el, binding){
- bindFast($(el), 'timer')
- }
- },
- },
- })
|