| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- var myDate = new Date();
- var curYear = myDate.getFullYear(); //获取完整的年份(4位,1970-????)
- var curMonth = myDate.getMonth()+1; //获取当前月份(0-11,0代表1月)
- var curQuarters = Math.floor( ( (curMonth-1) % 3 == 0 ? ( (curMonth-1) / 3 ) : ( (curMonth-1) / 3 + 1 ) ) );
- var scopeTitle = '月 度';
- myDate.getMonth(); //获取当前月份(0-11,0代表1月)
- //调整相应的频度
- function tyepChange(){
- if($("#attType").val() == "0"){
- $("#attMonth").removeAttr("disabled");
- $("#attMonth").css("background","");
- $("#attQuarters").attr("disabled","disabled");
- $("#attQuarters").css("background","#f0f0f0");
- scopeTitle = '月 度';
- }else if($("#attType").val() == "1"){
- $("#attMonth").attr("disabled","disabled");
- $("#attMonth").css("background","#f0f0f0");
- $("#attQuarters").removeAttr("disabled");
- $("#attQuarters").css("background","");
- scopeTitle = '季 度';
- }else{
- $("#attMonth").attr("disabled","disabled");
- $("#attMonth").css("background","#f0f0f0");
- $("#attQuarters").attr("disabled","disabled");
- $("#attQuarters").css("background","#f0f0f0");
- scopeTitle = '年 度';
- }
- }
- var _hasSearch=false;
- function setDefault(){
- if(curMonth<10)
- curMonth = "0"+curMonth;
- $("#attMonth").val(curMonth);
- $("#attYear").val(curYear);
- $('#attQuarters').val(curQuarters);
- }
- var _rpttitle = '报表';
- function btn_output(){
- if(!_hasSearch){
- alert('请先查询数据');
- return;
- }
- var opt = {
- type:'excel'
- ,fileName:_rpttitle
- ,escape:'false'
- ,mso:{
- fileFormat: 'xlshtml'
- ,onMsoNumberFormat: null
- ,pageFormat: 'a4'
- ,pageOrientation: 'portrait'
- ,rtl: false
- ,styles: ['background-color',
- 'color',
- 'font-family',
- 'font-size',
- 'font-weight',
- 'text-align',
- 'height',
- 'padding',
- ,'border-bottom', 'border-top', 'border-left', 'border-right'
- ]
- // ,worksheetName: 'abc'
- }
- };
- // $('#jqGrid').tableExport(opt);
- var ex = $('#jqGrid').clone();
- var tbody = ex.find('tbody');
- var tds = tbody.find('tr:eq(0)').find('td');
- var thead = $("#gbox_jqGrid .ui-jqgrid-htable thead").clone();
- tbody.before(thead);
- var titleTr =$('<tr></tr>');
- var titleTh = $('<th></th>');
- titleTr.append(titleTh);
- titleTh.append($('.ui-jqgrid-title').clone());
- titleTh.attr('colspan',tds.length);
- thead.prepend(titleTr);
- thead.css('text-align','center');
- var footer = $('table.ui-jqgrid-ftable tbody tr');
- tbody.append(footer);
- // ex.hide();
- $('body').append(ex);
- ex.tableExport(opt);
- ex.remove();
- }
|