修改时间选择

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

@ -158,11 +158,12 @@ const onSearchByCollectTime = function (obj) {
setTimeout(function () { setTimeout(function () {
var storeId = document.getElementById('table'); var storeId = document.getElementById('table');
var rowsLength = storeId.rows.length; var rowsLength = storeId.rows.length;
var key = obj.value; var [startTime,endTime] = obj.value.split(' - ');
var searchCol = storeId.rows.item(0).cells.length-3; var searchCol = storeId.rows.item(0).cells.length-3;
for (var i = 1; i < rowsLength; i++) { for (var i = 1; i < rowsLength; i++) {
var searchText = storeId.rows[i].cells[searchCol].innerHTML; 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 = ''; storeId.rows[i].style.display = '';
} else { } else {
storeId.rows[i].style.display = 'none'; storeId.rows[i].style.display = 'none';

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

@ -1,5 +1,5 @@
<!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>
@ -9,17 +9,20 @@
<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">
<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> <ul>
<li> <li>
<input type="hidden" id="sensorId" name="sensorId"/> <input id="sensorId" name="sensorId" type="hidden"/>
</li> </li>
<li class="select-time"> <li class="select-time">
<label>采集时间:</label> <label>采集时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" <input class="time-input" id="startTime" name="beginCollectTime" placeholder="开始时间"
name="beginCollectTime"/> type="text"/>
<span>-</span> <span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" <input class="time-input" id="endTime" name="endCollectTime" placeholder="结束时间"
name="endCollectTime"/> type="text"/>
</li> </li>
<li> <li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="tableRefresh()"><i <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 :: 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";
@ -133,8 +136,8 @@
colspan: 1, colspan: 1,
rowspan: 1, rowspan: 1,
align: "center", align: "center",
formatter: function(value, row, index) { formatter: function (value, row, index) {
return value.replace("T"," "); return value.replace("T", " ");
} }
}); });
} }
@ -188,7 +191,7 @@
} }
// 自定义按钮导出数据 // 自定义按钮导出数据
function exportData(){ function exportData() {
$('#bootstrap-table').tableExport({ $('#bootstrap-table').tableExport({
type: 'excel', type: 'excel',
exportDataType: "basic", exportDataType: "basic",

Loading…
Cancel
Save