'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: '{point.key}
',
pointFormat: '{series.name}: | ' +
'{point.y}{series.className} |
',
footerFormat: '
',
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: '{point.key}',
pointFormat: '{series.name}: | ' +
'{point.y}{series.className} |
',
footerFormat: '
',
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('办理中(收)
' + 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('已办结(收)
' + 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('办理中(发)
' + 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('已办结(发)
' + 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}: {point.y}'
},
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: '{point.key}',
pointFormat: '{series.name}: | ' +
'{point.y}{series.className} |
',
footerFormat: '
',
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"
}
}
}