|
@@ -117,6 +117,13 @@
|
|
|
<button class="layui-btn layui-btn-sm" id="invertSelect">反选</button>
|
|
|
<button class="layui-btn layui-btn-sm layui-btn-danger" id="batchDelete">批量删除</button>
|
|
|
</div>
|
|
|
+ <div>
|
|
|
+ <div class="siftWarning" style="width: 100px; margin-left: 260px; margin-top: -45px;">
|
|
|
+ <select>
|
|
|
+ <option value="">类型筛选</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</table>
|
|
|
</div>
|
|
|
<div class="layui-card-body ">
|
|
@@ -217,21 +224,8 @@
|
|
|
var snValue = document.getElementsByName('T_sn')[0].value;
|
|
|
|
|
|
const url = `?page=1&T_sn=${encodeURIComponent(snValue)}&Time_start=${encodeURIComponent(startTime)}&Time_end=${encodeURIComponent(endTime)}&pageSize=${encodeURIComponent(pageSize)}`; // 将pageSize作为查询参数添加到URL
|
|
|
- // console.log("发送的URL:", url);
|
|
|
window.location.href = url;
|
|
|
- // fetch(url, { // 使用调整后的URL
|
|
|
- // method: 'GET', // 保持GET方法,既然这是根据需求设定的
|
|
|
- // })
|
|
|
- // .then(response => {
|
|
|
- // if (!response.ok) {
|
|
|
- // throw new Error(`网络响应异常: ${response.statusText}`);
|
|
|
- // }
|
|
|
- // // 可能需要处理响应数据,这里假设不需要返回数据处理
|
|
|
- // })
|
|
|
- // .catch(error => {
|
|
|
- // console.error('发送pageSize至后端时发生错误:', error);
|
|
|
- // // 可能还需要通知用户发生了错误
|
|
|
- // });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
layui.use(['layer', 'laydate', 'form'],
|
|
@@ -272,7 +266,6 @@
|
|
|
|
|
|
var seventhColumnValue = row.find('td:eq(6)').text();
|
|
|
console.log(seventhColumnValue);
|
|
|
- // 现在您可以根据需要使用 seventhColumnValue,例如将其与ID一起存储
|
|
|
|
|
|
selectedIds.push({
|
|
|
id: this.value,
|
|
@@ -346,7 +339,7 @@
|
|
|
// 发送POST请求到后端
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
|
- url: "/Device/DeviceWarningAdd", // 替换为您的后端接口地址
|
|
|
+ url: "/Device/DeviceWarningAdd",
|
|
|
data: JSON.stringify(rowData),
|
|
|
contentType: "application/json;charset=utf-8",
|
|
|
dataType: "json",
|
|
@@ -436,6 +429,64 @@
|
|
|
|
|
|
});
|
|
|
|
|
|
+ $('.siftWarning').on('click', function () {
|
|
|
+ $.ajax({
|
|
|
+ type: "GET",
|
|
|
+ url: "/Device/DeviceWarning_waraning",
|
|
|
+ contentType: "application/json;charset=utf-8",
|
|
|
+ dataType: "json",
|
|
|
+ success: function (response) {
|
|
|
+ if (response.Code === 200) {
|
|
|
+ const data = response.Data;
|
|
|
+ // 获取select元素
|
|
|
+ const selectElement = document.querySelector('select');
|
|
|
+ // 清空原有的选项(除了第一个默认选项)
|
|
|
+ for (let i = selectElement.options.length - 1; i >= 1; i--) {
|
|
|
+ selectElement.remove(i);
|
|
|
+ }
|
|
|
+ // 遍历数据并添加新的选项
|
|
|
+ data.forEach(item => {
|
|
|
+ const option = document.createElement('option');
|
|
|
+ option.value = item.Key;
|
|
|
+ option.textContent = item.Value;
|
|
|
+ selectElement.appendChild(option);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ layer.msg('获取类型失败', {icon: 5, time: 2000});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (xhr, status, error) {
|
|
|
+ layer.msg('请求错误,请检查网络连接!', {icon: 5, time: 2000});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const selectElement = document.querySelector('select');
|
|
|
+ // 添加change事件监听器
|
|
|
+ selectElement.addEventListener('change', function() {
|
|
|
+ // 在这里写你需要执行的方法或逻辑
|
|
|
+ console.log('选中的值:', this.value); // 打印选中的值
|
|
|
+ // 可以在这里调用其他方法或执行其他操作
|
|
|
+ const t_tp=this.value;
|
|
|
+ getWarningType(t_tp)
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ })
|
|
|
+ function getWarningType (t_tp) {
|
|
|
+ var pageSize = localStorage.getItem('pageSize') || 100;
|
|
|
+ // 获取输入框的值
|
|
|
+ const startTime = document.getElementById('Time_start').value;
|
|
|
+ const endTime = document.getElementById('Time_end').value;
|
|
|
+ const sn = document.querySelector('input[name="T_sn"]').value;
|
|
|
+ // 在这里处理这些值,例如发送到服务器或进行其他操作
|
|
|
+ console.log('开始时间:', startTime);
|
|
|
+ console.log('结束时间:', endTime);
|
|
|
+ console.log('SN:', sn);
|
|
|
+ console.log('page:', pageSize);
|
|
|
+ console.log('t_tp:', t_tp);
|
|
|
+ const url = `?page=1&T_sn=${encodeURIComponent(sn)}&Time_start=${encodeURIComponent(startTime)}&Time_end=${encodeURIComponent(endTime)}&pageSize=${encodeURIComponent(pageSize)}&t_tp=${encodeURIComponent(t_tp)}`;
|
|
|
+ window.location.href = url;
|
|
|
+
|
|
|
+ }
|
|
|
// 定义提交更新到后端的函数
|
|
|
function submitUpdate(rowId, columnName, newValue, T_Ut_value,attr) {
|
|
|
var dataToSubmit = {
|
|
@@ -474,7 +525,7 @@
|
|
|
fetch("/Device/DeviceWarning_waraning")
|
|
|
.then(response => {
|
|
|
if (!response.ok) {
|
|
|
- throw new Error('Network response was not ok');
|
|
|
+ throw new Error('网络连接失败');
|
|
|
}
|
|
|
return response.json();
|
|
|
})
|
|
@@ -485,7 +536,7 @@
|
|
|
});
|
|
|
})
|
|
|
.catch(error => {
|
|
|
- console.error('There has been a problem with your fetch operation:', error);
|
|
|
+ console.error( error);
|
|
|
});
|
|
|
break;
|
|
|
case 't__state':
|
|
@@ -498,7 +549,7 @@
|
|
|
fetch("/Device/DeviceWarning_ALL_SN")
|
|
|
.then(response => {
|
|
|
if (!response.ok) {
|
|
|
- throw new Error('Network response was not ok');
|
|
|
+ throw new Error('网络连接失败');
|
|
|
}
|
|
|
return response.json();
|
|
|
})
|
|
@@ -508,7 +559,7 @@
|
|
|
});
|
|
|
})
|
|
|
.catch(error => {
|
|
|
- console.error('There has been a problem with your fetch operation:', error);
|
|
|
+ console.error(error);
|
|
|
});
|
|
|
break;
|
|
|
case 't_id':
|
|
@@ -517,7 +568,7 @@
|
|
|
fetch(url)
|
|
|
.then(response => {
|
|
|
if (!response.ok) {
|
|
|
- throw new Error('Network response was not ok');
|
|
|
+ throw new Error('连接失败');
|
|
|
}
|
|
|
return response.json();
|
|
|
})
|
|
@@ -528,7 +579,7 @@
|
|
|
});
|
|
|
})
|
|
|
.catch(error => {
|
|
|
- console.error('There has been a problem with your fetch operation:', error);
|
|
|
+ console.error(error);
|
|
|
});
|
|
|
break;
|
|
|
default:
|