datasource.html
5.2 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<include file="public@header"/>
<style>
.data-item-tr, .search-btn {
cursor: pointer;
}
.col-xs-3 {
padding-right: 0;
}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
<notempty name="filters">
<form method="post" action="{:url('theme/dataSource')}" id="search-form">
<div class="row">
<foreach name="filters" item="filter" key="filterName">
<switch name="filter.type">
<case value="text">
<div class="col-xs-3">
<div class="form-group">
<label class="sr-only">{$filter.title|default=''}</label>
<input type="text" class="form-control" name="{$filterName}"
placeholder="{$filter.placeholder|default=''}"
value="{$form[$filterName]|default=''}">
</div>
</div>
</case>
<case value="select">
<div class="col-xs-3">
<div class="form-group">
<label class="sr-only">{$filter.title|default=''}</label>
<select class="form-control" name="{$filterName}">
<notempty name="filter.placeholder">
<option value="">{$filter.placeholder|default=''}</option>
</notempty>
<foreach name="filter.options" item="option">
<php>
$option_selected='';
if(isset($form[$filterName]) && $form[$filterName]==$option['id']){
$option_selected='selected';
};
</php>
<option value="{$option.id}" {$option_selected}>{$option.name}</option>
</foreach>
</select>
</div>
</div>
</case>
</switch>
</foreach>
<div class="col-xs-3">
<input type="hidden" value="{$data_source}" name="data_source">
<button type="submit" class="btn btn-primary">搜索</button>
<a class="btn btn-danger" href="{:url('theme/dataSource')}?data_source={$data_source}">清空</a>
</div>
</div>
<!--<div class="form-group">-->
<!--<div class="input-group">-->
<!--<input type="text" class="form-control" name="keyword" value="{$keyword|default=''}"-->
<!--placeholder="请输入关键字">-->
<!--<input type="hidden" value="{$data_source}" name="data_source">-->
<!--<span class="input-group-addon search-btn" onclick="submitSearchForm()">GO!</span>-->
<!--</div>-->
<!--</div>-->
</form>
</notempty>
<form method="post" class="js-ajax-form">
<table class="table table-hover table-bordered table-list">
<thead>
<tr>
<th width="16">
<if condition="$multi">
<label>
<input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
</label>
</if>
</th>
<th width="50">ID</th>
<th>名称</th>
</tr>
</thead>
<tbody>
{$items_tree}
</tbody>
</table>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
$('.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 submitSearchForm() {
$('#search-form').get(0).submit();
}
function confirm() {
var selectedObjectsId = [];
var selectedObjectsName = [];
var selectedObjects = [];
$('.js-select-box:checked').each(function () {
var $this = $(this);
selectedObjectsId.push($this.val());
selectedObjectsName.push($this.data('name'));
selectedObjects.push({
id: $this.val(),
name: $this.data('name')
});
});
return {
selectedObjects: selectedObjects,
selectedObjectsId: selectedObjectsId,
selectedObjectsName: selectedObjectsName
};
}
</script>
</body>
</html>