From 9e789e0dc8ab92c55a63e3319dc96e86c2ab8ff3 Mon Sep 17 00:00:00 2001 From: yulee Date: Wed, 21 Jan 2026 11:14:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A1=A8=E6=A0=BC=E8=A1=8C?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E5=88=87=E6=8D=A2=E6=96=B9=E6=B3=95=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E7=A4=BA=E4=BE=8B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/ruoyi/js/ry-ui.js | 10 +++++++++- .../resources/templates/demo/table/other.html | 17 ++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 3901bc70f..5d873b3c8 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -595,7 +595,15 @@ var table = { hideAllColumns: function(tableId) { var currentId = $.common.isEmpty(tableId) ? table.options.id : tableId; $("#" + currentId).bootstrapTable('hideAllColumns'); - } + }, + // 选中/取消选中表格某一行 + toggleCheck: function (index, checked, tableId) { + let currentId = $.common.isEmpty(tableId) ? table.options.id : tableId; + $("#" + currentId).bootstrapTable( + checked ? 'check' : 'uncheck', + index + ); + }, }, // 表格树封装处理 treeTable: { diff --git a/ruoyi-admin/src/main/resources/templates/demo/table/other.html b/ruoyi-admin/src/main/resources/templates/demo/table/other.html index b0a6e9cce..b21339c45 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/table/other.html +++ b/ruoyi-admin/src/main/resources/templates/demo/table/other.html @@ -24,6 +24,9 @@ 获取选中首列值 + + 选中第一行 +
@@ -47,23 +50,23 @@ checkbox: true }, { - field : 'userId', + field : 'userId', title : '用户ID' }, { - field : 'userCode', + field : 'userCode', title : '用户编号' }, { - field : 'userName', + field : 'userName', title : '用户姓名' }, { - field : 'userPhone', + field : 'userPhone', title : '用户手机' }, { - field : 'userEmail', + field : 'userEmail', title : '用户邮箱' }, { @@ -91,12 +94,12 @@ }; $.table.init(options); }); - + function selectColumns() { var column = $.table.selectColumns('userName'); alert(column); } - + function selectFirstColumns() { var column = $.table.selectFirstColumns(); alert(column);