From 283d92e8aaf134816fa5245e1fbe467d6c952ef9 Mon Sep 17 00:00:00 2001 From: Ricky Date: Mon, 18 Jan 2021 17:16:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=BB=E5=AD=90=E8=A1=A8?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=AD=E5=88=97=E9=9A=90=E8=97=8F=E5=90=8E?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E5=88=97=E5=81=8F=E7=A7=BB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/static/ruoyi/js/common.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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 3b8aeaffa..0c17190d1 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/common.js @@ -420,15 +420,22 @@ var storage = { // 主子表操作封装处理 var sub = { editColumn: function() { - var count = $("#" + table.options.id).bootstrapTable('getData').length; - var params = new Array(); + var dataColumns = []; + for (var columnIndex = 0; columnIndex < table.options.columns.length; columnIndex++) { + if (table.options.columns[columnIndex].visible != false) { + dataColumns.push(table.options.columns[columnIndex]); + } + } + var params = new Array(); + var data = $("#" + table.options.id).bootstrapTable('getData'); + var count = data.length; for (var dataIndex = 0; dataIndex < count; dataIndex++) { var columns = $('#' + table.options.id + ' tr[data-index="' + dataIndex + '"] td'); var obj = new Object(); for (var i = 0; i < columns.length; i++) { var inputValue = $(columns[i]).find('input'); var selectValue = $(columns[i]).find('select'); - var key = table.options.columns[i].field; + var key = dataColumns[i].field; if ($.common.isNotEmpty(inputValue.val())) { obj[key] = inputValue.val(); } else if ($.common.isNotEmpty(selectValue.val())) { @@ -437,7 +444,9 @@ var sub = { obj[key] = ""; } } - params.push({ index: dataIndex, row: obj }); + var item = data[dataIndex]; + var extendObj = $.extend({},item,obj); + params.push({ index: dataIndex, row: extendObj }); } $("#" + table.options.id).bootstrapTable("updateRow", params); },