logout.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("logoutCtrl", ["$http", "$scope", "$timeout", function ($http, $scope, $timeout) {
  6. var self = this;
  7. self.webApiUrl2 = "";
  8. self.get_userid = $.cookie("GlWorkPlatform-userid");
  9. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  10. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno") || 1; ///接收传过来的第几页
  11. var postCfgJson = {
  12. headers: {
  13. 'Content-Type': 'application/json',
  14. 'Authorization': "Bearer " + self.get_AccessToken
  15. }
  16. };
  17. self.search = {
  18. USERREALNAME: "",
  19. IDNO: "",
  20. BLOCK: "",
  21. BUILDING: "",
  22. DOORNO: "",
  23. HOUSENO: ""
  24. };
  25. ///声明
  26. self.noDataTip = 1;
  27. self.rows = []; //声明空数组
  28. self.pageno = 1; // 初始化 当前页为 1
  29. self.total_count = 0;
  30. self.itemsPerPage = 10;
  31. self.pageOptions = [10, 15, 20, 25, 30];
  32. // 初始化分页数据
  33. self.getData = function (pageno) {
  34. self.pageno = pageno;
  35. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  36. 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;
  37. ///查询这条记录,生成数组,赋值给表
  38. //得到返回的数据的id
  39. let postSearchData = {
  40. "fields": "",
  41. "orderby": "DELETEAPPDATE desc",
  42. "eqparams": "",
  43. "likeparams": set_like,
  44. "dateparams": "",
  45. "inparams": "",
  46. "page": self.pageno,
  47. "pagesize": self.itemsPerPage
  48. }
  49. $http.post(apiurljs.backend + "Xinguan/UserCancelApplyList", postSearchData, postCfgJson)
  50. .success(function (res) {
  51. if (sp.isval(res.items)) {
  52. self.noDataTip = 1;
  53. angular.forEach(res.items, function (item, index) {
  54. item.DELETEAPPDATE = sp.formatMinute(item.DELETEAPPDATE);
  55. item.CREATETIME = sp.formatMinute(item.CREATETIME);
  56. if (item.STATUS == "1") {
  57. item.STATUS_SET = "已实名";
  58. } else if (item.STATUS == "-1") {
  59. item.STATUS_SET = "正在申请注销";
  60. } else {
  61. }
  62. });
  63. self.rows = res.items;
  64. self.total_count = res.total;
  65. } else {
  66. self.rows = [];
  67. self.noDataTip = 0;
  68. self.total_count = 1;
  69. }
  70. }).error(function (err) {
  71. sp.dialog(JSON.stringify(err));
  72. });
  73. }
  74. $timeout(function () {
  75. self.getData(self.get_lastReturnPageno);
  76. }, 200)
  77. ///刷新
  78. self.btnRefresh = function () {
  79. self.getData(self.pageno);
  80. };
  81. ///删除
  82. self.btnDelete = function ($index) {
  83. var getDelID = $index;
  84. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  85. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  86. 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>";
  87. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  88. sp.openCenter(".sp-dialog");
  89. ///取消按钮
  90. $('.sp-closeDialog').click(function (event) {
  91. sp.dialoghide();
  92. event.preventDefault(); event.stopPropagation();
  93. });
  94. //post消息的id
  95. $("#dialog_btnConfirm").click(function () {
  96. var getid = $(this).attr("data-id");
  97. var data = {
  98. "userid": self.rows[getDelID].USERID,
  99. "openid": self.rows[getDelID].OPENID,
  100. "currentuserid": self.get_userid
  101. };
  102. $http.post(apiurljs.backend + "Xinguan/UserDelete", data, postCfgJson)
  103. .success(function (res) {
  104. if (res.success) {
  105. self.getData(self.pageno);
  106. sp.dialoghide();
  107. } else {
  108. sp.dialog("删除失败,请联系管理员!");
  109. }
  110. });
  111. });
  112. }
  113. ///筛选
  114. self.openSearchLayer = function () {
  115. sp.layer("#layer_search");
  116. };
  117. //筛选确认
  118. self.btnSearchTrue = function () {
  119. self.getData(1);
  120. sp.layerhide();
  121. };
  122. //筛选重置
  123. self.btnSearchCancel = function () {
  124. self.search = {
  125. USERREALNAME: "",
  126. IDNO: "",
  127. BLOCK: "",
  128. BUILDING: "",
  129. DOORNO: "",
  130. HOUSENO: ""
  131. };
  132. self.getData(1);
  133. sp.layerhide();
  134. };
  135. }]);