代码生成主子表序号调整

dep_wangsr
RuoYi 4 years ago committed by Limy
parent d10033f907
commit 7d556aee07

@ -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) } })
}
}
};

@ -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;
},
// 列超出指定长度浮动提示 targetcopy单击复制文本 open弹窗打开文本

@ -96,7 +96,11 @@
{
field: 'index',
align: 'center',
title: "序号"
title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
return columnIndex + $.table.serialNumber(index);
}
},
{
field: 'name',
@ -164,7 +168,6 @@
type: "",
}
});
sub.resetIndex();
}
</script>
</body>

@ -210,7 +210,11 @@
{
field: 'index',
align: 'center',
title: "序号"
title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.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
</script>

@ -211,7 +211,11 @@
{
field: 'index',
align: 'center',
title: "序号"
title: "序号",
formatter: function (value, row, index) {
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.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
</script>

Loading…
Cancel
Save