sqgs.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("listCtrl", ["$scope", "$http", "$timeout", function ($scope, $http, $timeout) {
  6. var self = this;
  7. var s4 = new SM4Util();
  8. self.userId = $.cookie("GlWorkPlatform-userid");
  9. self.userName = $.cookie("GlWorkPlatform-chineseName");
  10. self.get_AccessToken = !localStorage.getItem("GlWorkPlatform-AccessToken") ? sp.getUrlName("token") : localStorage.getItem("GlWorkPlatform-AccessToken");
  11. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  12. self.type = sp.getUrlName("type");
  13. var postCfg = {
  14. headers: {
  15. 'Content-Type': 'application/json',
  16. 'Authorization': "Bearer " + self.get_AccessToken
  17. }
  18. }
  19. self.search = {
  20. type: 1,
  21. ctype: "行政许可"
  22. }
  23. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  24. self.pageno = 1;
  25. self.total_count = 0;
  26. self.itemsPerPage = 10;
  27. self.pageOptions = [10, 20, 30, 40];
  28. self.getData = function (pageno) {
  29. self.list = [];
  30. self.loading = true;
  31. self.pageno = pageno;
  32. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  33. var data = {
  34. tablename: "XQGONGSHI",
  35. pagesize: self.itemsPerPage,
  36. pageno: self.pageno,
  37. colums: "*",
  38. order: "ID",
  39. sqlwhere: { CTYPE: self.search.ctype},
  40. sqlorwhere: "",
  41. sqlinwhere: "",
  42. sqllikewhere: ""
  43. };
  44. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", data, postCfg)
  45. .success(function (obj) {
  46. //var res = strToJson(s4.decryptData_CBC(obj.data));
  47. var res = obj;
  48. if (res.data == null || res.data == undefined || res.data == "") {
  49. self.noDataTip = 0;
  50. } else {
  51. self.noDataTip = 1;
  52. self.list = res.data;
  53. self.total_count = res.totalCount;
  54. }
  55. })
  56. }
  57. self.load = function () {
  58. if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
  59. self.getData(self.pageno);
  60. } else {
  61. $timeout(function () {
  62. self.getData(self.get_lastReturnPageno);
  63. }, 1)
  64. }
  65. }
  66. self.load()
  67. self.getInfo = function (item) {
  68. var set_convertType = 0;
  69. //if (item.CODE.indexOf("pdf") > -1) {
  70. // set_convertType = 20;
  71. //} else if (item.CODE.indexOf("ofd") > -1) {
  72. // set_convertType = 570;
  73. //} else if (/(jpg|png|gif|bmp)$/i.test(item.CODE) == true) {
  74. // set_convertType = 23;
  75. //} else {
  76. // set_convertType = 0;
  77. //}
  78. //let postData = {
  79. // convertType: set_convertType,
  80. // fileUrl: apiurljs.login + "g2work/files2/inline/" + item.CODE
  81. //};
  82. let postData = {
  83. convertType: 20,
  84. fileUrl: apiurljs.login.split("glwork")[0] + "glworkweb/tpl/deskunit/0e3084aa21ac379410aa07ab29bd9381.pdf"
  85. };
  86. var postCfg_transfer = {
  87. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  88. transformRequest: function (data) {
  89. return $.param(data);
  90. }
  91. };
  92. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  93. .success(function (res) {
  94. //console.log(res);
  95. if (res.errorcode === 0) {
  96. let rst = res.data;
  97. if (self.type == "phone") {
  98. window.location.href = rst.viewUrl
  99. } else {
  100. window.open(rst.viewUrl);
  101. }
  102. } else {
  103. sp.dialog(res.message);
  104. }
  105. });
  106. }
  107. self.changeType = function (n) {
  108. if (self.search.type == n) {
  109. return;
  110. } else {
  111. self.search.type = n;
  112. switch(self.search.type){
  113. case 1:self.search.ctype="行政许可";break;
  114. case 2:self.search.ctype="行政处罚";break;
  115. case 3:self.search.ctype="行政强制";break;
  116. case 4:self.search.ctype="行政检查";break;
  117. case 5:self.search.ctype="行政奖励";break;
  118. case 6:self.search.ctype="其他类别";break;
  119. }
  120. self.getData(1)
  121. }
  122. }
  123. }])