diff --git a/templates/upload_excel_modal.html b/templates/upload_excel_modal.html index d685bad..ccf3a89 100644 --- a/templates/upload_excel_modal.html +++ b/templates/upload_excel_modal.html @@ -128,69 +128,70 @@ $(document).ready(function() { }); }); - function updateTable() { - var tableBody = $('#form-input-table tbody'); - tableBody.empty(); // 清空表体内容 + // 更新表格内容,处理分页按钮的点击事件 + function updateTable() { + var tableBody = $('#form-input-table tbody'); + tableBody.empty(); // 清空表体内容 - var upload_excel_preview_config = {{ upload_excel_preview_config|safe }}; + var upload_excel_preview_config = {{ upload_excel_preview_config|safe }}; - var startIndex = (currentPage - 1) * rowsPerPage; - var endIndex = startIndex + rowsPerPage; - var pageData = tableData.slice(startIndex, endIndex); + var startIndex = (currentPage - 1) * rowsPerPage; + var endIndex = startIndex + rowsPerPage; + var pageData = tableData.slice(startIndex, endIndex); - // 遍历分页数据行 - $.each(pageData, function(index, rowData) { - var row = $(''); // 创建新的行元素 - row.append($('').text(startIndex + index + 1)); // 添加序号列 + // 遍历分页数据行 + $.each(pageData, function(index, rowData) { + var row = $(''); // 创建新的行元素 + row.append($('').text(startIndex + index + 1)); // 添加序号列 - var cellIndex = 0; // 初始化列索引 + var cellIndex = 0; // 初始化列索引 - // 为每个单元格创建对应的输入框或下拉菜单 - $.each(upload_excel_preview_config.rows, function(key, cell) { - var cellElement; - var cellValue = rowData[cellIndex] || ''; // 通过列索引获取值 + // 为每个单元格创建对应的输入框或下拉菜单 + $.each(upload_excel_preview_config.rows, function(key, cell) { + var cellElement; + var cellValue = rowData[cellIndex] || ''; // 通过列索引获取值 - if (cell.type === 'text') { - // 创建输入框 - cellElement = $('').attr({ - style: "width: " + cell.width, - type: 'text', - class: 'form-control', - id: key, - name: key, - value: cellValue, - }); - } else if(cell.type === 'select') { - // 创建下拉菜单 - cellElement = $('').attr({ + style: "width: " + cell.width, + type: 'text', + class: 'form-control', + id: key, + name: key, + value: cellValue, + }); + } else if(cell.type === 'select') { + // 创建下拉菜单 + cellElement = $('