车闸对接前端,后端未实装
This commit is contained in:
161
src/main/webapp/JS/jsyw/vehicleGateList.js
Normal file
161
src/main/webapp/JS/jsyw/vehicleGateList.js
Normal file
@ -0,0 +1,161 @@
|
||||
function getDirectionText(direction) {
|
||||
return direction === "IN" ? "进闸" : "出闸";
|
||||
}
|
||||
|
||||
function getStatusText(status) {
|
||||
return status === "ABNORMAL" ? "异常" : "正常";
|
||||
}
|
||||
|
||||
function getDirectionLabel(direction) {
|
||||
if (direction === "IN") {
|
||||
return "<span class='label label-success'>进闸</span>";
|
||||
}
|
||||
return "<span class='label label-info'>出闸</span>";
|
||||
}
|
||||
|
||||
function getStatusLabel(status) {
|
||||
if (status === "ABNORMAL") {
|
||||
return "<span class='label label-danger'>异常</span>";
|
||||
}
|
||||
return "<span class='label label-primary'>正常</span>";
|
||||
}
|
||||
|
||||
function renderSummaryByResponse(res) {
|
||||
$("#summaryInCount").text(res.summaryInCount || 0);
|
||||
$("#summaryOutCount").text(res.summaryOutCount || 0);
|
||||
$("#summaryInsideCount").text(res.summaryInsideCount || 0);
|
||||
$("#summaryAbnormalCount").text(res.summaryAbnormalCount || 0);
|
||||
}
|
||||
|
||||
function initGateTable() {
|
||||
$("#gateTable").bootstrapTable({
|
||||
url: ext.contextPath + "/jsyw/vehicleGate/getList.do",
|
||||
method: "post",
|
||||
cache: false,
|
||||
striped: true,
|
||||
pagination: true,
|
||||
pageList: [10, 20, 50],
|
||||
pageSize: 10,
|
||||
pageNumber: 1,
|
||||
sidePagination: "server",
|
||||
queryParams: function (params) {
|
||||
return {
|
||||
rows: params.limit,
|
||||
page: params.offset / params.limit + 1,
|
||||
sort: params.sort,
|
||||
order: params.order,
|
||||
plateNo: $.trim($("#search_plateNo").val()),
|
||||
passDate: $.trim($("#search_passDate").val()),
|
||||
direction: $("#search_direction").val(),
|
||||
status: $("#search_status").val()
|
||||
};
|
||||
},
|
||||
responseHandler: function (res) {
|
||||
renderSummaryByResponse(res || {});
|
||||
return {
|
||||
total: (res && res.total) ? res.total : 0,
|
||||
rows: (res && res.rows) ? res.rows : []
|
||||
};
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
field: "plateNo",
|
||||
title: "车牌号",
|
||||
align: "center",
|
||||
valign: "middle"
|
||||
},
|
||||
{
|
||||
field: "direction",
|
||||
title: "通行方向",
|
||||
align: "center",
|
||||
valign: "middle",
|
||||
formatter: function (value) {
|
||||
return getDirectionLabel(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "passTime",
|
||||
title: "通行时间",
|
||||
align: "center",
|
||||
valign: "middle"
|
||||
},
|
||||
{
|
||||
field: "gateName",
|
||||
title: "闸机",
|
||||
align: "center",
|
||||
valign: "middle"
|
||||
},
|
||||
{
|
||||
field: "driverName",
|
||||
title: "司机",
|
||||
align: "center",
|
||||
valign: "middle"
|
||||
},
|
||||
{
|
||||
field: "status",
|
||||
title: "状态",
|
||||
align: "center",
|
||||
valign: "middle",
|
||||
formatter: function (value) {
|
||||
return getStatusLabel(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "note",
|
||||
title: "备注",
|
||||
align: "center",
|
||||
valign: "middle"
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
align: "center",
|
||||
valign: "middle",
|
||||
width: 100,
|
||||
formatter: function (value, row, index) {
|
||||
return "<button class='btn btn-default btn-sm' onclick='showGateDetail(" + index + ")'><i class='fa fa-eye'></i> 查看</button>";
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function () {
|
||||
adjustBootstrapTableView("gateTable");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function searchGateRecords() {
|
||||
$("#gateTable").bootstrapTable("refresh", {pageNumber: 1});
|
||||
}
|
||||
|
||||
function resetGateSearch() {
|
||||
$("#search_plateNo").val("");
|
||||
$("#search_passDate").val("");
|
||||
$("#search_direction").val("");
|
||||
$("#search_status").val("");
|
||||
$("#gateTable").bootstrapTable("refresh", {pageNumber: 1});
|
||||
}
|
||||
|
||||
function showGateDetail(index) {
|
||||
var pageRows = $("#gateTable").bootstrapTable("getData") || [];
|
||||
var row = pageRows[index];
|
||||
if (!row) {
|
||||
return;
|
||||
}
|
||||
$("#detail_plateNo").text(row.plateNo || "");
|
||||
$("#detail_direction").text(getDirectionText(row.direction || ""));
|
||||
$("#detail_passTime").text(row.passTime || "");
|
||||
$("#detail_gateName").text(row.gateName || "");
|
||||
$("#detail_driverName").text(row.driverName || "");
|
||||
$("#detail_status").text(getStatusText(row.status || ""));
|
||||
$("#detail_note").text(row.note || "");
|
||||
$("#gateDetailModal").modal("show");
|
||||
}
|
||||
|
||||
$(function () {
|
||||
$("#search_passDate").datepicker({
|
||||
autoclose: true,
|
||||
language: "zh-CN",
|
||||
format: "yyyy-mm-dd"
|
||||
});
|
||||
initGateTable();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user