From d24dd35d265a0b6bd0620285d226b5bed3d4566e Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期四, 11 十二月 2025 19:40:27 +0800
Subject: [PATCH] 大屏提交1:首页、GIS、视频页面

---
 fzzy-igdss-web/src/main/resources/static/group/index.js | 1126 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 1,126 insertions(+), 0 deletions(-)

diff --git a/fzzy-igdss-web/src/main/resources/static/group/index.js b/fzzy-igdss-web/src/main/resources/static/group/index.js
new file mode 100644
index 0000000..6ca7fb2
--- /dev/null
+++ b/fzzy-igdss-web/src/main/resources/static/group/index.js
@@ -0,0 +1,1126 @@
+var nowClientWidth = document.documentElement.clientWidth; // 褰撳墠瑙嗗彛瀹藉害
+var pieVarietyChart = null;   // 鍝佺楗肩姸鍥� -- 绮
+var pieTypeChart = null;      // 鎬ц川楗肩姸鍥� -- 绮
+var pieLevelChart = null;     // 绛夌骇楗肩姸鍥� -- 绮
+var pieYearChart = null;      // 骞翠唤楗肩姸鍥� -- 绮
+var pieAreaChart = null;      // 鍖哄煙楗肩姸鍥� -- 绮
+var hisVarietyChart = null;   // 鍝佺鏌辩姸鍥�
+var deptAreaAllList = null;   // 鎵�鏈夊簱鍖哄垪琛ㄤ俊鎭�
+var deptAreaList = null;      // 瀛樻斁鍒囨崲搴撳尯鍒楄〃淇℃伅
+var companyList = null;       // 鍏徃淇℃伅
+var deptCode = null;          // 褰撳墠闂儊鍦板尯鐨勭紪鐮�
+var timer1;     // 搴撳尯瀹氭椂
+var index1 = 0; // 搴撳尯鍒囨崲涓嬫爣
+var timer2;     // 绮鏁伴噺瀹氭椂
+var index2 = 0; // 绮鏁伴噺鍒囨崲涓嬫爣
+var number2 = 2;// 绮鏁伴噺鍒囨崲鎬绘暟閲�
+var timer3;     // 鍌ㄩ噺楗煎浘瀹氭椂
+var index3 = 0; // 鍌ㄩ噺楗煎浘鍒囨崲涓嬫爣
+var number3 = 2;// 鍌ㄩ噺楗煎浘鍒囨崲鎬绘暟閲�
+
+var mapChart = null;
+var geoMap = [{name: '涔岄瞾鏈ㄩ綈', value: [87.617733, 43.792818]}]; //榛樿鐐逛綅
+var map = chinaMapOutline; //榛樿鍔犺浇鍏ㄥ浗鍦板浘
+$(function () {
+    // 鍒濆鍖栭〉闈�
+    init();
+
+    //鎻愰啋
+    // showTip("鍙屽嚮椤甸潰鏍囪锛屽垏鎹㈠叏灞�");
+});
+
+
+// 鍒濆鍖栭〉闈�
+function init() {
+    // 閫傚簲灞忓箷澶у皬
+    initScrollbar();
+    // 鏃堕棿
+    initTime();
+    // 鍒濆鍖栧浘琛�
+    initChart();
+
+    //鍒濆鍖栧湴鍥�
+    initMap();
+
+    //鍔犺浇鎸囧畾鍦板尯鍦板浘
+    renderMapPoints("鏂扮枂缁村惥灏旇嚜娌诲尯");
+    // 璇锋眰搴撳尯淇℃伅
+    // ajaxDeptArea();
+    // 鑾峰彇鍏徃淇℃伅
+    // ajaxCompany();
+    // 璇锋眰绮鏁伴噺缁熻淇℃伅
+    // ajaxFoodNum();
+    // 璇锋眰鑾峰彇搴撳尯鍔ㄦ�佷俊鎭�
+    // ajaxMsg();
+}
+
+//鍔犺浇搴撳尯鍦板浘浣嶇疆
+function renderMap() {
+    var myChart = mapChart;
+    //娉ㄥ叆鍦板浘杈圭晫
+    echarts.registerMap('chinaMapOutline', map);
+    myChart.option.series[1].data = geoMap;
+    myChart.chart.setOption(myChart.option, true);
+    mapChart = myChart;
+}
+
+//鍔犺浇鎸囧畾鍦板尯鍦板浘鍜岀偣浣�
+function renderMapPoints(areaName) {
+    if(!areaName){
+        return;
+    }
+    var names = areaName.split(",");
+    if(names.length < 1){
+        return;
+    }
+
+    //鏍规嵁闇�瑕佽缃煇涓湴鍖虹殑鍦板浘
+    var all = chinaMap.features;
+    map = {
+        "type": "FeatureCollection",
+        "features": []
+    };
+
+    //榛樿鑾峰彇鐪佷唤鐪佷細鍧愭爣
+    geoMap = [];
+    for (var j = 0; j < names.length; j++) {
+        for (var i = 0; i < all.length; i++) {
+            if(all[i].properties.name == names[j]){
+                map.features.push(all[i]);
+                geoMap.push({
+                    name: all[i].properties.centerName,
+                    value: [all[i].properties.center[0], all[i].properties.center[1], 12]
+                });
+                renderMap();
+                break;
+            }
+        }
+    }
+}
+
+/**
+ * 鍒濆鍖栧姞杞藉湴鍥�
+ * @param areaName 榛樿鍏ㄥ浗鍦板浘
+ */
+function initMap() {
+    var myChart = echarts.init(document.getElementById('map'));
+
+    //娉ㄥ叆鍦板浘杈圭晫
+    echarts.registerMap('chinaMapOutline', map);
+
+    var option = {
+        backgroundColor:'transparent',
+        tooltip: {
+            show: false,
+            trigger: 'item'
+        },
+        geo: {
+            silent: true,
+            map: 'chinaMapOutline',
+            show: false,
+            zoom: 0.8,
+            top: '0%',
+            label: {
+                normal: {
+                    show: false,
+                    textStyle: {
+                        color: '#fff'
+                    }
+                },
+                emphasis: {
+                    textStyle: {
+                        color: '#fff'
+                    }
+                }
+            },
+
+            roam: false,
+            itemStyle: {
+                normal: {
+                    areaColor: {
+                        type: 'linear-gradient',
+                        x: 0.5,
+                        y: 0.5,
+                        r: 0.8,
+                        colorStops: [{
+                            offset: 0,
+                            color: 'rgba(45,68,121,0.15)' // 0% 澶勭殑棰滆壊
+                        },
+                            {
+                                offset: 1,
+                                color: 'rgba(45,68,121,0.18)' // 100% 澶勭殑棰滆壊
+                            }
+                        ],
+                        global: true // 缂虹渷涓� false
+                    },
+                    // areaColor: 'transparent',
+                    borderColor: '#83BAFF',
+                    borderWidth: 1,
+                    shadowColor: 'rgba(56,164,255,.26)',
+                    opacity: 0.5,
+                    shadowOffsetX: 5,
+                    shadowOffsetY: 5,
+                    shadowBlur: 5,
+                    show: true, // 鏄惁鏄剧ず瀵瑰簲鍦板悕
+                    textStyle: {
+                        //瀛椾綋棰滆壊
+                        color: '#797979'
+                    }
+                },
+                emphasis: {
+                    color: 'transparent', //鎮诞鑳屾櫙
+                    textStyle: {
+                        color: '#fff'
+                    }
+                }
+            }
+        },
+        visualMap: {
+            type: 'piecewise',
+            show: false,
+            textStyle: {
+                color: '#fff'
+            },
+            color: ['#68cc5c']
+        },
+        series: [
+            {
+                map: 'chinaMapOutline',
+                silent: true,
+                type: 'map',
+                zoom: 1,
+                label: {
+                    normal: {
+                        show: false,
+                        textStyle: {
+                            color: '#fff'
+                        }
+                    },
+                    emphasis: {
+                        textStyle: {
+                            color: '#fff'
+                        }
+                    }
+                },
+                top: '0%',
+                roam: false,
+                itemStyle: {
+                    normal: {
+                        areaColor: 'rgba(0,255,255,.02)',
+                        borderColor: '#02a5f4',
+                        borderWidth: 1.5,
+                        shadowColor: '#02a5f4',
+                        shadowOffsetX: 0,
+                        shadowOffsetY: 4,
+                        shadowBlur: 10,
+                    },
+                    emphasis: {
+                        areaColor: 'transparent', //鎮诞鑳屾櫙
+                        textStyle: {
+                            color: '#fff'
+                        }
+                    }
+                }
+            },
+            {
+                type: 'effectScatter',
+                coordinateSystem: 'geo',
+                data: geoMap,
+                symbolSize:  function (val) {
+                    return val[2];
+                },
+                rippleEffect: {
+                    color: '#68cc5c'
+                },
+                showEffectOn: 'render',
+                label: {
+                    normal: {
+                        show: true,
+                        position: 'top',
+                        formatter: '{b}',
+                        color: '#ffffff',
+                        fontSize: nowSize(15)
+                    },
+                    emphasis: {
+                        show: false
+                    }
+                },
+                itemStyle: {
+                    emphasis: {
+                        borderColor: '#fff',
+                        borderWidth: 1
+                    }
+                }
+            }
+        ]
+    };
+
+    myChart.setOption( option );
+    mapChart = {"chart": myChart, "option": option};
+}
+
+/**
+ * 鑾峰彇鍏徃淇℃伅
+ */
+function ajaxCompany() {
+    $.ajax({
+        type: "POST",
+        url: "../../visual/index-company",
+        dataType: "json",
+        contentType: "application/json;charset=UTF-8",
+        data: JSON.stringify({
+            "companyId": companyId
+        }),
+        success: function (result) {
+            if (result.code == "0000") {
+                companyList = result.data;
+            }
+        }
+    });
+}
+
+/**
+ * 璇锋眰鑾峰彇鍔ㄦ�佷俊鎭�
+ */
+function ajaxMsg() {
+    $.ajax({
+        type: "POST",
+        url: "../../visual/index-info",
+        dataType: "json",
+        contentType: "application/json;charset=UTF-8",
+        data: JSON.stringify({
+            "companyId": companyId
+        }),
+        success: function (result) {
+            if (result.code == "0000") {
+                renderMsg(result.data);
+            }
+        },
+        error: function (error) {
+
+        }
+    });
+}
+
+// 鏇存柊鍔ㄦ�佷俊鎭�
+function renderMsg(data) {
+    var html = '';
+    var flag = false;
+    var num1 = '';
+    var num7 = '';
+    if (data != null && data.length > 0) {
+        $.each(data, function (index, item) {
+            var deptAreaId = item.deptAreaId;
+            if(item.dailyTotal === 0){
+                num1 = '褰撴棩涓�鍒囨甯�';
+            }else{
+                num1 = '褰撴棩鏁伴噺'+ item.dailyTotal + '涓�';
+            }
+            if(item.warnNum7 === 0){
+                num7 = '杩戜竷澶╀竴鍒囨甯�';
+            }else{
+                num7 = '杩戜竷澶╂暟閲�'+ item.warnNum7 + '涓�';
+            }
+            html += '<div class="panel-content-body-tr">';
+            if (item.level && item.level === "01") {
+                flag = true;
+                // html += '<img src="../../static/images/visual/l1.png"  style="width:10%; height:85%;" alt="">';
+                html += '<span class="body-item sp" style="color: #bc2032;" onclick=\"toAiHome('+'\''+ deptAreaId+'\'' + ')\" >' + item.deptAreaName + '</span>';
+                html += '<span class="body-item sp" style="color: #bc2032;">' + num1 + '</span>';
+                html += '<span class="body-item sp" style="color: #bc2032;">' + num7 + '</span>';
+                // html += '<span class="body-item" style="color: #bc2032; flex: 0.3;">' + item.createTime + '</span>';
+            } else if (item.level && item.level === "02") {
+                flag = true;
+                // html += '<img src="../../static/images/visual/l2.png" style="width:10%; height:85%;" alt="">';
+                html += '<span class="body-item sp" style="color: #f37b3d;" onclick=\"toAiHome('+'\''+ deptAreaId+'\'' + ')\"  >' + item.deptAreaName + '</span>';
+                html += '<span class="body-item sp" style="color: #f37b3d;">' + num1+ '</span>';
+                html += '<span class="body-item sp" style="color: #f37b3d;">' + num7 + '</span>';
+                // html += '<span class="body-item" style="color: #f37b3d; flex: 0.3;">' + item.createTime + '</span>';
+            } else if (item.level && item.level === "03"){
+                flag = true;
+                // html += '<img src="../../static/images/visual/l3.png" style="width:10%; height:85%;" alt="">';
+                html += '<span class="body-item sp"  onclick=\"toAiHome('+'\''+ deptAreaId+'\'' + ')\" >' + item.deptAreaName + '</span>';
+                html += '<span class="body-item sp">' + num1 + '</span>';
+                html += '<span class="body-item sp">' + num7 + '</span>';
+                // html += '<span class="body-item" style="flex: 0.3;">' + item.createTime + '</span>';
+            }else {
+                flag = true;
+                // html += '<img src="../../static/images/visual/l3.png" style="width:10%; height:85%;" alt="">';
+                html += '<span class="body-item sp"  onclick=\"toAiHome('+'\''+ deptAreaId+'\'' + ')\" >' + item.deptAreaName + '</span>';
+                html += '<span class="body-item sp">' + num1 + '</span>';
+                html += '<span class="body-item sp">' + num7 + '</span>';
+                // html += '<span class="body-item" style="flex: 0.3;">' + item.createTime + '</span>';
+            }
+            html += '</div>';
+        })
+    } else {
+        if (deptAreaList != null && deptAreaList.length > 0) {
+            $.each(deptAreaList, function (index, item) {
+                html += '<div class="panel-content-body-tr">';
+                html += '<span class="body-item sp">' + item.name + '</span>';
+                html += '<span class="body-item sp">' + '褰撴棩鍒嗘瀽涓�鍒囨甯�' + '</span>';
+                html += '<span class="body-item" style="flex: 0.3;">' + formatDate('mm/dd', new Date()) + '</span>';
+                html += '</div>';
+            });
+        }
+    }
+    $("#panel-title").html('鐩戠鍔ㄦ�佷俊鎭�  <i class="dot"></i>');
+    $("#inventoryInfo").html(html);
+}
+
+/**
+ * 璺宠浆鑷冲悗鍙伴璀﹂〉闈�
+ * @param deptAreaId
+ */
+function toAiHome(deptAreaId) {
+    var url = "../home?t=WarnInfo&deptAreaId="+deptAreaId;
+    window.parent.open(url, "_self");
+}
+
+/**
+ * 璇锋眰鑾峰彇搴撳尯鐩稿叧淇℃伅
+ */
+function ajaxDeptArea() {
+    // $.ajax({
+    //     type: "POST",
+    //     url: "../../visual/index-dept-area",
+    //     dataType: "json",
+    //     contentType: "application/json;charset=UTF-8",
+    //     data: JSON.stringify({
+    //         "companyId": companyId
+    //     }),
+    //     success: function (result) {
+    //         if (result.code == "0000") {
+    //             deptAreaAllList = result.data;
+    //             getChangeDeptArea(null);
+    //         }
+    //     },
+    //     error: function (error) {
+    //
+    //     }
+    // });
+
+    //鍔犺浇搴撳尯鍦板浘
+    geoMap = updateDeptMap();
+    renderMap();
+}
+
+function updateDeptMap() {
+    var points = [];
+    $.each(deptList, function(index, item) {
+        var val = [];
+        var name = '';
+        // if(index == deptNum){
+        //     name = item.name;
+        //     val = [item.lon, item.lat, 17];
+        // }else {
+            val = [item.jd, item.wd, 8];
+        // }
+        points.push({
+            name: name,
+            value: val
+        });
+    });
+    return points;
+}
+
+/* ---------- 鑾峰彇瑕佸垏鎹㈠簱鍖虹殑鏁版嵁淇℃伅 ---------- */
+function getChangeDeptArea(id) {
+    deptAreaList = [];
+    index1 = 0;
+    clearInterval(timer1);
+
+    if (id) {
+        if (id === "511400") {
+            deptAreaList = deptAreaAllList;
+        } else {
+            if (deptAreaAllList != null && deptAreaAllList.length > 0) {
+                $.each(deptAreaAllList, function (index, item) {
+                    if (id.length > 6 && id == item.deptCompany) {
+                        deptAreaList.push(item);
+                    }
+                    if (id.length == 6 && id == item.deptCounty) {
+                        deptAreaList.push(item);
+                    }
+                })
+            }
+        }
+    } else {
+        deptAreaList = deptAreaAllList;
+    }
+
+    deptAreaSwitch();
+}
+
+/* ---------- 搴撳尯瀹氭椂鍒囨崲 ---------- */
+function deptAreaSwitch() {
+    timer1 = setInterval(function () {
+        if (index1 == deptAreaList.length) {
+            index1 = 0;
+        }
+
+        renderDeptArea();
+
+        index1 += 1;
+
+    }, 3000);
+}
+
+// 鏇存柊搴撳尯淇℃伅
+function renderDeptArea() {
+
+    if (deptAreaList == null || deptAreaList.length <= 0) {
+        return;
+    }
+
+    $("#cityAndCounty").html(deptAreaList[index1].deptCityName + "-" + deptAreaList[index1].deptCountyName);
+    $("#deptAreaName").html(deptAreaList[index1].name);
+    $("#depotNum").html(deptAreaList[index1].depotNum == null ? "0" : deptAreaList[index1].depotNum);
+    $("#depotOilNum").html(deptAreaList[index1].depotOilNum == null ? "0" : deptAreaList[index1].depotOilNum);
+
+    if (deptAreaList[index1].storageStr.length > 9
+        || deptAreaList[index1].oilStorageStr.length > 9
+        || deptAreaList[index1].areaStr.length > 9) {
+        $("#foodNum").css("font-size", "28px");
+        $("#oilNum").css("font-size", "28px");
+        $("#area").css("font-size", "28px");
+    } else if(deptAreaList[index1].storageStr.length > 5
+        || deptAreaList[index1].oilStorageStr.length > 5
+        || deptAreaList[index1].areaStr.length > 5){
+        $("#foodNum").css("font-size", "30px");
+        $("#oilNum").css("font-size", "30px");
+        $("#area").css("font-size", "30px");
+    } else {
+        $("#foodNum").css("font-size", "46px");
+        $("#oilNum").css("font-size", "46px");
+        $("#area").css("font-size", "46px");
+    }
+    $("#foodNum").html(deptAreaList[index1].storageStr);
+    $("#oilNum").html(deptAreaList[index1].oilStorageStr);
+    $("#area").html(deptAreaList[index1].areaStr);
+
+    if (deptCode) {
+        $("#" + deptCode).removeClass("kuqu-h");
+    }
+    deptCode = deptAreaList[index1].deptCounty;
+    $("#" + deptCode).addClass("kuqu-h");
+}
+
+/**
+ * 璇锋眰鑾峰彇鐩稿叧鏁伴噺淇℃伅
+ */
+function ajaxFoodNum() {
+    $.ajax({
+        type: "POST",
+        url: "../../visual/index-food-number",
+        dataType: "json",
+        contentType: "application/json;charset=UTF-8",
+        data: JSON.stringify({
+            "companyId": companyId
+        }),
+        success: function (result) {
+            if (result.code == "0000") {
+                var data = result.data;
+                renderFoodNum(data);
+            }
+        },
+        error: function (error) {
+
+        }
+    });
+}
+
+// 鏇存柊搴撳尯淇℃伅
+function renderFoodNum(data) {
+
+    if (!data) {
+        return;
+    }
+
+    /*----- 鐩戠搴撶偣淇℃伅 -----*/
+    $("#companyNum").html(data.companyNum);
+    $("#deptAreaNum").html(data.deptAreaNum);
+    $("#depotSum").html(data.depotNum);
+
+    /*----- 鐩戠鏁伴噺淇℃伅 -----*/
+    if (data.foodSum.length > 8 || data.oilSum.length > 8) {
+        $("#foodSum").css("font-size", "32px");
+        $("#oilSum").css("font-size", "32px");
+    }
+    $("#foodSum").html(data.foodSum);
+    $("#oilSum").html(data.oilSum);
+
+    if (data.goodsFoodSum.length > 8 || data.goodsOilSum.length > 8) {
+        $("#goodsFoodSum").css("font-size", "32px");
+        $("#goodsOilSum").css("font-size", "32px");
+    }
+    $("#goodsFoodSum").html(data.goodsFoodSum);
+    $("#goodsOilSum").html(data.goodsOilSum);
+
+
+    /*----- 鍒嗗搧绉嶆煴鐘跺浘 -----*/
+    if (data.xaxis.length > 0 && data.seriesData.length > 0) {
+        var hisFoodVariety = hisVarietyChart;
+        hisFoodVariety.option.xAxis.data = data.xaxis;
+        hisFoodVariety.option.series[0].data = data.seriesData;
+        hisFoodVariety.chart.setOption(hisFoodVariety.option, true);
+        hisVarietyChart = hisFoodVariety;
+    }
+
+    /*----- 楗煎浘 -----*/
+    // 鍝佺 -- 绮
+    if (data.varietyChartPie.length > 0) {
+        var varietyChart = pieVarietyChart;
+        varietyChart.option.series[0].data = data.varietyChartPie;
+        varietyChart.chart.setOption(varietyChart.option, true);
+        pieVarietyChart = varietyChart;
+    }
+    // 鎬ц川 -- 绮
+    if (data.typeChartPie.length > 0) {
+        var typeChart = pieTypeChart;
+        typeChart.option.series[0].data = data.typeChartPie;
+        typeChart.chart.setOption(typeChart.option, true);
+        pieTypeChart = typeChart;
+    }
+    // 绛夌骇 -- 绮
+    if (data.levelChartPie.length > 0) {
+        var levelChart = pieLevelChart;
+        levelChart.option.series[0].data = data.levelChartPie;
+        levelChart.chart.setOption(levelChart.option, true);
+        pieLevelChart = levelChart;
+    }
+    // 骞翠唤 -- 绮
+    if (data.yearChartPie.length > 0) {
+        var yearChart = pieYearChart;
+        yearChart.option.series[0].data = data.yearChartPie;
+        yearChart.chart.setOption(yearChart.option, true);
+        pieYearChart = yearChart;
+    }
+    // 鍖哄煙 -- 绮
+    if (data.areaChartPie.length > 0) {
+        var areaChart = pieAreaChart;
+        areaChart.option.series[0].data = data.areaChartPie;
+        areaChart.chart.setOption(areaChart.option, true);
+        pieAreaChart = areaChart;
+    }
+
+    // 绮鐩戠鏁伴噺鍒囨崲
+    foodNumSwitch();
+    // 绮楗煎浘鍒囨崲
+    pieChartSwitch();
+}
+
+/* ---------- 绮鏁伴噺鐩戠鍒囨崲 ---------- */
+function foodNumSwitch() {
+    $(".lb-body .right-topInfo-jg").eq(0).show().siblings().hide();
+    StartLunbo();
+
+    $(".lb-tab").hover(function () {
+        clearInterval(timer2);
+        index2 = $(this).index();
+        ShowPicTab();
+    }, function () {
+        StartLunbo();
+    });
+
+    $(".lb-btn1").click(function () {
+        clearInterval(timer2);
+        index2--;
+        if (index2 == -1) {
+            index2 = number2 - 1;
+        }
+
+        ShowPicTab();
+        StartLunbo();
+    });
+
+    $(".lb-btn2").click(function () {
+        clearInterval(timer2);
+        index2++;
+        if (index2 == number2) {
+            index2 = 0;
+        }
+        ShowPicTab();
+        StartLunbo();
+    });
+}
+
+function ShowPicTab() {
+    if (index2 === 0) {
+        $("#foodNumTitle").html("鍌ㄥ绮补");
+    } else if (index2 === 1) {
+        $("#foodNumTitle").html("鍟嗗搧绮补");
+    }
+    // else if (index2 === 2) {
+    //     $("#foodNumTitle").html("灏忓寘瑁呯伯娌�");
+    // }
+    $(".lb-body .right-topInfo-jg").eq(index2).fadeIn(300).siblings().fadeOut(300);
+    $(".lb-tab").eq(index2).addClass("bg").siblings().removeClass("bg");
+}
+
+function StartLunbo() {
+    timer2 = setInterval(function () {
+        index2++;
+        if (index2 >= number2) {
+            index2 = 0;
+        }
+        ShowPicTab();
+    }, 3000);
+}
+
+/* ---------- 绮楗煎浘鍒囨崲 ---------- */
+function pieChartSwitch() {
+    $(".tubiao-Carousel .stats-chart-box").eq(0).show().siblings().hide();
+    StartCarousel();
+
+    $(".carousel-tab").hover(function () {
+        clearInterval(timer3);
+        index3 = $(this).index();
+        ShowTubiao();
+
+    }, function () {
+        StartCarousel();
+    });
+
+    $(".carousel-btn1").click(function () {
+        clearInterval(timer3);
+        index3--;
+        if (index3 == -1) {
+            index3 = number3 - 1;
+        }
+
+        ShowTubiao();
+        StartCarousel();
+    });
+
+    $(".carousel-btn2").click(function () {
+        clearInterval(timer3);
+        index3++;
+        if (index3 == number3) {
+            index3 = 0;
+        }
+        ShowTubiao();
+        StartCarousel();
+    });
+}
+
+function ShowTubiao() {
+    if (index3 === 0) {
+        $("#pieCharTitle").html("绮鏁伴噺缁熻(鍚�)");
+    } else if (index3 === 1) {
+        $("#pieCharTitle").html("娌硅剛鏁伴噺缁熻(鍚�)");
+    }
+    $(".tubiao-Carousel .stats-chart-box").eq(index3).fadeIn(300).siblings().fadeOut(300);
+    $(".carousel-tab").eq(index3).addClass("bg").siblings().removeClass("bg");
+}
+
+function StartCarousel() {
+    timer3 = setInterval(function () {
+        index3++;
+        if (index3 >= number3) {
+            index3 = 0;
+        }
+        ShowTubiao();
+    }, 3000);
+}
+
+// 鍒锋柊鏃堕棿
+function initTime() {
+    setInterval(function () {
+        $("#navBarDate").html(formatDate('mm鏈坉d鏃�', new Date()));
+        $("#navBarTime").html(formatDate('HH:MM:SS', new Date()));
+        $("#navBarWeek").html(getWeekDate());
+    }, 1000);
+}
+
+/**
+ * 鍒濆鍖栧睆骞曞ぇ灏�
+ */
+function initScrollbar() {
+
+    if (pieVarietyChart) {
+        pieVarietyChart.resize();
+    }
+
+    if (pieTypeChart) {
+        pieTypeChart.resize();
+    }
+
+    if (pieLevelChart) {
+        pieLevelChart.resize();
+    }
+
+    if (pieYearChart) {
+        pieYearChart.resize();
+    }
+
+    if (pieAreaChart) {
+        pieAreaChart.resize();
+    }
+
+    if (hisVarietyChart) {
+        hisVarietyChart.resize();
+    }
+
+    setInterval(function () {
+        if (!hasScrollbar()) {
+            document.getElementById('inventoryInfoBox').scrollTop = 0;
+        } else {
+            if (document.getElementById('inventoryInfoBox').scrollTop >= (document.getElementById('inventoryInfo').clientHeight - document.getElementById('inventoryInfoBox').clientHeight)) {
+                document.getElementById('inventoryInfoBox').scrollTop = 0;
+            } else {
+                document.getElementById('inventoryInfoBox').scrollTop++;
+            }
+        }
+    }, 60);
+}
+
+/**
+ * 鍒ゆ柇搴曢儴鏄惁鍑虹幇婊氬姩鏉�
+ *
+ * @return {boolean}
+ */
+function hasScrollbar() {
+    return document.getElementById('inventoryInfo').clientHeight > document.getElementById('inventoryInfoBox').clientHeight;
+}
+
+// 鍒濆鍖栧浘琛�
+function initChart() {
+
+    /* 搴撳瓨鍥捐〃鍔犺浇 */
+    allInventoryChartLoad(
+        ['灏忛害', '鐜夌背', '绋昏胺', '鎴愬搧绮�',  '鎴愬搧娌�', '鍏朵粬'],
+        [1000, 1200, 1500, 1300, 1100, 1600]
+    );
+
+    /* 鍝佺 - 绮 */
+    pieChartLoad(
+        [
+            {value: 0, name: '绋昏胺'},
+            {value: 0, name: '鐜夌背'},
+            {value: 0, name: '灏忛害'}
+        ],
+        'pieVarietyChart'
+    );
+    /* 鎬ц川 - 绮 */
+    pieChartLoad(
+        [
+            {value: 0, name: '鐪佺骇鍌ㄥ'},
+            {value: 0, name: '甯傜骇鍌ㄥ'},
+            {value: 0, name: '鍘跨骇鍌ㄥ'}
+        ],
+        'pieTypeChart'
+    );
+    /* 绛夌骇 - 绮 */
+    pieChartLoad(
+        [
+            {value: 0, name: '涓�绛�'},
+            {value: 0, name: '浜岀瓑'},
+            {value: 0, name: '涓夌瓑'},
+            {value: 0, name: '鍥涚瓑'},
+            {value: 0, name: '浜旂瓑'},
+            {value: 0, name: '绛夊'}
+        ],
+        'pieLevelChart'
+    );
+    /* 骞翠唤 - 绮 */
+    pieChartLoad(
+        [
+            {value: 0, name: '2019'},
+            {value: 0, name: '2020'},
+            {value: 0, name: '2021'},
+            {value: 0, name: '2022'},
+            {value: 0, name: '2023'}
+
+        ],
+        'pieYearChart'
+    );
+    /* 鍦板煙 - 绮 */
+    pieChartLoad(
+        [
+            {value: 0, name: '2019'},
+            {value: 0, name: '2020'},
+            {value: 0, name: '2021'},
+            {value: 0, name: '2022'},
+            {value: 0, name: '2023'}
+        ], 'pieAreaChart'
+    );
+}
+
+/**
+ * 鏌辩姸鍥惧姞杞�
+ *
+ * @param names
+ * @param data
+ */
+function allInventoryChartLoad(names, data) {
+    var dom = document.getElementById('allInventoryChart');
+    var myChart = echarts.init(dom);
+
+    var options = {
+        grid: {
+            left: '2%',
+            right: '1%',
+            bottom: '1%',
+            top: '15%',
+            containLabel: true
+        },
+        tooltip: {
+            show: true,
+        },
+        xAxis: {
+            type: 'category',
+            // 缃戞牸鏍峰紡
+            splitLine: {
+                show: false,
+            },
+            axisLine: {
+                show: true,
+                lineStyle: {
+                    color: "#39c9ff"
+                }
+            },
+            axisTick: {
+                show: false,
+            },
+            axisLabel: {
+                textStyle: {
+                    color: '#ffffff',
+                    fontSize: nowSize(16),
+                },
+                interval: 0,
+                margin: nowSize(15),
+            },
+            data: names,
+        },
+        yAxis: {
+            type: 'value',
+            // 缃戞牸鏍峰紡
+            splitLine: {
+                show: false,
+            },
+            axisLine: {
+                show: false,
+            },
+            axisTick: {
+                show: false,
+            },
+            axisLabel: {
+                show: false,
+            },
+        },
+        series: [{
+            name: '',
+            data: data,
+            type: 'bar',
+            barWidth: '40%',
+            label: {
+                show: true,
+                position: 'top',
+                color: '#ffffff',
+                fontSize: nowSize(12),
+                distance: 0,
+                lineHeight: nowSize(25),
+            },
+            // showBackground: false,
+            // backgroundStyle: {
+            // color: 'rgba(16,52,94,0.41)',
+            // },
+            itemStyle: {
+                normal: {
+                    color: function (params) {
+                        var colorList = [
+                            new echarts.graphic.LinearGradient(
+                                0, 1, 0, 0,
+                                [{offset: 0, color: '#ff5600'}, {offset: 1, color: '#f27f44'}]
+                            ),
+                            new echarts.graphic.LinearGradient(
+                                0, 1, 0, 0,
+                                [{offset: 0, color: '#ffb335'}, {offset: 1, color: '#ffcc77'}]
+                            ),
+                            new echarts.graphic.LinearGradient(
+                                0, 1, 0, 0,
+                                [{offset: 0, color: '#08e53e'}, {offset: 1, color: '#59ff81'}]
+                            ),
+                            new echarts.graphic.LinearGradient(
+                                0, 1, 0, 0,
+                                [{offset: 0, color: '#02a5f4'}, {offset: 1, color: '#60cbff'}]
+                            ),
+                            new echarts.graphic.LinearGradient(
+                                0, 1, 0, 0,
+                                [{offset: 0, color: '#0a43bc'}, {offset: 1, color: '#3571f0'}]
+                            ),
+                            new echarts.graphic.LinearGradient(
+                                0, 1, 0, 0,
+                                [{offset: 0, color: '#af1f2e'}, {offset: 1, color: '#ef3476'}]
+                            )
+                        ];
+
+                        return colorList[params.dataIndex]
+                    }
+                }
+            }
+        }]
+    };
+    myChart.setOption(options);
+    hisVarietyChart = {"chart": myChart, "option": options};
+}
+
+/**
+ * 楗煎浘鍔犺浇
+ *
+ * @param obj
+ * @param id
+ */
+function pieChartLoad(data, id) {
+    var dom = document.getElementById(id);
+    var pieChart = echarts.init(dom);
+
+    var option = {
+        tooltip: {
+            trigger: 'item'
+        },
+        legend: {
+            bottom: 10,
+            right: 10,
+            left: 10,
+            textStyle: {
+                color: '#fff',
+                fontSize: 12
+            },
+            itemWidth: 8,
+            itemHeight: 8,
+            icon: "circle",
+            // 浣跨敤鍥炶皟鍑芥暟
+            formatter:function(name) {
+
+                var than = option.series[0].data;
+                var total = 0;
+                var tarValue;
+                for (var i = 0, l = than.length; i < l; i++) {
+                    total += Number(than[i].value);
+                    if (than[i].name == name) {
+                        tarValue = Number(than[i].value);
+                    }
+                }
+                var p = 0.0;
+                if(total > 0){
+                    p = (tarValue / total) * 100;
+                }
+                return name + " " + " " + p.toFixed(2) + "%";
+            }
+        },
+
+        color: ['#26a2cf', '#d36b37', '#d49327', '#2d6be9', '#36b994', '#bc2032', '#d3614f'],
+        series: [
+            {
+                name: '',
+                type: 'pie',
+                radius: ['20%', '50%'],
+                center: ['center', '30%'],
+                avoidLabelOverlap: false,
+                itemStyle: {
+                    borderRadius: 10,
+                    borderColor: '#041636',
+                    borderWidth: 8,
+                },
+                label: {
+                    show: false,
+                    color: '#fff',
+                    formatter: '{b}\n{d}%',
+                    fontSize: nowSize(16),
+                    lineHeight: nowSize(25),
+                },
+                labelLine: {
+                    show: true,
+                    lineStyle: {
+                        cap: 'round',
+                    }
+                },
+                data: data
+            }
+        ]
+    };
+
+    pieChart.setOption(option);
+
+    if (id === 'pieVarietyChart') {
+        pieVarietyChart = {"chart": pieChart, "option": option};
+    } else if (id === 'pieTypeChart') {
+        pieTypeChart = {"chart": pieChart, "option": option};
+    } else if (id === 'pieLevelChart') {
+        pieLevelChart = {"chart": pieChart, "option": option};
+    } else if (id === 'pieYearChart') {
+        pieYearChart = {"chart": pieChart, "option": option};
+    } else if (id === 'pieAreaChart') {
+        pieAreaChart = {"chart": pieChart, "option": option};
+    }
+}
+
+/**
+ * 鎹㈢畻鏂规硶
+ *
+ * @param val
+ * @param initWidth
+ * @return {number}
+ */
+nowSize = function (val) {
+    var initWidth = 1920;
+    return val * (nowClientWidth / initWidth);
+};
+
+/**
+ * 鏍煎紡鍖栨棩鏈�
+ *
+ * @param fmt
+ * @param date
+ * @return {*}
+ */
+function formatDate(fmt, date) {
+    var ret;
+    var opt = {
+        "Y+": date.getFullYear().toString(),        // 骞�
+        "m+": (date.getMonth() + 1).toString(),     // 鏈�
+        "d+": date.getDate().toString(),            // 鏃�
+        "H+": date.getHours().toString(),           // 鏃�
+        "M+": date.getMinutes().toString(),         // 鍒�
+        "S+": date.getSeconds().toString()          // 绉�
+        // 鏈夊叾浠栨牸寮忓寲瀛楃闇�姹傚彲浠ョ户缁坊鍔狅紝蹇呴』杞寲鎴愬瓧绗︿覆
+    };
+    for (var k in opt) {
+        ret = new RegExp("(" + k + ")").exec(fmt);
+        if (ret) {
+            fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
+        }
+    }
+    return fmt;
+}
+
+/**
+ * 鑾峰彇褰撳墠鏄熸湡鍑�
+ */
+function getWeekDate() {
+    var now = new Date();
+    var day = now.getDay();
+    var weeks = new Array("鏄熸湡鏃�", "鏄熸湡涓�", "鏄熸湡浜�", "鏄熸湡涓�", "鏄熸湡鍥�", "鏄熸湡浜�", "鏄熸湡鍏�");
+    var week = weeks[day];
+    return week;
+}
+
+// 鍙充笅瑙掓彁閱掍俊鎭�
+function showTip(msg) {
+    layer.open({
+        // type: 1,
+        btn: null,
+        title: "鎻愮ず",
+        skin: 'layui-layer-lan',
+        content: msg,
+        // offset: 'rb',
+        offset: 'rt',
+        time: 1500,
+        area: ['250px', '120px'],
+        anim: 1,
+        // shade: false,
+        shadeClose: true
+    });
+}

--
Gitblit v1.9.3