Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/workQualityCollectionView.js =================================================================== diff -u -r36248 -r36255 --- ssts-web/src/main/webapp/disinfectsystem/reportforms/workQualityCollectionView.js (.../workQualityCollectionView.js) (revision 36248) +++ ssts-web/src/main/webapp/disinfectsystem/reportforms/workQualityCollectionView.js (.../workQualityCollectionView.js) (revision 36255) @@ -597,6 +597,9 @@ } else { var html = getTableHtml(result.data, type, year); document.getElementById('thisIframe').contentWindow.document.getElementById('table').innerHTML = html; + document.getElementById('thisIframe').contentWindow.document.getElementById('is2Column').value = is2Column; + document.getElementById('thisIframe').contentWindow.document.getElementById('widthStr').value = widthArr.join(','); + document.getElementById('thisIframe').contentWindow.document.getElementById('ToolBar').style.display = 'block'; } }, failure: function (response, options) { @@ -728,28 +731,7 @@ autoScroll: true,//自动显示滚动条 collapsible: true,//允许展开和收缩 bodyPadding: 5, - tbar: [{ - text: '导出', - handler: function () { - var html = document.getElementById('thisIframe').contentWindow.document.getElementById('table').innerHTML; - if (html !== '') { - var data = { - fileName: title, - fileType: ".xls",//文档类型 经测试 可以doc xls html 其他的自己去试 - html: html - } - exportMask = new Ext.LoadMask(Ext.getBody(), { - msg: '正在导出文件,请稍候!', - removeMask: true - }); - exportMask.show(); - setTimeout(function () { - exportReportExcel(data, 'thisIframe', is2Column, widthArr); - }, 1000); - } - } - }], - html: '' + html: '' }); var viewport = new Ext.Viewport({ Index: ssts-web/src/main/webapp/homepage/exportMonitorData.jsp =================================================================== diff -u -r36254 -r36255 --- ssts-web/src/main/webapp/homepage/exportMonitorData.jsp (.../exportMonitorData.jsp) (revision 36254) +++ ssts-web/src/main/webapp/homepage/exportMonitorData.jsp (.../exportMonitorData.jsp) (revision 36255) @@ -7,9 +7,22 @@ + + + + + + + + + + + -
+ + + +
+ + +
@@ -43,6 +86,44 @@ // 提交表单 $("#none_form").submit(); } + function printAll(){ + if(isIE()){ + var newWindow = window.open(); + newWindow.document.write(document.getElementById('table').innerHTML); + newWindow.document.close(); + newWindow.focus(); + newWindow.print(); + newWindow.close(); + }else { + window.print(); + } + } + function exportReportForExcel(){ + var title = document.getElementById('table').getElementsByTagName('p')[0].innerHTML; + if (isIE()) { + var fileName = title + '.xls'; + var tableHtml = ''; + tableHtml += document.getElementById('table').innerHTML; + tableHtml += ''; + tableHtml = Base64.encode(encodeURI(tableHtml)); + var htmlTable = LZString.compressToEncodedURIComponent(tableHtml) + var jsFileName = "\\disinfectsystem\\reportforms\\js\\LZString.js"; + document.getElementById('htmlFileName').value = fileName; + document.getElementById('jsFileName').value = jsFileName; + document.getElementById('htmlTable').value = htmlTable; + $("#none_form").submit(); + } else { + var is2Column = document.getElementById('is2Column').value; + var widthStr = document.getElementById('widthStr').value; + var widthArr = widthStr.split(','); + XSExport.excelExport( + document.getElementById('table'), + title, + is2Column || false, + widthArr || [] + ); + } + } @@ -64,4 +145,4 @@ out.clear(); out = pageContext.pushBody(); } - %> \ No newline at end of file +%> \ No newline at end of file