123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- '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 = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='dialog_btnConfirm' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.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();
- };
- }]);
|