selectgroup.html 3.1 KB
<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap" style="min-width: inherit">
    <form class="well form-inline margin-top-20" method="post" action="">
        用户ID:
        <input class="form-control" type="text" name="uid" style="width: 200px;" value="{$gid}"
               placeholder="请输入圈子id">
       <!-- 关键字:
        <input class="form-control" type="text" name="keyword" style="width: 200px;" value="{$keyword}"
               placeholder="昵称/电话">-->
        <input type="submit" class="btn btn-primary" value="搜索"/>
        <a class="btn btn-danger" href="">清空</a>
    </form>
    <form method="post" class="js-ajax-form" action="">
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="16">
                    <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </label>
                </th>
                <th width="50">ID</th>
                <th>名称</th>

            </tr>
            </thead>
            <tbody id="tb">
            <foreach name="list" item="vo">
                <tr id="check-tr">
                    <td >
                        <input type="checkbox" id="in{$vo.id}" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$vo.id}" data-name="{$vo.name}" <if condition="in_array($vo['id'],$selectedIds)"> checked</if> >
                    </td>
                    <td>{$vo.id}</td>

                    <td>{$vo.name}</td>
                </tr>
            </foreach>
            </tbody>
        </table>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
     // $('.js-check').click(function(e) {
     //        var sel_id='in'+e.currentTarget.defaultValue;
     //
     //      $( ".js-check" ).each( function(res) {
     //               console.log(res)
     //               $(".js-check").eq(res).prop("checked",false)
     //               $('#'+sel_id).prop("checked",true)
     //    } );
     // }
     //
     // )
    $('.data-item-tr').click(function (e) {

        console.log(e);
        var $this = $(this);
        if ($(e.target).is('input')) {
            return;
        }

        var $input = $this.find('input');
        if ($input.is(':checked')) {
            $input.prop('checked', false);
        } else {
            $input.prop('checked', true);
        }
    });

    function confirm() {
        var selectedUsersId   = [];
        var selectedUsersName = [];
        var selectedUsers     = [];
        $('.js-check:checked').each(function () {
            var $this = $(this);
            selectedUsersId.push($this.val());
            selectedUsersName.push($this.data('name'));

            selectedUsers.push({
                id: $this.val(),
                name: $this.data('name')
            });
        });

        return {
            selectedUsers: selectedUsers,
            selectedUsersId: selectedUsersId,
            selectedUsersName: selectedUsersName
        };
    }
</script>
</body>
</html>