mirror of https://gitee.com/y_project/RuoYi.git
代码生成主子表序号调整
parent
326fe6a63f
commit
3846329c82
|
@ -365,6 +365,7 @@ var sub = {
|
||||||
$("#" + table.options.id).bootstrapTable("updateRow", params);
|
$("#" + table.options.id).bootstrapTable("updateRow", params);
|
||||||
},
|
},
|
||||||
delColumn: function(column) {
|
delColumn: function(column) {
|
||||||
|
sub.editColumn();
|
||||||
var subColumn = $.common.isEmpty(column) ? "index" : column;
|
var subColumn = $.common.isEmpty(column) ? "index" : column;
|
||||||
var ids = $.table.selectColumns(subColumn);
|
var ids = $.table.selectColumns(subColumn);
|
||||||
if (ids.length == 0) {
|
if (ids.length == 0) {
|
||||||
|
@ -372,17 +373,6 @@ var sub = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$("#" + table.options.id).bootstrapTable('remove', { field: subColumn, values: ids });
|
$("#" + 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,
|
pagination: true,
|
||||||
paginationLoop: false,
|
paginationLoop: false,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
pageNumber: 1,
|
||||||
pageList: [10, 25, 50],
|
pageList: [10, 25, 50],
|
||||||
toolbar: "toolbar",
|
toolbar: "toolbar",
|
||||||
striped: false,
|
striped: false,
|
||||||
|
@ -275,8 +276,8 @@ var table = {
|
||||||
serialNumber: function (index, tableId) {
|
serialNumber: function (index, tableId) {
|
||||||
var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId;
|
var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId;
|
||||||
var tableParams = $("#" + currentId).bootstrapTable('getOptions');
|
var tableParams = $("#" + currentId).bootstrapTable('getOptions');
|
||||||
var pageSize = tableParams.pageSize;
|
var pageSize = $.common.isNotEmpty(tableParams.pageSize) ? tableParams.pageSize: table.options.pageSize;
|
||||||
var pageNumber = tableParams.pageNumber;
|
var pageNumber = $.common.isNotEmpty(tableParams.pageNumber) ? tableParams.pageNumber: table.options.pageNumber;
|
||||||
return pageSize * (pageNumber - 1) + index + 1;
|
return pageSize * (pageNumber - 1) + index + 1;
|
||||||
},
|
},
|
||||||
// 列超出指定长度浮动提示 target(copy单击复制文本 open弹窗打开文本)
|
// 列超出指定长度浮动提示 target(copy单击复制文本 open弹窗打开文本)
|
||||||
|
|
|
@ -96,7 +96,11 @@
|
||||||
{
|
{
|
||||||
field: 'index',
|
field: 'index',
|
||||||
align: 'center',
|
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',
|
field: 'name',
|
||||||
|
@ -164,7 +168,6 @@
|
||||||
type: "",
|
type: "",
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sub.resetIndex();
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -210,7 +210,11 @@
|
||||||
{
|
{
|
||||||
field: 'index',
|
field: 'index',
|
||||||
align: 'center',
|
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)
|
#foreach($column in $subTable.columns)
|
||||||
#set($dictType=$column.dictType)
|
#set($dictType=$column.dictType)
|
||||||
|
@ -269,7 +273,6 @@
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sub.resetIndex();
|
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -211,7 +211,11 @@
|
||||||
{
|
{
|
||||||
field: 'index',
|
field: 'index',
|
||||||
align: 'center',
|
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)
|
#foreach($column in $subTable.columns)
|
||||||
#set($dictType=$column.dictType)
|
#set($dictType=$column.dictType)
|
||||||
|
@ -250,7 +254,6 @@
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
$.table.init(options);
|
$.table.init(options);
|
||||||
sub.resetIndex();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function addColumn() {
|
function addColumn() {
|
||||||
|
@ -271,7 +274,6 @@
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sub.resetIndex();
|
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue