'use strict'; var app = angular.module('app', [ 'angularUtils.directives.dirPagination' ]); app.controller("logoutCtrl", ["$http", "$scope", "$timeout", function ($http, $scope, $timeout) { var self = this; self.webApiUrl2 = ""; self.get_userid = $.cookie("GlWorkPlatform-userid"); self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken"); self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno") || 1; ///接收传过来的第几页 var postCfgJson = { headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + self.get_AccessToken } }; self.search = { USERREALNAME: "", IDNO: "", BLOCK: "", BUILDING: "", DOORNO: "", HOUSENO: "" }; ///声明 self.noDataTip = 1; self.rows = []; //声明空数组 self.pageno = 1; // 初始化 当前页为 1 self.total_count = 0; self.itemsPerPage = 10; self.pageOptions = [10, 15, 20, 25, 30]; // 初始化分页数据 self.getData = function (pageno) { self.pageno = pageno; $scope.__default__currentPage = self.pageno; //设置页面样式在第几页 var set_like = "USERREALNAME=" + self.search.USERREALNAME + "&IDNO=" + self.search.IDNO + "&BLOCK=" + self.search.BLOCK + "&BUILDING=" + self.search.BUILDING + "&DOORNO=" + self.search.DOORNO + "&HOUSENO=" + self.search.HOUSENO; ///查询这条记录,生成数组,赋值给表 //得到返回的数据的id let postSearchData = { "fields": "", "orderby": "DELETEAPPDATE desc", "eqparams": "", "likeparams": set_like, "dateparams": "", "inparams": "", "page": self.pageno, "pagesize": self.itemsPerPage } $http.post(apiurljs.backend + "Xinguan/UserCancelApplyList", postSearchData, postCfgJson) .success(function (res) { if (sp.isval(res.items)) { self.noDataTip = 1; angular.forEach(res.items, function (item, index) { item.DELETEAPPDATE = sp.formatMinute(item.DELETEAPPDATE); item.CREATETIME = sp.formatMinute(item.CREATETIME); if (item.STATUS == "1") { item.STATUS_SET = "已实名"; } else if (item.STATUS == "-1") { item.STATUS_SET = "正在申请注销"; } else { } }); self.rows = res.items; self.total_count = res.total; } else { self.rows = []; self.noDataTip = 0; self.total_count = 1; } }).error(function (err) { sp.dialog(JSON.stringify(err)); }); } $timeout(function () { self.getData(self.get_lastReturnPageno); }, 200) ///刷新 self.btnRefresh = function () { self.getData(self.pageno); }; ///删除 self.btnDelete = function ($index) { var getDelID = $index; var dialogHead = "温馨提示×"; var dialogBody = "
删除后不可恢复,您确认要删除吗?
"; var dialogFoot = "
"; $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot); sp.openCenter(".sp-dialog"); ///取消按钮 $('.sp-closeDialog').click(function (event) { sp.dialoghide(); event.preventDefault(); event.stopPropagation(); }); //post消息的id $("#dialog_btnConfirm").click(function () { var getid = $(this).attr("data-id"); var data = { "userid": self.rows[getDelID].USERID, "openid": self.rows[getDelID].OPENID, "currentuserid": self.get_userid }; $http.post(apiurljs.backend + "Xinguan/UserDelete", data, postCfgJson) .success(function (res) { if (res.success) { self.getData(self.pageno); sp.dialoghide(); } else { sp.dialog("删除失败,请联系管理员!"); } }); }); } ///筛选 self.openSearchLayer = function () { sp.layer("#layer_search"); }; //筛选确认 self.btnSearchTrue = function () { self.getData(1); sp.layerhide(); }; //筛选重置 self.btnSearchCancel = function () { self.search = { USERREALNAME: "", IDNO: "", BLOCK: "", BUILDING: "", DOORNO: "", HOUSENO: "" }; self.getData(1); sp.layerhide(); }; }]);