plug.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("plugCtrl", ["$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");
  11. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno") || 1;
  12. self.leaf = sp.getUrlName("leaf") | 0;
  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.loading = false;
  21. //党建工作
  22. self.tab_dangjian = [
  23. //{ "CNAME": "党建工作", "CODE": "P010201" }, { "CNAME": "机关党务公开", "CODE": "P010202" },
  24. //{ "CNAME": "巡察工作", "CODE": "P010203" }, { "CNAME": "领导讲话", "CODE": "P010204" },
  25. //{ "CNAME": "党委会会议纪要", "CODE": "P010205" }, { "CNAME": "党建工作(学习园地)", "CODE": "P010206" },
  26. //{ "CNAME": "时政要闻", "CODE": "P010207" }
  27. ];
  28. self.tab_dangjian_active = "";
  29. ///委发文件
  30. self.tab_weiFaWenJian = [
  31. //{ "CNAME": "党委文件", "CODE": "P010301" },{ "CNAME": "委发规范性文件", "CODE": "P010302" }
  32. ];
  33. self.tab_weiFaWenJian_active = "";
  34. ///行政工作
  35. self.tab_xingZhengGongZuo = [
  36. //{ "CNAME": "住建工作动态", "CODE": "P010101" }, { "CNAME": "督查专报", "CODE": "P010102" },
  37. //{ "CNAME": "主任办公会会议纪要", "CODE": "P010103" }
  38. ];
  39. self.tab_xingZhengGongZuo_active = "";
  40. ///相关知识
  41. self.tab_xiangGuanZhiShi = [
  42. //{ "CNAME": "国家安全和保密工作", "CODE": "P010401" }, { "CNAME": "网信知识", "CODE": "P010402" }
  43. ];
  44. self.tab_xiangGuanZhiShi_active = "";
  45. ///学习园地
  46. self.tab_xueXiYuanDi = [
  47. { "CNAME": "学习园地", "CODE": "P010206" }
  48. ];
  49. self.getLM = function () {
  50. var data = {
  51. tablename: "CODE_LM"
  52. }
  53. $http.post(apiurljs.login + "g2app/filepublishing/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  54. .success(function (obj) {
  55. var res = strToJson(s4.decryptData_CBC(obj.data));
  56. //console.log(JSON.stringify(res.data[0].C_H_I_L_D_DATA));
  57. self.LM = res.data[0].C_H_I_L_D_DATA;
  58. self.LM.forEach(function (item) {
  59. if (item.CODE == "P0102") {
  60. ///党建工作
  61. var set_array = [];
  62. item.C_H_I_L_D_DATA.forEach(function (item1) {
  63. if (item1.CODE != "P010201" && item1.CODE != "P010206" && item1.CODE != "P010207") {
  64. var setjson = { "CNAME": item1.CNAME, "CODE": item1.CODE };
  65. set_array.push(setjson);
  66. }
  67. //var setjson = { "CNAME": item1.CNAME, "CODE": item1.CODE };
  68. //set_array.push(setjson);
  69. })
  70. self.tab_dangjian = set_array;
  71. //console.log("党建工作:" + JSON.stringify(set_array));
  72. self.getData_up(self.get_lastReturnPageno, "P0102");
  73. self.getData(self.get_lastReturnPageno, self.tab_dangjian[0].CODE, 3);
  74. self.tab_dangjian_active = self.tab_dangjian[0].CODE;
  75. }
  76. if (item.CODE == "P0103") {
  77. ///委发文件
  78. var set_array = [];
  79. item.C_H_I_L_D_DATA.forEach(function (item1) {
  80. if (item1.CODE != "P010301") {
  81. var setjson = { "CNAME": item1.CNAME, "CODE": item1.CODE };
  82. set_array.push(setjson);
  83. }
  84. })
  85. self.tab_weiFaWenJian = set_array;
  86. //console.log("委发文件:" + JSON.stringify(set_array));
  87. self.getData_up(self.get_lastReturnPageno, "P0103");
  88. self.getData(self.get_lastReturnPageno, self.tab_weiFaWenJian[0].CODE, 3);
  89. self.tab_weiFaWenJian_active = self.tab_weiFaWenJian[0].CODE;
  90. }
  91. if (item.CODE == "P0101") {
  92. ///行政工作
  93. var set_array = [];
  94. item.C_H_I_L_D_DATA.forEach(function (item1) {
  95. if (item1.CODE != "P010101") {
  96. var setjson = { "CNAME": item1.CNAME, "CODE": item1.CODE };
  97. set_array.push(setjson);
  98. }
  99. })
  100. self.tab_xingZhengGongZuo = set_array;
  101. //console.log("行政工作:" + JSON.stringify(set_array));
  102. self.getData_up(self.get_lastReturnPageno, "P0101");
  103. self.getData(self.get_lastReturnPageno, self.tab_xingZhengGongZuo[0].CODE, 3);
  104. self.tab_xingZhengGongZuo_active = self.tab_xingZhengGongZuo[0].CODE;
  105. }
  106. if (item.CODE == "P0104") {
  107. ///相关知识
  108. var set_array = [];
  109. item.C_H_I_L_D_DATA.forEach(function (item1) {
  110. if (item1.CODE != "P010401") {
  111. var setjson = { "CNAME": item1.CNAME, "CODE": item1.CODE };
  112. set_array.push(setjson);
  113. }
  114. })
  115. self.tab_xiangGuanZhiShi = set_array;
  116. //console.log("相关知识:" + JSON.stringify(set_array));
  117. self.getData_up(self.get_lastReturnPageno, "P0104");
  118. self.getData(self.get_lastReturnPageno, self.tab_xiangGuanZhiShi[0].CODE, 3);
  119. self.tab_xiangGuanZhiShi_active = self.tab_xiangGuanZhiShi[0].CODE;
  120. }
  121. });
  122. })
  123. }
  124. self.getLM();
  125. ///顶部一级及第二级的第一个
  126. self.list_dangjian_up = []; self.noDataTip_dangjian_up = 1;
  127. self.list_weifa_up = []; self.noDataTip_weifa_up = 1;
  128. self.list_xingZheng_up = []; self.noDataTip_xingZheng_up = 1;
  129. self.list_zhiShi_up = []; self.noDataTip_zhiShi_up = 1;
  130. self.getData_up = function (pageno, codestr) {
  131. var CODE = ["'" + codestr + "'", "'" + codestr + "01'"];
  132. self.loading = false;
  133. var sqlwhere = { FBZT: "1" };
  134. var data = {
  135. tablename: "SX_FBLIST",
  136. pagesize: 3,
  137. pageno: 1,
  138. colums: "*",
  139. order: "FBRQ",
  140. sqlwhere: " and LM in(" + CODE.join(",") + ") and gkfw ISNULL OR gkfw LIKE '" + self.userId + "'"
  141. };
  142. //console.log(JSON.stringify(data))
  143. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage3", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  144. .success(function (obj) {
  145. var res = strToJson(s4.decryptData_CBC(obj.data));
  146. //console.log(JSON.stringify(res.data))
  147. self.loading = false;
  148. if (codestr == "P0102") {
  149. if(sp.isval(res.data)){
  150. self.list_dangjian_up = res.data;
  151. self.noDataTip_dangjian_up = 1;
  152. }else{
  153. self.list_dangjian_up = [];
  154. self.noDataTip_dangjian_up = 0;
  155. }
  156. }
  157. if (codestr == "P0103") {
  158. if (sp.isval(res.data)) {
  159. self.list_weifa_up = res.data;
  160. self.noDataTip_weifa_up = 1;
  161. } else {
  162. self.list_weifa_up = [];
  163. self.noDataTip_weifa_up = 0;
  164. }
  165. }
  166. if (codestr == "P0101") {
  167. if (sp.isval(res.data)) {
  168. self.list_xingZheng_up = res.data;
  169. self.noDataTip_xingZheng_up = 1;
  170. } else {
  171. self.list_xingZheng_up = [];
  172. self.noDataTip_xingZheng_up = 0;
  173. }
  174. }
  175. if (codestr == "P0104") {
  176. if (sp.isval(res.data)) {
  177. self.list_zhiShi_up = res.data;
  178. self.noDataTip_zhiShi_up = 1;
  179. } else {
  180. self.list_zhiShi_up = [];
  181. self.noDataTip_zhiShi_up = 0;
  182. }
  183. }
  184. })
  185. }
  186. ////底部分栏目
  187. self.list_dangjian_foot = []; self.noDataTip_dangjian_foot = 1;
  188. self.list_weifa_foot = []; self.noDataTip_weifa_foot = 1;
  189. self.list_xingZheng_foot = []; self.noDataTip_xingZheng_foot = 1;
  190. self.list_zhiShi_foot = []; self.noDataTip_zhiShi_foot = 1;
  191. self.list_xuexiYuandi_foot = []; self.noDataTip_xuexiYuandi_foot = 1;
  192. self.getData = function (pageno, codestr, pagesize) {
  193. var CODE = ["'" + codestr + "'"];
  194. self.loading = false;
  195. var sqlwhere = { FBZT: "1" };
  196. var data = {
  197. tablename: "SX_FBLIST",
  198. pagesize: pagesize,
  199. pageno: 1,
  200. colums: "*",
  201. order: "FBRQ",
  202. sqlwhere: " and LM in(" + CODE.join(",") + ") and gkfw ISNULL OR gkfw LIKE '" + self.userId + "'"
  203. };
  204. //console.log(JSON.stringify(data))
  205. $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage3", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  206. .success(function (obj) {
  207. var res = strToJson(s4.decryptData_CBC(obj.data));
  208. //console.log(JSON.stringify(res.data))
  209. self.loading = false;
  210. if (codestr != "P010206" && codestr.indexOf("P0102") != -1) {
  211. if (sp.isval(res.data)) {
  212. self.list_dangjian_foot = res.data;
  213. self.noDataTip_dangjian_foot = 1;
  214. } else {
  215. self.list_dangjian_foot = [];
  216. self.noDataTip_dangjian_foot = 0;
  217. }
  218. }
  219. if (codestr.indexOf("P0103") != -1) {
  220. if (sp.isval(res.data)) {
  221. self.list_weifa_foot = res.data;
  222. self.noDataTip_weifa_foot = 1;
  223. } else {
  224. self.list_weifa_foot = [];
  225. self.noDataTip_weifa_foot = 0;
  226. }
  227. }
  228. if (codestr.indexOf("P0101") != -1) {
  229. if (sp.isval(res.data)) {
  230. self.list_xingZheng_foot = res.data;
  231. self.noDataTip_xingZheng_foot = 1;
  232. } else {
  233. self.list_xingZheng_foot = [];
  234. self.noDataTip_xingZheng_foot = 0;
  235. }
  236. }
  237. if (codestr.indexOf("P0104") != -1) {
  238. if (sp.isval(res.data)) {
  239. self.list_zhiShi_foot = res.data;
  240. self.noDataTip_zhiShi_foot = 1;
  241. } else {
  242. self.list_zhiShi_foot = [];
  243. self.noDataTip_zhiShi_foot = 0;
  244. }
  245. }
  246. if (codestr == "P010206") {
  247. if (sp.isval(res.data)) {
  248. self.list_xuexiYuandi_foot = res.data;
  249. self.noDataTip_xuexiYuandi_foot = 1;
  250. } else {
  251. self.list_xuexiYuandi_foot = [];
  252. self.noDataTip_xuexiYuandi_foot = 0;
  253. }
  254. }
  255. })
  256. }
  257. self.getData(self.get_lastReturnPageno, self.tab_xueXiYuanDi[0].CODE, 6);
  258. self.tabClick_dangjian = function (codestr) {
  259. self.getData(self.get_lastReturnPageno, codestr,3);
  260. self.tab_dangjian_active = codestr;
  261. };
  262. self.tabClick_weifa = function (codestr) {
  263. self.getData(self.get_lastReturnPageno, codestr, 3);
  264. self.tab_weiFaWenJian_active = codestr;
  265. }
  266. self.tabClick_xingZhengGongZuo = function (codestr) {
  267. self.getData(self.get_lastReturnPageno, codestr, 3);
  268. self.tab_xingZhengGongZuo_active = codestr;
  269. }
  270. self.tabClick_xiangGuanZhiShi = function (codestr) {
  271. self.getData(self.get_lastReturnPageno, codestr, 3);
  272. self.tab_xiangGuanZhiShi_active = codestr;
  273. }
  274. ///其他四个更多点击跳转地址
  275. self.goZL = function (codestr) {
  276. sp.openNewWindow("list1.html?code=" + codestr + "&leaf=0" + "&code1=", "")
  277. //window.location.href = "list1.html?code=" + item.CODE + "&leaf=" + (self.leaf + 1) + "&code1=";
  278. }
  279. self.goUrl = function (item, codestr) {
  280. //if (self.tablename == "WJFB_CB") {
  281. // window.location.href = "../../tpl/wenjianbg/WJFBB/detail.html?id=" + item.ID + "&formPage=wenjianshow&&tablename=" + self.tablename + "&code=" + self.code + "&val=" + self.val
  282. //} else {
  283. // window.location.href = "../../tpl/tongzhibg/TZGG/detail.html?id=" + item.ID + "&formPage=wenjianshow&&tablename=" + self.tablename + "&code=" + self.code + "&val=" + self.val
  284. //}
  285. sp.openNewWindow("detail.html?id=" + item.ID + "&code=" + codestr + "&code1=" + "&lastReturnPageno=1" + (self.leaf ? "&leaf=1" : ""), item.WJBT)
  286. //window.location.href = "detail.html?id=" + item.ID + "&code=" + self.code + "&code1=" + self.code1 + "&lastReturnPageno=" + self.pageno + (self.leaf ? "&leaf=1" : "");
  287. }
  288. ///list4.html?lastReturnPageno=1
  289. self.goPageYuanDi = function () {
  290. sp.openNewWindow("list4.html?lastReturnPageno=1", "学习园地")
  291. }
  292. self.goPageYuanDiDetail = function (item) {
  293. sp.openNewWindow("../../tpl/wenjianbg/WJFBB/detail.html?id=" + item.ID, "学习园地")
  294. }
  295. }])