From f0c32bc34b8cbc810336b2dfa2acf38d05698db2 Mon Sep 17 00:00:00 2001 From: Ricky Date: Fri, 30 Apr 2021 13:10:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E4=BE=8B=E6=BC=94=E7=A4=BA=E4=B8=AD?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E8=A1=A8=E6=A0=BC=E5=A2=9E=E5=8A=A0=E4=BB=A5?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E5=BD=A2=E5=BC=8F=E5=9B=9E=E6=98=BE=E5=88=B0?= =?UTF-8?q?=E7=88=B6=E7=AA=97=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/templates/demo/modal/table.html | 20 +++++++++++++++++++ .../templates/demo/modal/table/parent.html | 7 ++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/table.html b/ruoyi-admin/src/main/resources/templates/demo/modal/table.html index e9313183..5ff3818c 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/table.html +++ b/ruoyi-admin/src/main/resources/templates/demo/modal/table.html @@ -26,6 +26,7 @@

弹出复选框表格及单选框表格(点击提交后得到数据并回显到父窗体)。

+

@@ -48,6 +49,25 @@ $.modal.open("选择用户", prefix + "/parent"); } + function selectUsersToParentCallBack(){ + var options = { + title: '选择用户', + url: prefix + "/parent", + callBack: doSubmit + }; + $.modal.openOptions(options); + } + + function doSubmit(index, layero){ + var rows = layero.find("iframe")[0].contentWindow.getSelections(); + if (rows.length == 0) { + $.modal.alertWarning("请至少选择一条记录"); + return; + } + $('#userids').html(rows.join()) + layer.close(index); + } + function selectUsers(){ alert(1); } diff --git a/ruoyi-admin/src/main/resources/templates/demo/modal/table/parent.html b/ruoyi-admin/src/main/resources/templates/demo/modal/table/parent.html index 40019c7a..76606170 100644 --- a/ruoyi-admin/src/main/resources/templates/demo/modal/table/parent.html +++ b/ruoyi-admin/src/main/resources/templates/demo/modal/table/parent.html @@ -72,7 +72,7 @@ $.table.init(options); }); - /* 添加用户-选择用户-提交 */ + /* 添加用户-选择用户-提交(子页面调用父页面形式) */ function submitHandler(index, layero) { var rows = $.table.selectFirstColumns(); if (rows.length == 0) { @@ -85,6 +85,11 @@ // 父页面的变量 parent.$('#userids').html(rows.join()); } + + /* 添加用户-选择用户-提交(回调形式-父页面调用子页面) */ + function getSelections() { + return $.table.selectFirstColumns(); + } \ No newline at end of file