(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] + '
' + value.split(' ')[1] }, splitJson:function(json,type){ var str = ''; for(var k in json){ str += ''+k+' : '+JSON.stringify(json[k])+'
' } 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') } }, }, })