修改时间选择

main
夜笙歌 2 years ago
parent 02ce084f8e
commit fce82d7d91

@ -158,11 +158,12 @@ const onSearchByCollectTime = function (obj) {
setTimeout(function () {
var storeId = document.getElementById('table');
var rowsLength = storeId.rows.length;
var key = obj.value;
var [startTime,endTime] = obj.value.split(' - ');
var searchCol = storeId.rows.item(0).cells.length-3;
for (var i = 1; i < rowsLength; i++) {
var searchText = storeId.rows[i].cells[searchCol].innerHTML;
if (searchText.match(key)) {
console.log(searchText)
if ((new Date(searchText).getTime() >= new Date(startTime).getTime()) && (new Date(searchText).getTime() <= new Date(endTime).getTime())) {
storeId.rows[i].style.display = '';
} else {
storeId.rows[i].style.display = 'none';

@ -1,43 +1,46 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<html lang="en" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro" xmlns:th="http://www.thymeleaf.org">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>传感器汇总</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link th:href="@{favicon.ico}" rel="shortcut icon"/>
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<link rel="shortcut icon" th:href="@{favicon.ico}"/>
<!--<link rel="stylesheet" th:href="@{/css/lot-ui/bootstrap.min.css}"/>-->
<link rel="stylesheet" th:href="@{/css/lot-ui/bootstrap.min.css}"/>
<link rel="stylesheet" th:href="@{/css/lot-ui/bootstrap-table.css}"/>
<link rel="stylesheet" th:href="@{/css/lot-ui/Iot-sensorSummaryStyle.css}"/>
</head>
<style>
.bootstrap-table .fixed-table-container .fixed-table-body{
.bootstrap-table .fixed-table-container .fixed-table-body {
height: calc(91vh - 100px);
}
</style>
<body>
<!--传感器类型-->
<iframe id="sensorType" name="a_iframe" width="100%" height="100%" frameborder="1" align="middle"
scrolling="auto" src="about:blank" style="overflow-x: hidden;
overflow-y: scroll;">
<iframe align="middle" frameborder="1" height="100%" id="sensorType" name="a_iframe" scrolling="auto"
src="about:blank" style="overflow-x: hidden;
overflow-y: scroll;" width="100%">
</iframe>
<!-- 搜索框 -->
<div class="sensorHistoryData searchBox" style="height:6%;top: 3%">
<form action="#" class="search-form">
<input id="sensorTypeId" type="hidden" name="sensorTypeId">
<input id="sensorTypeId" name="sensorTypeId" type="hidden">
<div style="width: 90%;height: 100%;border: 0px solid red;">
<label class="search-label" style="padding-left: 0%;">监测位置:</label>
<input type="text" class="form-control" onkeydown="onSearchByMonitorLocation(this)" id="monitorLocation"
name="monitorLocation" placeholder="请输入监测位置">
<input class="form-control" id="monitorLocation" name="monitorLocation"
onkeydown="onSearchByMonitorLocation(this)"
placeholder="请输入监测位置" type="text">
<label class="search-label">传感器编号:</label>
<input type="text" class="form-control" onkeydown="onSearchBySensorId(this)" id="sensorId" name="sensorId"
placeholder="请输入传感器编号">
<input class="form-control" id="sensorId" name="sensorId" onkeydown="onSearchBySensorId(this)"
placeholder="请输入传感器编号"
type="text">
<label class="search-label">时间:</label>
<input type="text" class="form-control" onkeydown="onSearchByCollectTime(this)" id="collectTime" name="collectTime" placeholder="请输入时间">
<input class="form-control" id="collectTime" name="collectTime" onkeydown="onSearchByCollectTime(this)"
placeholder="请输入时间" type="text" style="width:250px">
</div>
</form>
</div>
@ -63,6 +66,7 @@
laydate.render({
elem: '#collectTime',
type: 'datetime',
range: true,
trigger: 'click',
done: (value) => {
onSearchByCollectTime(document.getElementById("collectTime"));

@ -1,5 +1,5 @@
<!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>
<th:block th:include="include :: header('历史记录')"/>
</head>
@ -9,17 +9,20 @@
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<div style="position: absolute;top:50%;right:12px;transform: translateY(-50%)">
<a class="btn btn-primary btn-rounded btn-sm" onclick="window.history.back()">返回</a>
</div>
<ul>
<li>
<input type="hidden" id="sensorId" name="sensorId"/>
<input id="sensorId" name="sensorId" type="hidden"/>
</li>
<li class="select-time">
<label>采集时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间"
name="beginCollectTime"/>
<input class="time-input" id="startTime" name="beginCollectTime" placeholder="开始时间"
type="text"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间"
name="endCollectTime"/>
<input class="time-input" id="endTime" name="endCollectTime" placeholder="结束时间"
type="text"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="tableRefresh()"><i
@ -45,8 +48,8 @@
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<!--表格导出-->
<th:block th:include="include :: bootstrap-table-export-js" />
<th:block th:include="include :: FileSaver-xlsx-Base64-js" />
<th:block th:include="include :: bootstrap-table-export-js"/>
<th:block th:include="include :: FileSaver-xlsx-Base64-js"/>
<script th:inline="javascript">
var prefix = ctx + "record/recordSensorData";
@ -133,8 +136,8 @@
colspan: 1,
rowspan: 1,
align: "center",
formatter: function(value, row, index) {
return value.replace("T"," ");
formatter: function (value, row, index) {
return value.replace("T", " ");
}
});
}
@ -188,7 +191,7 @@
}
// 自定义按钮导出数据
function exportData(){
function exportData() {
$('#bootstrap-table').tableExport({
type: 'excel',
exportDataType: "basic",

Loading…
Cancel
Save