|
@@ -149,7 +149,8 @@
|
|
|
|
|
|
<div class="layui-input-inline layui-show-xs-block" style="float: right">
|
|
|
<button class="layui-btn layui-btn-normal" id="importData">导入数据</button>
|
|
|
- <button class="layui-btn layui-btn-normal" id="exportData" onclick="exportData()">导出数据</button>
|
|
|
+ <button class="layui-btn layui-btn-normal" id="exportData" onclick="exportData()">导出数据
|
|
|
+ </button>
|
|
|
<button class="layui-btn layui-btn-normal" onclick="F_moban()">导入模板说明</button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -159,12 +160,13 @@
|
|
|
<button class="layui-btn layui-btn-normal" onclick="reverseSelect()">反选</button>
|
|
|
<button class="layui-btn layui-btn-normal" onclick="noSelect()">全不选</button>
|
|
|
<button class="layui-btn layui-btn-danger" onclick="deleteSelect()">删除</button>
|
|
|
- <button class="layui-btn layui-btn-danger" onclick="deleteSelectTime()">删除选择时间范围</button>
|
|
|
+ <button class="layui-btn layui-btn-danger" onclick="deleteSelectTime()">删除选择时间范围
|
|
|
+ </button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<!-- 传感器数据时间选择 选择 end-->
|
|
|
- <div class="layui-card-body" >
|
|
|
+ <div class="layui-card-body">
|
|
|
<table class="layui-table ">
|
|
|
<colgroup>
|
|
|
<col width="100">
|
|
@@ -194,18 +196,18 @@
|
|
|
<!--按钮部分 start-->
|
|
|
<div>
|
|
|
<span>每页显示:</span>
|
|
|
- <select id="perPageSelect">
|
|
|
- <option value="10">10条/页</option>
|
|
|
- <option value="100">100条/页</option>
|
|
|
- <option value="300">300条/页</option>
|
|
|
- <option value="500">500条/页</option>
|
|
|
- <option value="800">800条/页</option>
|
|
|
- <option value="1000">1000条/页</option>
|
|
|
- <option value="2000">2000条/页</option>
|
|
|
- <option value="3000">3000条/页</option>
|
|
|
- <option value="4000">4000条/页</option>
|
|
|
- <option value="5000">5000条/页</option>
|
|
|
- </select>
|
|
|
+ <select id="perPageSelect">
|
|
|
+ <option value="10">10条/页</option>
|
|
|
+ <option value="100">100条/页</option>
|
|
|
+ <option value="300">300条/页</option>
|
|
|
+ <option value="500">500条/页</option>
|
|
|
+ <option value="800">800条/页</option>
|
|
|
+ <option value="1000">1000条/页</option>
|
|
|
+ <option value="2000">2000条/页</option>
|
|
|
+ <option value="3000">3000条/页</option>
|
|
|
+ <option value="4000">4000条/页</option>
|
|
|
+ <option value="5000">5000条/页</option>
|
|
|
+ </select>
|
|
|
</div>
|
|
|
|
|
|
<!--按钮部分 end-->
|
|
@@ -215,7 +217,7 @@
|
|
|
|
|
|
</div>
|
|
|
|
|
|
-<!-- <input type="number" id="perPageInput" min="1" value="10">-->
|
|
|
+ <!-- <input type="number" id="perPageInput" min="1" value="10">-->
|
|
|
|
|
|
<!--分页部分 end-->
|
|
|
</div>
|
|
@@ -520,6 +522,7 @@
|
|
|
let t = {
|
|
|
t_sn: $(e).attr('data-sn'),
|
|
|
t_id: Number.parseInt($(e).attr('data-id')),
|
|
|
+ create_time: ($(e).attr('data-createtime')),
|
|
|
t_t: Number.parseFloat($(e).attr('data-tt')),
|
|
|
t_rh: Number.parseFloat($(e).attr('data-trh')),
|
|
|
t_site: $(e).attr('data-site'),
|
|
@@ -551,51 +554,69 @@
|
|
|
layui.layer.close(index);
|
|
|
});
|
|
|
}
|
|
|
- //删除选择时间范围
|
|
|
-function deleteSelectTime() {
|
|
|
- // 获取选择的行
|
|
|
- var Time_start = $("#Time_start").val();
|
|
|
- var Time_end = $("#Time_end").val();
|
|
|
- var T_sn = $("#sn_id").val();
|
|
|
- var split = T_sn.split(",");
|
|
|
-
|
|
|
- // 构造查询字符串
|
|
|
- var query = `?t_sn=${encodeURIComponent(split[0])}&t_id=${encodeURIComponent(split[1])}&time_start=${encodeURIComponent(Time_start)}&t_end=${encodeURIComponent(Time_end)}`;
|
|
|
|
|
|
- layui.layer.confirm(`是否删除时间: ${Time_start}-------${Time_end} 的数据`, function (index) {
|
|
|
- $.ajax({
|
|
|
- type: "GET",
|
|
|
- url: `/Data/Device_Sensor_List_Delete_Time${query}`,
|
|
|
- success: function (res) {
|
|
|
- console.log(res.Code)
|
|
|
- if (res.Code === 200) {
|
|
|
- layui.layer.msg(`删除数据成功!`);
|
|
|
- get_DeviceSensor_data(0);
|
|
|
- } else {
|
|
|
- layui.layer.msg(res.Msg);
|
|
|
- }
|
|
|
+ //删除选择时间范围
|
|
|
+ function deleteSelectTime() {
|
|
|
+ // 获取选择的行
|
|
|
+ console.log("删除选中事件范围")
|
|
|
+ const Time_start = $("#Time_start").val();
|
|
|
+ const Time_end = $("#Time_end").val();
|
|
|
+ console.log("删除选中事件范围", Time_start, Time_end)
|
|
|
+ let checkboxes = $('.checkboxxx');
|
|
|
+ let querys = {
|
|
|
+ t_sn: [],
|
|
|
+ t_id: [],
|
|
|
+ time_start:Time_start,
|
|
|
+ time_end:Time_end,
|
|
|
+ };
|
|
|
+ checkboxes.each(function () {
|
|
|
+ if ($(this).is(':checked')) {
|
|
|
+ const checkboxValue = $(this).val();
|
|
|
+ const values = checkboxValue.split(',');
|
|
|
+ const sn = values[0];
|
|
|
+ const id = values[1];
|
|
|
+ console.log(sn, id);
|
|
|
+ querys.t_sn.push(sn);
|
|
|
+ querys.t_id.push(id);
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- layui.layer.close(index);
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
+ if (querys.length === 0) {
|
|
|
+ layui.layer.msg('没有选中要删除的记录哦!')
|
|
|
+ }else {
|
|
|
+ layui.layer.confirm(`是否删除选中时间: ${Time_start}-------${Time_end} 的数据`, function (index) {
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: `/Data/Device_Sensor_List_Delete_Time`,
|
|
|
+ data: JSON.stringify(querys),
|
|
|
+ contentType: 'application/json;charset=utf-8',
|
|
|
+ success: function (res) {
|
|
|
+ console.log(res.Code)
|
|
|
+ if (res.Code === 200) {
|
|
|
+ layui.layer.msg(`成功删除 ${res.Data} 条数据`);
|
|
|
+ get_DeviceSensor_data(0);
|
|
|
+ } else {
|
|
|
+ layui.layer.msg(res.Msg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ layui.layer.close(index);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//删除当前行,当当前行按钮被点击后
|
|
|
function deleteOne(e) {
|
|
|
e = $(e).parent().prevAll()
|
|
|
e = e[e.length - 1]
|
|
|
e = $(e).children()[0]
|
|
|
- console.log(e,"==============")
|
|
|
+ console.log(e, "==============")
|
|
|
let t = {
|
|
|
t_sn: $(e).attr('data-sn'),
|
|
|
t_id: Number.parseInt($(e).attr('data-id')),
|
|
|
+ create_time: ($(e).attr('data-createtime')),
|
|
|
t_t: Number.parseFloat($(e).attr('data-tt')),
|
|
|
t_rh: Number.parseFloat($(e).attr('data-trh')),
|
|
|
t_site: $(e).attr('data-site'),
|
|
|
- User_tokey: $.cookie("User_tokey")
|
|
|
}
|
|
|
layui.layer.confirm(`是否删除选中 sn: ${t.t_sn} 1 条记录`, {title: '删除记录'}, function (index) {
|
|
|
$.ajax({
|
|
@@ -644,13 +665,14 @@ function deleteSelectTime() {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- $('#perPageSelect').on('change', function() {
|
|
|
+
|
|
|
+ $('#perPageSelect').on('change', function () {
|
|
|
let itemsPerPage = $(this).val();
|
|
|
get_DeviceSensor_data(0, itemsPerPage); // 调用获取数据函数,传入新的每页条数
|
|
|
});
|
|
|
|
|
|
// 如果是输入框,则可能需要验证用户输入并做相应的处理
|
|
|
- $('#perPageInput').on('input', function() {
|
|
|
+ $('#perPageInput').on('input', function () {
|
|
|
let itemsPerPage = parseInt($(this).val());
|
|
|
if (!isNaN(itemsPerPage)) {
|
|
|
get_DeviceSensor_data(0, itemsPerPage);
|
|
@@ -661,7 +683,7 @@ function deleteSelectTime() {
|
|
|
});
|
|
|
|
|
|
|
|
|
- function get_DeviceSensor_data(page,itemsPerPage) {
|
|
|
+ function get_DeviceSensor_data(page, itemsPerPage) {
|
|
|
|
|
|
if ($("#Time_start").val().length > 0) {
|
|
|
Time_start = $("#Time_start").val();
|
|
@@ -698,7 +720,7 @@ function deleteSelectTime() {
|
|
|
$('#DeviceSensor_data').html("")
|
|
|
$('#DeviceSensor_data_Pages').html("")
|
|
|
$('#DeviceSensor_data_Pages_x').html("")
|
|
|
- if (result.Data !=null) {
|
|
|
+ if (result.Data != null) {
|
|
|
DeviceSensor_data = result.Data.list
|
|
|
}
|
|
|
if (DeviceSensor_data.length == 0) {
|
|
@@ -706,7 +728,7 @@ function deleteSelectTime() {
|
|
|
return
|
|
|
}
|
|
|
addDeviceSensorData(result.Data.list)
|
|
|
- addDeviceSensorDataPage(result.Data,itemsPerPage)
|
|
|
+ addDeviceSensorDataPage(result.Data, itemsPerPage)
|
|
|
|
|
|
} else {
|
|
|
|
|
@@ -784,7 +806,7 @@ function deleteSelectTime() {
|
|
|
}
|
|
|
|
|
|
//分页添加
|
|
|
- function addDeviceSensorDataPage(pageInfo,itemsPerPage) {
|
|
|
+ function addDeviceSensorDataPage(pageInfo, itemsPerPage) {
|
|
|
let start, end
|
|
|
start = pageInfo.currentPage - 5 < 1 ? 1 : pageInfo.currentPage - 5
|
|
|
end = pageInfo.currentPage + 5 > pageInfo.totalPage ? pageInfo.totalPage : pageInfo.currentPage + 5
|
|
@@ -843,6 +865,7 @@ function deleteSelectTime() {
|
|
|
*/
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// 新增copyAndAdd函数实现复制并添加新行
|
|
|
function copyAndAdds(button, t_sn, t_id, t_t, t_rh, t_site, create_time) {
|
|
|
// 准备发送给后端的数据对象
|
|
@@ -861,7 +884,7 @@ function deleteSelectTime() {
|
|
|
type: 'POST',
|
|
|
contentType: 'application/json',
|
|
|
data: JSON.stringify(dataToSend),
|
|
|
- success: function(response) {
|
|
|
+ success: function (response) {
|
|
|
console.log("数据提交成功,响应:", response.Data);
|
|
|
|
|
|
// 假设后端返回了新行ID或者其他需要的数据,这里可以根据需要处理response
|
|
@@ -901,13 +924,14 @@ function deleteSelectTime() {
|
|
|
// window.location.reload()
|
|
|
// 这里可以添加成功后的其他操作,如提示用户、更新界面等
|
|
|
},
|
|
|
- error: function(jqXHR, textStatus, errorThrown) {
|
|
|
+ error: function (jqXHR, textStatus, errorThrown) {
|
|
|
console.error("数据提交失败:", textStatus, errorThrown);
|
|
|
// 处理错误情况,比如提示用户
|
|
|
alert("数据提交失败,请重试!");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
function showRecord(e) {
|
|
|
e = $(e).parent().prevAll()
|
|
|
e = e[e.length - 1]
|
|
@@ -957,16 +981,19 @@ function deleteSelectTime() {
|
|
|
let e = $(even).prevAll()
|
|
|
console.log(e)
|
|
|
e = $(e[e.length - 1]).children()[0]
|
|
|
- console.log(e)
|
|
|
+ // console.log(e)
|
|
|
+
|
|
|
let t = {
|
|
|
t_sn: $(e).attr('data-sn'),
|
|
|
t_id: Number.parseInt($(e).attr('data-id')),
|
|
|
+ create_time: ($(e).attr('data-createtime')),
|
|
|
t_t: Number.parseFloat($(e).attr('data-tt')),
|
|
|
t_rh: Number.parseFloat($(e).attr('data-trh')),
|
|
|
t_site: $(e).attr('data-site'),
|
|
|
}
|
|
|
+ // console.log(t)
|
|
|
let type = $(even).attr('data-type')
|
|
|
- console.log(t)
|
|
|
+ // console.log(t,"============修改值==================")
|
|
|
let input = $(`<input class="layui-input" type="text" value="${even.innerText}">`)
|
|
|
input[0].onblur = function () {
|
|
|
t["type"] = type
|
|
@@ -1032,33 +1059,7 @@ function deleteSelectTime() {
|
|
|
Time_end = ""
|
|
|
}
|
|
|
let checkboxes = $('.checkboxxx');
|
|
|
- // console.log(checkboxs,"==========================")
|
|
|
- // checkboxs.each(function (index, item) {})
|
|
|
- // let checkbox = document.getElementById('sn_id');
|
|
|
- // console.log(checkbox.value)
|
|
|
- // if (checkbox.checked) {
|
|
|
- // $.ajax({
|
|
|
- // type: "post",
|
|
|
- // url: "/Data/EXportData",
|
|
|
- // data: {
|
|
|
- // T_snid: checkbox.value,
|
|
|
- // Time_start: Time_start,
|
|
|
- // Time_end: Time_end,
|
|
|
- // },
|
|
|
- // success: function (rlt) {
|
|
|
- // console.log(rlt)
|
|
|
- // if (rlt.Code === 200) {
|
|
|
- // let link = document.createElement('a');
|
|
|
- // link.href = rlt.Data;
|
|
|
- // link.click(); // 触发点击事件以开始下载
|
|
|
- // link.remove();
|
|
|
- // }
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }else{
|
|
|
- // layui.layer.msg("请选择导出项")
|
|
|
- // }
|
|
|
- checkboxes.each(function() {
|
|
|
+ checkboxes.each(function () {
|
|
|
if ($(this).is(':checked')) {
|
|
|
var checkboxValue = $(this).val();
|
|
|
var values = checkboxValue.split(',');
|
|
@@ -1184,11 +1185,12 @@ function deleteSelectTime() {
|
|
|
});
|
|
|
return false
|
|
|
}
|
|
|
+
|
|
|
function F_moban() {
|
|
|
layer.open({
|
|
|
title: '导入模版'
|
|
|
- ,content: '1、根据模板格式 导入数据 <a href="/static/20240523140020.xlsx" style="color: #1E9FFF">点击下载模版</a><hr>'+
|
|
|
- '2、导入文件名为 SN编号,如 2024xxxxxxxxxx.xlsx <hr>'
|
|
|
+ , content: '1、导入模板需先导出然后根据导出模板进行填写导入<hr>' +
|
|
|
+ '2、导入文件名为 SN编号,如 2024xxxxxxxxxx.xlsx <hr>'
|
|
|
|
|
|
});
|
|
|
}
|