若依实现父弹窗获取子弹窗的数据

参考这个:RuoYi-弹出新窗口选择数据回显到父页面
https://blog.csdn.net/u014440968/article/details/116266076
还有官方的demo就行:
若依实现父弹窗获取子弹窗的数据_第1张图片
最终实现效果:

关键的方法:
父页面:

<div class="form-group">
                <label class="col-sm-3 control-label">接收人:</label>
                <div class="col-sm-8">
                    <input id="userids1" name="receiver" class="form-control" type="text" onclick="selectUser()"  required>
                </div>
 </div>
/* 选择发送的用户 */
        function selectUser() {
            // var prefix1 = ctx + "system/role/authUser";
            // var url = prefix1 + '/selectUser1';
            var options={
                title: '选择用户',
                url: ctx+"system/role/authUser/selectUser1",
                callBack:doSubmit
            }
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            console.log(rows.length);
            var x = "";
            var y = "";
           for( i=0;i<rows.length;i++){
               if (i == rows.length - 1) {
                   x = x + rows[i].organizationName;
                   y = y + rows[i].memberCode;
               } else {
                   x = x + rows[i].organizationName + ",";
                   y = y + rows[i].memberCode + ",";
               }
            }
            $('#userids1').val(x);
            $('#userids').val(y)
            $.modal.closeAll();
        }

子页面:

 /* 获取选择的数据 */
    function getSelections() {
        return $("#" + table.options.id).bootstrapTable('getSelections');
    }

你可能感兴趣的:(java)