var App = function () { this.userGrid = $('#task-grid'); this.data = {}; this.selectedRow = []; this.AddDialog = new AddDialog(this); this.EditDialog = new EditDialog(this); this.EditPasswordDialog = new EditPasswordDialog(this); this.Startup = function () { $('#manage').addClass('active'); this.RedirectPage(); this.ReLayout(); this.InitOrgList(); this.InitDataGrid(); this.AddDialog.Setup(); this.EditDialog.Setup(); this.EditPasswordDialog.Setup(); $('#add-btn').on('click', this.OnAddButtonClick.bind(this)); $('#edit-btn').on('click', this.onEditButtonClick.bind(this)); $('#edit-password-btn').on('click', this.onEditPasswordButtonClick.bind(this)); $('#delete-btn').on('click', this.onDeleteButtonClick.bind(this)); $('#query-btn').on('click', this.onQueryButtonClick.bind(this)); $('#delete-dialog-close').on('click', this.CloseDeleteDialog.bind(this)); $('#dialog-sure').on('click', this.OnSureOfDeleteButtonClick.bind(this)); $('#dialog-cancel').on('click', this.CloseDeleteDialog.bind(this)); $('#query-btn').trigger('click'); window.onresize = this.ReLayout.bind(this); }; this.RedirectPage = function () { var user = document.getElementById('user-info'); if (user.getAttribute('class') === 'user-login') window.location.href = '/User/Login'; else return; }; 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.InitOrgList = function () { $.ajax({ type: "POST", dataType: 'text', url: '/OrgManagement/Query', data: { page: 1, rows: 10000 }, success: function (result) { var data = JSON.parse(result).rows; var newData = data.splice(0, 0, { Id: 0, Name: '全部' }); $('#org-list').combobox({ valueField: 'Id', textField: 'Name', editable: false, panelHeight: 'auto', panelMaxHeight: 190, data: data }); $('#org-list').combobox('setValue', 0); }.bind(this) }); }; this.InitDataGrid = function () { this.userGrid.datagrid({ columns: [[ { field: 'RealName', title: '姓名', align: 'center', width: 120 }, { field: 'OrgName', title: '所属机构', align: 'left', width: 180 }, { field: 'LoginName', title: '登录账户', align: 'left', width: 150 }, //{ field: 'LoginPassWord', title: '登录密码', align: 'left', width: 120, formatter: this.formatPassword.bind(this) }, { field: 'ComputeCount', title: '计算次数', align: 'center', width: 80 }, { field: 'LastComputeTime', title: '最后计算时间', align: 'center', width: 160, formatter: this.formatLastComputeTime.bind(this) }, { field: 'LoginCount', title: '登录次数', align: 'center', width: 80 }, { field: 'LastLoginTime', title: '最后登录时间', align: 'center', width: 160, formatter: this.formatLastLoginTime.bind(this) }, { field: 'CreateTime', 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('
暂无数据