| | |
| | | // 导出报表
|
| | | ;(function($, window, document, gl, undefined) {
|
| | | // 定义testVal的命名空间
|
| | | gl.namespace('expExcel');
|
| | | gl.namespace('Table');
|
| | | var ExpExcel = function() {
|
| | | this.thead = ''; // 表格的头部
|
| | | this.tbody = ''; // 表格的内容
|
| | |
| | |
|
| | |
|
| | | var expExcel = new ExpExcel();
|
| | | console.log(expExcel);
|
| | | //console.log(expExcel);
|
| | | // 绑定导出数据对象
|
| | | GLOBAL.expExcel = expExcel; |
| | | GLOBAL.Table.expExcel = expExcel;
|
| | | |
| | | |
| | | //构造导出表格对象
|
| | | function createTableData(tOptions){
|
| | | var thead_arr = new Array(); //表头数据数组
|
| | | var thody_arr = new Array(); //表格数据数组
|
| | | var proname_arr = new Array(); //属性名数组
|
| | | //console.info(tOptions); |
| | | if(tOptions != undefined){ |
| | | //构造表头数组 |
| | | for(var i = 0;i< tOptions.cols.length;i++){
|
| | | var _th = tOptions.cols[i];
|
| | | for(var k=0;k<_th.length;k++){ |
| | | if(_th[k].field != undefined){ |
| | | proname_arr.push(_th[k].field);
|
| | | thead_arr.push(_th[k].title);
|
| | | }
|
| | | }
|
| | | }
|
| | | //构造表格内部数据数组
|
| | | for(var j = 0;j < tOptions.data.length;j++){
|
| | | var _data = tOptions.data[j];
|
| | | for(var k=0;k<proname_arr.length;k++){
|
| | | thody_arr.push(_data[proname_arr[k]]);
|
| | | }
|
| | | }
|
| | | }
|
| | | return {
|
| | | thead: [thead_arr],
|
| | | tbody:[thody_arr]
|
| | | };
|
| | | }
|
| | | |
| | | // 绑定导出数据对象
|
| | | GLOBAL.Table.cTblData = createTableData;
|
| | | })(jQuery, window, document, GLOBAL);
|
| | |
|
| | | // 生成阿里图标的元素
|