gztc.js 16 KB

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