gztc.js 14 KB

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