Przeglądaj źródła

waterAnalysisSharingEnginePush water.js 李欣儒 commit at 2021-04-25

李欣儒 4 lat temu
rodzic
commit
16614e0b2c
1 zmienionych plików z 190 dodań i 0 usunięć
  1. 190 0
      waterAnalysisSharingEnginePush/externalJs/water.js

+ 190 - 0
waterAnalysisSharingEnginePush/externalJs/water.js

@@ -1817,3 +1817,193 @@ function getListData(queryParam = {}) {
                         },
 
                         backgroundColor: 'rgba(37, 46, 100, 0.45)', //两边未选中的滑动条区域的颜色
+                        showDataShadow: false, //是否显示数据阴影 默认auto
+                        // showDetail: false, //即拖拽时候是否显示详细数值信息 默认true
+                        filterMode: 'filter',
+                    },
+
+                    xAxis: [{
+                        type: 'category',
+                        //	boundaryGap: true,//坐标轴两边留白
+                        data: xData,
+                        axisLabel: {
+                            interval: 0,
+                            // rotate: 340,
+                            // formatter: function(val) {
+                            //     return val.split("").join("\n");
+                            // }, //横轴信息文字竖直显示
+                            textStyle: {
+                                color: '#AADDFF',
+                                fontStyle: 'normal',
+                                fontFamily: '微软雅黑',
+                                fontSize: 12,
+                            },
+                        },
+
+                        axisTick: {
+                            //坐标轴刻度相关设置。
+                            show: false,
+                        },
+                        axisLine: {
+                            //坐标轴轴线相关设置
+                        },
+                        splitLine: {
+                            //坐标轴在 grid 区域中的分隔线。
+                            show: false,
+                        },
+                    }, ],
+                    yAxis: [{
+                        type: 'value',
+
+                        axisLabel: false,
+                        axisLine: {
+                            show: false,
+                        },
+                        axisTick: {
+                            show: false,
+                        },
+                        splitLine: {
+                            show: true,
+                            lineStyle: {
+                                color: "#aaa", // 分割线颜色
+                                opacity: '0.2'
+                            },
+                        },
+                        boundaryGap: ['0', '10%'],
+                    }],
+                    series: [{
+                            name: '波动前水压值',
+                            type: 'bar',
+                            data: before_fluctuation,
+                            barMaxWidth: '11',
+                            itemStyle: {
+                                borderColor: "#0096FF",
+                            },
+                            barGap: '50%',
+                        },
+                        {
+                            name: '波动后水压值',
+                            type: 'bar',
+                            data: after_fluctuation,
+                            barMaxWidth: '11',
+                            itemStyle: {
+                                borderColor: "#FF9C00",
+                            },
+                        },
+                    ],
+                };
+
+                myChart.setOption(option);
+                var img1 = document.getElementById('dataChangeChart1_img');
+                setTimeout(function() {
+                    img1.src = myChart.getDataURL();
+                }, 1000)
+            })();
+
+            /* 
+                 导出数据对接 start
+            */
+
+
+        } else {
+            layui.use('layer', function() {
+                var layer = layui.layer;
+                layer.alert('暂无数据', { icon: 5 }, function() {
+                    location.reload();
+                });
+            });
+        }
+    }, function(errorMsg) {
+        layui.use('layer', function() {
+            var layer = layui.layer;
+            layer.alert('数据请求失败', { icon: 5 });
+        });
+    }, 1)
+};
+
+function getSearchParamObj() {
+    let queryParam = {};
+    let buildingVal = $('#building').val();
+    let chooseTime = $('#chooseTime').val();
+    queryParam.company_code = buildingVal;
+    queryParam.generation_time = chooseTime;
+    return queryParam;
+};
+
+//日期筛选
+layui.use('laydate', function() {
+    var laydate = layui.laydate;
+    ///年月选择器
+    laydate.render({
+        elem: '#chooseTime',
+        type: 'month',
+        max: -30, //7天后
+        trigger: 'click', //呼出事件改成click
+
+        done: function(value, date, endDate) {
+            setTimeout(function() {
+                getListData(getSearchParamObj());
+            }, 100)
+        }
+
+    });
+
+});
+
+//建筑筛选
+$("#building").change(function() {
+    setTimeout(function() {
+        getListData(getSearchParamObj());
+    }, 100)
+
+});
+
+// 打印
+(function() {
+
+    $("#btnPrint").click(function() {
+        print_detail()
+    });
+
+    var print_detail = function() {
+
+        //打印前echarts图表转换成图片 start   
+        $('#divergenceChart1_img').show()
+        $('#divergenceChart1').hide()
+
+        $('#hiddenCheckChart1_img').show()
+        $('#hiddenCheckChart1').hide()
+
+        $('#deviceLinkChart1_img,#deviceLinkChart2_img').show()
+        $('#deviceLinkChart1,#deviceLinkChart2').hide()
+
+        $('#dataChangeChart1_img').show()
+        $('#dataChangeChart1').hide()
+            //  end
+
+        var div1_label1 = document.getElementById('printArea').innerHTML;
+        var hkey_key;
+        var hkey_root = 'HKEY_CURRENT_USER';
+        var hkey_path = '\\Software\\Micorsoft\\Internet Explorer\\PageSetup\\';
+        var print_win = window.open('打印窗口', '_blank');
+        var div = document.createElement('div');
+        div.setAttribute('width', '100%');
+        div.setAttribute('height', '100%');
+        var div_print = document.createElement('div');
+        div_print.setAttribute('style', 'width:595px;height:842px;padding:50px 20px;margin:0px auto 0px auto');
+        div_print.innerHTML = div1_label1;
+        div.appendChild(div_print);
+
+        print_win.document.write(div.innerHTML);
+        print_win.document.close();
+        try {
+            var RegWsh = new ActiveXObject('WScript.Shell');
+            hkey_key = 'header';
+            RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, '');
+            hkey_key = 'footer';
+            RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, '');
+        } catch (e) {}
+        print_win.print();
+        print_win.close();
+    }
+})()