Ming 4 年之前
父節點
當前提交
06fe3dab3b
共有 6 個文件被更改,包括 158 次插入19 次删除
  1. 3 0
      api/request.js
  2. 1 18
      eleFireIndex.html
  3. 22 0
      js/eleFire.js
  4. 37 0
      js/water.js
  5. 95 0
      test.html
  6. 0 1
      waterIndex.html

+ 3 - 0
api/request.js

@@ -17,6 +17,9 @@ const WATER_DATA = "YtIoT/iot/analysis/view/getWaterAnalysisList"; //水系统
 const GET_NAME_LIST_DATA = "YtIoT/iot/company/view/getNameList"; //建筑下拉
 
 
+const UPDATE_USER_STATE = "YtIoT/iot/userstate/updateUserState"; //电气火灾,水系统,读取状态更新
+
+
 function ajaxRequest(path, method, data, success, error, type = 1) {
 
     let url = URL + path;

+ 1 - 18
eleFireIndex.html

@@ -354,24 +354,7 @@
     <script src="js/eleFire.js"></script>
 
 
-    <script>
-        layui.use('layer', function() {
-            var layer = layui.layer;
-            layer.open({
-                icon: 7,
-                title: '提示信息',
-                content: '您有报告未读,请查看!',
-                yes: function(index, layero) {
-
-
-                    //do something
-                    layer.close(index); //如果设定了yes回调,需进行手工关闭
-                    // location.reload();
-                }
-            });
-
-        });
-    </script>
+
 </body>
 
 </html>

+ 22 - 0
js/eleFire.js

@@ -2,6 +2,28 @@
      电气火灾数据对接
 */
 
+//动态获取登录用户名
+// const aaa = sessionStorage.getItem('V_LOGINNAME');
+// const LOGIN_NAME = aaa;
+
+updateUserState({
+    "queryJson": '{"V_LOGINNAME": "admin","STATE":1}' //用户名需更改为动态获取到的
+});
+
+function updateUserState(params = {}) {
+    $.ajax({
+        type: "POST",
+        url: "https://iot.usky.cn/YtIoT/iot/userstate/updateUserState",
+        data: params,
+        success: function(data) {},
+        error: function() {
+            console.log("发生错误")
+        },
+        complete: function() {
+            // console.log("ajax请求完事,最终操作在这里完成")
+        }
+    });
+}
 
 //建筑下拉
 getNameList();

+ 37 - 0
js/water.js

@@ -1,3 +1,34 @@
+/* 
+     水系统数据对接
+*/
+
+//动态获取登录用户名
+// const aaa = sessionStorage.getItem('V_LOGINNAME');
+// const LOGIN_NAME = aaa;
+
+
+
+updateUserState({
+    "queryJson": '{"V_LOGINNAME": "admin","STATE":2}' //用户名需更改为动态获取到的
+});
+
+function updateUserState(params = {}) {
+    $.ajax({
+        type: "POST",
+        url: "https://iot.usky.cn/YtIoT/iot/userstate/updateUserState",
+        data: params,
+        success: function(data) {},
+        error: function() {
+            console.log("发生错误")
+        },
+        complete: function() {
+            // console.log("ajax请求完事,最终操作在这里完成")
+        }
+    });
+}
+
+
+
 //建筑下拉
 getNameList();
 
@@ -442,6 +473,10 @@ function getListData(queryParam = {}) {
                 let end_pressure = [];
                 let data_time = [];
                 let leakage_data = leakage_investigation.leakage_data;
+
+
+                console.log('leakage_data')
+                console.log(leakage_data)
                 leakage_data.forEach(function(item, index) {
                     //异常值
                     abnormal_pressure.push(item.abnormal_pressure)
@@ -454,6 +489,8 @@ function getListData(queryParam = {}) {
                         //时间
                     data_time.push(item.data_time)
                 });
+                console.log('abnormal_pressure')
+                console.log(abnormal_pressure)
 
                 var xData = location_description;
 

+ 95 - 0
test.html

@@ -0,0 +1,95 @@
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+
+    <link rel="stylesheet" href="https://iot.usky.cn/YtIoT/view/efireAnalysis/layui/css/layui.css" />
+
+    <title>Document</title>
+    <style>
+        .layui-layer-title {
+            background: #081A32 !important;
+            color: #fff !important;
+            border-bottom: 1px solid #1E9FFF !important;
+        }
+        
+        .layui-layer {
+            background: #072442 !important;
+            color: #fff;
+        }
+        
+        .layui-layer-ico {
+            border-radius: 50%;
+        }
+        
+        .layui-layer-btn .layui-layer-btn0 {
+            font-size: 0.2rem;
+        }
+    </style>
+</head>
+
+<body>
+
+
+    <script src="https://iot.usky.cn/YtIoT/view/efireAnalysis/layui/layui.js"></script>
+    <script src="js/jquery.js"></script>
+
+    <script>
+        $(document).ready(function() {
+            getReportState({
+                "queryJson": '{"V_LOGINNAME": "admin"}'
+            });
+        });
+
+        function getReportState(params = {}) {
+            $.ajax({
+                type: "POST",
+                url: "https://iot.usky.cn/YtIoT/iot/userstate/getUserStateList",
+                data: params,
+                success: function(data) {
+                    var result = eval('(' + data + ')');
+                    var getState = result.RESULT[0].STATE
+                    console.log('getState')
+                    console.log(getState);
+                    if (getState != 3) {
+                        layui.use('layer', function() {
+                            var layer = layui.layer;
+                            layer.open({
+                                icon: 7,
+                                title: '提示信息',
+                                closeBtn: false,
+                                btn: ['确定', '取消'],
+                                content: '您有报告未读,请查看!',
+                                yes: function(index, layero) { //yes对应第一个按钮“确定”
+                                    if (getState == 0) {
+                                        window.location.href = "../waterIndex.html";
+                                    } else if (getState == 1) {
+                                        window.location.href = "../waterIndex.html";
+                                    } else if (getState == 2) {
+                                        window.location.href = "../eleFireIndex.html";
+                                    }
+                                },
+                                btn2: function(index, layero) { //该操作对应的是“取消”按钮
+                                    layer.close(index)
+                                    return false;
+                                },
+                            });
+                        });
+                    }
+                },
+                error: function() {
+                    console.log("发生错误")
+                        // alert("发生错误");
+                },
+                complete: function() {
+                    // console.log("ajax请求完事,最终操作在这里完成")
+                }
+            });
+        }
+    </script>
+</body>
+
+</html>

+ 0 - 1
waterIndex.html

@@ -9,7 +9,6 @@
     <script src="js/flexible.js"></script>
     <link rel="stylesheet" href="layui/css/layui.css">
     <link rel="stylesheet" href="css/index.css" />
-
 </head>
 
 <body>