myApp.controller("donate", ["$scope", "$http", "NgTableParams", function($scope, $http, NgTableParams) { window.hub.stop(); var self = this; var source = []; $scope.loading(); $scope.paginationConf = { currentPage: 1, itemsPerPage: 10, pagesLength: 25, perPageOptions: [1, 5, 10, 15, 20, 30, 40, 50, 100, 200], rememberPerPage: 'perPageItems', onChange: function() { self.GetPageData($scope.paginationConf.currentPage, $scope.paginationConf.itemsPerPage); } }; this.GetPageData = function(page, size) { $scope.loading(); $http.post("/donate/getpagedata", { page, size }).then(function(res) { $scope.paginationConf.totalItems = res.data.TotalCount; $("div[ng-table-pagination]").remove(); self.tableParams = new NgTableParams({ count: 50000 }, { filterDelay: 0, dataset: res.data.Data }); source = angular.copy(res.data.Data); $scope.loadingDone(); }); }; self.del = function(row) { swal({ title: "确认删除这条打赏记录吗?", text: row.NickName, showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "确定", cancelButtonText: "取消", showLoaderOnConfirm: true, animation: true, allowOutsideClick: false }).then(function() { $scope.request("/donate/delete", { id: row.Id }, function(data) { window.notie.alert({ type: 1, text: data.Message, time: 4 }); }); _.remove(self.tableParams.settings().dataset, function(item) { return row === item; }); self.tableParams.reload().then(function(data) { if (data.length === 0 && self.tableParams.total() > 0) { self.tableParams.page(self.tableParams.page() - 1); self.tableParams.reload(); } }); }, function() { }).catch(swal.noop); } $scope.save = function (row) { if (row==null) { row = { NickName: "", DonateTime: "", Amount: "", Email: "", QQorWechat: "", Via:"" }; } swal({ title: '添加打赏记录', html: '