list.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("listCtrl", ["$scope", "$http", "$timeout", '$sce', function ($scope, $http, $timeout, $sce) {
  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");
  11. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  12. self.get_type = sp.getUrlName("type");
  13. var postCfg = {
  14. headers: {
  15. 'Content-Type': 'application/json',
  16. 'Authorization': "Bearer " + self.get_AccessToken
  17. }
  18. }
  19. self.CrossPage = window.parent.CrossPage;
  20. self.getDataImg = function () {
  21. var data = {
  22. tablename: "WJFB_TPXW",
  23. pagesize: 10,
  24. pageno: 1,
  25. colums: "*",
  26. order: "ID",
  27. sqlwhere: { FBZT: "1" },
  28. sqlorwhere: "",
  29. sqlinwhere: "",
  30. sqllikewhere: ""
  31. };
  32. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  33. .success(function (obj) {
  34. var res = strToJson(s4.decryptData_CBC(obj.data));
  35. self.listImg = res.data;
  36. $.each(self.listImg, function (index, item) {
  37. if (item.IMAGEDATA != "[]" && item.IMAGEDATA != "") {
  38. item.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + JSON.parse(item.IMAGEDATA)[0].FILEURL)
  39. } else {
  40. item.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + JSON.parse(item.IMAGESDATA)[0].FILEURL)
  41. }
  42. })
  43. if (self.listImg.length > 1) {
  44. $timeout(function () {
  45. var swiper = new Swiper('.swiper-container', {
  46. loop: true,
  47. autoplay: {
  48. delay: 2000,
  49. disableOnInteraction: false,
  50. },
  51. slidesPerView: 1,
  52. centeredSlides: true,
  53. pagination: {
  54. el: '.swiper-pagination',
  55. clickable: true,
  56. }
  57. })
  58. }, 1)
  59. }
  60. })
  61. }
  62. self.getDataImg()
  63. self.getZRBM = function () {
  64. var data = {
  65. ckey: "CODE_ZRBM",
  66. routeinfoid: self.routeinfoid
  67. }
  68. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  69. .success(function (obj) {
  70. var res = strToJson(s4.decryptData_CBC(obj.data));
  71. self.ZRBM = res.data.CODE_ZRBM;
  72. self.getData1()
  73. self.getData2()
  74. self.getData3()
  75. self.getData4()
  76. self.getData5()
  77. })
  78. }
  79. self.getZRBM()
  80. self.check1 = 1;
  81. self.check2 = 1;
  82. self.check3 = 1;
  83. self.check4 = 1;
  84. self.check5 = 1;
  85. self.getData1 = function () {
  86. self.sqlwhere1 = "";
  87. self.TABLENAME1 = "";
  88. switch (self.check1) {
  89. case 1: self.sqlwhere1 = { GGBK: "C02", FBZT: "1" }; self.TABLENAME1 = "SX_TZGG"; break;
  90. case 2: self.sqlwhere1 = { LX: "C01", FBZT: "1" }; self.TABLENAME1 = "WJFB_CB"; break;
  91. case 3: self.sqlwhere1 = { LX: "C02", FBZT: "1" }; self.TABLENAME1 = "WJFB_CB"; break;
  92. case 4: self.sqlwhere1 = { LX: "C03", FBZT: "1" }; self.TABLENAME1 = "WJFB_CB"; break;
  93. }
  94. var data = {
  95. tablename: self.TABLENAME1,
  96. pagesize: 10,
  97. pageno: 1,
  98. colums: "*",
  99. order: "ID",
  100. sqlwhere: self.sqlwhere1,
  101. sqlorwhere: "",
  102. sqlinwhere: "",
  103. sqllikewhere: ""
  104. };
  105. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  106. .success(function (obj) {
  107. var res = strToJson(s4.decryptData_CBC(obj.data));
  108. self.list1 = res.data;
  109. self.list1.forEach(function (item) {
  110. item.BT = item.WJBT ? item.WJBT : item.GGBT;
  111. self.ZRBM.forEach(function (item1) {
  112. if (item.FBBM == item1.CODE) {
  113. item.BM = item1.CNAME;
  114. }
  115. })
  116. })
  117. })
  118. }
  119. self.getData2 = function () {
  120. self.sqlwhere2 = "";
  121. self.TABLENAME2 = "";
  122. switch (self.check2) {
  123. case 1: self.sqlwhere2 = { LX: "C08", FBZT: "1" }; self.TABLENAME2 = "WJFB_CB"; break;
  124. case 2: self.sqlwhere2 = { GGBK: "C06", FBZT: "1" }; self.TABLENAME2 = "SX_TZGG"; break;
  125. }
  126. var data = {
  127. tablename: self.TABLENAME2,
  128. pagesize: 10,
  129. pageno: 1,
  130. colums: "*",
  131. order: "ID",
  132. sqlwhere: self.sqlwhere2,
  133. sqlorwhere: "",
  134. sqlinwhere: "",
  135. sqllikewhere: ""
  136. };
  137. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  138. .success(function (obj) {
  139. var res = strToJson(s4.decryptData_CBC(obj.data));
  140. self.list2 = res.data;
  141. self.list2.forEach(function (item) {
  142. item.BT = item.WJBT ? item.WJBT : item.GGBT;
  143. self.ZRBM.forEach(function (item1) {
  144. if (item.FBBM == item1.CODE) {
  145. item.BM = item1.CNAME;
  146. }
  147. })
  148. })
  149. })
  150. }
  151. self.getData3 = function () {
  152. self.sqlwhere3 = "";
  153. self.TABLENAME3 = "";
  154. switch (self.check3) {
  155. case 1: self.sqlwhere3 = { GGBK: "C01", FBZT: "1" }; self.TABLENAME3 = "SX_TZGG"; break;
  156. case 2: self.sqlwhere3 = { LX: "C09", FBZT: "1" }; self.TABLENAME3 = "WJFB_CB"; break;
  157. case 3: self.sqlwhere3 = { GGBK: "C05", FBZT: "1" }; self.TABLENAME3 = "SX_TZGG"; break;
  158. case 4: self.sqlwhere3 = { GGBK: "C08", FBZT: "1" }; self.TABLENAME3 = "SX_TZGG"; break;
  159. case 5: self.sqlwhere3 = { LX: "C06", FBZT: "1" }; self.TABLENAME3 = "WJFB_CB"; break;
  160. }
  161. var data = {
  162. tablename: self.TABLENAME3,
  163. pagesize: 10,
  164. pageno: 1,
  165. colums: "*",
  166. order: "ID",
  167. sqlwhere: self.sqlwhere3,
  168. sqlorwhere: "",
  169. sqlinwhere: "",
  170. sqllikewhere: ""
  171. };
  172. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  173. .success(function (obj) {
  174. var res = strToJson(s4.decryptData_CBC(obj.data));
  175. self.list3 = res.data;
  176. self.list3.forEach(function (item) {
  177. item.BT = item.WJBT ? item.WJBT : item.GGBT;
  178. item.FBRQ = item.FBRQ ? item.FBRQ : item.FBSJ;
  179. self.ZRBM.forEach(function (item1) {
  180. if (item.FBBM == item1.CODE) {
  181. item.BM = item1.CNAME;
  182. }
  183. })
  184. })
  185. })
  186. }
  187. self.getData4 = function () {
  188. self.sqlwhere4 = "";
  189. self.TABLENAME4 = "";
  190. switch (self.check4) {
  191. case 1: self.sqlwhere4 = { LX: "C04", FBZT: "1" }; self.TABLENAME4 = "WJFB_CB"; break;
  192. case 2: self.sqlwhere4 = { LX: "C05", FBZT: "1" }; self.TABLENAME4 = "WJFB_CB"; break;
  193. case 3: self.sqlwhere4 = { GGBK: "C03", FBZT: "1" }; self.TABLENAME4 = "SX_TZGG"; break;
  194. case 4: self.sqlwhere4 = { GGBK: "C04", FBZT: "1" }; self.TABLENAME4 = "SX_TZGG"; break;
  195. case 5: self.sqlwhere4 = { GGBK: "C07", FBZT: "1" }; self.TABLENAME4 = "SX_TZGG"; break;
  196. }
  197. var data = {
  198. tablename: self.TABLENAME4,
  199. pagesize: 10,
  200. pageno: 1,
  201. colums: "*",
  202. order: "ID",
  203. sqlwhere: self.sqlwhere4,
  204. sqlorwhere: "",
  205. sqlinwhere: "",
  206. sqllikewhere: ""
  207. };
  208. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  209. .success(function (obj) {
  210. var res = strToJson(s4.decryptData_CBC(obj.data));
  211. self.list4 = res.data;
  212. self.list4.forEach(function (item) {
  213. item.BT = item.WJBT ? item.WJBT : item.GGBT;
  214. self.ZRBM.forEach(function (item1) {
  215. if (item.FBBM == item1.CODE) {
  216. item.BM = item1.CNAME;
  217. }
  218. })
  219. })
  220. })
  221. }
  222. self.getData5 = function () {
  223. self.sqlwhere5 = "";
  224. self.TABLENAME5 = "WJFB_CB";
  225. switch (self.check5) {
  226. case 1: self.sqlwhere5 = { LX: "C10", FBZT: "1" }; break;
  227. case 2: self.sqlwhere5 = { LX: "C11", FBZT: "1" }; break;
  228. case 3: self.sqlwhere5 = { LX: "C12", FBZT: "1" }; break;
  229. }
  230. var data = {
  231. tablename: self.TABLENAME5,
  232. pagesize: 10,
  233. pageno: 1,
  234. colums: "*",
  235. order: "ID",
  236. sqlwhere: self.sqlwhere5,
  237. sqlorwhere: "",
  238. sqlinwhere: "",
  239. sqllikewhere: ""
  240. };
  241. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  242. .success(function (obj) {
  243. var res = strToJson(s4.decryptData_CBC(obj.data));
  244. self.list5 = res.data;
  245. self.list5.forEach(function (item) {
  246. item.BT = item.WJBT ? item.WJBT : item.GGBT;
  247. self.ZRBM.forEach(function (item1) {
  248. if (item.FBBM == item1.CODE) {
  249. item.BM = item1.CNAME;
  250. }
  251. })
  252. })
  253. })
  254. }
  255. self.changeType = function (str, n) {
  256. if (self[str] == n) {
  257. return
  258. } else {
  259. self[str] = n;
  260. switch (str.slice(5)) {
  261. case '1': self.getData1(); break;
  262. case '2': self.getData2(); break;
  263. case '3': self.getData3(); break;
  264. case '4': self.getData4(); break;
  265. case '5': self.getData5(); break;
  266. }
  267. }
  268. }
  269. self.goUrl = function (obj, n) {
  270. var code = [];
  271. for (var i in self["sqlwhere" + n]) {
  272. code.push(i)
  273. }
  274. console.log(obj);
  275. if (n == 0) {
  276. window.location.href = "../../tpl/wenjianbg/WJFBB1/detail.html?id=" + obj.ID + "&formPage=wenjianshow";
  277. } else {
  278. if (self["TABLENAME" + n] == "WJFB_CB") {
  279. window.location.href = "../../tpl/wenjianbg/WJFBB/detail.html?id=" + obj.ID + "&formPage=wenjianshow&tablename=" + self["TABLENAME" + n] + "&code=" + code[0] + "&val=" + self["sqlwhere" + n][code[0]]
  280. } else {
  281. window.location.href = "../../tpl/tongzhibg/TZGG/detail.html?id=" + obj.ID + "&formPage=wenjianshow&tablename=" + self["TABLENAME" + n] + "&code=" + code[0] + "&val=" + self["sqlwhere" + n][code[0]]
  282. }
  283. }
  284. }
  285. self.goMore = function (n) {
  286. var code = [];
  287. for (var i in self["sqlwhere" + n]) {
  288. code.push(i)
  289. }
  290. window.location.href = "list1.html?tablename=" + self["TABLENAME" + n] + "&code=" + code[0] + "&val=" + self["sqlwhere" + n][code[0]]
  291. }
  292. //记录日志
  293. self.journalRecord = function (time1, time2, title, func, url) {
  294. if (!self.CrossPage || !self.CrossPage.cname) { return; }
  295. var data = {
  296. tablename: "SYS_CLICKLOG",
  297. data: {
  298. CTIME: time1 == null ? sp.getLocalDate1() : time1,
  299. TITLE: (title != "" ? self.CrossPage.cname + "/" + title : self.CrossPage.cname),
  300. REQUESTURL: url,
  301. REQUESTHEADERURL: window.location.origin,
  302. LOGTYPE: func,
  303. USERTYPE: $.cookie("GlWorkPlatform-userType"),
  304. ADMIN: $.cookie("GlWorkPlatform-userTypeEng"),
  305. CLIENTIP: sp.myIP(),
  306. PCNAME: sp.detectOS(),
  307. BROWSERNAME: sp.browser(),
  308. RESPONSETIME: time2 == null ? sp.getLocalDate1() : time2,
  309. USERID: self.userId,
  310. USERNAME: self.userName
  311. }
  312. }
  313. $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  314. .success(function (res) {
  315. self.CrossPage.type = 1;
  316. })
  317. }
  318. }])