From 6626162e712b0496eb108ec772a092ec0695a028 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 21 May 2019 20:27:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=83=BD=E5=A4=9F=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=95=B0=E6=8D=AE=E8=A1=A8=E4=B8=BB=E9=94=AE=E5=88=97?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #Comment smartTable: { idField: ‘DictId’, sortName: 'Category', columns: [ ] } --- .../wwwroot/lib/longbow/longbow.dataentity.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Bootstrap.Admin/wwwroot/lib/longbow/longbow.dataentity.js b/Bootstrap.Admin/wwwroot/lib/longbow/longbow.dataentity.js index ccfee8ac..62dfa9fa 100644 --- a/Bootstrap.Admin/wwwroot/lib/longbow/longbow.dataentity.js +++ b/Bootstrap.Admin/wwwroot/lib/longbow/longbow.dataentity.js @@ -7,6 +7,12 @@ return data; }; + var findIdField = function (tableName) { + var idField = $(tableName).bootstrapTable("getOptions").idField; + if (idField === undefined) idField = "Id"; + return idField; + } + DataEntity = function (options) { this.options = options; }; @@ -159,13 +165,15 @@ confirmButtonClass: "btn-danger ml-2", cancelButtonText: "取消" }, function () { - $.logData.push({ url: options.url, + $.logData.push({ + url: options.url, data: arrselections.map(function (element, index) { return formatData($.extend({}, element)); - }) + }) }); setTimeout(function () { - var iDs = arrselections.map(function (element, index) { return element.Id; }); + var idField = findIdField(options.bootstrapTable); + var iDs = arrselections.map(function (element, index) { return element[idField]; }); $.bc({ url: options.url, data: iDs, method: 'delete', title: options.delTitle, callback: function (result) { @@ -238,8 +246,9 @@ }, function () { $.logData.push({ url: op.url, data: data }); setTimeout(function () { + var idField = findIdField($(op.table)); var iDs = data.map(function (element, index) { - return element.Id; + return element[idField]; }); $.bc({ url: op.url, data: iDs, method: 'delete', title: '删除数据',