|
@@ -96,6 +96,7 @@
|
|
|
<button type="button" class="layui-btn layui-btn-sm" onclick="addTemplate()">添加指标模板</button>
|
|
|
<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" onclick="deleteTemplate()">删除指标模板</button>
|
|
|
<div id="allArea"></div>
|
|
|
+ <div id="allMetrics"></div>
|
|
|
<div id="indicatorTemplate"></div>
|
|
|
<div id="add-template" style="display: none;">
|
|
|
<form class="layui-form" action="">
|
|
@@ -166,9 +167,6 @@
|
|
|
<script>
|
|
|
const host = window.location.host
|
|
|
const username = window.sessionStorage.getItem('userName')
|
|
|
- // if(!username){
|
|
|
- // window.location.href = '/login'
|
|
|
- // }
|
|
|
const socket = new WebSocket(`ws://${host}/ws?username=${username}`);
|
|
|
socket.onopen = (event) => {
|
|
|
console.log(event)
|
|
@@ -227,6 +225,7 @@
|
|
|
});
|
|
|
initTreeCity(tree)
|
|
|
initTreeIndicator(tree)
|
|
|
+ initAllIndicator(tree)
|
|
|
initTreeIndicatorTemplate(tree)
|
|
|
// console.log(window.sessionStorage.getItem('userName'))
|
|
|
$("#userName").text(window.sessionStorage.getItem('userName'))
|
|
@@ -267,7 +266,19 @@
|
|
|
showCheckbox: true,
|
|
|
accordion: true,
|
|
|
id: 'Id3',
|
|
|
- data: r?.data
|
|
|
+ data: r?.data,
|
|
|
+ oncheck: function(obj){
|
|
|
+ // console.log(obj);
|
|
|
+ if(obj.checked) {
|
|
|
+ // console.log('tree.getChecked("Id4"): ', tree.getChecked('Id4'));
|
|
|
+ tree.getChecked('Id4').length = 0
|
|
|
+ tree.setChecked('Id4', [])
|
|
|
+ tree.reload('Id4', {
|
|
|
+ //新的参数
|
|
|
+ });
|
|
|
+ // console.log(' ----++++ ', tree.getChecked('Id4'));
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
return
|
|
|
}
|
|
@@ -276,6 +287,38 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ function initAllIndicator(tree) {
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ url: '/api/allIndicator',
|
|
|
+ success: function (r) {
|
|
|
+ if (r?.success) {
|
|
|
+ treeIn = tree.render({
|
|
|
+ elem: '#allMetrics',
|
|
|
+ showCheckbox: true,
|
|
|
+ accordion: true,
|
|
|
+ id: 'Id4',
|
|
|
+ data: r?.data,
|
|
|
+ oncheck: function(obj){
|
|
|
+ // console.log(obj);
|
|
|
+ if(obj.checked) {
|
|
|
+ // console.log('tree.getChecked("Id3"): ', tree.getChecked('Id3'));
|
|
|
+ tree.getChecked('Id3').length = 0
|
|
|
+ tree.setChecked('Id3', [])
|
|
|
+ tree.reload('Id3', {
|
|
|
+ //新的参数
|
|
|
+ });
|
|
|
+ // console.log(' ---- ', tree.getChecked('Id3'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ alert(r?.message ?? '发生错误了');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
function initTreeIndicator(tree) {
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
@@ -287,7 +330,7 @@
|
|
|
showCheckbox: true,
|
|
|
accordion: true,
|
|
|
id: 'Id2',
|
|
|
- data: r?.data
|
|
|
+ data: r?.data,
|
|
|
});
|
|
|
return
|
|
|
}
|
|
@@ -295,7 +338,6 @@
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
function renderTable(condition, searchType, table, citys, quxians, indicators, timeType, startTime, endTime) {
|
|
|
var tishi = layer.load(1, {
|
|
|
shadeClose: false,
|
|
@@ -359,7 +401,7 @@
|
|
|
alert('填选择时间')
|
|
|
return;
|
|
|
}
|
|
|
- if (tree.getChecked('Id3').length === 0) {
|
|
|
+ if (tree.getChecked('Id3').length === 0 && tree.getChecked('Id4').length === 0) {
|
|
|
alert('请选择指标')
|
|
|
return;
|
|
|
}
|
|
@@ -384,7 +426,17 @@
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
- let checkData2 = tree.getChecked('Id3')[0].children;
|
|
|
+ // console.log('0000000', tree.getChecked('Id4')[0]);
|
|
|
+
|
|
|
+ let checkData2 ;
|
|
|
+ console.log('3333 ', tree.getChecked('Id3')[0]?.children);
|
|
|
+ console.log('4444 ', tree.getChecked('Id4')[0]?.children);
|
|
|
+ if(tree.getChecked('Id3')[0]?.children){
|
|
|
+ checkData2= tree.getChecked('Id3')[0].children ;
|
|
|
+ }
|
|
|
+ if(tree.getChecked('Id4')[0]?.children){
|
|
|
+ checkData2= tree.getChecked('Id4')[0].children ;
|
|
|
+ }
|
|
|
const indicators = new Set();
|
|
|
checkData2.forEach(eee => {
|
|
|
eee.children.forEach(ee => {
|
|
@@ -392,6 +444,7 @@
|
|
|
})
|
|
|
});
|
|
|
indicators.add('eci')
|
|
|
+ indicators.add('sdate')
|
|
|
let timeType = $('#timeType').val()
|
|
|
let sdate = $('#time1').val()
|
|
|
const [startTime, endTime] = sdate.split(' - ')
|
|
@@ -491,8 +544,8 @@
|
|
|
// url: '/api/json/citys.json',
|
|
|
url: '/api/logout',
|
|
|
success: function (r) {
|
|
|
- layer.msg('退出登录成功');
|
|
|
window.sessionStorage.clear()
|
|
|
+ layer.msg('退出登录成功');
|
|
|
setTimeout(() => window.location.href = '/login', 1000)
|
|
|
}
|
|
|
});
|
|
@@ -509,7 +562,7 @@
|
|
|
},1000)
|
|
|
});
|
|
|
window.onbeforeunload=function(e){
|
|
|
- if (!window.sessionStorage.getItem('userName')) {
|
|
|
+ if (window.sessionStorage.getItem('userName')) {
|
|
|
logOutFun()
|
|
|
}
|
|
|
}
|