ywbl.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. var colors = ["#d5e7f5", "#d2f4e0", "#feedcf", "#fcdce1", "#e0f2f2", "#eae9f7"]
  18. self.getTop6 = function () {
  19. var data = {
  20. userid: self.userId,
  21. ntops:0//6
  22. }
  23. $http.post(apiurljs.login + "g2work/routeinfo/queryDataToDoFlowRouteCountDesktopByUserid", data, postCfg)
  24. .success(function (obj) {
  25. // var res = strToJson(s4.decryptData_CBC(obj.data));
  26. var res = obj;
  27. self.ywblList = res.data;
  28. $.each(self.ywblList, function (index, item) {
  29. item.background = { "background-color": "" + colors[index % 6] + "" };
  30. item.news = { "background": "url(img/triangle" + (index % 6 + 1) + ".png) no-repeat center" }
  31. item.base = { "background": "url('img/base" + (index % 6 + 1) + ".png') no-repeat center center", "background-size": "110% 115%" };
  32. item.circel = { "background": "url('img/icon" + (index % 6 + 1) + ".png') no-repeat center center rgba(74,156,247,0.6)" };
  33. item.show = item.FILEN.indexOf("shouwenbg") > -1 || item.FILEN.indexOf("shixiangdb") > -1 || item.FILEN.indexOf("xinfangbg") > -1
  34. //self.getData(item, index + 1)
  35. })
  36. self.ywblCss = {
  37. "width": self.ywblList.length > 6 ? self.deviceType == "pad" ? "calc(100% - 60px)" : "calc(100% - 100px)" : "100%",
  38. "height": "150px",
  39. "overflow": "hidden"
  40. }
  41. })
  42. }
  43. self.getTop6()
  44. $interval(function () {
  45. //self.getTop6()
  46. }, 5000)
  47. self.ywblMove = function (n) {
  48. var marginLeft = parseInt($(".sp-page").css("margin-left").slice(0, $(".sp-page").css("margin-left").indexOf("px"))) + n * $(".Item").outerWidth();
  49. if (marginLeft > 0) {
  50. marginLeft = 0
  51. } else if (marginLeft < ($(".sp-page").outerWidth() - $(".Item").outerWidth() * 6) * -1) {
  52. marginLeft = ($(".sp-page").outerWidth() - $(".Item").outerWidth() * 6) * -1
  53. }
  54. $(".sp-page").css("margin-left", marginLeft)
  55. }
  56. self.getData = function (obj, n) {
  57. $timeout(function () {
  58. var chart = new Highcharts.Chart({
  59. chart: {
  60. spacing: [40, 0, 40, 0],
  61. renderTo: "chart" + n,
  62. backgroundColor: 'rgba(0,0,0,0)',
  63. type: 'pie',
  64. style: {
  65. position: 'relative',
  66. left: '-8px'
  67. }
  68. },
  69. title: {
  70. floating: true,
  71. text: '', //图表的标题
  72. useHTML: true,
  73. formatter: function () {
  74. return '<img src="img/img1.png" width=60px>'
  75. }
  76. },
  77. tooltip: {
  78. enabled: false,
  79. },
  80. colors: ['#FFFF00', '#32CD32', '#FF0000'],
  81. legend: {
  82. enabled: false,
  83. },
  84. plotOptions: {
  85. pie: {
  86. cursor: 'pointer',
  87. size: 75,
  88. dataLabels: {
  89. enabled: false,
  90. }
  91. }
  92. },
  93. series: [{
  94. data: [{ name: "紫灯", y: 1, num: obj.BLACKCOUNT }, { name: "红灯", y: 1, num: obj.REDCOUNT }, { name: "黄灯", y: 1, num: obj.YELLOWCOUNT }, { name: "绿灯", y: 1, num: obj.GREENCOUNT }]
  95. }],
  96. credits: {
  97. enabled: false//隐藏右下角网址
  98. },
  99. exporting: {
  100. enabled: false//隐藏右上角打印
  101. }
  102. })
  103. chart.setSize(100, 98)
  104. },0)
  105. }
  106. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  107. self.addTabNav = function (obj) {
  108. if (self.deviceType == "pad") {
  109. window.top.jumpPageParent(obj.FLOWCODE, obj.CNAME, obj.FILEN);
  110. } else {
  111. window.top.sp.addTabNav(obj.FLOWCODE, obj.CNAME, obj.FILEN);
  112. }
  113. event.stopPropagation()
  114. }
  115. self.goParams = function (obj, params) {
  116. if (params != "") {
  117. if (self.deviceType == "pad") {
  118. window.top.jumpPageParent(obj.FLOWCODE, obj.CNAME, obj.FILEN + (obj.FILEN.indexOf("?") == -1 ? "?params=" + params : "&params=" + params));
  119. } else {
  120. window.top.sp.addTabNav(obj.FLOWCODE, obj.CNAME, obj.FILEN + (obj.FILEN.indexOf("?") == -1 ? "?params=" + params : "&params=" + params));
  121. }
  122. }
  123. event.stopPropagation()
  124. }
  125. self.updateTest = function () {
  126. var data1 = {
  127. tablename: "SW_LDPSCBD",
  128. id: "1241076374974132224",
  129. data: {
  130. DBSX: "2024-07-15 00:00:00"
  131. }
  132. }
  133. $http.post(apiurljs.login + "g2app/dataabase/upFormData", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
  134. .success(function (obj1) {
  135. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  136. //if (res1.success) {
  137. // var data2 = {
  138. // routeinfoid: "1254744583690924032",
  139. // userid: "",
  140. // edate: "2024-07-15 00:00:00",
  141. // linkrouteinfoid: "1241076374982520832"
  142. // }
  143. // $http.post(apiurljs.login +
  144. // "g2work/routeinfo/addRouteinfoTimelimitDelayedate", {
  145. // data: s4.encryptData_CBC(JSON.stringify(data2))
  146. // }, postCfg)
  147. // .success(function (obj2) {
  148. // self.getDataTest()
  149. // })
  150. //}
  151. })
  152. }
  153. //self.updateTest()
  154. self.getDataTest = function () {
  155. var data = {
  156. tablename: "SW_LDPSCBD",
  157. colums: "*",
  158. order: "ID",
  159. sqlwhere: { ID: "1241076374974132224" },
  160. sqlinwhere: "",
  161. sqllikewhere: ""
  162. }
  163. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  164. .success(function (obj) {
  165. var res = strToJson(s4.decryptData_CBC(obj.data));
  166. console.log(res)
  167. })
  168. }
  169. //self.getDataTest()
  170. }])
  171. app.directive("repeatFinish", function () {
  172. return {
  173. link: function (scope) {
  174. if (scope.$parent.ctl.ywblList.length > 6) {
  175. if (scope.$parent.ctl.deviceType == "pad") {
  176. $(".Item").eq(scope.$index).css("width", ($(window).width() - 60) / 6)
  177. if (scope.$last == true) {
  178. $(".sp-page").css("width", scope.$parent.ctl.ywblList.length * ($(window).width() - 60) / 6)
  179. }
  180. } else {
  181. $(".Item").eq(scope.$index).css("width", ($(window).width() - 100) / 6)
  182. if (scope.$last == true) {
  183. $(".sp-page").css("width", scope.$parent.ctl.ywblList.length * ($(window).width() - 100) / 6)
  184. }
  185. }
  186. } else {
  187. $(".Item").eq(scope.$index).css("width", $(window).width() / 6)
  188. if (scope.$last == true) {
  189. $(".sp-page").css("width", scope.$parent.ctl.ywblList.length * $(window).width() / 6)
  190. }
  191. }
  192. }
  193. };
  194. });