gztc.js 14 KB

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