account.html
8.13 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<style type="text/css">
.table-bordered {
border: 1px solid; }
.table-bordered > thead > tr > th,
.table-bordered > thead > tr > td,
.table-bordered > tbody > tr > th,
.table-bordered > tbody > tr > td,
.table-bordered > tfoot > tr > th,
.table-bordered > tfoot > tr > td {
border: 1px solid; }
.table-bordered > thead > tr > th,
.table-bordered > thead > tr > td {
border-bottom-width: 2px; }
.table > tbody + tbody {
border-top: 1px solid; }
</style>
<div class="page-head">
<div class="page-title">
<h1>$$$$$${txt-1006}</h1>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="portlet light porttlet-fit bordered">
<div class="portlet-title">
<form class="form-inline" action="">
<div style="display: inline-block;">
<span class="item-label" style="width: 80px;">$$$$$${txt-3815}: </span>
<select class="form-control" name="line" id="line" style="width: 180px;"></select>
</div>
<div style="display: inline-block;margin-left: 15px;">
<span class="item-label" style="width: 80px;">$$$$$${txt-4004}: </span>
<input class="form-control" type="text" id="date" style="width: 180px;"/>
</div>
<div style="display: inline-block;margin-left: 15px">
<span class="item-label" style="width: 140px;">$$$$$${txt-2297} </span>
<select class="form-control" name="code" id="code" style="width: 180px;"></select>
<input class="btn btn-default" type="button" id="czcl" value="X"/>
</div>
<div class="form-group">
<input class="btn btn-default" type="button" id="query" value="$$$$$${txt-3890}"/>
<input class="btn btn-default" type="button" id="export" value="$$$$$${txt-4163}"/>
</div>
</form>
</div>
<div class="portlet-body">
<div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
<table class="table table-bordered table-hover table-checkable" id="forms">
<thead>
<tr>
<th>$$$$$${txt-3934}</th>
<th>$$$$$${txt-3815}</th>
<th class="nbbmPx">$$$$$${txt-4009}</th>
<th>$$$$$${txt-2686}</th>
<th>$$$$$${txt-2703}</th>
<th>$$$$$${txt-2702}</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script>
$(function(){
$("#export").attr('disabled',"true");
var reqCodeMap = {"0xA1": i18n('txt-1302'), "0xA2": i18n('txt-2535'), "0xA3": i18n('txt-2534'), "0xA5": i18n('txt-2533'), "0xA7": i18n('txt-2532'), "0x50": i18n('txt-2528'), "0x70": i18n('txt-2537'), "0x60": i18n('txt-2527'), "0x11": i18n('txt-2531'), "0x12" : i18n('txt-3853')};
// 关闭左侧栏
if (!$('body').hasClass('page-sidebar-closed'))
$('.menu-toggler.sidebar-toggler').click();
$("#date").datetimepicker({
format : 'YYYY-MM-DD',
locale : 'zh-cn'
});
/* $.get('/basic/lineCode2Name',function(result){
var data=[];
for(var code in result){
data.push({id: code, text: result[code]});
}
initPinYinSelect2('#line',data,'');
}) */
$.get('/report/lineList',function(xlList){
var data = [];
// data.push({id: " ", text: "全部线路"});
$.get('/user/companyData', function(result){
for(var i = 0; i < result.length; i++){
var companyCode = result[i].companyCode;
var children = result[i].children;
for(var j = 0; j < children.length; j++){
var code = children[j].code;
for(var k=0;k < xlList.length;k++ ){
if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
// tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
}
}
}
}
initPinYinSelect2('#line',data,'');
initCl();
});
});
//重置
$('#czcl').on('click', function () {
$('#code').val('').change();
});
$("#line").on("change",initCl);
function initCl(){
$('#code').select2({
ajax: {
url: '/report/carList',
dataType: 'json',
delay: 150,
data: function(params){
return{nbbm: params.term,xlbm:$('#line').val()};
},
processResults: function (data) {
return {
results: data
};
},
cache: true
},
templateResult: function(repo){
if (repo.loading) return repo.text;
var h = '<span>'+repo.text+'</span>';
h += (repo.lineName?' <span class="select2-desc">'+repo.lineName+'</span>':'');
return h;
},
escapeMarkup: function (markup) { return markup; },
minimumInputLength: 1,
templateSelection: function(repo){
return repo.text;
},
language: {
noResults: function(){
return '<span style="color:red;font-size: 12px;">$$$$$${txt-808}</span>';
},
inputTooShort : function(e) {
return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> $$$$$${txt-551}</span>';
},
searching : function() {
return '<span style="color:gray;font-size: 12px;"> $$$$$${txt-1380}</span>';
}
}
});
}
var line = $("#line").val();
var xlName = $("#select2-line-container").html();
var date = $("#date").val();
var code = $("#code").val();
var px="desc";
$(".nbbmPx").on("click",function(){
if($("#date").val() == null || $("#date").val().trim().length == 0){
layer.msg("$$$$$${txt-1928}");
return;
}
if(px=="desc"){
px="asc";
}else{
px="desc";
}
line = $("#line").val();
xlName = $("#select2-line-container").html();
date = $("#date").val();
code = $("#code").val();
$get('/realSchedule/accountPx',{line:line,date:date,code:code,xlName:xlName,px:px},function(result){
$.each(result, function(i, obj) {
obj.requestType = reqCodeMap[obj.requestType];
});
// 把数据填充到模版中
var tbodyHtml = template('list_account',{list:result});
// 把渲染好的模版html文本追加到表格中
$('#forms tbody').html(tbodyHtml);
});
})
$("#query").on("click",function(){
if($("#date").val() == null || $("#date").val().trim().length == 0){
layer.msg("$$$$$${txt-1928}");
return;
}
line = $("#line").val();
xlName = $("#select2-line-container").html();
date = $("#date").val();
code = $("#code").val();
var type = "query";
$(".hidden").removeClass("hidden");
$get('/realSchedule/account',{line:line,date:date,code:code,xlName:xlName,type:type},function(result){
$.each(result, function(i, obj) {
obj.requestType = reqCodeMap[obj.requestType];
});
// 把数据填充到模版中
var tbodyHtml = template('list_account',{list:result});
// 把渲染好的模版html文本追加到表格中
$('#forms tbody').html(tbodyHtml);
if(result.length == 0)
$("#export").attr('disabled',"true");
else
$("#export").removeAttr("disabled");
});
});
$("#export").on("click",function(){
var type = "export";
$get('/realSchedule/account', {line:line,date:date,code:code,xlName:xlName,type:type}, function(result){
window.open("/downloadFile/download?fileName="
+moment(date).format("YYYYMMDD")
+"-"+xlName+"-$$$$$${txt-1006}");
});
});
});
</script>
<script type="text/html" id="list_account">
{{each list as obj i}}
<tr>
<td>{{i+1}}</td>
<td>{{obj.xlName}}</td>
<td>{{obj.clZbh}}</td>
<td>{{obj.company}}</td>
<td>{{obj.requestType}}</td>
<td>{{obj.requestTime}}</td>
</tr>
{{/each}}
{{if list.length == 0}}
<tr>
<td colspan="6"><h6 class="muted">$$$$$${txt-750}</h6></td>
</tr>
{{/if}}
</script>