Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/yearWorkloadReportView2.jsp
===================================================================
diff -u -r36219 -r37620
--- ssts-web/src/main/webapp/disinfectsystem/reportforms/yearWorkloadReportView2.jsp (.../yearWorkloadReportView2.jsp) (revision 36219)
+++ ssts-web/src/main/webapp/disinfectsystem/reportforms/yearWorkloadReportView2.jsp (.../yearWorkloadReportView2.jsp) (revision 37620)
@@ -20,13 +20,16 @@
+
+
+
年度消毒供应中心员工工作量统计报表
Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/yearWorkloadReportView2.js
===================================================================
diff -u -r36219 -r37620
--- ssts-web/src/main/webapp/disinfectsystem/reportforms/yearWorkloadReportView2.js (.../yearWorkloadReportView2.js) (revision 36219)
+++ ssts-web/src/main/webapp/disinfectsystem/reportforms/yearWorkloadReportView2.js (.../yearWorkloadReportView2.js) (revision 37620)
@@ -68,24 +68,36 @@
//生成表格
function getTableBody(data, titleArr, yearStr, monthStr) {
var dateArray = {};
- if (monthStr == '') {
- for (var i = 0; i < 12; i++) {
- var m = ((i + 1) > 9) ? (i + 1) : ('0' + (i + 1));
- var ym = yearStr + '-' + m;
- dateArray[ym] = []
+ var queryType = Ext.getCmp('queryType').getValue();
+ if (queryType == '汇总') {
+ if (monthStr == '') {
+ for (var i = 0; i < 12; i++) {
+ var m = ((i + 1) > 9) ? (i + 1) : ('0' + (i + 1));
+ var ym = yearStr + '-' + m;
+ dateArray[ym] = []
+ }
+ } else {
+ var d = new Date(yearStr, monthStr, 0);
+ for (var i = 0; i < d.getDate(); i++) {
+ var dayStr = ((i + 1) > 9) ? (i + 1) : ('0' + (i + 1));
+ var ymd = yearStr + '-' + monthStr + '-' + dayStr;
+ dateArray[ymd] = []
+ }
}
+ for (var i = 0; i < data.length; i++) {
+ var month = data[i].month;
+ dateArray[month].push(data[i])
+ }
} else {
- var d = new Date(yearStr, monthStr, 0);
- for (var i = 0; i < d.getDate(); i++) {
- var dayStr = ((i + 1) > 9) ? (i + 1) : ('0' + (i + 1));
- var ymd = yearStr + '-' + monthStr + '-' + dayStr;
- dateArray[ymd] = []
+ for (var i = 0; i < data.length; i++) {
+ var month = data[i].month;
+ if (!dateArray[month]) {
+ dateArray[month] = [data[i]]
+ } else {
+ dateArray[month].push(data[i])
+ }
}
}
- for (var i = 0; i < data.length; i++) {
- var month = data[i].month;
- dateArray[month].push(data[i])
- }
var html = "";
for (var item in dateArray) {
html += "";
@@ -119,49 +131,111 @@
html += "" + value + " | ";
}
} else {
- var value = (parseFloat(price) > 0) ? parseFloat(price).toFixed(2) : parseInt(amount);
+ var value = ''
+ if (item == '环比增减' || item == '同比增减') {
+ value = amount;
+ } else {
+ value = (parseFloat(price) > 0) ? parseFloat(price).toFixed(2) : parseInt(amount);
+ }
html += "" + value + " | ";
}
}
html += "
";
}
- html += "";
- html += "合计 | ";
- for (var j = 0; j < titleArr.length; j++) {
- if (titleArr[j].children && titleArr[j].children.length > 0) {
- if (titleArr[j].sumAmount) {
- for (var k = 0; k < titleArr[j].sumAmount.length; k++) {
- var sumAmount = titleArr[j].sumAmount;
- html += "" + sumAmount[k] + " | ";
+ if (queryType == '汇总') {
+ html += "
";
+ html += "合计 | ";
+ for (var j = 0; j < titleArr.length; j++) {
+ if (titleArr[j].children && titleArr[j].children.length > 0) {
+ if (titleArr[j].sumAmount) {
+ for (var k = 0; k < titleArr[j].sumAmount.length; k++) {
+ var sumAmount = titleArr[j].sumAmount;
+ html += "" + sumAmount[k] + " | ";
+ }
}
- }
- if (titleArr[j].sumPrice) {
- for (var k = 0; k < titleArr[j].sumPrice.length; k++) {
- var sumPrice = titleArr[j].sumPrice;
- html += "" + sumPrice[k] + " | ";
+ if (titleArr[j].sumPrice) {
+ for (var k = 0; k < titleArr[j].sumPrice.length; k++) {
+ var sumPrice = titleArr[j].sumPrice;
+ html += "" + sumPrice[k] + " | ";
+ }
}
- }
- } else {
- var sumValue = 0;
- if (titleArr[j].sumAmount && typeof titleArr[j].sumAmount == 'object') {
- sumValue = 0
- } else if (titleArr[j].sumPrice && typeof titleArr[j].sumPrice == 'object') {
- sumValue = 0
} else {
- if (titleArr[j].sumPrice > 0) {
- sumValue = titleArr[j].sumPrice || 0;
+ var sumValue = 0;
+ if (titleArr[j].sumAmount && typeof titleArr[j].sumAmount == 'object') {
+ sumValue = 0
+ } else if (titleArr[j].sumPrice && typeof titleArr[j].sumPrice == 'object') {
+ sumValue = 0
} else {
- sumValue = titleArr[j].sumAmount || 0;
+ if (titleArr[j].sumPrice > 0) {
+ sumValue = titleArr[j].sumPrice || 0;
+ } else {
+ sumValue = titleArr[j].sumAmount || 0;
+ }
}
+ html += "" + sumValue + " | ";
}
- html += "" + sumValue + " | ";
}
+ html += "
";
}
- html += "";
html += "";
return html;
}
+//DGSFYBJY-76:增加簇状柱形图
+var myechart;
+function searchReportForChart(title, subtext, seriesData, legendData, xAxisData) {
+ var option = {
+ color: ['#5470c6', '#91cc75', '#fac858'],
+ title: [
+ {
+ left: 'center',
+ text: title,
+ subtext: subtext
+ }
+ ],
+ // 工具提示
+ tooltip: {
+ trigger: 'axis',
+ axisPointer: {
+ type: 'cross',
+ crossStyle: {
+ color: '#999'
+ }
+ }
+ },
+ legend: {
+ data: legendData,
+ bottom: '0%'
+ },
+ xAxis: [
+ {
+ type: 'category',
+ data: xAxisData,
+ axisPointer: {
+ type: 'shadow'
+ }
+ }
+ ],
+ yAxis: [
+ {
+ type: 'value',
+ name: ''
+ },
+ {
+ type: 'value',
+ axisLabel: {
+ formatter: '{value} %'
+ }
+ }
+ ],
+ grid: {
+ bottom: '20%'
+ },
+ series: seriesData
+ };
+ document.getElementById('thisIframe').contentWindow.document.getElementById('echartsOption').value = JSON.stringify(option);
+}
+
Ext.onReady(function () {
Ext.QuickTips.init();
Ext.Ajax.timeout = 300000;
@@ -245,6 +319,13 @@
myMask.show();
var isSpecial = false;
var jasperreportName = null;
+
+ //DGSFYBJY-76:增加查询类型,对比类型
+ var queryType = Ext.getCmp('queryType').getValue();
+ var comparisonType = ''
+ if (queryType !== '汇总') {
+ comparisonType = Ext.getCmp('comparisonType').getValue();
+ }
if (sstsConfig.hasOwnProperty('isYearWorkloadReportSpecial') && sstsConfig.isYearWorkloadReportSpecial) {
isSpecial = true;
yearStr = year;
@@ -287,6 +368,10 @@
if (!sstsConfig.isYearWorkloadReportSpecial) {
params.month = monthStr;
}
+ //DGSFYBJY-76:增加查询类型,对比类型
+ params.queryType = queryType;
+ params.comparisonType = comparisonType;
+
searchReport(url, params);
} else {
var url = WWWROOT + '/jasperreports/jasperreportsAction!queryDataSourceList.do';
@@ -300,19 +385,98 @@
if (!sstsConfig.isYearWorkloadReportSpecial) {
params.month = monthStr;
}
+ //DGSFYBJY-76:增加查询类型,对比类型
+ params.queryType = queryType;
+ params.comparisonType = comparisonType;
+
Ext.Ajax.request({
url: url,
async: false,
params: params,
success: function (response) {
var result = Ext.decode(response.responseText);
+ if (myechart) {
+ document.getElementById('thisIframe').contentWindow.document.getElementById('echarts').removeAttribute("_echarts_instance_")
+ }
if (result.data.length > 0) {
- var html = getTableHtml(result, yearStr, monthStr);
- Ext.getCmp('titleName').setValue(result.parametMap.title);
- document.getElementById('thisIframe').contentWindow.document.getElementById('table').innerHTML = html;
+ var showType = Ext.getCmp('showType2').getValue();
+ if (queryType !== '汇总' && showType == '簇状柱形图') {
+ var legendData = [];
+ var xAxisData = [];
+ var seriesData = [];
+ var colorIndex = 0;
+ for (var i = 0; i < result.parametMap.titleArr.length; i++) {
+ var title = result.parametMap.titleArr[i].title;
+ xAxisData.push(title);
+ }
+ for (var i = 0; i < result.data.length; i++) {
+ var month = result.data[i].month;
+ if (legendData.indexOf(month) == -1) {
+ legendData.push(month);
+ if (month == '环比增减' || month == '同比增减') {
+ seriesData.push({
+ name: month,
+ type: 'line',
+ yAxisIndex: 1,
+ tooltip: {
+ valueFormatter: function (value) {
+ return value + ' %';
+ }
+ },
+ data: []
+ })
+ } else {
+ seriesData.push({
+ name: month,
+ type: 'bar',
+ data: []
+ })
+ }
+ colorIndex++
+ }
+ }
+ var obj = {};
+ for (var i = 0; i < result.data.length; i++) {
+ var month = result.data[i].month;
+ var columnName = result.data[i].columnName;
+ var amount = 0
+ if (month == '环比增减' || month == '同比增减') {
+ amount = parseFloat(result.data[i].amount).toFixed(2);
+ } else {
+ amount = parseInt(result.data[i].amount);
+ }
+ for (var j = 0; j < xAxisData.length; j++) {
+ if (xAxisData[j] == columnName) {
+ if (obj[month]) {
+ obj[month].push(amount);
+ } else {
+ obj[month] = [amount]
+ }
+ }
+ }
+ }
+ for (var i = 0; i < seriesData.length; i++) {
+ var name = seriesData[i].name;
+ if (obj[name]) {
+ seriesData[i].data = obj[name];
+ }
+ }
+ var subtext = ''
+ searchReportForChart(result.parametMap.title, subtext, seriesData, legendData, xAxisData);
+ setTimeout(function () {
+ document.getElementById('thisIframe').contentWindow.document.getElementById('createEcharts').click();
+ document.getElementById('thisIframe').contentWindow.document.getElementById('table').innerHTML = '';
+ }, 300);
+ } else {
+ var html = getTableHtml(result, yearStr, monthStr);
+ Ext.getCmp('titleName').setValue(result.parametMap.title);
+ document.getElementById('thisIframe').contentWindow.document.getElementById('table').innerHTML = html;
+ document.getElementById('thisIframe').contentWindow.document.getElementById('echarts').style.display = 'none';
+ }
} else {
Ext.getCmp('titleName').setValue('');
document.getElementById('thisIframe').contentWindow.document.getElementById('table').innerHTML = '查询无数据
';
+ document.getElementById('thisIframe').contentWindow.document.getElementById('echarts').style.display = 'none';
}
myMask.hide();
},
@@ -351,11 +515,11 @@
border: 0,
frame: true,
bodyStyle: 'padding:0px auto;margin:0px',// padding:1px;padding-top:5px;
- height: 110,
+ height: 130,
labelWidth: 90,
items: [{
layout: 'column',
- height: 40,
+ height: 60,
items: [{
xtype: 'hidden',
id: 'titleName',
@@ -383,6 +547,10 @@
if ('年份' == this.value) {
Ext.getCmp('yearSearch_id').show();
Ext.getCmp('monthSearch_id').hide();
+ var queryType = Ext.getCmp('queryType').getValue();
+ if (queryType == '同比') {
+ Ext.getCmp('queryType').setValue('汇总')
+ }
} else {
Ext.getCmp('yearSearch_id').hide();
Ext.getCmp('monthSearch_id').show();
@@ -476,6 +644,119 @@
}
}
}]
+ }, {
+ columnWidth: .2,
+ layout: 'form',
+ id: 'comparisonTypeBox',
+ items: [{
+ xtype: 'combo',
+ fieldLabel: "对比类型",
+ valueField: 'value',
+ displayField: 'value',
+ store: new Ext.data.SimpleStore({
+ fields: ['value'],
+ data: [['上半年对比'], ['季度对比'], ['月度对比'], ['年度对比']]
+ }),
+ triggerAction: 'all',
+ editable: false,
+ mode: 'local',
+ forceSelection: false,
+ name: "comparisonType",
+ id: "comparisonType",
+ anchor: '95%',
+ value: '上半年对比',
+ listeners: {
+ render: function () {
+ setTimeout(function () {
+ Ext.getCmp('comparisonTypeBox').hide();
+ }, 100);
+ }
+ }
+ }]
+ }, {
+ columnWidth: 1,
+ layout: 'column',
+ items: [{
+ width: 300,
+ layout: 'form',
+ items: [new Ext.ux.RadioGroup({
+ fieldLabel: "查询类型",
+ allowBlank: false,
+ horizontal: true,
+ defaultValue: '汇总',
+ name: "queryType",
+ id: "queryType",
+ anchor: '95%',
+ listWidth: 400,
+ radios: [
+ { boxLabel: '汇总', value: '汇总' },
+ { boxLabel: '环比', value: '环比' },
+ { boxLabel: '同比', value: '同比' }
+ ],
+ listeners: {
+ 'change': function (v, p, group, checked) {
+ if (group == "同比") {
+ Ext.getCmp('comparisonTypeBox').show();
+ Ext.getCmp('timeType').setValue('年月');
+ Ext.getCmp('yearSearch_id').hide();
+ Ext.getCmp('monthSearch_id').show();
+
+ } else {
+ Ext.getCmp('comparisonTypeBox').hide();
+ }
+ if (group == "汇总") {
+ Ext.getCmp('showType1Box').show();
+ Ext.getCmp('showType2Box').hide();
+ } else {
+ Ext.getCmp('showType2Box').show();
+ Ext.getCmp('showType1Box').hide();
+ }
+ }
+ }
+ })]
+ }, {
+ width: 250,
+ layout: 'form',
+ id: 'showType1Box',
+ items: [new Ext.ux.RadioGroup({
+ fieldLabel: "查询类型",
+ allowBlank: false,
+ horizontal: true,
+ defaultValue: '表格',
+ name: "showType1",
+ id: "showType1",
+ anchor: '95%',
+ listWidth: 400,
+ radios: [
+ { boxLabel: '表格', value: '表格' }
+ ]
+ })]
+ }, {
+ width: 250,
+ layout: 'form',
+ id: 'showType2Box',
+ items: [new Ext.ux.RadioGroup({
+ fieldLabel: "查询类型",
+ allowBlank: false,
+ horizontal: true,
+ defaultValue: '表格',
+ name: "showType2",
+ id: "showType2",
+ anchor: '95%',
+ listWidth: 400,
+ radios: [
+ { boxLabel: '表格', value: '表格' },
+ { boxLabel: '簇状柱形图', value: '簇状柱形图' }
+ ],
+ listeners: {
+ render: function () {
+ setTimeout(function () {
+ Ext.getCmp('showType2Box').hide();
+ }, 100);
+ }
+ }
+ })]
+ }]
}]
}],
buttons: [{
@@ -504,6 +785,15 @@
text: '导出',
hidden: sstsConfig.isYearWorkloadReportSpecial,
handler: function () {
+ var showType = Ext.getCmp('showType2').getValue();
+ if (showType == "簇状柱形图") {
+ if (isIE()) {
+ showResult('IE不支持导出图表');
+ return
+ }
+ document.getElementById('thisIframe').contentWindow.document.getElementById('exportEcharts').click();
+ return
+ }
var html = document.getElementById('thisIframe').contentWindow.document.getElementById('table').innerHTML;
var title = Ext.getCmp('titleName').getValue();
if (title !== '') {
Index: ssts-web/src/main/webapp/homepage/exportMonitorData.jsp
===================================================================
diff -u -r37061 -r37620
--- ssts-web/src/main/webapp/homepage/exportMonitorData.jsp (.../exportMonitorData.jsp) (revision 37061)
+++ ssts-web/src/main/webapp/homepage/exportMonitorData.jsp (.../exportMonitorData.jsp) (revision 37620)
@@ -8,6 +8,7 @@
+
@@ -17,6 +18,7 @@
+