From 52464bae20af8972c79c872798690493a7d73589 Mon Sep 17 00:00:00 2001 From: Sai Date: Fri, 29 Mar 2024 23:57:50 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=AA=BF=E6=95=B4=E6=B8=85=E7=B7=9A?= =?UTF-8?q?=E6=98=8E=E7=B4=B0=20Excel=E8=A1=A8=E9=A0=AD=E9=A1=AF=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AMESCoreStudio.Web/Views/PCS/PCS037L.cshtml | 29 ++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/AMESCoreStudio.Web/Views/PCS/PCS037L.cshtml b/AMESCoreStudio.Web/Views/PCS/PCS037L.cshtml index 4015ac62..d1b927db 100644 --- a/AMESCoreStudio.Web/Views/PCS/PCS037L.cshtml +++ b/AMESCoreStudio.Web/Views/PCS/PCS037L.cshtml @@ -14,7 +14,7 @@
- @ViewData["Tips"]        Rev.A2 +
@Html.Raw(ViewData["Tips"])        Rev.A2
sdfsdfasdf
@@ -134,6 +134,7 @@ }, { text: '匯出Excel', + layuiicon: '', class: 'layui-btn-normal', handler: function () { $.ajax({ @@ -145,8 +146,19 @@ type: "GET", success(res) { var data = res.data; - console.log(res); - data = excel.filterExportData(data, [ + + // 创建一个包含标题的 Excel 数据数组 + var excelData = []; + var tipsText = $('#tips').text(); + tipsText = tipsText.replace('Rev.A2', ' Rev.A2'); + // 添加标题行 + var titleRow = [ + `${tipsText}` + ]; + excelData.push(titleRow); + + // 将数据合并到 Excel 数据中 + var filteredData = excel.filterExportData(data, [ 'clearDetailID', 'stationName', 'surplusFlag', @@ -155,10 +167,14 @@ 'reasonDesc', 'checkUser' ]); - data.unshift({ + + + filteredData.unshift({ clearDetailID: "編號", stationName: "站別名稱", surplusFlag: "是否缺料", partNo: "料號", qty: "數量", reasonDesc: "原因分析", checkUser: "確認人員" }); - excel.downloadExcel(data, '清線資料Excel', 'xlsx'); + + excelData = excelData.concat(filteredData); + excel.downloadExcel(excelData, '清線資料Excel', 'xlsx'); } , error() { layer.alert('匯出失敗'); @@ -170,4 +186,5 @@ //基本数据表格 var table = hg.table.datatable('test', '清線資料', '/PCS/GetWipClearDetails/' + clearID.value, {}, tableCols, toolbar, true, 'full-100', ['filter', 'print']); -} \ No newline at end of file +} +