LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發(fā)文檔 其他文檔  
 
網(wǎng)站管理員

點晴模切ERP-生產(chǎn)工單分頁拆行js按鈕功能

liguoquan
2025年4月1日 16:40 本文熱度 1136
:點晴ERP-生產(chǎn)工單分頁拆行js按鈕功能


 function splitTable(tableId) {  

   const table = document.getElementById(tableId); // 獲取原始 table 元素

   const toptable=document.getElementById('headbody');

   const bottmtable=document.getElementById('bottombody');

   if (!table) {  

     console.error("Table with id '" + tableId + "' not found.");  

     return;  

   }  

 

   const rows = table.rows; // 獲取所有行  

   const rowCount = rows.length;  

 

   if (rowCount <= 1) {  

     console.warn("Table has less than 2 rows, no splitting needed.");  

     return; // 如果只有表頭或者沒有數(shù)據(jù),則無需拆分  

   }  

 

   const headerRow = rows[0]; // 保存表頭行  

   const rowsPerTable = 7; // 每個新 table 的行數(shù)  

   let tableCounter = 1; // 新table計數(shù)器,用于標識新table的序號  

 

   for (let i = 1; i < rowCount; i += rowsPerTable) { // 從第二行開始,步長為 rowsPerTable  

     const newTable = document.createElement("table"); // 創(chuàng)建新的 table 元素  

 

     // 復(fù)制原table的 class 和 style  

     newTable.className = table.className;  

     newTable.style.cssText = table.style.cssText;  

 

     //復(fù)制原table的屬性  

     for (let j = 0; j < table.attributes.length; j++) {  

       const attr = table.attributes[j];  

       newTable.setAttribute(attr.name, attr.value);  

     }  

 

     // 復(fù)制表頭  

     const newHeaderRow = headerRow.cloneNode(true); // 深拷貝表頭行  

     newTable.appendChild(newHeaderRow); // 添加到新 table  

 

     // 復(fù)制數(shù)據(jù)行  

     for (let j = i; j < Math.min(i + rowsPerTable, rowCount); j++) {  

       const newRow = rows[j].cloneNode(true); // 深拷貝數(shù)據(jù)行  

       newTable.appendChild(newRow); // 添加到新 table  

     }  

 

     // 將新 table 插入到原始 table 之后  

     //table.parentNode.insertBefore(newTable, table.nextSibling);  

// document.getElementById('print_body1').appendChild(toptable)

document.getElementById('print_body1').appendChild(newTable);

// document.getElementById('print_body1').appendChild(bottmtable);

     //可選:添加一個序號或標識,方便區(qū)分  

     newTable.id = tableId + "_split_" + tableCounter;  

     tableCounter++;  

   }  

   document.getElementById("indexTable").remove();

   

   const div = document.createElement("div");

   div.style.pageBreakAfter = "always";

   div.style.height = "10px;"

   for (let i = 1; i <tableCounter; i++) {

const indexTable_split_i=document.getElementById('indexTable_split_'+i)

    const headClone = document.getElementById('headbody').cloneNode(true);  

    const bottomClone = document.getElementById('bottombody').cloneNode(true);

bottomClone.id="bottomClone_"+i;

headClone.id="headClone"+i

const divClone=div.cloneNode(true);

    indexTable_split_i.parentNode.insertBefore(headClone, indexTable_split_i);   

indexTable_split_i.parentNode.insertBefore(bottomClone, indexTable_split_i.nextSibling); 

bottomClone.parentNode.insertBefore(divClone, bottomClone.nextSibling); 

  

   }  

   bottmtable.style.display="none";

   toptable.style.display="none";

}  

  splitTable("indexTable");



點晴模切ERP更多信息:http://moqie.clicksun.cn,聯(lián)系電話:4001861886

該文章在 2025/4/1 16:40:33 編輯過
關(guān)鍵字查詢
相關(guān)文章
正在查詢...
點晴ERP是一款針對中小制造業(yè)的專業(yè)生產(chǎn)管理軟件系統(tǒng),系統(tǒng)成熟度和易用性得到了國內(nèi)大量中小企業(yè)的青睞。
點晴PMS碼頭管理系統(tǒng)主要針對港口碼頭集裝箱與散貨日常運作、調(diào)度、堆場、車隊、財務(wù)費用、相關(guān)報表等業(yè)務(wù)管理,結(jié)合碼頭的業(yè)務(wù)特點,圍繞調(diào)度、堆場作業(yè)而開發(fā)的。集技術(shù)的先進性、管理的有效性于一體,是物流碼頭及其他港口類企業(yè)的高效ERP管理信息系統(tǒng)。
點晴WMS倉儲管理系統(tǒng)提供了貨物產(chǎn)品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質(zhì)期管理,貨位管理,庫位管理,生產(chǎn)管理,WMS管理系統(tǒng),標簽打印,條形碼,二維碼管理,批號管理軟件。
點晴免費OA是一款軟件和通用服務(wù)都免費,不限功能、不限時間、不限用戶的免費OA協(xié)同辦公管理系統(tǒng)。
Copyright 2010-2025 ClickSun All Rights Reserved

黄频国产免费高清视频,久久不卡精品中文字幕一区,激情五月天AV电影在线观看,欧美国产韩国日本一区二区
日本一区二区在线视频观看 | 亚洲第一国产综合野狼 | 日韩欧美乱国产日韩欧美 | 日韩一区二区三区免费播放 | 婷婷中文色字幕 | 久久国产午夜精品理 |