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