diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js index 845d77e7..68a43ba8 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js @@ -365,6 +365,7 @@ var sub = { $("#" + table.options.id).bootstrapTable("updateRow", params); }, delColumn: function(column) { + sub.editColumn(); var subColumn = $.common.isEmpty(column) ? "index" : column; var ids = $.table.selectColumns(subColumn); if (ids.length == 0) { @@ -372,17 +373,6 @@ var sub = { return; } $("#" + table.options.id).bootstrapTable('remove', { field: subColumn, values: ids }); - if($.common.equals("index", subColumn)) - { - sub.resetIndex(); - } - }, - resetIndex: function(msg) { - var count = $("#" + table.options.id).bootstrapTable('getData').length; - for (var index = 0; index <= count; index++) { - // 重置序号 - $("#" + table.options.id).bootstrapTable('updateRow', { index: index, row: { index: parseInt(index + 1) } }) - } } }; diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 2b07117c..7b1951b5 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -45,6 +45,7 @@ var table = { pagination: true, paginationLoop: false, pageSize: 10, + pageNumber: 1, pageList: [10, 25, 50], toolbar: "toolbar", striped: false, @@ -275,8 +276,8 @@ var table = { serialNumber: function (index, tableId) { var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId; var tableParams = $("#" + currentId).bootstrapTable('getOptions'); - var pageSize = tableParams.pageSize; - var pageNumber = tableParams.pageNumber; + var pageSize = $.common.isNotEmpty(tableParams.pageSize) ? tableParams.pageSize: table.options.pageSize; + var pageNumber = $.common.isNotEmpty(tableParams.pageNumber) ? tableParams.pageNumber: table.options.pageNumber; return pageSize * (pageNumber - 1) + index + 1; }, // 列超出指定长度浮动提示 target(copy单击复制文本 open弹窗打开文本) diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/subdata.html b/ruoyi-admin/src/main/resources/templates/demo/table/subdata.html index 519adf6f..ea86580d 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/subdata.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/subdata.html @@ -96,7 +96,11 @@ { field: 'index', align: 'center', - title: "序号" + title: "序号", + formatter: function (value, row, index) { + var columnIndex = $.common.sprintf("", $.table.serialNumber(index)); + return columnIndex + $.table.serialNumber(index); + } }, { field: 'name', @@ -164,7 +168,6 @@ type: "", } }); - sub.resetIndex(); } diff --git a/ruoyi-generator/src/main/resources/vm/html/add.html.vm b/ruoyi-generator/src/main/resources/vm/html/add.html.vm index 77dd7142..0d32c365 100644 --- a/ruoyi-generator/src/main/resources/vm/html/add.html.vm +++ b/ruoyi-generator/src/main/resources/vm/html/add.html.vm @@ -210,7 +210,11 @@ { field: 'index', align: 'center', - title: "序号" + title: "序号", + formatter: function (value, row, index) { + var columnIndex = $.common.sprintf("", $.table.serialNumber(index)); + return columnIndex + $.table.serialNumber(index); + } }, #foreach($column in $subTable.columns) #set($dictType=$column.dictType) @@ -269,7 +273,6 @@ #end } }); - sub.resetIndex(); } #end diff --git a/ruoyi-generator/src/main/resources/vm/html/edit.html.vm b/ruoyi-generator/src/main/resources/vm/html/edit.html.vm index af31dd0f..5d2ea8cb 100644 --- a/ruoyi-generator/src/main/resources/vm/html/edit.html.vm +++ b/ruoyi-generator/src/main/resources/vm/html/edit.html.vm @@ -211,7 +211,11 @@ { field: 'index', align: 'center', - title: "序号" + title: "序号", + formatter: function (value, row, index) { + var columnIndex = $.common.sprintf("", $.table.serialNumber(index)); + return columnIndex + $.table.serialNumber(index); + } }, #foreach($column in $subTable.columns) #set($dictType=$column.dictType) @@ -250,7 +254,6 @@ }] }; $.table.init(options); - sub.resetIndex(); }); function addColumn() { @@ -271,7 +274,6 @@ #end } }); - sub.resetIndex(); } #end