修改时间选择
parent
02ce084f8e
commit
fce82d7d91
@ -1,217 +1,220 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
<html lang="zh" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<th:block th:include="include :: header('历史记录')"/>
|
<th:block th:include="include :: header('历史记录')"/>
|
||||||
</head>
|
</head>
|
||||||
<body class="gray-bg">
|
<body class="gray-bg">
|
||||||
<div class="container-div">
|
<div class="container-div">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 search-collapse">
|
<div class="col-sm-12 search-collapse">
|
||||||
<form id="formId">
|
<form id="formId">
|
||||||
<div class="select-list">
|
<div class="select-list">
|
||||||
<ul>
|
<div style="position: absolute;top:50%;right:12px;transform: translateY(-50%)">
|
||||||
<li>
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="window.history.back()">返回</a>
|
||||||
<input type="hidden" id="sensorId" name="sensorId"/>
|
</div>
|
||||||
</li>
|
<ul>
|
||||||
<li class="select-time">
|
<li>
|
||||||
<label>采集时间:</label>
|
<input id="sensorId" name="sensorId" type="hidden"/>
|
||||||
<input type="text" class="time-input" id="startTime" placeholder="开始时间"
|
</li>
|
||||||
name="beginCollectTime"/>
|
<li class="select-time">
|
||||||
<span>-</span>
|
<label>采集时间:</label>
|
||||||
<input type="text" class="time-input" id="endTime" placeholder="结束时间"
|
<input class="time-input" id="startTime" name="beginCollectTime" placeholder="开始时间"
|
||||||
name="endCollectTime"/>
|
type="text"/>
|
||||||
</li>
|
<span>-</span>
|
||||||
<li>
|
<input class="time-input" id="endTime" name="endCollectTime" placeholder="结束时间"
|
||||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="tableRefresh()"><i
|
type="text"/>
|
||||||
class="fa fa-search"></i> 搜索</a>
|
</li>
|
||||||
|
<li>
|
||||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="tableRefresh()"><i
|
||||||
class="fa fa-refresh"></i> 重置</a>
|
class="fa fa-search"></i> 搜索</a>
|
||||||
|
|
||||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="exportData()">
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
|
||||||
<i class="fa fa-download"></i> 导出
|
class="fa fa-refresh"></i> 重置</a>
|
||||||
</a>
|
|
||||||
</li>
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="exportData()">
|
||||||
</ul>
|
<i class="fa fa-download"></i> 导出
|
||||||
</div>
|
</a>
|
||||||
</form>
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-12 select-table table-striped">
|
<div class="col-sm-12 select-table table-striped">
|
||||||
<table id="bootstrap-table"></table>
|
<table id="bootstrap-table"></table>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<th:block th:include="include :: footer"/>
|
<th:block th:include="include :: footer"/>
|
||||||
<th:block th:include="include :: datetimepicker-js"/>
|
<th:block th:include="include :: datetimepicker-js"/>
|
||||||
<!--表格导出-->
|
<!--表格导出-->
|
||||||
<th:block th:include="include :: bootstrap-table-export-js" />
|
<th:block th:include="include :: bootstrap-table-export-js"/>
|
||||||
<th:block th:include="include :: FileSaver-xlsx-Base64-js" />
|
<th:block th:include="include :: FileSaver-xlsx-Base64-js"/>
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
|
||||||
var prefix = ctx + "record/recordSensorData";
|
var prefix = ctx + "record/recordSensorData";
|
||||||
|
|
||||||
$(() => {
|
$(() => {
|
||||||
tableRefresh();
|
tableRefresh();
|
||||||
})
|
})
|
||||||
|
|
||||||
const tableRefresh = function () {
|
const tableRefresh = function () {
|
||||||
let sensorId = [[${sensorId}]].split(",");
|
let sensorId = [[${sensorId}]].split(",");
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
formData.append("sensorId", sensorId[0]);
|
formData.append("sensorId", sensorId[0]);
|
||||||
formData.append("sensorType", sensorId[1]);
|
formData.append("sensorType", sensorId[1]);
|
||||||
formData.append("beginCollectTime", $("#startTime").val());
|
formData.append("beginCollectTime", $("#startTime").val());
|
||||||
formData.append("endCollectTime", $("#endTime").val());
|
formData.append("endCollectTime", $("#endTime").val());
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: "/record/recordSensorData/list",
|
url: "/record/recordSensorData/list",
|
||||||
contentType: "application/json;charset=utf-8",
|
contentType: "application/json;charset=utf-8",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: formData,
|
data: formData,
|
||||||
json: 'callback',
|
json: 'callback',
|
||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
success: function (json) {
|
success: function (json) {
|
||||||
|
|
||||||
const sensorTypeArray = getparamsFunction(sensorId[1]);
|
const sensorTypeArray = getparamsFunction(sensorId[1]);
|
||||||
|
|
||||||
const columnsArray = [];
|
const columnsArray = [];
|
||||||
|
|
||||||
if (sensorTypeArray.length > 0) {
|
if (sensorTypeArray.length > 0) {
|
||||||
columnsArray.push({
|
columnsArray.push({
|
||||||
field: "uid",
|
field: "uid",
|
||||||
title: "设备UID",
|
title: "设备UID",
|
||||||
width: 160,
|
width: 160,
|
||||||
height: 60,
|
height: 60,
|
||||||
colspan: 1,
|
colspan: 1,
|
||||||
rowspan: 1,
|
rowspan: 1,
|
||||||
align: "center"
|
align: "center"
|
||||||
});
|
});
|
||||||
|
|
||||||
columnsArray.push({
|
columnsArray.push({
|
||||||
field: "sensorId",
|
field: "sensorId",
|
||||||
title: "传感器编号",
|
title: "传感器编号",
|
||||||
width: 160,
|
width: 160,
|
||||||
height: 60,
|
height: 60,
|
||||||
colspan: 1,
|
colspan: 1,
|
||||||
rowspan: 1,
|
rowspan: 1,
|
||||||
align: "center"
|
align: "center"
|
||||||
});
|
});
|
||||||
|
|
||||||
columnsArray.push({
|
columnsArray.push({
|
||||||
field: "datatype",
|
field: "datatype",
|
||||||
title: "类型",
|
title: "类型",
|
||||||
width: 160,
|
width: 160,
|
||||||
height: 60,
|
height: 60,
|
||||||
colspan: 1,
|
colspan: 1,
|
||||||
rowspan: 1,
|
rowspan: 1,
|
||||||
align: "center"
|
align: "center"
|
||||||
});
|
});
|
||||||
|
|
||||||
if (json.length > 0) {
|
if (json.length > 0) {
|
||||||
|
|
||||||
const jsonObj = Object.keys(json[0]);
|
const jsonObj = Object.keys(json[0]);
|
||||||
for (let i = 0; i < jsonObj.length; i++) {//Object.keys(obj) 获取key名称
|
for (let i = 0; i < jsonObj.length; i++) {//Object.keys(obj) 获取key名称
|
||||||
let property = jsonObj[i];
|
let property = jsonObj[i];
|
||||||
if (property != "uid" && property != "sensorId" && property != "collectTime" && property != "datatype") {
|
if (property != "uid" && property != "sensorId" && property != "collectTime" && property != "datatype") {
|
||||||
columnsArray.push({
|
columnsArray.push({
|
||||||
field: property,
|
field: property,
|
||||||
title: typeof (sensorTypeArray.find(x => x.paramTitle.includes(property))) == "undefined" ? property : sensorTypeArray.find(x => x.paramTitle.includes(property)).paramText,
|
title: typeof (sensorTypeArray.find(x => x.paramTitle.includes(property))) == "undefined" ? property : sensorTypeArray.find(x => x.paramTitle.includes(property)).paramText,
|
||||||
width: 140,
|
width: 140,
|
||||||
align: "center"
|
align: "center"
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
columnsArray.push({
|
|
||||||
field: "collectTime",
|
|
||||||
title: "采集时间",
|
|
||||||
width: 160,
|
|
||||||
height: 60,
|
|
||||||
colspan: 1,
|
|
||||||
rowspan: 1,
|
|
||||||
align: "center",
|
|
||||||
formatter: function(value, row, index) {
|
|
||||||
return value.replace("T"," ");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$('#bootstrap-table').bootstrapTable('destroy');
|
|
||||||
$('#bootstrap-table').bootstrapTable({
|
|
||||||
data: json,
|
|
||||||
striped: true,
|
|
||||||
cache: false,
|
|
||||||
pageNumber: 1,
|
|
||||||
pagination: true,
|
|
||||||
showColumns: true,
|
|
||||||
sidePagination: 'client',
|
|
||||||
pageSize: 10,
|
|
||||||
pageList: [5, 10, 15, 20, 25, 50],
|
|
||||||
showRefresh: true,
|
|
||||||
columns: columnsArray
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
columnsArray.push();
|
|
||||||
},
|
|
||||||
error: function () {
|
|
||||||
alert("错误");
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
|
||||||
|
columnsArray.push({
|
||||||
const getparamsFunction = function (sensorTypeId) {
|
field: "collectTime",
|
||||||
var returnData;
|
title: "采集时间",
|
||||||
let formData = new FormData();
|
width: 160,
|
||||||
formData.append("sensorTypeId", sensorTypeId);
|
height: 60,
|
||||||
$.ajax({
|
colspan: 1,
|
||||||
type: "post",
|
rowspan: 1,
|
||||||
url: "/base/sysParamConfig/getParameterNotVisibleFlag",
|
align: "center",
|
||||||
data: formData,
|
formatter: function (value, row, index) {
|
||||||
contentType: "application/json;charset=utf-8",
|
return value.replace("T", " ");
|
||||||
dataType: "json",
|
|
||||||
json: 'callback',
|
|
||||||
processData: false,
|
|
||||||
contentType: false,
|
|
||||||
async: false,
|
|
||||||
success: function (json) {
|
|
||||||
returnData = json;
|
|
||||||
},
|
|
||||||
error: function () {
|
|
||||||
alert("错误");
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$('#bootstrap-table').bootstrapTable('destroy');
|
||||||
|
$('#bootstrap-table').bootstrapTable({
|
||||||
|
data: json,
|
||||||
|
striped: true,
|
||||||
|
cache: false,
|
||||||
|
pageNumber: 1,
|
||||||
|
pagination: true,
|
||||||
|
showColumns: true,
|
||||||
|
sidePagination: 'client',
|
||||||
|
pageSize: 10,
|
||||||
|
pageList: [5, 10, 15, 20, 25, 50],
|
||||||
|
showRefresh: true,
|
||||||
|
columns: columnsArray
|
||||||
});
|
});
|
||||||
return returnData;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 自定义按钮导出数据
|
|
||||||
function exportData(){
|
|
||||||
$('#bootstrap-table').tableExport({
|
|
||||||
type: 'excel',
|
|
||||||
exportDataType: "basic",
|
|
||||||
fileName: '历史数据报表',//下载文件名称
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
<!-- laydate示例 -->
|
columnsArray.push();
|
||||||
layui.use('laydate', function () {
|
},
|
||||||
var laydate = layui.laydate;
|
error: function () {
|
||||||
|
alert("错误");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const getparamsFunction = function (sensorTypeId) {
|
||||||
|
var returnData;
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append("sensorTypeId", sensorTypeId);
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/base/sysParamConfig/getParameterNotVisibleFlag",
|
||||||
|
data: formData,
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
dataType: "json",
|
||||||
|
json: 'callback',
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
async: false,
|
||||||
|
success: function (json) {
|
||||||
|
returnData = json;
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
alert("错误");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return returnData;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 自定义按钮导出数据
|
||||||
|
function exportData() {
|
||||||
|
$('#bootstrap-table').tableExport({
|
||||||
|
type: 'excel',
|
||||||
|
exportDataType: "basic",
|
||||||
|
fileName: '历史数据报表',//下载文件名称
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
laydate.render({
|
<!-- laydate示例 -->
|
||||||
elem: '#startTime',
|
layui.use('laydate', function () {
|
||||||
type: 'datetime',
|
var laydate = layui.laydate;
|
||||||
trigger: 'click'
|
|
||||||
});
|
|
||||||
|
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#endTime',
|
elem: '#startTime',
|
||||||
type: 'datetime',
|
type: 'datetime',
|
||||||
trigger: 'click'
|
trigger: 'click'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
laydate.render({
|
||||||
|
elem: '#endTime',
|
||||||
|
type: 'datetime',
|
||||||
|
trigger: 'click'
|
||||||
});
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue