list1.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. 'use strict';
  2. var app = angular.module('app', [
  3. 'angularUtils.directives.dirPagination'
  4. ]);
  5. app.controller("listCtrl", ["$scope", "$http", "$timeout", function ($scope, $http, $timeout) {
  6. var self = this;
  7. var s4 = new SM4Util();
  8. self.userId = $.cookie("GlWorkPlatform-userid");
  9. self.userName = $.cookie("GlWorkPlatform-chineseName");
  10. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  11. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  12. self.get_type = sp.getUrlName("type");
  13. var postCfg = {
  14. headers: {
  15. 'Content-Type': 'application/json',
  16. 'Authorization': "Bearer " + self.get_AccessToken
  17. }
  18. }
  19. self.search = {
  20. TYPE: 0,
  21. KSSJ: "",
  22. JSSJ: "",
  23. GWZT: 1,
  24. JJCD: ""
  25. }
  26. self.changeType = function () {
  27. switch (self.search.TYPE) {
  28. case "0": self.search.KSSJ = sp.getLocalDate(); self.search.JSSJ = ""; break;
  29. case "1": self.search.KSSJ = getWeek(1); self.search.JSSJ = getWeek(2); break;
  30. case "2": self.search.KSSJ = sp.monthfirst(sp.getLocalDate()); self.search.JSSJ = sp.formatMonthLast(sp.getLocalDate()); break;
  31. case "3": self.search.KSSJ = sp.quarter(sp.getLocalDate(), 1); self.search.JSSJ = sp.quarter(sp.getLocalDate(), 2); break;
  32. case "4": self.search.KSSJ = getYearB(1); self.search.JSSJ = getYearB(2); break;
  33. case "5": self.search.KSSJ = sp.format(sp.getLocalDate()); self.search.JSSJ = sp.format(sp.getLocalDate()); break;
  34. }
  35. }
  36. self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
  37. self.getData1 = function () {
  38. self.list1 = [];
  39. self.list2 = [];
  40. var data = {
  41. fwflow: "AA88|AA89|AA46|AA22|AA54|AA58|AA20|AA03|AA10|AA57|AA08|AA23|AA77|AA06|AA63|AA80",
  42. swflow: "AA18|AA16|AA02|AA17",
  43. yzflow: "AA64",
  44. begindate: self.search.KSSJ + (self.search.TYPE == 0 ? "" : " 00:00:00"),
  45. enddate: self.search.JSSJ + (self.search.TYPE == 0 ? "" : " 23:59:59")
  46. }
  47. $http.post(apiurljs.login + "g2app/richang/GongWenStatistics", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  48. .success(function (obj) {
  49. var res = strToJson(s4.decryptData_CBC(obj.data));
  50. if (res.data == null || res.data == undefined || res.data == "") {
  51. self.noDataTip = 0;
  52. } else {
  53. self.noDataTip = 1;
  54. self.gwsl = res.data.GWCOUNT;
  55. self.blz = res.data.DEAL;
  56. self.ygd = res.data.STOP;
  57. self.yzsl = res.data.YZCOUNT;
  58. self.bys = res.data.SW_MONTH;
  59. self.byf = res.data.FW_MONTH;
  60. self.list1 = res.data.FAWEN_TYPE;
  61. self.list2 = res.data.SHOUWEN_TYPE;
  62. self.getColumn1()
  63. self.getColumn2()
  64. }
  65. })
  66. }
  67. self.getData1()
  68. self.getColumn1 = function () {
  69. var title = [], data = [];
  70. self.list1.forEach(function (item) {
  71. title.push(item.FLOWNAME);
  72. data.push(item.TOTAL);
  73. })
  74. var chart = new Highcharts.Chart({
  75. chart: {
  76. renderTo: "column-gwzl",
  77. type: 'column'
  78. },
  79. title: {
  80. text: '', //图表的标题
  81. //margin: 80
  82. },
  83. tooltip: {
  84. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  85. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  86. '<td style="padding:0"><b>{point.y}</b>{series.className}</td></tr>',
  87. footerFormat: '</table>',
  88. shared: true,
  89. useHTML: true
  90. },
  91. xAxis: {
  92. categories: title
  93. },
  94. yAxis: {
  95. title: {
  96. text: ''
  97. },
  98. lineWidth: 1,
  99. gridLineWidth: 1
  100. },
  101. legend: {
  102. enabled: false
  103. },
  104. plotOptions: {
  105. series: {
  106. pointWidth: 30,
  107. turboThreshold: 0,
  108. cursor: 'pointer',
  109. dataLabels: {
  110. enabled: true,
  111. }
  112. }
  113. },
  114. series: [{
  115. name: "数量",
  116. data: data
  117. }],
  118. credits: {
  119. enabled: false//隐藏右下角网址
  120. },
  121. exporting: {
  122. enabled: false//隐藏右上角打印
  123. }
  124. })
  125. chart.setSize(null, 400)
  126. }
  127. self.getColumn2 = function () {
  128. var title = [], data = [];
  129. self.list2.forEach(function (item) {
  130. title.push(item.FLOWNAME);
  131. data.push(item.TOTAL);
  132. })
  133. var chart = new Highcharts.Chart({
  134. chart: {
  135. renderTo: "column-bmbl",
  136. type: 'column'
  137. },
  138. title: {
  139. text: '', //图表的标题
  140. //margin: 80
  141. },
  142. tooltip: {
  143. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  144. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  145. '<td style="padding:0"><b>{point.y}</b>{series.className}</td></tr>',
  146. footerFormat: '</table>',
  147. shared: true,
  148. useHTML: true
  149. },
  150. xAxis: {
  151. categories: title
  152. },
  153. yAxis: {
  154. title: {
  155. text: ''
  156. },
  157. lineWidth: 1,
  158. gridLineWidth: 1
  159. },
  160. legend: {
  161. enabled: false
  162. },
  163. plotOptions: {
  164. series: {
  165. pointWidth: 30,
  166. turboThreshold: 0,
  167. cursor: 'pointer',
  168. dataLabels: {
  169. enabled: true,
  170. }
  171. }
  172. },
  173. series: [{
  174. name: "数量",
  175. data: data
  176. }],
  177. credits: {
  178. enabled: false//隐藏右下角网址
  179. },
  180. exporting: {
  181. enabled: false//隐藏右上角打印
  182. }
  183. })
  184. chart.setSize(null, 400)
  185. }
  186. self.getData3 = function () {
  187. self.list3 = {};
  188. var data = {
  189. fwflow: "AA88|AA89|AA46|AA22|AA54|AA58|AA20|AA03|AA10|AA57|AA08|AA23|AA77|AA06|AA63|AA80",
  190. swflow: "AA18|AA16|AA02|AA17",
  191. begindate: sp.currentYear() + "-" + formate(self.search.GWZT) + "-01"
  192. }
  193. $http.post(apiurljs.login + "g2app/richang/GongWenStatusStatistics",{ data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  194. .success(function (obj) {
  195. var res = strToJson(s4.decryptData_CBC(obj.data));
  196. self.list3 = res.data;
  197. $('#xmjz1').circleProgress({
  198. startAngle: -Math.PI / 2,
  199. value: NumIsNaN(self.list3.SW_DEALTOTAL / self.list3.SW_TOTAL),
  200. size: $('#xmjz1').width(),
  201. fill: { color: "#6395F9" }
  202. }).on('circle-animation-end', function (event) {
  203. $(this).find('strong').html('办理中(收)<br>' + NumIsNaN(self.list3.SW_DEALTOTAL / self.list3.SW_TOTAL) * 100 + '%');
  204. });
  205. $('#xmjz2').circleProgress({
  206. startAngle: -Math.PI / 2,
  207. value: NumIsNaN(self.list3.SW_STOPTOTAL / self.list3.SW_TOTAL),
  208. size: $('#xmjz2').width(),
  209. fill: { color: "#62DAAB" }
  210. }).on('circle-animation-end', function (event) {
  211. $(this).find('strong').html('已办结(收)<br>' + NumIsNaN(self.list3.SW_STOPTOTAL / self.list3.SW_TOTAL) * 100 + '%');
  212. });
  213. $('#xmjz3').circleProgress({
  214. startAngle: -Math.PI / 2,
  215. value: NumIsNaN(self.list3.FW_DEALTOTAL / self.list3.FW_TOTAL),
  216. size: $('#xmjz3').width(),
  217. fill: { color: "#657798" }
  218. }).on('circle-animation-end', function (event) {
  219. $(this).find('strong').html('办理中(发)<br>' + NumIsNaN(self.list3.FW_DEALTOTAL / self.list3.FW_TOTAL) * 100 + '%');
  220. });
  221. $('#xmjz4').circleProgress({
  222. startAngle: -Math.PI / 2,
  223. value: NumIsNaN(self.list3.FW_STOPTOTAL / self.list3.FW_TOTAL),
  224. size: $('#xmjz4').width(),
  225. fill: { color: "#F6C022" }
  226. }).on('circle-animation-end', function (event) {
  227. $(this).find('strong').html('已办结(发)<br>' + NumIsNaN(self.list3.FW_STOPTOTAL / self.list3.FW_TOTAL) * 100 + '%');
  228. });
  229. })
  230. }
  231. self.getData3()
  232. self.getData4 = function () {
  233. self.list4 = [];
  234. var data = {
  235. fwxzflow: "AA20|AA03|AA10|AA57|AA08|AA23|AA77|AA06|AA63|AA80",
  236. fwdkflow: "AA88|AA89|AA46|AA22|AA54|AA58"
  237. }
  238. $http.post(apiurljs.login + "g2app/richang/YZStatistics", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  239. .success(function (obj) {
  240. var res = strToJson(s4.decryptData_CBC(obj.data));
  241. for (var i in res.data) {
  242. self.list4.push(res.data[i])
  243. }
  244. self.getPie()
  245. })
  246. }
  247. self.getData4()
  248. self.getPie = function () {
  249. var dataPie = self.list4.map(function (item) {
  250. return { name: item.name, y: item.total }
  251. })
  252. var chart = new Highcharts.Chart({
  253. chart: {
  254. renderTo: "pie-yz",
  255. type: 'pie',
  256. style: {
  257. position: 'relative',
  258. left: '-30px'
  259. }
  260. },
  261. title: {
  262. text: '', //图表的标题
  263. //margin: 80
  264. },
  265. tooltip: {
  266. pointFormat: '{point.name}: <b>{point.y}</b>'
  267. },
  268. legend: {
  269. align: 'center',
  270. verticalAlign: 'bottom',
  271. layout: 'horizontal',
  272. enabled: true,
  273. },
  274. plotOptions: {
  275. pie: {
  276. allowPointSelect: true,
  277. cursor: 'pointer',
  278. size: 150,
  279. dataLabels: {
  280. enabled: false,
  281. },
  282. showInLegend: true
  283. }
  284. },
  285. series: [{
  286. name: '',
  287. data: dataPie
  288. }],
  289. credits: {
  290. enabled: false//隐藏右下角网址
  291. },
  292. exporting: {
  293. enabled: false//隐藏右上角打印
  294. }
  295. })
  296. chart.setSize(null, 200)
  297. }
  298. self.getJJCD = function () {
  299. var data = { tablename: "CODE_JJCD" }
  300. $http.post(apiurljs.login + "g2app/DangAn/queryCodeData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  301. .success(function (obj) {
  302. var res = strToJson(s4.decryptData_CBC(obj.data));
  303. self.list5 = res.data;
  304. self.getData5()
  305. })
  306. }
  307. self.getJJCD()
  308. self.getData5 = function () {
  309. var data = {
  310. code:self.search.JJCD
  311. }
  312. $http.post(apiurljs.login + "g2app/richang/JJCDStatistics", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  313. .success(function (obj) {
  314. var res = strToJson(s4.decryptData_CBC(obj.data));
  315. self.list5.forEach(function (item) {
  316. for (var i in res.data.FW) {
  317. if (item.CODE == i) {
  318. item.f = res.data.FW[i]
  319. }
  320. }
  321. for (var i in res.data.SW) {
  322. if (item.CODE == i) {
  323. item.s = res.data.SW[i]
  324. }
  325. }
  326. })
  327. self.getColumn5()
  328. })
  329. }
  330. self.getColumn5 = function () {
  331. var title = [], data = [{ name: "发文", data: [] }, { name: "收文", data: [] }];
  332. self.list5.forEach(function (item) {
  333. title.push(item.CNAME);
  334. data[0].data.push(item.f);
  335. data[1].data.push(item.s);
  336. })
  337. var chart = new Highcharts.Chart({
  338. chart: {
  339. renderTo: "column-jjcd",
  340. type: 'column'
  341. },
  342. title: {
  343. text: '', //图表的标题
  344. //margin: 80
  345. },
  346. colors: ["#6395F9", "#62DAAB"],
  347. tooltip: {
  348. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  349. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
  350. '<td style="padding:0"><b>{point.y}</b>{series.className}</td></tr>',
  351. footerFormat: '</table>',
  352. shared: true,
  353. useHTML: true
  354. },
  355. xAxis: {
  356. categories: title
  357. },
  358. yAxis: {
  359. title: {
  360. text: ''
  361. },
  362. lineWidth: 1,
  363. gridLineWidth: 1
  364. },
  365. legend: {
  366. enabled: true
  367. },
  368. plotOptions: {
  369. series: {
  370. pointWidth: 30,
  371. turboThreshold: 0,
  372. cursor: 'pointer',
  373. dataLabels: {
  374. enabled: true,
  375. }
  376. },
  377. column: {
  378. stacking: 'normal'
  379. }
  380. },
  381. series: data,
  382. credits: {
  383. enabled: false//隐藏右下角网址
  384. },
  385. exporting: {
  386. enabled: false//隐藏右上角打印
  387. }
  388. })
  389. chart.setSize(null, 400)
  390. }
  391. //头部下滚冻结
  392. $(function () {
  393. //页面高度撑满
  394. setTimeout(function () {
  395. if ($(".ibox-content").height() < $(window).height() - 31) {
  396. $(".ibox-content").css("height", $(window).height() - 31)
  397. }
  398. }, 1)
  399. })
  400. }])
  401. function NumIsNaN(d) {
  402. return isNaN(d) ? 0 : d;
  403. }
  404. function formate(d) {
  405. return d > 9 ? d : "0" + d;
  406. }
  407. function getWeek(n) {
  408. var week = new Date().getDay();
  409. week = week == 0 ? 7 : week;
  410. if (n == 1) {
  411. return sp.dateCount((week - 1) * -1)
  412. } else {
  413. return sp.dateCount(7 - week)
  414. }
  415. }
  416. function getYearB(n) {
  417. if (sp.format(sp.getLocalDate()) < sp.currentYear() + "-06-30") {
  418. if (n == 1) {
  419. return sp.currentYear() + "-01-01"
  420. } else {
  421. return sp.currentYear() + "-06-30"
  422. }
  423. } else {
  424. if (n == 1) {
  425. return sp.currentYear() + "-07-01"
  426. } else {
  427. return sp.currentYear() + "-12-31"
  428. }
  429. }
  430. }