修改模板 动表头前备份
This commit is contained in:
@ -106,8 +106,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<form class="layui-form" style="height:100%;width:100%" id="tablepanel">
|
<form class="layui-form" style="height:100%;width:100%;" id="tablepanel">
|
||||||
<div class="layui-panel" id="gridpanel" >
|
<div class="layui-panel" id="gridpanel" style="height:100%;width:100%;overflow:scroll;">
|
||||||
<div id="result"></div>
|
<div id="result"></div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@ -124,9 +124,10 @@
|
|||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
layui.use(["layer", "laytpl", "element", "form", "slider", "laydate", "rate", "colorpicker", "carousel", "upload", "formField", "numberInput", "iconPicker", "cron", "labelGeneration"],
|
layui.use(["table", "layer", "laytpl", "element", "form", "slider", "laydate", "rate", "colorpicker", "carousel", "upload", "formField", "numberInput", "iconPicker", "cron", "labelGeneration"],
|
||||||
function () {
|
function () {
|
||||||
var $ = layui.jquery,
|
var $ = layui.jquery,
|
||||||
|
table = layui.table,
|
||||||
layer = layui.layer,
|
layer = layui.layer,
|
||||||
laytpl = layui.laytpl,
|
laytpl = layui.laytpl,
|
||||||
setter = layui.cache,
|
setter = layui.cache,
|
||||||
@ -355,37 +356,41 @@
|
|||||||
|
|
||||||
// 合并单元格
|
// 合并单元格
|
||||||
handler.mergeTable(workbook, true);
|
handler.mergeTable(workbook, true);
|
||||||
|
staticToLayTable();
|
||||||
completeLoading();
|
completeLoading();
|
||||||
},
|
},
|
||||||
|
|
||||||
// csv 数据转换为 table
|
// csv 数据转换为 table
|
||||||
csv2table(csv, showTab = false) {
|
csv2table(csv, showTab = false) {
|
||||||
var html = "<table class=\"layui-table\" lay-even=\"\" lay-skin=\"row\">";
|
var html = "<table lay-filter = \"tdemo\" class=\"layui-table\" lay-even=\"\" lay-skin=\"row\">";
|
||||||
var rows = csv.split("\n");
|
var rows = csv.split("\n");
|
||||||
|
debugger;
|
||||||
rows.pop(); // 最后一行没用的
|
rows.pop(); // 最后一行没用的
|
||||||
|
html += "<tbody>";
|
||||||
rows.forEach(function (row, idx) {
|
rows.forEach(function (row, idx) {
|
||||||
var columns = row.split(",");
|
var columns = row.split(",");
|
||||||
if (showTab) {
|
//if (showTab) {
|
||||||
columns.unshift(idx + 1); // 添加行索引
|
// columns.unshift(idx + 1); // 添加行索引
|
||||||
if (idx == 0) {
|
// if (idx == 0) {
|
||||||
// 添加列索引
|
// // 添加列索引
|
||||||
html += "<tr>";
|
// html += "<tr>";
|
||||||
for (var i = 0; i < columns.length; i++) {
|
// for (var i = 1; i < columns.length; i++) {
|
||||||
html +=
|
// html +=
|
||||||
"<th>" +
|
// "<th>" +
|
||||||
//(i == 0 ? "" : String.fromCharCode(65 + i - 1)) +
|
// //(i == 0 ? "" : String.fromCharCode(65 + i - 1)) +
|
||||||
(i == 0 ? "" : i.toString()) +
|
// (i == 0 ? "" : i.toString()) +
|
||||||
"</th>";
|
// "</th>";
|
||||||
}
|
// }
|
||||||
html += "</tr>";
|
// html += "</tr>";
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
html += "<tr>";
|
html += "<tr>";
|
||||||
columns.forEach(function (column) {
|
columns.forEach(function (column) {
|
||||||
html += "<td align=center>" + column + "</td>";
|
html += "<td align=center>" + column + "</td>";
|
||||||
});
|
});
|
||||||
html += "</tr>";
|
html += "</tr>";
|
||||||
});
|
});
|
||||||
|
html += "</tbody>";
|
||||||
html += "</table>";
|
html += "</table>";
|
||||||
return html;
|
return html;
|
||||||
},
|
},
|
||||||
@ -402,11 +407,11 @@
|
|||||||
let baiseAdd = hasTab ? 1 : 0;
|
let baiseAdd = hasTab ? 1 : 0;
|
||||||
|
|
||||||
mergeInfo.forEach((item) => {
|
mergeInfo.forEach((item) => {
|
||||||
let start_r = item.s.r + baiseAdd;
|
let start_r = item.s.r + baiseAdd-1;
|
||||||
let end_r = item.e.r + baiseAdd;
|
let end_r = item.e.r + baiseAdd-1;
|
||||||
|
|
||||||
let start_c = item.s.c + baiseAdd;
|
let start_c = item.s.c + baiseAdd-1;
|
||||||
let end_c = item.e.c + baiseAdd;
|
let end_c = item.e.c + baiseAdd-1;
|
||||||
|
|
||||||
for (let i = start_r; i <= end_r; i++) {
|
for (let i = start_r; i <= end_r; i++) {
|
||||||
let row = document.querySelectorAll("#result tr")[i];
|
let row = document.querySelectorAll("#result tr")[i];
|
||||||
@ -438,6 +443,18 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function staticToLayTable()
|
||||||
|
{
|
||||||
|
var table = layui.table;
|
||||||
|
|
||||||
|
//转换静态表格
|
||||||
|
table.init('tdemo', {
|
||||||
|
//height: 315 //设置高度
|
||||||
|
//, limit: 10 //注意:请务必确保 limit 参数(默认:10)是与你服务端限定的数据条数一致
|
||||||
|
//支持所有基础参数
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function dataURLToFile(dataUrl, fileName) {
|
function dataURLToFile(dataUrl, fileName) {
|
||||||
const dataArr = dataUrl.split(',');
|
const dataArr = dataUrl.split(',');
|
||||||
|
BIN
HT.Cloud.Web/wwwroot/report/Report20230322154508.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230322154508.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230322154541.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230322154541.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230322154920.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230322154920.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230322155021.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230322155021.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323104713.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323104713.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323104757.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323104757.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323105032.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323105032.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323105506.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323105506.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323105527.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323105527.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323105608.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323105608.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323110004.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323110004.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323110439.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323110439.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323111301.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323111301.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323111342.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323111342.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323111754.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323111754.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323111814.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323111814.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323112519.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323112519.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323112610.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323112610.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323134220.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323134220.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323134313.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323134313.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323134359.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323134359.xlsx
Normal file
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/Report20230323135035.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/Report20230323135035.xlsx
Normal file
Binary file not shown.
Binary file not shown.
BIN
HT.Cloud.Web/wwwroot/report/报表预设模板带厂名.xlsx
Normal file
BIN
HT.Cloud.Web/wwwroot/report/报表预设模板带厂名.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user