gcsy.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. PRJNAME: "",
  21. CADDR: "",
  22. APPCODE: "",
  23. APPUNIT: "",
  24. FUNIT: ""
  25. }
  26. self.pageno = 1;
  27. self.total_count = 0;
  28. self.getData = function (pageno) {
  29. self.list = [];
  30. self.pageno = pageno;
  31. $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
  32. var data = {
  33. tablename: "XQPROJECT",
  34. pagesize: 10,
  35. pageno: self.pageno,
  36. colums: "*",
  37. order: "ID",
  38. sqlwhere: "",
  39. sqlorwhere: "",
  40. sqlinwhere: "",
  41. sqllikewhere: self.search
  42. };
  43. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  44. .success(function (obj) {
  45. var res = strToJson(s4.decryptData_CBC(obj.data));
  46. if (res.data == null || res.data == undefined || res.data == "") {
  47. self.noDataTip = 0;
  48. } else {
  49. self.noDataTip = 1;
  50. self.list = res.data;
  51. self.total_count = res.totalCount;
  52. self.data = self.list[0];
  53. }
  54. })
  55. }
  56. self.getData(self.pageno)
  57. self.getInfo = function (item, n) {
  58. if (!item) {
  59. return
  60. }
  61. var set_convertType = 0;
  62. //if (item.CODE.indexOf("pdf") > -1) {
  63. // set_convertType = 20;
  64. //} else if (item.CODE.indexOf("ofd") > -1) {
  65. // set_convertType = 570;
  66. //} else if (/(jpg|png|gif|bmp)$/i.test(item.CODE) == true) {
  67. // set_convertType = 23;
  68. //} else {
  69. // set_convertType = 0;
  70. //}
  71. //let postData = {
  72. // convertType: set_convertType,
  73. // fileUrl: apiurljs.login + "g2work/files2/inline/" + item.CODE
  74. //};
  75. let postData = {
  76. convertType: 20,
  77. fileUrl: apiurljs.login.split("glwork")[0] + "glworkweb/tpl/deskunit/0e3084aa21ac379410aa07ab29bd938" + n + ".pdf"
  78. };
  79. var postCfg_transfer = {
  80. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  81. transformRequest: function (data) {
  82. return $.param(data);
  83. }
  84. };
  85. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  86. .success(function (res) {
  87. //console.log(res);
  88. if (res.errorcode === 0) {
  89. let rst = res.data;
  90. if (self.type == "phone") {
  91. window.location.href = rst.viewUrl
  92. } else {
  93. window.open(rst.viewUrl);
  94. }
  95. } else {
  96. sp.dialog(res.message);
  97. }
  98. });
  99. }
  100. }])