Index: ssts-web/src/main/webapp/js/common.js
===================================================================
diff -u -r31186 -r31205
--- ssts-web/src/main/webapp/js/common.js (.../common.js) (revision 31186)
+++ ssts-web/src/main/webapp/js/common.js (.../common.js) (revision 31205)
@@ -3655,4 +3655,55 @@
}
}
});
+}
+
+/**
+ * 创建echarts图形
+ * @param {应用图形的容器} doc
+ * @param {参数} res
+ */
+function createEcharts(doc,res){
+ myChart = echarts.init(doc);
+ myChart.clear();
+ if(res.legendData.length > 0){
+ doc.style.width = res.xAxisData.length>10?1500:1000 + 'px';
+ var option = {
+ backgroundColor:"#fff",
+ tooltip: {
+ trigger: 'axis',
+ axisPointer: {
+ type: 'shadow'
+ }
+ },
+ legend: {
+ data: res.legendData,
+ type: 'scroll',
+ orient: 'vertical',
+ right: '10',
+ top: 'center',
+ bottom: 20
+ },
+ toolbox: {
+ show: false
+ },
+ xAxis: [{
+ type: 'category',
+ data: res.xAxisData,
+ axisLabel:{
+ showMaxLabel:true,
+ interval:0,
+ rotate:res.xAxisData.length>10?40:0
+ }
+ }],
+ yAxis: [{
+ type: 'value'
+ }],
+ series: res.seriesData
+ };
+ myChart.setOption(option);
+ myChart.resize({
+ width: res.xAxisData.length>10?1500:1000,
+ height: 400
+ })
+ }
}
\ No newline at end of file
Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/materialTypeWorkloadReportView.jsp
===================================================================
diff -u -r29513 -r31205
--- ssts-web/src/main/webapp/disinfectsystem/reportforms/materialTypeWorkloadReportView.jsp (.../materialTypeWorkloadReportView.jsp) (revision 29513)
+++ ssts-web/src/main/webapp/disinfectsystem/reportforms/materialTypeWorkloadReportView.jsp (.../materialTypeWorkloadReportView.jsp) (revision 31205)
@@ -6,33 +6,17 @@
<%@ include file="/common/includeExtJsAndCss.jsp"%>
-
-
-
-
-
+
-
+
+
+
材料类型工作量统计月报
-
-
-
-
Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/showEchartsAndTable.jsp
===================================================================
diff -u
--- ssts-web/src/main/webapp/disinfectsystem/reportforms/showEchartsAndTable.jsp (revision 0)
+++ ssts-web/src/main/webapp/disinfectsystem/reportforms/showEchartsAndTable.jsp (revision 31205)
@@ -0,0 +1,101 @@
+<%@ page contentType="text/html; charset=UTF-8"%>
+<%@ page import="com.forgon.tools.*,org.apache.commons.lang.*"%>
+<%@ page import="com.forgon.tools.*,com.forgon.disinfectsystem.reportforms.service.*"%>
+<%@page import="java.io.PrintStream"%>
+<%@ include file="/common/taglibs.jsp"%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<%
+ String fileName = request.getParameter("fileName");
+ String fileContents = request.getParameter("fileContents");
+ String fileSizes = request.getParameter("fileSizes");
+ String htmlTable = request.getParameter("htmlTable");
+ String jsFileName = request.getParameter("jsFileName");
+ if(fileName != null && fileName != ""){
+ ServletOutputStream servletOutputStream = response.getOutputStream();
+ try{
+ response.setContentType("application/vnd.ms-excel");
+ response.addHeader("Content-Disposition","inline;filename=" + new String(fileName.getBytes("GBK"), "ISO8859_1"));
+ ReportFormsManager reportFormsManager = (ReportFormsManager)SpringBeanManger.getBean("reportFormsManager");
+ reportFormsManager.exportExcelForImg(fileContents,htmlTable,fileName,fileSizes,jsFileName,request,response);
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+ servletOutputStream.flush();
+ out.clear();
+ out = pageContext.pushBody();
+ }
+%>
\ No newline at end of file
Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/materialTypeWorkloadReportView.js
===================================================================
diff -u -r31202 -r31205
--- ssts-web/src/main/webapp/disinfectsystem/reportforms/materialTypeWorkloadReportView.js (.../materialTypeWorkloadReportView.js) (revision 31202)
+++ ssts-web/src/main/webapp/disinfectsystem/reportforms/materialTypeWorkloadReportView.js (.../materialTypeWorkloadReportView.js) (revision 31205)
@@ -1,42 +1,121 @@
var entityName = "清洗区材料分类工作量统计报表";
var grid;
-var rd = new Ext.data.JsonReader({
- fields: [
- { name: 'id' },
- { name: 'departId' },
- { name: 'name' }
-
- ]
-});
-
-var supplyRoomStore = new Ext.data.Store({
- proxy: new Ext.data.HttpProxy({
- url: WWWROOT + '/disinfectSystem/baseData/supplyRoomConfigAction!loadSupplyRoomConfigRoom.do',
- method: 'POST'
- }),
- baseParams: { type: "12" },
- reader: rd,
- listeners: {
- 'load': function (thiz, records, options) {
- if (records.length > 0) {
- Ext.getCmp('querySupplyRoom').setValue(records[0].data.departId);
- Ext.getCmp('querySupplyRoom').setValue(records[0].data.name);
+function getTableAndEchartsData(resultData) {
+ var html = "";
+ var newSumCount = {};
+ var legendData = [];
+ var xAxisData = [];
+ var seriesData = [];
+ var data = {};
+ html += "";
+ html += "日期 | ";
+ for (var i = 0; i < resultData.header.length; i++) {
+ html += "" + resultData.header[i].split(',')[0] + " | ";
+ legendData.push(resultData.header[i].split(',')[0]);
+ }
+ html += "合计 | ";
+ html += "
";
+ html += "清洗数量 | 不合格数 | 不合格率 |
";
+ html += "";
+ html += "";
+ for (var item in resultData.dayOfMonthMap) {
+ xAxisData.push(item);
+ html += "";
+ html += "" + item + " | ";
+ for (var i = 0; i < resultData.header.length; i++) {
+ var materialType = resultData.header[i].split(',')[0];
+ var amount = 0;
+ var washUnqualifiedAmount = 0;
+ var washUnqualifiedPercentage = 0;
+ for (var j = 0; j < resultData.dayOfMonthMap[item].length; j++) {
+ if (newSumCount[materialType]) {
+ newSumCount[materialType].amount += parseInt(resultData.dayOfMonthMap[item][j].amount);
+ newSumCount[materialType].washUnqualifiedAmount += parseInt(resultData.dayOfMonthMap[item][j].washUnqualifiedAmount);
+ newSumCount[materialType].washUnqualifiedPercentage += parseFloat(resultData.dayOfMonthMap[item][j].washUnqualifiedPercentage);
+ } else {
+ newSumCount[materialType] = {
+ amount: resultData.dayOfMonthMap[item][j].amount,
+ washUnqualifiedAmount: resultData.dayOfMonthMap[item][j].washUnqualifiedAmount,
+ washUnqualifiedPercentage: resultData.dayOfMonthMap[item][j].washUnqualifiedPercentage
+ };
+ }
+ if (materialType == resultData.dayOfMonthMap[item][j].materialType) {
+ amount = resultData.dayOfMonthMap[item][j].amount;
+ washUnqualifiedAmount = resultData.dayOfMonthMap[item][j].washUnqualifiedAmount;
+ washUnqualifiedPercentage = resultData.dayOfMonthMap[item][j].washUnqualifiedPercentage;
+ continue;
+ }
}
+ if (data[materialType]) {
+ data[materialType].push(washUnqualifiedPercentage);
+ } else {
+ data[materialType] = [washUnqualifiedPercentage];
+ }
+ html += "" + amount + " | ";
+ html += "" + washUnqualifiedAmount + " | ";
+ html += "" + parseFloat(washUnqualifiedPercentage).toFixed(4) + "% | ";
}
+ if (resultData.sumData[item]) {
+ html += "" + resultData.sumData[item].amount + " | ";
+ html += "" + resultData.sumData[item].washUnqualifiedAmount + " | ";
+ html += "" + parseFloat(resultData.sumData[item].washUnqualifiedPercentage).toFixed(4) + "% | ";
+ }
+ html += "
";
}
-});
-//supplyRoomStore.load();
+ html += "";
+ html += "";
+ html += "合计 | ";
+ for (var i = 0; i < resultData.header.length; i++) {
+ if (newSumCount[materialType]) {
+ html += "" + newSumCount[materialType].amount + " | ";
+ html += "" + newSumCount[materialType].washUnqualifiedAmount + " | ";
+ html += "" + parseFloat(newSumCount[materialType].washUnqualifiedPercentage).toFixed(4) + "% | ";
+ } else {
+ html += " | ";
+ html += " | ";
+ html += " | ";
+ }
+ seriesData[i] = {
+ name: legendData[i],
+ type: 'bar',
+ barGap: 0,
+ emphasis: {
+ focus: 'series'
+ },
+ data: data[legendData[i]]
+ }
+ }
+ if (resultData.sumData['合计']) {
+ html += "" + resultData.sumData['合计'].amount + " | ";
+ html += "" + resultData.sumData['合计'].washUnqualifiedAmount + " | ";
+ html += "" + parseFloat(resultData.sumData['合计'].washUnqualifiedPercentage).toFixed(4) + "% | ";
+ }
+ html += "
";
+ html += "";
+ html += "
";
+ var res = {
+ legendData: legendData,
+ xAxisData: xAxisData,
+ seriesData: seriesData,
+ html: html
+ }
+ return res;
+}
var myMask;
Ext.onReady(function () {
Ext.QuickTips.init();
- //20181225
var supplyRoomRecord = Ext.data.Record.create([
{ name: 'departCode', type: 'string' },
{ name: 'name', type: 'string' }
]);
+ var timeTypeStore = new Ext.data.SimpleStore({
+ fields: ['value'],
+ data: [['年份'], ['年月']]
+ });
+
var supplyRoomStore = new Ext.data.SimpleStore({
fields: ['departCode', 'name']
});
@@ -47,7 +126,6 @@
method: 'POST'
}),
baseParams: { type: "12" },
- // reader : rd,
reader: new Ext.data.JsonReader({
fields: [
{ name: 'id', mapping: 'id' },
@@ -93,52 +171,100 @@
}
}
});
- //20181225 end
+
+ supplyRoomRemoteStore.load();
+
function reloadReport() {
var monthSearch = $Id('monthSearch').value;
+ var yearSearch = $Id('yearSearch').value;
+ var timeType = $Id('timeType').value;
+
var querySupplyRoom = Ext.getCmp('querySupplyRoom').getValue();
if (querySupplyRoom.indexOf(ALL) == 0) {
querySupplyRoom = "";
}
+ if (timeType == '年月') {
+ yearSearch = ''
+ } else {
+ monthSearch = '';
+ }
+
myMask = new Ext.LoadMask(Ext.getBody(), {
msg: '正在加载,请稍候!',
removeMask: true
});
+
myMask.show();
- var url = WWWROOT + '/jasperreports/jasperreportsAction!createReportFromJavaBeanSource.do';
+ var url = WWWROOT + '/jasperreports/jasperreportsAction!getReportDataOfEcharts.do';
var params = {
- jasperreportName: 'materialTypeWorkloadReport.jasper',
+ jasperreportName: sstsConfig.enableTheHistogramDisplayOfCleaningAreaMaterialTypeWorkloadStatisticsReport ? 'materialTypeWorkloadChartReport.jasper' : 'materialTypeWorkloadReport.jasper',
month: monthSearch,
+ year: yearSearch,
querySupplyRoom: querySupplyRoom,
reportName: 'materialTypeWorkloadReport'
}
-
- searchReport(url, params);
+ Ext.Ajax.request({
+ url: url,
+ params: params,
+ success: function (response, options) {
+ var result = Ext.decode(response.responseText);
+ if (!result.success || !result.data.dataList.length == 0) {
+ document.getElementById('thisIframe').contentWindow.document.getElementById("title").innerHTML = "";
+ document.getElementById('thisIframe').contentWindow.document.getElementById("table").innerHTML = "";
+ document.getElementById('thisIframe').contentWindow.document.getElementById("echartJs").style.display = "none";
+ }
+ var dayOfMonthMap = {};
+ var header = [];
+ var materialTypeMap = {};
+ for (var i = 0; i < result.data.dataList.length; i++) {
+ var dayOfMonth = result.data.dataList[i].dayOfMonth;
+ var materialType = result.data.dataList[i].materialType;
+ var columnNum = result.data.dataList[i].columnNum;
+ if (dayOfMonthMap[dayOfMonth]) {
+ dayOfMonthMap[dayOfMonth].push(result.data.dataList[i]);
+ } else {
+ dayOfMonthMap[dayOfMonth] = [result.data.dataList[i]]
+ }
+ if (materialTypeMap[materialType + ',' + columnNum]) {
+ materialTypeMap[materialType + ',' + columnNum].push(result.data.dataList[i]);
+ } else {
+ materialTypeMap[materialType + ',' + columnNum] = [result.data.dataList[i]]
+ }
+ if (header.indexOf(materialType + ',' + columnNum) == -1) {
+ header.push(materialType + ',' + columnNum)
+ }
+ }
+ header = header.sort(function (a, b) { return parseInt(a.split(',')[1]) - parseInt(b.split(',')[1]) })
+ if (header.length > 0) {
+ var resultData = {
+ header: header,
+ dayOfMonthMap: dayOfMonthMap,
+ sumData: result.data.sumData
+ }
+ var doc = document.getElementById('thisIframe').contentWindow.document.getElementById("echartJs");
+ var title = "清洗区材料类型工作量统计报表 " + ((timeType == '年月') ? monthSearch : yearSearch);
+ var res = getTableAndEchartsData(resultData);
+ var chartsData = {
+ legendData: res.legendData,
+ xAxisData: res.xAxisData,
+ seriesData: res.seriesData
+ }
+ if (sstsConfig.enableTheHistogramDisplayOfCleaningAreaMaterialTypeWorkloadStatisticsReport) {
+ createEcharts(doc, chartsData);
+ document.getElementById('thisIframe').contentWindow.document.getElementById("echartJs").style.display = "block";
+ }
+ document.getElementById('thisIframe').contentWindow.document.getElementById("table").innerHTML = res.html;
+ document.getElementById('thisIframe').contentWindow.document.getElementById("title").innerHTML = title;
+ }
+ myMask.hide();
+ },
+ failure: function (response, options) {
+ showResult(response.responseText);
+ }
+ });
}
- var sign = true;
- var dwrCallParams = null;
-
- var tbar = [{
- text: '导出Excel',
- iconCls: 'btn_ext_refresh',
- id: 'editTbar',
- handler: function () {
- var month = Ext.getCmp('monthSearch').getRawValue();
- location.href = WWWROOT + "/disinfectsystem/reportforms/departmentMonthlyExport.jsp?month=" + month + "&reportType=科室月报明细";
- }
- }];
-
- Ext.ux.ForgonPageGrid.prototype.getGridParameterMap = function () {
-
- };
-
- var departJsonStore = new Ext.data.SimpleStore({
- fields: ['departName'],
- url: WWWROOT + '/disinfectSystem/reportFormsCenterAction!getAllDepartName.do'
- });
-
var form = new Ext.form.FormPanel({
title: entityName + "月报",
region: 'north',
@@ -155,9 +281,65 @@
layout: 'column',
height: 40,
items: [{
- width: 220,
+ width: 160,
layout: 'form',
- labelWidth: 90,
+ labelWidth: 60,
+ items: [{
+ xtype: 'combo',
+ fieldLabel: "日期类型",
+ valueField: 'value',
+ displayField: 'value',
+ store: timeTypeStore,
+ triggerAction: 'all',
+ editable: false,
+ mode: 'local',
+ forceSelection: false,
+ name: "timeType",
+ id: "timeType",
+ anchor: '95%',
+ value: '年月',
+ listeners: {
+ select: function () {
+ if ('年份' == this.value) {
+ Ext.getCmp('yearSearch_id').show();
+ Ext.getCmp('monthSearch_id').hide();
+ } else {
+ Ext.getCmp('yearSearch_id').hide();
+ Ext.getCmp('monthSearch_id').show();
+ }
+ }
+ }
+ }]
+
+ }, {
+ width: 200,
+ layout: 'form',
+ labelWidth: 60,
+ id: 'yearSearch_id',
+ hidden: false,
+ items: [
+ new Ext.ux.MonthField({
+ id: 'yearSearch',
+ name: 'yearSearch',
+ fieldLabel: '年份',
+ readOnly: true,
+ width: 110,
+ format: 'Y',
+ value: new Date(),
+ listeners: {
+ render: function () {
+ setTimeout(function () {
+ Ext.getCmp('yearSearch_id').hide();
+ }, 100);
+ }
+ }
+ })
+ ]
+ }, {
+ width: 200,
+ layout: 'form',
+ labelWidth: 60,
+ id: 'monthSearch_id',
items: [new Ext.form.DateField({
id: 'monthSearch',
name: 'monthSearch',
@@ -226,23 +408,7 @@
}
}
}]
-
- // items : [{
- // xtype : 'combo',
- // id : 'querySupplyRoom',
- // name : 'querySupplyRoom',
- // valueField : 'departId',
- // displayField : 'name',
- // allowBlank : true,
- // editable : false,
- // store : supplyRoomStore,
- // forceSelection : true,
- // mode : 'local',
- // triggerAction : 'all',
- // anchor : '95%'
- // }]
}]
-
}]
}],
buttons: [{
@@ -269,7 +435,31 @@
autoScroll: true,//自动显示滚动条
collapsible: true,//允许展开和收缩
bodyPadding: 5,
- html: ''
+ tbar: [{
+ text: '导出',
+ handler: function () {
+ if (document.getElementById('thisIframe').contentWindow.document.getElementById("title").innerHTML == '') {
+ showResult("请查询后再导出");
+ return
+ }
+ // excel的文件名称
+ var fileName = document.getElementById('thisIframe').contentWindow.document.getElementById("title").innerHTML;
+ var chartImg = encodeURIComponent(myChart.getDataURL());
+ // 图片宽度和高度,为了计算图片比例,以便在excel中以正常比例显示,不至于拉伸
+ var chartSize = myChart.getWidth() + ":" + myChart.getHeight();
+ var jsFileName = "\\disinfectsystem\\reportforms\\js\\LZString.js";
+ var tableHtml = document.getElementById('thisIframe').contentWindow.document.getElementById('table').innerHTML;
+ tableHtml = Base64.encode(encodeURI(tableHtml));
+ var htmlTable = LZString.compressToEncodedURIComponent(tableHtml)
+ document.getElementById('thisIframe').contentWindow.document.getElementById('fileName').value = fileName;
+ document.getElementById('thisIframe').contentWindow.document.getElementById('fileContents').value = chartImg;
+ document.getElementById('thisIframe').contentWindow.document.getElementById('fileSizes').value = chartSize;
+ document.getElementById('thisIframe').contentWindow.document.getElementById('jsFileName').value = jsFileName;
+ document.getElementById('thisIframe').contentWindow.document.getElementById('htmlTable').value = htmlTable;
+ document.getElementById('thisIframe').contentWindow.document.getElementById('submitForm').click();
+ }
+ }],
+ html: ''
});
var viewport = new Ext.Viewport({
@@ -282,6 +472,4 @@
items: reportForm
}]
});
- //supplyRoomStore.load();
- supplyRoomRemoteStore.load();//20181225
});
\ No newline at end of file
Index: ssts-web/src/main/webapp/disinfectsystem/config/zsxlrmyy/config.js
===================================================================
diff -u -r30818 -r31205
--- ssts-web/src/main/webapp/disinfectsystem/config/zsxlrmyy/config.js (.../config.js) (revision 30818)
+++ ssts-web/src/main/webapp/disinfectsystem/config/zsxlrmyy/config.js (.../config.js) (revision 31205)
@@ -97,6 +97,8 @@
desktopShortcutIconsConfig:["设备维护信息"],
// 是否显示辅助发货按钮
showAuxiliaryInvoiceBtn:true,
+ //开启【清洗区材料类型工作量统计报表】的柱状图显示
+ enableTheHistogramDisplayOfCleaningAreaMaterialTypeWorkloadStatisticsReport:true,
//禁用基数限制
disableCardinalNumLimit:true
}
\ No newline at end of file