| @@ -402,7 +402,11 @@ | |||||
| <div class="form-group"> | <div class="form-group"> | ||||
| <label class="col-md-1 control-label">家庭情况:</label> | <label class="col-md-1 control-label">家庭情况:</label> | ||||
| <div class="col-md-11"> | <div class="col-md-11"> | ||||
| <textarea name="jtqk" class="form-control"></textarea> | |||||
| <button type="button" class="btn btn-unite" onclick="addRow()">增加</button> | |||||
| <button type="button" class="btn btn-unite" onclick="sub.delRow()">删除</button> | |||||
| <div class="col-sm-12 select-table table-striped"> | |||||
| <table id="bootstrap-table"></table> | |||||
| </div> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -411,8 +415,8 @@ | |||||
| </div> | </div> | ||||
| <th:block th:include="include :: footer" /> | <th:block th:include="include :: footer" /> | ||||
| <script th:inline="javascript"> | <script th:inline="javascript"> | ||||
| var prefix = ctx + "system/information" | |||||
| var $("#familyMemberCode").val(generateCodeId()); | |||||
| var prefix = ctx + "system/information"; | |||||
| $("#familyMemberCode").val(generateCodeId()); | |||||
| $("#form-information-add").validate({ | $("#form-information-add").validate({ | ||||
| focusCleanup: true | focusCleanup: true | ||||
| }); | }); | ||||
| @@ -420,7 +424,82 @@ | |||||
| //初始化 | //初始化 | ||||
| function init(){ | function init(){ | ||||
| loadTable(); | |||||
| } | |||||
| //加载表格 | |||||
| function loadTable(){ | |||||
| var options = { | |||||
| data: [], | |||||
| pagination: false, | |||||
| showSearch: false, | |||||
| showRefresh: false, | |||||
| showToggle: false, | |||||
| showColumns: false, | |||||
| sidePagination: "client", | |||||
| columns: [{ | |||||
| checkbox: true | |||||
| }, | |||||
| { | |||||
| field: 'index', | |||||
| align: 'center', | |||||
| title: "序号", | |||||
| formatter: function (value, row, index) { | |||||
| var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index)); | |||||
| var columnId = $.common.sprintf("<input type='hidden' name='list[%s].id' value='%s'>", index, row.id); | |||||
| return columnIndex + $.table.serialNumber(index) + columnId; | |||||
| } | |||||
| }, | |||||
| { | |||||
| field: 'appellation', | |||||
| align: 'center', | |||||
| title: '称谓', | |||||
| formatter: function(value, row, index) { | |||||
| return $.common.sprintf("<input class='form-control' type='text' name='list[%s].appellation' value='%s' />", index, value); | |||||
| } | |||||
| }, | |||||
| { | |||||
| field: 'name', | |||||
| align: 'center', | |||||
| title: '姓名', | |||||
| formatter: function(value, row, index) { | |||||
| return $.common.sprintf("<input class='form-control' type='text' name='list[%s].name' value='%s' />", index, value); | |||||
| } | |||||
| }, | |||||
| { | |||||
| field: 'birthday', | |||||
| align: 'center', | |||||
| title: '出生年月', | |||||
| formatter: function(value, row, index) { | |||||
| return $.common.sprintf("<input class='form-control' type='text' name='list[%s].birthday' value='%s' />", index, value); | |||||
| } | |||||
| }, | |||||
| { | |||||
| field: 'politicalStatus', | |||||
| align: 'center', | |||||
| title: '政治面貌', | |||||
| formatter: function(value, row, index) { | |||||
| return $.common.sprintf("<input class='form-control' type='text' name='list[%s].politicalStatus' value='%s' />", index, value); | |||||
| } | |||||
| }, | |||||
| { | |||||
| field: 'unitJob', | |||||
| align: 'left', | |||||
| title: '工作单位及职务', | |||||
| formatter: function(value, row, index) { | |||||
| return $.common.sprintf("<textarea class='form-control' rows=\"2\" name='list[%s].unitJob'>%s</textarea>", index, value); | |||||
| } | |||||
| }, | |||||
| { | |||||
| title: '操作', | |||||
| align: 'center', | |||||
| formatter: function(value, row, index) { | |||||
| var num = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index); | |||||
| return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + num + '\')"><i class="fa fa-remove"></i>删除</a>'; | |||||
| } | |||||
| }] | |||||
| }; | |||||
| $.table.init(options); | |||||
| } | } | ||||
| function submitHandler() { | function submitHandler() { | ||||
| @@ -429,6 +508,28 @@ | |||||
| } | } | ||||
| } | } | ||||
| function addRow() { | |||||
| var element = $("#" + table.options.id); | |||||
| var count = element.bootstrapTable('getData').length; | |||||
| var row = { | |||||
| index: $.table.serialNumber(count), | |||||
| appellation:"", | |||||
| name: "", | |||||
| birthday: "", | |||||
| politicalStatus: "", | |||||
| unitJob: "" | |||||
| } | |||||
| sub.addRow(row); | |||||
| scrollToBottom(); | |||||
| } | |||||
| // 滚动到页面底部的函数 | |||||
| function scrollToBottom() { | |||||
| $('html, body').animate({ | |||||
| scrollTop: $(document).height() | |||||
| }, 'slow'); | |||||
| } | |||||
| //随机生成连表code | //随机生成连表code | ||||
| function generateCodeId() { | function generateCodeId() { | ||||
| const timestamp = Date.now(); | const timestamp = Date.now(); | ||||