From a751e547d67c4f8e2c6fddf958c1559f792515bd Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期五, 27 六月 2025 16:11:50 +0800 Subject: [PATCH] 添加工作流 --- src/components/table2excel/table2excel.js | 27 ++++++++++++--------------- 1 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/components/table2excel/table2excel.js b/src/components/table2excel/table2excel.js index 940c431..9fdec8d 100644 --- a/src/components/table2excel/table2excel.js +++ b/src/components/table2excel/table2excel.js @@ -1,16 +1,8 @@ -/* - * jQuery table2excel - v1.1.2 - * jQuery plugin to export an .xls file in browser from an HTML table - * https://github.com/rainabba/jquery-table2excel - * - * Made by rainabba - * Under MIT License - */ + //table2excel.js import jQuery from 'jquery' (function ( $, window, document, undefined ) { var pluginName = "table2excel", - defaults = { exclude: ".noExl", name: "Table2Excel", @@ -77,7 +69,7 @@ } // Create HTML for Row - tempRows += "<tr style='" + additionalStyles + "'>"; + tempRows += "<tr align='center' valign='center' style='" + additionalStyles + "'>"; // Loop through each TH and TD $(p).find("td,th").not(e.settings.exclude).each(function (i,q) { // p did not exist, I corrected @@ -101,15 +93,21 @@ if( rc.flag.length > 0 ) { tempRows += "<td> </td>"; // exclude it!! } else { - tempRows += "<td"; + // 鍖归厤鏍煎紡涓�'yyyy-mm'鐨勬棩鏈熷瓧绗︿覆鏁版嵁锛岃嫢鏈夊叾浠栭渶姹傚悗鏈熷啀澧炲姞 + var regexPattern = /^\d{4}-\d{2}$/; + if($(q).html().match(regexPattern)){ + tempRows += "<td style=\"mso-number-format:'yyyy-mm';\""; + }else{ + tempRows += "<td"; + if(additionalStyles){ + tempRows += " style='" + additionalStyles + "'"; + } + } if( rc.rows > 0) { tempRows += " rowspan='" + rc.rows + "' "; } if( rc.cols > 0) { tempRows += " colspan='" + rc.cols + "' "; - } - if(additionalStyles){ - tempRows += " style='" + additionalStyles + "'"; } tempRows += ">" + $(q).html() + "</td>"; } @@ -260,7 +258,6 @@ $.data( e, "plugin_" + pluginName, new Plugin( this, options ) ); } }); - // chain jQuery functions return e; }; -- Gitblit v1.9.3