123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441 |
- 'use strict';
- var app = angular.module('app', [
- 'angularUtils.directives.dirPagination'
- ]);
- app.controller("listCtrl", ["$scope", "$http", "$timeout", function ($scope, $http, $timeout) {
- var self = this;
- var s4 = new SM4Util();
- self.userId = $.cookie("GlWorkPlatform-userid");
- self.userName = $.cookie("GlWorkPlatform-chineseName");
- self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
- self.get_type = sp.getUrlName("type");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- }
- self.search = {
- TYPE: 0,
- KSSJ: "",
- JSSJ: "",
- GWZT: 1,
- JJCD: ""
- }
- self.changeType = function () {
- switch (self.search.TYPE) {
- case "0": self.search.KSSJ = sp.getLocalDate(); self.search.JSSJ = ""; break;
- case "1": self.search.KSSJ = getWeek(1); self.search.JSSJ = getWeek(2); break;
- case "2": self.search.KSSJ = sp.monthfirst(sp.getLocalDate()); self.search.JSSJ = sp.formatMonthLast(sp.getLocalDate()); break;
- case "3": self.search.KSSJ = sp.quarter(sp.getLocalDate(), 1); self.search.JSSJ = sp.quarter(sp.getLocalDate(), 2); break;
- case "4": self.search.KSSJ = getYearB(1); self.search.JSSJ = getYearB(2); break;
- case "5": self.search.KSSJ = sp.format(sp.getLocalDate()); self.search.JSSJ = sp.format(sp.getLocalDate()); break;
- }
- }
- self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
- self.getData1 = function () {
- self.list1 = [];
- self.list2 = [];
- var data = {
- fwflow: "AA88|AA89|AA46|AA22|AA54|AA58|AA20|AA03|AA10|AA57|AA08|AA23|AA77|AA06|AA63|AA80",
- swflow: "AA18|AA16|AA02|AA17",
- yzflow: "AA64",
- begindate: self.search.KSSJ + (self.search.TYPE == 0 ? "" : " 00:00:00"),
- enddate: self.search.JSSJ + (self.search.TYPE == 0 ? "" : " 23:59:59")
- }
- $http.post(apiurljs.login + "g2app/richang/GongWenStatistics", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.data == null || res.data == undefined || res.data == "") {
- self.noDataTip = 0;
- } else {
- self.noDataTip = 1;
- self.gwsl = res.data.GWCOUNT;
- self.blz = res.data.DEAL;
- self.ygd = res.data.STOP;
- self.yzsl = res.data.YZCOUNT;
- self.bys = res.data.SW_MONTH;
- self.byf = res.data.FW_MONTH;
- self.list1 = res.data.FAWEN_TYPE;
- self.list2 = res.data.SHOUWEN_TYPE;
- self.getColumn1()
- self.getColumn2()
- }
- })
- }
- self.getData1()
- self.getColumn1 = function () {
- var title = [], data = [];
- self.list1.forEach(function (item) {
- title.push(item.FLOWNAME);
- data.push(item.TOTAL);
- })
- var chart = new Highcharts.Chart({
- chart: {
- renderTo: "column-gwzl",
- type: 'column'
- },
- title: {
- text: '', //图表的标题
- //margin: 80
- },
- tooltip: {
- headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
- pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
- '<td style="padding:0"><b>{point.y}</b>{series.className}</td></tr>',
- footerFormat: '</table>',
- shared: true,
- useHTML: true
- },
- xAxis: {
- categories: title
- },
- yAxis: {
- title: {
- text: ''
- },
- lineWidth: 1,
- gridLineWidth: 1
- },
- legend: {
- enabled: false
- },
- plotOptions: {
- series: {
- pointWidth: 30,
- turboThreshold: 0,
- cursor: 'pointer',
- dataLabels: {
- enabled: true,
- }
- }
- },
- series: [{
- name: "数量",
- data: data
- }],
- credits: {
- enabled: false//隐藏右下角网址
- },
- exporting: {
- enabled: false//隐藏右上角打印
- }
- })
- chart.setSize(null, 400)
- }
- self.getColumn2 = function () {
- var title = [], data = [];
- self.list2.forEach(function (item) {
- title.push(item.FLOWNAME);
- data.push(item.TOTAL);
- })
- var chart = new Highcharts.Chart({
- chart: {
- renderTo: "column-bmbl",
- type: 'column'
- },
- title: {
- text: '', //图表的标题
- //margin: 80
- },
- tooltip: {
- headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
- pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
- '<td style="padding:0"><b>{point.y}</b>{series.className}</td></tr>',
- footerFormat: '</table>',
- shared: true,
- useHTML: true
- },
- xAxis: {
- categories: title
- },
- yAxis: {
- title: {
- text: ''
- },
- lineWidth: 1,
- gridLineWidth: 1
- },
- legend: {
- enabled: false
- },
- plotOptions: {
- series: {
- pointWidth: 30,
- turboThreshold: 0,
- cursor: 'pointer',
- dataLabels: {
- enabled: true,
- }
- }
- },
- series: [{
- name: "数量",
- data: data
- }],
- credits: {
- enabled: false//隐藏右下角网址
- },
- exporting: {
- enabled: false//隐藏右上角打印
- }
- })
- chart.setSize(null, 400)
- }
-
- self.getData3 = function () {
- self.list3 = {};
- var data = {
- fwflow: "AA88|AA89|AA46|AA22|AA54|AA58|AA20|AA03|AA10|AA57|AA08|AA23|AA77|AA06|AA63|AA80",
- swflow: "AA18|AA16|AA02|AA17",
- begindate: sp.currentYear() + "-" + formate(self.search.GWZT) + "-01"
- }
- $http.post(apiurljs.login + "g2app/richang/GongWenStatusStatistics",{ data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.list3 = res.data;
- $('#xmjz1').circleProgress({
- startAngle: -Math.PI / 2,
- value: NumIsNaN(self.list3.SW_DEALTOTAL / self.list3.SW_TOTAL),
- size: $('#xmjz1').width(),
- fill: { color: "#6395F9" }
- }).on('circle-animation-end', function (event) {
- $(this).find('strong').html('办理中(收)<br>' + NumIsNaN(self.list3.SW_DEALTOTAL / self.list3.SW_TOTAL) * 100 + '%');
- });
- $('#xmjz2').circleProgress({
- startAngle: -Math.PI / 2,
- value: NumIsNaN(self.list3.SW_STOPTOTAL / self.list3.SW_TOTAL),
- size: $('#xmjz2').width(),
- fill: { color: "#62DAAB" }
- }).on('circle-animation-end', function (event) {
- $(this).find('strong').html('已办结(收)<br>' + NumIsNaN(self.list3.SW_STOPTOTAL / self.list3.SW_TOTAL) * 100 + '%');
- });
- $('#xmjz3').circleProgress({
- startAngle: -Math.PI / 2,
- value: NumIsNaN(self.list3.FW_DEALTOTAL / self.list3.FW_TOTAL),
- size: $('#xmjz3').width(),
- fill: { color: "#657798" }
- }).on('circle-animation-end', function (event) {
- $(this).find('strong').html('办理中(发)<br>' + NumIsNaN(self.list3.FW_DEALTOTAL / self.list3.FW_TOTAL) * 100 + '%');
- });
- $('#xmjz4').circleProgress({
- startAngle: -Math.PI / 2,
- value: NumIsNaN(self.list3.FW_STOPTOTAL / self.list3.FW_TOTAL),
- size: $('#xmjz4').width(),
- fill: { color: "#F6C022" }
- }).on('circle-animation-end', function (event) {
- $(this).find('strong').html('已办结(发)<br>' + NumIsNaN(self.list3.FW_STOPTOTAL / self.list3.FW_TOTAL) * 100 + '%');
- });
- })
- }
- self.getData3()
- self.getData4 = function () {
- self.list4 = [];
- var data = {
- fwxzflow: "AA20|AA03|AA10|AA57|AA08|AA23|AA77|AA06|AA63|AA80",
- fwdkflow: "AA88|AA89|AA46|AA22|AA54|AA58"
- }
- $http.post(apiurljs.login + "g2app/richang/YZStatistics", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- for (var i in res.data) {
- self.list4.push(res.data[i])
- }
- self.getPie()
- })
- }
- self.getData4()
- self.getPie = function () {
- var dataPie = self.list4.map(function (item) {
- return { name: item.name, y: item.total }
- })
- var chart = new Highcharts.Chart({
- chart: {
- renderTo: "pie-yz",
- type: 'pie',
- style: {
- position: 'relative',
- left: '-30px'
- }
- },
- title: {
- text: '', //图表的标题
- //margin: 80
- },
- tooltip: {
- pointFormat: '{point.name}: <b>{point.y}</b>'
- },
- legend: {
- align: 'center',
- verticalAlign: 'bottom',
- layout: 'horizontal',
- enabled: true,
- },
- plotOptions: {
- pie: {
- allowPointSelect: true,
- cursor: 'pointer',
- size: 150,
- dataLabels: {
- enabled: false,
- },
- showInLegend: true
- }
- },
- series: [{
- name: '',
- data: dataPie
- }],
- credits: {
- enabled: false//隐藏右下角网址
- },
- exporting: {
- enabled: false//隐藏右上角打印
- }
- })
- chart.setSize(null, 200)
- }
- self.getJJCD = function () {
- var data = { tablename: "CODE_JJCD" }
- $http.post(apiurljs.login + "g2app/DangAn/queryCodeData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.list5 = res.data;
- self.getData5()
- })
- }
- self.getJJCD()
- self.getData5 = function () {
- var data = {
- code:self.search.JJCD
- }
- $http.post(apiurljs.login + "g2app/richang/JJCDStatistics", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.list5.forEach(function (item) {
- for (var i in res.data.FW) {
- if (item.CODE == i) {
- item.f = res.data.FW[i]
- }
- }
- for (var i in res.data.SW) {
- if (item.CODE == i) {
- item.s = res.data.SW[i]
- }
- }
- })
- self.getColumn5()
- })
- }
- self.getColumn5 = function () {
- var title = [], data = [{ name: "发文", data: [] }, { name: "收文", data: [] }];
- self.list5.forEach(function (item) {
- title.push(item.CNAME);
- data[0].data.push(item.f);
- data[1].data.push(item.s);
- })
- var chart = new Highcharts.Chart({
- chart: {
- renderTo: "column-jjcd",
- type: 'column'
- },
- title: {
- text: '', //图表的标题
- //margin: 80
- },
- colors: ["#6395F9", "#62DAAB"],
- tooltip: {
- headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
- pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
- '<td style="padding:0"><b>{point.y}</b>{series.className}</td></tr>',
- footerFormat: '</table>',
- shared: true,
- useHTML: true
- },
- xAxis: {
- categories: title
- },
- yAxis: {
- title: {
- text: ''
- },
- lineWidth: 1,
- gridLineWidth: 1
- },
- legend: {
- enabled: true
- },
- plotOptions: {
- series: {
- pointWidth: 30,
- turboThreshold: 0,
- cursor: 'pointer',
- dataLabels: {
- enabled: true,
- }
- },
- column: {
- stacking: 'normal'
- }
- },
- series: data,
- credits: {
- enabled: false//隐藏右下角网址
- },
- exporting: {
- enabled: false//隐藏右上角打印
- }
- })
- chart.setSize(null, 400)
- }
- //头部下滚冻结
- $(function () {
- //页面高度撑满
- setTimeout(function () {
- if ($(".ibox-content").height() < $(window).height() - 31) {
- $(".ibox-content").css("height", $(window).height() - 31)
- }
- }, 1)
- })
- }])
- function NumIsNaN(d) {
- return isNaN(d) ? 0 : d;
- }
- function formate(d) {
- return d > 9 ? d : "0" + d;
- }
- function getWeek(n) {
- var week = new Date().getDay();
- week = week == 0 ? 7 : week;
- if (n == 1) {
- return sp.dateCount((week - 1) * -1)
- } else {
- return sp.dateCount(7 - week)
- }
- }
- function getYearB(n) {
- if (sp.format(sp.getLocalDate()) < sp.currentYear() + "-06-30") {
- if (n == 1) {
- return sp.currentYear() + "-01-01"
- } else {
- return sp.currentYear() + "-06-30"
- }
- } else {
- if (n == 1) {
- return sp.currentYear() + "-07-01"
- } else {
- return sp.currentYear() + "-12-31"
- }
- }
- }
|