10646c94
Andy
add
|
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
|
/**
* Created by chenbiao on 2017/8/23.
*/
/*进场时间筛选框*/
//进场时间初始化
$('#endor-daterange-btnsta').val(moment().subtract('days',6).format('YYYY-MM-DD'));
$('#endor-daterange-btnend').val(moment().subtract('days', 0).format('YYYY-MM-DD'));
//开始日期
$("#endor-daterange-btnsta").datetimepicker({
endDate: moment().subtract('days', 0).format('YYYY-MM-DD'),
format: 'yyyy-mm-dd',
autoclose: true,
startView: 2,
//maxDate:moment().subtract('months', 3),
minView: 2,
forceParse: false,
locale: "zh-CN",
language: 'zh-CN',
pickerPosition: "bottom-right"
}).on("click", function () {
$("#endor-daterange-btnsta").datetimepicker("setEndDate", $("#endor-daterange-btnend").val())
});
//结束日期
$("#endor-daterange-btnend").datetimepicker({
endDate: moment().subtract('days', 0).format('YYYY-MM-DD'),
//startDate:startVal,
format: 'yyyy-mm-dd',
weekStart: 1,
autoclose: true,
startView: 2,
minView: 2,
forceParse: false,
locale: "zh-CN",
language: 'zh-CN',
pickerPosition: "bottom-right"
}).on("click", function () {
$("#endor-daterange-btnend").datetimepicker("setStartDate", $("#endor-daterange-btnsta").val())
});
//隐藏显示 查询条件 搜索框 hide-common-style
documentBindFunc.on('click',".ITD-search-morebtn",function(){
$(".hide-common-style").toggleClass("display-none");
});
(function () {
var cacheParkData ;
var fun = {
init: function () {
//初始化停车状态下拉框
fn.getParkStatus(fun.initParkStatus);
fun.createTableData();
},
//生成表格数据
createTableData: function () {
$('#recordtable').bootstrapTable('destroy').bootstrapTable({
striped: true,//表格显示条纹
pagination: true, //启动分页
pageNumber: 1, //当前第几页
pageSize: 10, //每页显示的记录数
pageList: [10, 15, 20], //记录数可选列表
sidePagination: 'server',//表示服务端分页
queryParamsType: 'limit',
method: 'POST',//请求方法
paginationPreText: '<',
paginationNextText: '>',
fixedColumns:true,
fixedNumber:1,
leftFixedColumns: true,
leftFixedNumber: 1,
// rightFixedColumns: true,
// rightFixedNumber: 1,
ajax: tableLoadRequest,//自定义ajax加载数据
// uniqueId:'id',
columns: [
{
field: 'carNumber',
title: '车牌号',
width: '10%',
align:"left",
formatter: function (value, row, index) {
if (undefined != value && null != value) {
if (value.length > 8) {
return '无牌车'
} else {
return value;
}
}
}
},
{field: 'plName', title: '停车场名称', width: '10%', align:"left"},
{
field: 'parkInTime',
title: '进场时间',
width: '15%',
align:"left",
formatter: fun.inDatatimeFormatter
},
{
field: 'parkOutTime',
title: '出场时间',
width: '15%',
align:"left",
formatter: fun.outDatatimeFormatter
},
{
field: 'parkingDuration',
title: '停车时长',
width: '10%',
align:"left",
formatter: fun.parkingDurationFormatter
},
{
field: 'parkState',
title: '状态',
width: '10%',
align:"left",
formatter: fun.inOutStateFormatter
},
]
});
},
/*获取查询参数*/
getQueryParam: function () {
/*停车状态*/
var parkStatus = JSON.parse($("#parkStatus").val());
console.log(parkStatus)
if(parkStatus.length == 0 ||parkStatus==null ||parkStatus==undefined){
parkStatus = null;
}else{
parkStatus = parkStatus[0];
}
/*进场开始时间*/
var beginInTime = null;
/*进场结束*/
var endInTime = null;
/*出场开始时间*/
var beginOutTime = null;
/*出场结束时间*/
var endOutTime = null;
/*解析进场时间*/
var times1 = $('#endor-daterange-btnsta').val();
var times2 = $('#endor-daterange-btnend').val();
if (null != times1 && times1.trim().length > 0) {
beginInTime = times1;
}
if (null != times2 && times2.trim().length > 0) {
endInTime = times2;
}
/*var dateEntranceRange = $('#timeinStartDate input').val();
if (null != dateEntranceRange && dateEntranceRange.trim().length > 0) {
var times = dateEntranceRange.split(' - ');
beginInTime = times[0];
endInTime = times[1];
}*/
/*解析出场时间*/
var times3 = $('#endor-daterange-timeoutsta').val();
var times4 = $('#endor-daterange-timeoutend').val();
if (null != times3 && times3.trim().length > 0) {
beginOutTime = times3;
}
if (null != times4 && times4.trim().length > 0) {
endOutTime = times4;
}
/* var dateExitRange = $('#timeoutStartDate input').val();
if (null != dateExitRange && dateExitRange.trim().length > 0) {
var times = dateExitRange.split(' - ');
beginOutTime = times[0];
endOutTime = times[1];
}*/
/*车牌号*/
var carNum = $('#carNumber').val();
carNum = carNum == null || carNum.length == 0 ? null : carNum.trim();
var req = {
parkState: parkStatus,
beginInTime: beginInTime,
endInTime: endInTime,
beginOutTime: beginOutTime,
endOutTime: endOutTime,
carNumber: carNum
};
return req;
},
//停车状态下来框
initParkStatus: function (data) {
if (null == data) {
return;
}
$("#parkStatus").empty();
var html = '<option value="[]" selected >所有状态</option>';
$.each(data, function (index, item) {
html += '<option value="[' + item.codeValue + ']">' + item.codeValueName + '</option>'
});
$("#parkStatus").append(html);
$('#parkStatus').selectpicker('refresh');
},
inDatatimeFormatter: function (value, row, index) {
if (value == null) {
return "";
} else {
return "<div class='imgClick'>" + DateUtils.long2String(value, 7) + "</div>";
}
},
outDatatimeFormatter: function (value, row, index) {
if (value == null) {
return "";
} else {
return DateUtils.long2String(value, 7);
}
},
parkingDurationFormatter: function (value, row, index) {
if (value == null) {
return "";
} else {
return formatSeconds(value);
}
},
inOutStateFormatter: function (value, row, index) {
if (value == 10) {
return "在场";
} else if(value == 20){
return "离场";
}else{
return "未知";
}
},
imageformatter: function (value, row, index) {
return "<span onClick='' id='inParkimage'></span>";
}
};
//初始执行
fun.init();
documentBindFunc.on('click', '#queryBtn', function () {
fun.createTableData();
});
/**
* 自定义table AJAX请求
* @param {Object} params
*/
function tableLoadRequest(params) {
var req = fun.getQueryParam();
//设置请求参数
var pageNum = (params.data.offset / params.data.limit) + 1;
//条件查询
req.baseRequest = {
pageNum: pageNum,
pageSize: params.data.limit
};
req.sysCode = sysComm.sysCode;
var opt = {
method: 'post',
url: dataUrl.util.queryPageParkOrderByIllegalCar(),
async: false,
data: JSON.stringify(req),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (res) {
if (res.code == '8888') {
console.log(res.data);
params.success(res.data);
}
}
};
sysAjax(opt);
}
})
();
function formatSeconds(value) {
var theTime = parseInt(value);// 秒
var theTime1 = 0;// 分
var theTime2 = 0;// 小时
var theTime3 = 0;//天
if (theTime < 60) {
return theTime + '秒';
}
if (theTime > 60) {
theTime1 = parseInt(theTime / 60);
theTime = parseInt(theTime % 60);
}
if (theTime1 > 60) {
theTime2 = parseInt(theTime1 / 60);
theTime1 = parseInt(theTime1 % 60);
}
if (theTime2 > 24) {
theTime3 = parseInt(theTime2 / 24);
theTime2 = parseInt(theTime2 % 24);
}
var result = '';
if (theTime1 == 0 && theTime2 == 0 && theTime3 == 0) {
result = parseInt(theTime) + "秒"
}
if (theTime1 > 0) {
result = "" + parseInt(theTime1) + "分钟" + result;
}
if (theTime2 > 0) {
result = "" + parseInt(theTime2) + "小时" + result;
}
if (theTime3 > 0) {
result = "" + parseInt(theTime3) + "天" + result;
}
return result;
};
|