Browse Source

efAnalysisdataVisualization eleFire.js 韩正义 commit at 2020-09-03

韩正义 4 years ago
parent
commit
065694d853
1 changed files with 95 additions and 0 deletions
  1. 95 0
      efAnalysisdataVisualization/externalJs/eleFire.js

+ 95 - 0
efAnalysisdataVisualization/externalJs/eleFire.js

@@ -0,0 +1,95 @@
+/* 
+     电气火灾数据对接
+*/
+
+
+//建筑下拉
+getNameList();
+
+function getNameList(queryParam = {}) {
+
+    ajaxRequest(GET_NAME_LIST_DATA, "POST", queryParam, function(result) {
+        let data = result.RESULT;
+        let items = '';
+
+        data.forEach(function(item, key) {
+
+            items += `<option value="${item.owner_id}">${item.owner_name}</option>`
+
+        })
+        $('#building').html(items);
+
+    }, function(errorMsg) {
+        // alert("请求数据失败!");
+    }, 2)
+};
+
+//日期筛选
+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)
+
+});
+
+// 数据请求传参
+getListData(getSearchParamObj());
+
+function getListData(queryParam = {}) {
+
+    ajaxRequest(ELE_FIRE_DATA, "POST", queryParam, function(result) {
+
+        if (result.totalCount != 0) {
+
+            /* 
+                 主页面数据对接 start
+            */
+
+            //数据统计
+            var data_statistics = result.RESULT[0].data_statistics;
+            $('.total').html(data_statistics.alarm_number);
+            $('.solved').html(data_statistics.processing_number);
+            $('.unsolve').html(data_statistics.unprocessed_number);
+
+            // 环状饼图定制 (数据统计计算)
+            (function() {
+                // 实例化对象
+                var myChart = echarts.init(document.querySelector(".bar-3d .chart"));
+
+                // 生成扇形的曲面参数方程,用于 series-surface.parametricEquation
+                function getParametricEquation(startRatio, endRatio, isSelected, isHovered, k, height) {
+
+                    // 计算
+                    let midRatio = (startRatio + endRatio) / 2;
+
+                    let startRadian = startRatio * Math.PI * 2;
+                    let endRadian = endRatio * Math.PI * 2;
+                    let midRadian = midRatio * Math.PI * 2;
+
+                    // 如果只有一个扇形,则不实现选中效果。
+                    if (startRatio === 0 && endRatio === 1) {
+                        isSelected = false;
+                    }
+
+                    // 通过扇形内径/外径的值,换算出辅助参数 k(默认值 1/3)
+                    k = typeof k !== 'undefined' ? k : 1 / 3;
+