selectgroup.html
3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<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>