var App = function () { this.statisticGrid = $('#task-grid'); this.selectedRow = []; this.Startup = function () { $('#manage').addClass('active'); this.ReLayout(); this.InitDate(); this.InitDataGrid(); $('#query-btn').on('click', this.OnQueryButtonClick.bind(this)); $('#query-btn').trigger('click'); window.onresize = this.ReLayout.bind(this); }; this.ReLayout = function () { var width = $(window).width(); var height = $(window).height(); $('.manage-table, .manage-table .datagrid').width(width - 247); $('.manage-table, .manage-table .datagrid').height(height - 109); this.formatLastColumn(); }; this.OnQueryButtonClick = function () { this.ReLoadTableData(); }; this.ReLoadTableData = function () { this.statisticGrid.datagrid({ method: "POST", url: '/StatisticAnalysis/Query', queryParams: { fromTime: $("#from-date").datetimebox('getValue'), toTime: $("#to-date").datetimebox('getValue'), } }); }; this.InitDate = function () { $('#from-date').datetimebox({ panelAlign: 'right', panelWidth: 200, panelHeight: 230, showSeconds: false, currentText: '现在', onSelect: function (date) { var startTime = date.getTime(); var endDate = $('#to-date').val(); if (endDate) { var endTime = new Date(endDate).getTime(); if (startTime > endTime) alert('开始日期不能大于结束日期,请重新选择。'); } } }); $('#to-date').datetimebox({ panelWidth: 190, panelHeight: 230, panelAlign: 'right', showSeconds: false, currentText: '现在', onSelect: function (date) { var endTime = date.getTime(); var startDate = $('#from-date').val(); if (startDate) { var startTime = new Date(startDate).getTime(); if (startTime > endTime) alert('结束日期不能小于开始日期,请重新选择。'); } } }); $("#from-date").datetimebox('setValue', moment().add(-30, 'days').format('YYYY/MM/DD HH:mm')); }; this.InitDataGrid = function () { this.statisticGrid.datagrid({ columns: [[ { field: 'UserName', title: '姓名', align: 'center', width: 120 }, { field: 'OrgName', title: '所属机构', align: 'left', width: 180 }, { field: 'ComputeCount', title: '计算次数', align: 'center', width: 100 }, { field: 'LastComputeTime', title: '最后计算时间', align: 'center', width: 160, formatter: this.formatTime.bind(this) }, { field: 'Null', title: '', align: 'left' } ]], striped: true, singleSelect: false, fit: true, scrollbarSize: 0, pagination: true, pageNumber: 1, pageSize: 50, pageList: [10, 20, 50, 100, 150, 200], onSelect: this.OnTaskSelected.bind(this), onUnselect: this.OnTaskUnselected.bind(this), onBeforeLoad: this.OnTableGridBeforeLoad.bind(this), onLoadSuccess: function (data) { if (data.total === 0) { var body = $(this).data().datagrid.dc.body2; body.addClass('null-data-body'); body.append('
暂无数据