gztc.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination',
  4. ]);
  5. app.controller("indexCtrl", ["$scope", "$http", "$interval", "$timeout", function($scope, $http, $interval, $timeout) {
  6. var self = this;
  7. self.userId = $.cookie("GlWorkPlatform-userid");
  8. self.userName = $.cookie("GlWorkPlatform-username");
  9. self.userChineseName = $.cookie("GlWorkPlatform-chineseName")
  10. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  11. var postCfg = {
  12. headers: {
  13. 'Content-Type': 'application/json',
  14. 'Authorization': "Bearer " + self.get_AccessToken,
  15. }
  16. };
  17. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  18. self.goHref = function(obj) {
  19. if (self.deviceType == "pad") {
  20. window.top.jumpPageParent(obj.FLOWCODE, obj.CNAME, obj.FILEN + (obj.FILEN.indexOf("?") > -1 ? "&flowids=" + obj.FLOWID : "?flowids=" + obj.FLOWID));
  21. } else {
  22. window.top.sp.addTabNav(obj.FLOWCODE, obj.CNAME, obj.FILEN + (obj.FILEN.indexOf("?") > -1 ? "&flowids=" + obj.FLOWID : "?flowids=" + obj.FLOWID));
  23. }
  24. }
  25. self.goHref1 = function (obj) {
  26. window.open(obj.FILEN);
  27. }
  28. self.appList = []
  29. self.deptList = []
  30. var colors = ["#d5e7f5", "#d2f4e0", "#feedcf", "#fcdce1", "#e0f2f2", "#eae9f7"]
  31. self.getTop6 = function() {
  32. var data = {
  33. userid: self.userId
  34. }
  35. $http.post(apiurljs.login +
  36. "g2work/routeinfo/queryDataToDoFlowRouteCountDesktopByUseridGroup", data, postCfg)
  37. .success(function(obj) {
  38. //var res = strToJson(s4.decryptData_CBC(obj.data));
  39. var res = obj;
  40. self.ywblList = res.data;
  41. self.ywblList[2].CNAME = '业务分析'
  42. self.ywblList.splice(3, 0, {
  43. CNAME: '业务办理'
  44. })
  45. self.ywblList.splice(2, 1)
  46. $.each(self.ywblList, function(index, item) {
  47. // if(item.CNAME=='业务办理'){
  48. // item.CNAME='业务统计'
  49. // }
  50. item.background = {
  51. "background-color": "" + colors[index % 6] + ""
  52. };
  53. item.news = {
  54. "background": "url(img/triangle" + (index % 6 + 1) +
  55. ".png) no-repeat center"
  56. }
  57. item.base = {
  58. "background": "url('img/base" + (index % 6 + 1) +
  59. ".png') no-repeat center center",
  60. "background-size": "110% 115%"
  61. };
  62. item.circel = {
  63. "background": "url('img/icon" + (index % 6 + 1) +
  64. ".png') no-repeat center center rgba(74,156,247,0.6)"
  65. };
  66. if (item.DESKTOP) {
  67. for (let i = 0; i < item.DESKTOP.length; i++) {
  68. let iitem = item.DESKTOP[i]
  69. if (iitem.FILEN) {
  70. iitem.show = true || iitem.FILEN.indexOf("shouwenbg") > -
  71. 1 || iitem.FILEN.indexOf("shixiangdb") > -1 || iitem
  72. .FILEN.indexOf("xinfangbg") > -1
  73. }
  74. }
  75. }
  76. })
  77. self.ywblCss = {
  78. "width": "100%",
  79. "height": self.deviceType == "pad" ? "120px" : "150px",
  80. "overflow": "hidden"
  81. }
  82. })
  83. }
  84. self.activeBottomObj = 1;
  85. self.secondAfter = 0; //记录左移右移次数
  86. self.appDbCount = 0
  87. self.getSecond = function(n) {
  88. $(".bottomObj").removeClass($(".bottomObj").attr("class").split(" ")[2])
  89. $(".bottomObj").addClass("bottomObj" + (n + 1 > 7 ? 7 : n + 1))
  90. self.activeBottomObj = n + 1 > 7 ? 7 : n + 1
  91. }
  92. self.getTop6()
  93. $interval(function() {
  94. self.getTop6()
  95. }, 20000)
  96. self.ywblMove = function(n) {
  97. var marginLeft = parseInt($(".List").css("margin-left").slice(0, $(".List").css("margin-left")
  98. .indexOf("px"))) + n * $(".Item").outerWidth();
  99. if (marginLeft > 0) {
  100. $(".List").css("margin-left", 0)
  101. } else if (marginLeft < ($(".List").outerWidth() - $(".Item").outerWidth() * 7) * -1) {
  102. $(".List").css("margin-left", ($(".List").outerWidth() - $(".Item").outerWidth() * 7) * -1)
  103. } else {
  104. self.secondAfter = self.secondAfter + n;
  105. $(".List").css("margin-left", marginLeft)
  106. self.activeBottomObj = self.activeBottomObj + n * -1;
  107. if (self.activeBottomObj < 1) {
  108. self.activeBottomObj = 1
  109. } else if (self.activeBottomObj > self.ywblList.length) {
  110. self.activeBottomObj = self.ywblList.length;
  111. }
  112. }
  113. }
  114. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  115. self.addTabNav = function(obj, n) {
  116. self.deptAppList = []
  117. self.nowDeptName = ""
  118. self.activeBottomObj = n + 1
  119. $(".bottomObj").removeClass($(".bottomObj").attr("class").split(" ")[2])
  120. if (self.secondAfter != 0) {
  121. $(".bottomObj").addClass("bottomObj" + (n + 1 + self.secondAfter))
  122. } else {
  123. $(".bottomObj").addClass("bottomObj" + (n + 1))
  124. }
  125. if (self.activeBottomObj != 3) {
  126. window.parent[1].frameElement.height = '220px'
  127. //let iboxContent = document.getElementById("sjtsgzt")
  128. // iboxContent.style.height="100px"
  129. //console.log(iboxContent)
  130. } else {
  131. window.parent[1].frameElement.height = '229px'
  132. }
  133. }
  134. self.goParams = function(obj, params) {
  135. if (params != "" && params != undefined && params != null) {
  136. if (self.deviceType == "pad") {
  137. window.top.jumpPageParent(obj.FLOWCODE, obj.CNAME, obj.FILEN);
  138. } else {
  139. window.top.sp.addTabNav(obj.FLOWCODE, obj.CNAME, obj.FILEN);
  140. }
  141. } else {
  142. if (self.deviceType == "pad") {
  143. window.top.jumpPageParent(obj.FLOWCODE, obj.CNAME, obj.FILEN);
  144. } else {
  145. window.top.sp.addTabNav(obj.FLOWCODE, obj.CNAME, obj.FILEN);
  146. }
  147. }
  148. event.stopPropagation()
  149. }
  150. self.goApp = function(obj) {
  151. if (obj.url.indexOf("@token") > -1) {
  152. window.top.sp.addTabNav(obj.appCode, obj.name, obj.url.replace("@token", localStorage
  153. .getItem("main-token")));
  154. } else {
  155. window.top.sp.addTabNav(obj.appCode, obj.name, obj.url);
  156. }
  157. }
  158. self.goDeptApp = function(obj) {
  159. //sp.layerhide()
  160. if (obj.indexUrl.indexOf("?") > -1) {
  161. // window.top.sp.addTabNav(obj.appCode, obj.appName, obj.indexUrl + '&token=' + localStorage
  162. // .getItem("main-token"));
  163. window.open(obj.indexUrl + '&token=' + localStorage.getItem("main-token"));
  164. } else {
  165. // window.top.sp.addTabNav(obj.appCode, obj.appName, obj.indexUrl + '?token=' + localStorage
  166. // .getItem("main-token"));
  167. window.open(obj.indexUrl + '?token=' + localStorage.getItem("main-token"));
  168. }
  169. }
  170. self.deptAppList = []
  171. self.nowDeptName = ""
  172. self.goDeptAppList = function(obj) {
  173. window.parent[1].frameElement.height = '290px'
  174. //window.parent.parent.deptClick_FJSKECMADWDSCBNHX(obj.deptId,obj.deptName)
  175. self.deptAppList = []
  176. self.nowDeptName = obj.deptName
  177. //sp.layer("#dept-app-list")
  178. var dptCfg = {
  179. headers: {
  180. 'Content-Type': 'application/json',
  181. 'Access-Token': localStorage.getItem("main-token"),
  182. }
  183. };
  184. $http.get(
  185. apiurljs.dpt + "auth/system/app-list-divisions?deptId=" + obj.deptId,
  186. dptCfg
  187. ).success(function(obj) {
  188. self.deptAppList = obj.result
  189. })
  190. }
  191. self.deptClick = function(deptId) {
  192. //console.log(self.parent)
  193. //window.top.sp.deptClick_FJSKECMADWDSCBNHX('123');
  194. //sp.layer("#dept-app-list")
  195. //window.deptClick_FJSKECMADWDSCBNHX(deptId)
  196. }
  197. // self.sysappListOuter = function () {
  198. // let postCfg_ = {
  199. // headers: {
  200. // 'Content-Type': 'application/json',
  201. // 'Authorization': "Bearer " + self.get_AccessToken
  202. // }
  203. // };
  204. // var data = {
  205. // token: localStorage.getItem("main-token"),
  206. // userid: self.userId,
  207. // type: 'oa',
  208. // portalShow: 1,
  209. // }
  210. // $http.post(apiurljs.login + "g2app/pluginkinds/sysappListOuter", data, postCfg_)
  211. // .success(function (obj) {
  212. // var res = strToJson(s4.decryptData_CBC(obj.data));
  213. // var res = obj;
  214. // let appList = []
  215. // for (let i = 0; i < res.result.length; i++) {
  216. // let item = res.result[i]
  217. // for (let j = 0; j < item.appList.length; j++) {
  218. // let appItem = item.appList[j]
  219. // appList.push({
  220. // name: appItem.appName,
  221. // url: appItem.indexUrl,
  222. // appCode: appItem.appCode
  223. // })
  224. // }
  225. // }
  226. // self.appList = appList
  227. // self.appDbCount = 0
  228. // for (let i = 0; i < self.appList.length; i++) {
  229. // let data_ = {
  230. // token: localStorage.getItem("main-token"),
  231. // userid: self.userId,
  232. // appCode: self.appList[i].appCode,
  233. // portalShow: 1,
  234. // }
  235. // $http.post(apiurljs.login + "g2app/pluginkinds/behalf", data_, postCfg_)
  236. // .success(function (objj) {
  237. // var ress = strToJson(s4.decryptData_CBC(objj.data));
  238. // var res = obj;
  239. // if (ress.result == '-1') {
  240. // self.appList[i].dbCount = 0
  241. // } else {
  242. // self.appList[i].dbCount = +ress.result
  243. // }
  244. // self.appDbCount += self.appList[i].dbCount
  245. // })
  246. // }
  247. // })
  248. // }
  249. // self.sysappListOuter()
  250. self.sysappListOuter = function() {
  251. // appList.push({
  252. // name:'房地产市场',
  253. // url:'http://10.149.1.56:8077/realEstate/newHouseTransactions?topTitle=房地产市场分析&muemType=1&token=@token&u=1171164793054724096',
  254. // appCode:'F0104',
  255. // })
  256. // appList.push({
  257. // name:'政务办件统计',
  258. // url:'http://10.149.1.76:31693/manager/server/b1105/index?u=1171164793054724097',
  259. // appCode:'F0108',
  260. // })
  261. // self.appList = appList
  262. $http.post(
  263. apiurljs.login + "UserPower/PermissionsByMenuID", {
  264. userid: self.userId,
  265. menuid: 'F04'
  266. },
  267. postCfg
  268. ).success(function(obj) {
  269. //var res = strToJson(s4.decryptData_CBC(obj.data));
  270. var res = obj;
  271. let appList = []
  272. res.data.rows.forEach(function(row) {
  273. row.C_H_I_L_D.forEach(function(item) {
  274. appList.push({
  275. name: item.CNAME,
  276. url: item.FILEN,
  277. appCode: item.PKID,
  278. })
  279. })
  280. })
  281. self.appList = appList
  282. })
  283. }
  284. self.deptJc = [
  285. { jx: "政务服务处", qc:"政务服务处" },
  286. { jx: "投资计划处", qc:"投资计划处" },
  287. { jx: "建筑市场处", qc:"建筑市场管理处" },
  288. { jx: "标准设计处", qc:"标准设计处" },
  289. { jx: "工程质量管理处", qc:"" },
  290. { jx: "安全和应急处", qc:"工程安全和应急管理处" },
  291. { jx: "房屋管理处", qc:"房屋管理处" },
  292. { jx: "物业管理处", qc:"物业管理处" },
  293. { jx: "房地产市场管理处", qc:"房地产市场管理处" },
  294. { jx: "住房保障处", qc:"住房保障处" },
  295. { jx: "住房改革处", qc:"住房改革发展处" },
  296. { jx: "城市更新处", qc:"城市更新处" },
  297. { jx: "村镇管理处", qc:"村镇建设处" },
  298. { jx: "节能和绿色发展处", qc:"建筑节能和绿色发展促进处" },
  299. { jx: "科技教育处", qc:"科技教育处" },
  300. { jx: "消防验收处", qc:"建设工程消防验收处" },
  301. { jx: "网信办", qc:"网络安全和信息化办公室" },
  302. { jx: "执法总队", qc:"天津市住房和城乡建设综合行政执法总队" },
  303. { jx: "建筑市场中心", qc:"天津市建筑市场服务中心" },
  304. { jx: "住保中心", qc:"" },
  305. { jx: "房管中心", qc:"" },
  306. ]
  307. self.getDeptList = function() {
  308. self.deptList = []
  309. var dptCfg = {
  310. headers: {
  311. 'Content-Type': 'application/json',
  312. 'Access-Token': localStorage.getItem("main-token"),
  313. }
  314. };
  315. $http.get(
  316. apiurljs.dpt + "auth/permit/lead-offices",
  317. dptCfg
  318. ).success(function(obj) {
  319. //self.deptList.push({deptNameJx:"统计分析",deptName:"统计分析",deptId:"tjfx"})
  320. for(let i=0;i<self.deptJc.length;i++){
  321. let localDept = self.deptJc[i]
  322. for(let j=0;j<obj.result.length;j++){
  323. if(obj.result[j].deptName==localDept.qc||obj.result[j].deptName==localDept.jx){
  324. obj.result[j].deptNameJx = localDept.jx
  325. self.deptList.push(obj.result[j])
  326. break;
  327. }
  328. }
  329. }
  330. //self.deptList = obj.result
  331. // deptId "8a502c8e863ab2d9018678028b6004fa"
  332. // deptName "天津市住房保障服务中心"
  333. })
  334. }
  335. self.sysappListOuter()
  336. self.getDeptList()
  337. }])
  338. app.directive("repeatFinish", function() {
  339. return {
  340. link: function(scope) {
  341. if (scope.$parent.ctl.deviceType == "pad") {
  342. $(".Item").eq(scope.$index).css("width", $(window).width() / 7)
  343. if (scope.$last == true) {
  344. $(".List").css("width", scope.$parent.ctl.ywblList.length * $(window).width() / 7)
  345. }
  346. } else {
  347. $(".Item").eq(scope.$index).css("width", $(window).width() / 7)
  348. if (scope.$last == true) {
  349. $(".List").css("width", scope.$parent.ctl.ywblList.length * $(window).width() / 7)
  350. }
  351. }
  352. }
  353. };
  354. });
  355. function showBtnLR() {
  356. if (localStorage.getItem("tjJxtGoldenlinkWork-deviceType") != "pad") {
  357. $('.moveLeft').show();
  358. $('.moveRight').show()
  359. }
  360. }
  361. function hideBtnLR() {
  362. if (localStorage.getItem("tjJxtGoldenlinkWork-deviceType") != "pad") {
  363. $('.moveLeft').hide();
  364. $('.moveRight').hide()
  365. }
  366. }
  367. function formate(num) {
  368. return num > 9 ? num : "0" + num;
  369. }
  370. function getWeek(date) {
  371. switch (new Date(date).getDay()) {
  372. case 0:
  373. return "星期日";
  374. break;
  375. case 1:
  376. return "星期一";
  377. break;
  378. case 2:
  379. return "星期二";
  380. break;
  381. case 3:
  382. return "星期三";
  383. break;
  384. case 4:
  385. return "星期四";
  386. break;
  387. case 5:
  388. return "星期五";
  389. break;
  390. case 6:
  391. return "星期六";
  392. break;
  393. }
  394. }
  395. function getDate(str) {
  396. var year = str.getFullYear();
  397. var month = str.getMonth();
  398. var day = str.getDate();
  399. return new Date(year, month, day).getTime()
  400. }