作者 sgj
1 个管道 的构建 通过 耗费 0 秒

选择多人员

  1 +<include file="public@header"/>
  2 +</head>
  3 +<body>
  4 +<div class="wrap js-check-wrap" style="min-width: inherit">
  5 + <form class="well form-inline margin-top-20" method="post" action="">
  6 + 用户ID:
  7 + <input class="form-control" type="text" name="uid" style="width: 200px;" value="{$uid}"
  8 + placeholder="请输入用户ID">
  9 + 关键字:
  10 + <input class="form-control" type="text" name="keyword" style="width: 200px;" value="{$keyword}"
  11 + placeholder="昵称/电话">
  12 + <input type="submit" class="btn btn-primary" value="搜索"/>
  13 + <a class="btn btn-danger" href="">清空</a>
  14 + </form>
  15 + <form method="post" class="js-ajax-form" action="">
  16 + <table class="table table-hover table-bordered table-list">
  17 + <thead>
  18 + <tr>
  19 + <th width="16">
  20 + <label>
  21 + <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
  22 + </label>
  23 + </th>
  24 + <th width="50">ID</th>
  25 + <th>姓名</th>
  26 + <th>头像</th>
  27 + <th>电话</th>
  28 + </tr>
  29 + </thead>
  30 + <tbody id="tb">
  31 + <foreach name="list" item="vo">
  32 + <tr id="check-tr">
  33 + <td >
  34 + <input type="checkbox" id="in{$vo.id}" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
  35 + value="{$vo.id}" data-name="{$vo.user_login}" <if condition="in_array($vo['id'],$selectedIds)"> checked</if> >
  36 + </td>
  37 + <td>{$vo.id}</td>
  38 + <td>{$vo.user_login|default=$vo.user_nickname}</td>
  39 + <td><img width="50px" src="{$vo.avatar}"></td>
  40 + <td>{$vo.mobile}</td>
  41 + </tr>
  42 + </foreach>
  43 + </tbody>
  44 + </table>
  45 + </form>
  46 +</div>
  47 +<script src="__STATIC__/js/admin.js"></script>
  48 +<script>
  49 + // $('.js-check').click(function(e) {
  50 + // var sel_id='in'+e.currentTarget.defaultValue;
  51 + //
  52 + // $( ".js-check" ).each( function(res) {
  53 + // console.log(res)
  54 + // $(".js-check").eq(res).prop("checked",false)
  55 + // $('#'+sel_id).prop("checked",true)
  56 + // } );
  57 + // }
  58 + //
  59 + // )
  60 + $('.data-item-tr').click(function (e) {
  61 +
  62 + console.log(e);
  63 + var $this = $(this);
  64 + if ($(e.target).is('input')) {
  65 + return;
  66 + }
  67 +
  68 + var $input = $this.find('input');
  69 + if ($input.is(':checked')) {
  70 + $input.prop('checked', false);
  71 + } else {
  72 + $input.prop('checked', true);
  73 + }
  74 + });
  75 +
  76 + function confirm() {
  77 + var selectedUsersId = [];
  78 + var selectedUsersName = [];
  79 + var selectedUsers = [];
  80 + $('.js-check:checked').each(function () {
  81 + var $this = $(this);
  82 + selectedUsersId.push($this.val());
  83 + selectedUsersName.push($this.data('name'));
  84 +
  85 + selectedUsers.push({
  86 + id: $this.val(),
  87 + name: $this.data('name')
  88 + });
  89 + });
  90 +
  91 + return {
  92 + selectedUsers: selectedUsers,
  93 + selectedUsersId: selectedUsersId,
  94 + selectedUsersName: selectedUsersName
  95 + };
  96 + }
  97 +</script>
  98 +</body>
  99 +</html>