From 3ba9f3eb694f94bd0cfbb788ea256b7f3b3909ab Mon Sep 17 00:00:00 2001
From: xiebin <123456>
Date: Mon, 13 Feb 2023 17:27:41 +0800
Subject: [PATCH] 1.解决风景区子类勾选事件BUG 2.解决监测站子类勾选事件BUG

---
 widgets/RiskEarlyWarning/Widget.js |  474 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 421 insertions(+), 53 deletions(-)

diff --git a/widgets/RiskEarlyWarning/Widget.js b/widgets/RiskEarlyWarning/Widget.js
index 6c4e8ae..42346d2 100644
--- a/widgets/RiskEarlyWarning/Widget.js
+++ b/widgets/RiskEarlyWarning/Widget.js
@@ -502,64 +502,120 @@
                 $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) ul input').click(function (event) {
                     event.stopPropagation();
                     if (event.target == event.currentTarget) {
+                        var time = that.getTime()
                         var timeAvailable = that.getTimeAvailable();
-                        $('#riskEarlyWarningDateChoice').val(that.getCurrentTime());
+                        // $('#riskEarlyWarningDateChoice').val(that.getCurrentTime());
                         $('.jimu-widget-RiskEarlyWarning .risk-early-warning-top .text-content-box > div:eq(0) p').scrollTop(0);
                         // 水位勾选的事件函数
                         if ($(this).parent().index() == 0) {
                             // 勾选
                             if ($(this).prop('checked') == true) {
                                 // 实时预测启用
-                                that.layerLoad();
-                                that.btnInd = 1;
-                                $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) div button').prop('disabled', false);
-                                $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) div button:eq(0)').addClass('navli-clk-change').siblings().removeClass('navli-clk-change');
-                                $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1)>div>div>div').text('实时').css('left', 0).stop().show();
-                                loading();
-                                $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .early-warning-image .fjqswtl').stop().show();
-                                that.flagone = true;
-                                that.flag = false;
-                                that.excelFileName = '风景区水位' + '.xlsx';
-                                that.scenicSpot(timeAvailable.month, timeAvailable.dateTime);
-                                that.childrenShowOne();
+                                that.layerLoad()
+                                loading()
+                                $('#fjqsw_tl').stop().show()
+                                that.flagone = true
+                                that.excelFileName = '风景区水位' + '.xlsx'
+
+                                // 实时与预测都无选中效果
+                                if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) div button:eq(0)').hasClass('navli-clk-change') == false
+                                    && $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) div button:eq(1)').hasClass('navli-clk-change') == false) {
+                                    // 水库站加载实时函数
+                                    that.scenicSpot(timeAvailable.month, timeAvailable.dateTime)
+                                    that.btnInd = 1
+                                    that.flag = false
+                                    $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) div button').prop('disabled', false)
+                                    $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) div button:eq(0)').addClass('navli-clk-change')
+                                    $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1)>div>div>div').text('实时').css('left', 0).stop().show()
+                                }
+                                // 实时与预测其中有一个有选中效果
+                                else {
+                                    // 实时有选中效果
+                                    if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) div button:eq(0)').hasClass('navli-clk-change')) {
+                                        // 水库站加载实时函数
+                                        that.scenicSpot(timeAvailable.month, timeAvailable.dateTime)
+                                    }
+                                    // 预测有选中效果
+                                    else if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) div button:eq(1)').hasClass('navli-clk-change')) {
+                                        // 水库站加载预测函数
+                                        that.forecastScenicSpot(time)
+                                    }
+                                }
+                                that.childrenShowOne()
                             }
                             // 未勾选
                             else {
-                                $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .early-warning-image .fjqswtl').stop().hide();
+                                $('#fjqsw_tl').stop().hide()
                                 that.flagone = false;
+                                that.clearOneAll();
                                 // 判断风景区雨量站是否预警
                                 if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) ul li:eq(1) input').prop('checked') == true) {
-                                    that.childrenShowTwo();
-                                    that.excelFileName = '风景区雨量' + '.xlsx';
-                                    that.showLibraryOrDate();
+                                    that.childrenShowTwo()
+                                    that.excelFileName = '风景区雨量' + '.xlsx'
+                                    // 判断是实时还是预测
+                                    if (that.btnInd == 1) {
+                                        that.showLibraryOrDate()
+                                    } else if (that.btnInd == 2) {
+                                        that.hideLibraryOrDate('风景区雨量')
+                                    }
                                 } else {
-                                    that.excelFileName = '未选中.xlsx';
+                                    closeRealTime(1)
+                                    that.excelFileName = '未选中.xlsx'
                                 }
-                                closeRealTime(1);
-                                // 清除自身
-                                that.clearOneAll();
                             }
                         }
                         // 雨量勾选的事件函数
                         else if ($(this).parent().index() == 1) {
                             // 勾选
                             if ($(this).prop('checked') == true) {
-                                that.layerLoad();
+                                // 实时预测启用
+                                that.layerLoad()
                                 loading();
                                 $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .early-warning-image .fjqyltl').stop().show();
                                 that.flagtwo = true;
                                 that.excelFileName = '风景区雨量' + '.xlsx';
-                                that.rainfallInScenicSpots(timeAvailable.changeTime);
+                                // 实时与预测都无选中效果
+                                if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) div button:eq(0)').hasClass('navli-clk-change') == false
+                                    && $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) div button:eq(1)').hasClass('navli-clk-change') == false) {
+                                    // 水库站加载实时函数
+                                    that.rainfallInScenicSpots(timeAvailable.changeTime)
+                                    that.btnInd = 1
+                                    that.flag = false
+                                    $('#nav_menu>li:eq(1) div button').prop('disabled', false)
+                                    $('#nav_menu>li:eq(1) div button:eq(0)').addClass('navli-clk-change')
+                                    $('#nav_menu>li:eq(1)>div>div>div').text('实时').css('left', 0).stop().show()
+                                }
+                                // 实时与预测其中有一个有选中效果
+                                else {
+                                    // 实时有选中效果
+                                    if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) div button:eq(0)').hasClass('navli-clk-change')) {
+                                        // 水库站加载实时函数
+                                        that.rainfallInScenicSpots(timeAvailable.changeTime)
+                                    }
+                                    // 预测有选中效果
+                                    else if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) div button:eq(1)').hasClass('navli-clk-change')) {
+                                        // 水库站加载预测函数
+                                        that.forecastRainfallInScenicSpots(time.current)
+                                    }
+                                }
                                 that.childrenShowTwo();
                             }
                             // 未勾选
                             else {
                                 $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .early-warning-image .fjqyltl').stop().hide();
-                                that.flagtwo = false;
-                                // 清除自身
-                                that.clearTwoAll();
+                                that.flagtwo = false
+                                that.clearTwoAll()
                                 if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) ul li:eq(0) input').prop('checked') == true) {
-                                    that.childrenShowOne();
+                                    that.childrenShowOne()
+                                    that.excelFileName = '风景区水位' + '.xlsx'
+                                    if (that.btnInd == 1) {
+                                        that.showLibraryOrDate()
+                                    } else if (that.btnInd == 2) {
+                                        that.hideLibraryOrDate('风景区水位')
+                                    }
+                                } else {
+                                    closeRealTime(1)
+                                    that.excelFileName = '未选中.xlsx'
                                 }
                             }
                         }
@@ -578,10 +634,15 @@
                         loading();
                         $(this).addClass('navli-clk-change').siblings().removeClass('navli-clk-change');
                         that.clearOneAll();
+                        that.clearTwoAll();
                         if ($(this).index() == 0) {
                             that.showLibraryOrDate();
                         } else {
-                            that.hideLibraryOrDate();
+                            if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) ul li:eq(0) input').prop('checked') == true) {
+                                that.hideLibraryOrDate('风景区水位')
+                            } else if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) ul li:eq(1) input').prop('checked') == true) {
+                                that.hideLibraryOrDate('风景区雨量')
+                            }
                         }
                         // 实时
                         if ($(this).index() == 1) {
@@ -595,12 +656,18 @@
                         }
                         // 预测
                         else if ($(this).index() == 2) {
+                            console.log(1);
                             that.flag = true;
                             $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1)>div>div>div').stop().animate({left: '50%'}, 200, 'linear', function () {
                                 $(this).text('预测');
+                                console.log(2);
                             });
                             if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) ul li:eq(0) input').prop('checked') == true) {
                                 that.forecastScenicSpot(time);
+                                console.log(3);
+                            }
+                            if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(1) ul li:eq(1) input').prop('checked') == true) {
+                                that.forecastRainfallInScenicSpots(time.current)
                             }
                         }
                         that.btnInd = $(this).index();
@@ -618,18 +685,37 @@
                         if ($(this).parent().index() == 0) {
                             // 勾选
                             if ($(this).prop('checked') == true) {
-                                that.layerLoad();
-                                loading();
+                                that.layerLoad()
+                                loading()
+                                $('#ylz_tl').stop().show()
+                                that.flagone = true
+                                that.excelFileName = '雨量站' + '.xlsx'
                                 $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .early-warning-image .ylztl').stop().show();
-                                that.flagone = true;
-                                that.excelFileName = '雨量站' + '.xlsx';
-                                // 雨量站加载函数
-                                that.rainfallStation(timeAvailable.dateTime);
-                                that.childrenShowOne();
-                                // 判断水库站和河道站是否勾选,确定是否禁用实时,预测
-                                if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) ul li:eq(1) input').prop('checked') == false && $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) ul li:eq(2) input').prop('checked') == false) {
-                                    closeRealTime(2);
+                                // 实时与预测都无选中效果
+                                if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) div button:eq(0)').hasClass('navli-clk-change') == false
+                                    && $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) div button:eq(1)').hasClass('navli-clk-change') == false) {
+                                    // 水库站加载实时函数
+                                    that.rainfallStation(timeAvailable.dateTime)
+                                    that.btnInd = 1
+                                    that.flag = false
+                                    $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) div button').prop('disabled', false)
+                                    $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) div button:eq(0)').addClass('navli-clk-change')
+                                    $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2)>div>div>div').text('实时').css('left', 0).stop().show()
                                 }
+                                // 实时与预测其中有一个有选中效果
+                                else {
+                                    // 实时有选中效果
+                                    if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) div button:eq(0)').hasClass('navli-clk-change')) {
+                                        // 水库站加载实时函数
+                                        that.rainfallStation(timeAvailable.dateTime)
+                                    }
+                                    // 预测有选中效果
+                                    else if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) div button:eq(1)').hasClass('navli-clk-change')) {
+                                        // 水库站加载预测函数
+                                        that.forecastRainfallStation(time.current)
+                                    }
+                                }
+                                that.childrenShowOne()
                             }
                             // 未勾选
                             else {
@@ -659,6 +745,7 @@
                                             that.hideLibraryOrDate();
                                         }
                                     } else {
+                                        closeRealTime(2)
                                         that.excelFileName = '未选中.xlsx';
                                     }
                                 }
@@ -705,20 +792,26 @@
                                 that.clearTwoAll();
                                 // 判断河道站是否勾选
                                 if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) ul li:eq(2) input').prop('checked') == true) {
-                                    that.childrenShowThree();
-                                    that.excelFileName = '河道站' + '.xlsx';
+                                    that.childrenShowThree()
+                                    that.excelFileName = '河道站' + '.xlsx'
                                     if (that.btnInd == 1) {
-                                        that.showLibraryOrDate();
+                                        that.showLibraryOrDate()
                                     } else if (that.btnInd == 2) {
-                                        that.hideLibraryOrDate();
+                                        that.hideLibraryOrDate('河道站')
                                     }
                                 } else {
-                                    closeRealTime(2);
                                     // 判断雨量站是否勾选
                                     if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) ul li:eq(0) input').prop('checked') == true) {
-                                        that.showLibraryOrDate();
-                                        that.childrenShowOne();
+                                        that.childrenShowOne()
+                                        that.excelFileName = '雨量站' + '.xlsx'
+                                        // 判断是实时还是预测
+                                        if (that.btnInd == 1) {
+                                            that.showLibraryOrDate()
+                                        } else if (that.btnInd == 2) {
+                                            that.hideLibraryOrDate('雨量站')
+                                        }
                                     } else {
+                                        closeRealTime(2)
                                         that.excelFileName = '未选中.xlsx';
                                     }
                                 }
@@ -759,16 +852,21 @@
                                     if (that.btnInd == 1) {
                                         that.showLibraryOrDate();
                                     } else if (that.btnInd == 2) {
-                                        that.hideLibraryOrDate();
+                                        that.hideLibraryOrDate('水库站')
                                     }
-                                    that.excelFileName = '水库站' + '.xlsx';
                                 } else {
-                                    closeRealTime(2);
                                     // 判断雨量站是否勾选
                                     if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) ul li:eq(0) input').prop('checked') == true) {
-                                        that.showLibraryOrDate();
-                                        that.childrenShowOne();
+                                        that.childrenShowOne()
+                                        that.excelFileName = '雨量站' + '.xlsx'
+                                        // 判断是实时还是预测
+                                        if (that.btnInd == 1) {
+                                            that.showLibraryOrDate()
+                                        } else if (that.btnInd == 2) {
+                                            that.hideLibraryOrDate('雨量站')
+                                        }
                                     } else {
+                                        closeRealTime(2)
                                         that.excelFileName = '未选中.xlsx';
                                     }
                                 }
@@ -789,12 +887,17 @@
                         var timeAvailable = that.getTimeAvailable();
                         loading();
                         $(this).addClass('navli-clk-change').siblings().removeClass('navli-clk-change');
+                        that.clearOneAll()
                         that.clearTwoAll();
                         that.clearThreeAll();
                         if ($(this).index() == 0) {
                             that.showLibraryOrDate();
                         } else {
-                            that.hideLibraryOrDate();
+                            if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) ul li:eq(0) input').prop('checked') == true) {
+                                that.hideLibraryOrDate('雨量站')
+                            } else {
+                                that.hideLibraryOrDate('')
+                            }
                         }
                         // 实时
                         if ($(this).index() == 1) {
@@ -802,6 +905,9 @@
                             $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2)>div>div>div').stop().animate({left: 0}, 200, 'linear', function () {
                                 $(this).text('实时');
                             });
+                            if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) ul li:eq(0) input').prop('checked') == true) {
+                                that.rainfallStation(timeAvailable.dateTime)
+                            }
                             if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) ul li:eq(1) input').prop('checked') == true) {
                                 that.reservoirStation(timeAvailable.month, timeAvailable.dateTime);
                             }
@@ -815,6 +921,9 @@
                             $('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2)>div>div>div').stop().animate({left: '50%'}, 200, 'linear', function () {
                                 $(this).text('预测');
                             });
+                            if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) ul li:eq(0) input').prop('checked') == true) {
+                                that.forecastRainfallStation(time.current);
+                            }
                             if ($('.jimu-widget-RiskEarlyWarning .risk-early-warning-right-tab .nav>li:eq(2) ul li:eq(1) input').prop('checked') == true) {
                                 that.forecastReservoirStation(time);
                             }
@@ -3179,7 +3288,141 @@
                     }
                 });
             },
+            // 风景区预测雨量站
+            forecastRainfallInScenicSpots: function (time) {
+                var that = this
+                that.hideLibraryOrDate('风景区雨量')
+                that.completetwo = false
+                var url = null
 
+                if (that.futureOfRealTime == 0) {
+                    url = 'http://192.168.0.207:82/blade-ycreal/stop/selectYlyc'
+                } else {
+                    url = 'http://192.168.0.207:82/blade-ycreal/stop/selectYldyc'
+                }
+
+                $.ajax({
+                    url: url,
+                    type: 'POST',
+                    dataType: 'JSON',
+                    data: {
+                        time: time
+                    },
+                    success: function success(data) {
+                        that.clearTwoAll()
+                        var color = null
+                        data.data.forEach(function (item, index) {
+                            if (item.YjList.county && item.YjList.STNM && item.YjList.dj && item.YjList.bw) {
+                                if (that.tableTwoArr.length > 0) {
+                                    var a = 0
+                                    that.tableTwoArr.forEach(function (it, index) {
+                                        if (item.YjList.county != it.行政县) {
+                                            a += 1
+                                        } else {
+                                            it.风景区 += 1
+                                        }
+                                    })
+                                    if (a == that.tableTwoArr.length) {
+
+                                        that.tableTwoArr.push({
+                                            "行政县": item.YjList.county,
+                                            "风景区": 1,
+                                            "一级预警": 0,
+                                            "二级预警": 0
+                                            // "三级预警": 0
+                                        })
+                                    }
+                                } else {
+
+                                    that.tableTwoArr.push({
+                                        "行政县": item.YjList.county,
+                                        "风景区": 1,
+                                        "一级预警": 0,
+                                        "二级预警": 0
+                                        //"三级预警": 0
+                                    })
+                                }
+                                // 表格数据填充
+                                that.tableTwoArr.forEach(function (it, index) {
+                                    if (it.行政县 == item.YjList.county) {
+                                        if (item.YjList.YJ == '一级预警') {
+                                            it.一级预警 += 1
+                                        } else if (item.YjList.YJ == '二级预警') {
+                                            it.二级预警 += 1
+                                        }
+                                        //else if (item.YjList.YJ == '三级预警') {
+                                        //    it.三级预警 += 1
+                                        //}
+                                    }
+                                })
+
+                                color = that.getColors(item.YjList.YJ)
+
+                                if (item.YjList.identification == undefined) {
+
+                                    that.createEntitys(that.addTwoEntitys, that.entityTwoContent, '风景区雨量', item.YjList, item.YjList.dj, item.YjList.bw, color.outlineColors, that.entityTwoName, item.YjList.spotname, that.addTwoNameEntitys)
+                                    that.createTwinkleEntitys('风景区雨量', that.addTwoEntitys, item.YjList, item.YjList.dj, item.YjList.bw, color.twinkleColor)
+
+                                } else {
+
+                                    color.outlineColors = 'grey'
+                                    color.twinkleColor = 'grey-transparent'
+                                    that.createEntitys(that.addTwoEntitys, that.entityTwoContent, '风景区雨量', item.YjList, item.YjList.dj, item.YjList.bw, color.outlineColors, that.entityTwoName, item.YjList.spotname, that.addTwoNameEntitys)
+
+                                }
+
+
+                            }
+                        })
+                        var textContentOne = ''
+                        var textContentTwo = ''
+                        var textContentThree = ''
+                        for (var j = 0, a = 0, b = 0, c = 0, d = 0, e = 0; j < that.tableTwoArr.length; j++) {
+                            a += that.tableTwoArr[j].风景区
+                            b += that.tableTwoArr[j].一级预警
+                            c += that.tableTwoArr[j].二级预警
+                            // d += that.tableTwoArr[j].三级预警
+                            if (that.tableTwoArr[j].一级预警 > 0) {
+                                textContentOne += '<div> <i>' + that.tableTwoArr[j].行政县 + '</i>\uFF1A<strong t=\'\u4E00\u7EA7\u9884\u8B66\'> ' + that.tableTwoArr[j].一级预警 + ' </strong> \u4E2A\uFF1B</div>'
+                            }
+                            if (that.tableTwoArr[j].二级预警 > 0) {
+                                textContentTwo += '<div> <i>' + that.tableTwoArr[j].行政县 + '</i>\uFF1A<strong t=\'\u4E8C\u7EA7\u9884\u8B66\'> ' + that.tableTwoArr[j].二级预警 + ' </strong> \u4E2A\uFF1B</div>'
+                            }
+
+                        }
+                        // 生成文字预警信息
+                        $('#text_content_box > div:eq(0) .two').html('\u8D63\u5DDE\u5E02\u5171\u6709 <span ii=' + 0 + '>' + a + '</span> \u4E2A\u5173\u8054\u96E8\u91CF\u7AD9\u7684\u98CE\u666F\u533A\uFF0C \u6709<span ii=' + 1 + '>' + b + '</span>\u4E2A\u8FBE\u5230\u4E00\u7EA7\u9884\u8B66' + (textContentOne.length > 0 ? '(' + textContentOne + ')' : '') + '\uFF0C\u6709<span ii=' + 2 + '>' + c + '</span>\u4E2A\u8FBE\u5230\u4E8C\u7EA7\u9884\u8B66' + (textContentTwo.length > 0 ? '(' + textContentTwo + ')' : '') + '\u3002')
+                        that.tableTwoArr.unshift({
+                            "行政县": "赣州市",
+                            '风景区': a,
+                            "一级预警": b,
+                            "二级预警": c
+                        })
+                        // 生成表格头部
+                        var theadDiv = $("<div class='thead'></div>").html($('<table> <thead></thead> </table>'))
+                        var tbodyDiv = $("<div class='tbody'></div>").html($('<table> <tbody></tbody> </table>'))
+                        theadDiv.find('thead').append($('<tr> <th>\u884C\u653F\u53BF</th> <th>\u98CE\u666F\u533A</th> <th>\u4E00\u7EA7\u9884\u8B66</th> <th>\u4E8C\u7EA7\u9884\u8B66</th> <th>\u77ED\u4FE1</th> </tr>'))
+                        // 生成表格体(内容)
+                        var shortMessagebcgrd = null
+                        that.tableTwoArr.forEach(function (item, index) {
+                            // && item.三级预警 == 0
+                            if (item.一级预警 == 0 && item.二级预警 == 0) {
+                                shortMessagebcgrd = '#ccc'
+                            } else {
+                                shortMessagebcgrd = 'rgb(37, 129, 235)'
+                            }
+                            // <td class=\'fjq-ylz-red\'>' + item.三级预警 + '</td>
+                            tbodyDiv.find('tbody').append($('<tr>  <td class=\'yj-county\'>' + item.行政县 + '</td>  <td class=\'fjq-ylz-fjq\'>' + item.风景区 + '</td>  <td class=\'fjq-ylz-yellow\'>' + item.一级预警 + '</td> <td class=\'fjq-ylz-orange\'>' + item.二级预警 + '</td>  <td> <input class=\'fjq-ylz-dx\' type=\'button\' value=\'\u77ED\u4FE1\' style=\'cursor: pointer; background: ' + shortMessagebcgrd + ';\'> </td> \n\t\t\t\t\t\t\t </tr>'))
+                        })
+                        // 生成表格头部
+                        $('.jimu-widget-RiskEarlyWarning .risk-early-warning-bottom .table-box>div:eq(0) .two').html("<div class='thead'>" + theadDiv.html() + "</div><div class='tbody'>" + tbodyDiv.html() + "</div>")
+                        that.completeProgram('completetwo', 'flagtwo', 'completetwo', 'flagone', 'completeone')
+                    },
+                    error: function (XMLHttpRequest, textStatus, errorThrown) {
+                        that.msglayer.close(that.msgLoading)
+                    }
+                })
+            },
             // 风景区雨量站
             rainfallInScenicSpots: function (time) {
                 var that = this;
@@ -3306,6 +3549,130 @@
                         layer.close(that.msgLoading);
                     }
                 });
+            },
+
+            // 雨量站预测事件函数
+            forecastRainfallStation: function (time) {
+                var that = this
+                that.hideLibraryOrDate('雨量站')
+                that.completeone = false
+                var url = null
+
+                if (that.futureOfRealTime == 0) {
+                    url = "http://192.168.0.207:82/blade-ycreal/pptnr/pptnYc?time=" + time
+                } else {
+                    url = "http://192.168.0.207:82/blade-ycreal/pptnr/pptndYc?time=" + time
+                }
+
+                $.ajax({
+                    url: url,
+                    type: 'get',
+                    dataType: 'JSON',
+                    success: function success(data) {
+                        var color = null
+                        that.clearOneAll()
+                        data.data.forEach(function (item, index) {
+                            if (item.YjList.ADDVCD5 && item.YjList.STNM && item.YjList.STLC && item.YjList.LGTD && item.YjList.LTTD) {
+                                if (that.tableOneArr.length > 0) {
+                                    var a = 0
+                                    that.tableOneArr.forEach(function (it, index) {
+                                        if (item.YjList.ADDVCD5 != it.行政县) {
+                                            a += 1
+                                        } else {
+                                            it.雨量站 += 1
+                                        }
+                                    })
+                                    if (a == that.tableOneArr.length) {
+
+                                        that.tableOneArr.push({
+                                            "行政县": item.YjList.ADDVCD5,
+                                            "雨量站": 1,
+                                            "一级预警": 0,
+                                            "二级预警": 0
+                                        })
+                                    }
+                                } else {
+
+                                    that.tableOneArr.push({
+                                        "行政县": item.YjList.ADDVCD5,
+                                        "雨量站": 1,
+                                        "一级预警": 0,
+                                        "二级预警": 0
+                                    })
+                                }
+                                // 表格数据填充
+                                that.tableOneArr.forEach(function (it, index) {
+                                    if (it.行政县 == item.YjList.ADDVCD5) {
+                                        if (item.YjList.YJ == '一级预警') {
+                                            it.一级预警 += 1
+                                        } else if (item.YjList.YJ == '二级预警') {
+                                            it.二级预警 += 1
+                                        }
+                                    }
+                                })
+
+
+                                color = that.getColors(item.YjList.YJ)
+
+                                if (item.YjList.identification == undefined) {
+
+                                    that.createEntitys(that.addOneEntitys, that.entityOneContent, '雨量站', item.YjList, item.YjList.LGTD, item.YjList.LTTD, color.outlineColors, that.entityOneName, item.YjList.STNM, that.addOneNameEntitys)
+                                    that.createTwinkleEntitys('雨量站', that.addOneEntitys, item.YjList, item.YjList.LGTD, item.YjList.LTTD, color.twinkleColor)
+
+                                } else {
+
+                                    color.outlineColors = 'grey'
+                                    color.twinkleColor = 'grey-transparent'
+                                    that.createEntitys(that.addOneEntitys, that.entityOneContent, '雨量站', item.YjList, item.YjList.LGTD, item.YjList.LTTD, color.outlineColors, that.entityOneName, item.YjList.STNM, that.addOneNameEntitys)
+                                }
+
+
+                            }
+                        })
+                        var textContentOne = ''
+                        var textContentTwo = ''
+                        var textContentThree = ''
+                        for (var j = 0, a = 0, b = 0, c = 0, d = 0, e = 0; j < that.tableOneArr.length; j++) {
+                            a += that.tableOneArr[j].雨量站
+                            b += that.tableOneArr[j].一级预警
+                            c += that.tableOneArr[j].二级预警
+
+                            if (that.tableOneArr[j].一级预警 > 0) {
+                                textContentOne += '<div> <i>' + that.tableOneArr[j].行政县 + '</i>\uFF1A<strong t=\'\u4E00\u7EA7\u9884\u8B66\'> ' + that.tableOneArr[j].一级预警 + ' </strong> \u4E2A\uFF1B</div>'
+                            }
+                            if (that.tableOneArr[j].二级预警 > 0) {
+                                textContentTwo += '<div> <i>' + that.tableOneArr[j].行政县 + '</i>\uFF1A<strong t=\'\u4E8C\u7EA7\u9884\u8B66\'> ' + that.tableOneArr[j].二级预警 + ' </strong> \u4E2A\uFF1B</div>'
+                            }
+                        }
+                        // 生成文字预警信息
+                        $('#text_content_box > div:eq(0) .one').html('\u8D63\u5DDE\u5E02\u5171\u6709 <span ii=' + 0 + '>' + a + '</span> \u4E2A\u96E8\u91CF\u7AD9\uFF0C \u6709<span ii=' + 1 + '>' + b + '</span>\u4E2A\u8FBE\u5230\u4E00\u7EA7\u9884\u8B66' + (textContentOne.length > 0 ? '(' + textContentOne + ')' : '') + '\uFF0C\u6709<span ii=' + 2 + '>' + c + '</span>\u4E2A\u8FBE\u5230\u4E8C\u7EA7\u9884\u8B66' + (textContentTwo.length > 0 ? '(' + textContentTwo + ')' : '') + '\u3002')
+                        that.tableOneArr.unshift({
+                            "行政县": "赣州市",
+                            '雨量站': a,
+                            "一级预警": b,
+                            "二级预警": c
+                        })
+                        var theadDiv = $("<div class='thead'></div>").html($('<table> <thead></thead> </table>'))
+                        var tbodyDiv = $("<div class='tbody'></div>").html($('<table> <tbody></tbody> </table>'))
+                        theadDiv.find('thead').append($('<tr> <th>\u884C\u653F\u53BF</th> <th>\u96E8\u91CF\u7AD9</th> <th>\u4E00\u7EA7\u9884\u8B66</th> <th>\u4E8C\u7EA7\u9884\u8B66</th> <th>\u77ED\u4FE1</th> </tr>'))
+                        // 生成表格体(内容)
+                        var shortMessagebcgrd = null
+                        that.tableOneArr.forEach(function (item, index) {
+                            if (item.一级预警 == 0 && item.二级预警 == 0) {
+                                shortMessagebcgrd = '#ccc'
+                            } else {
+                                shortMessagebcgrd = 'rgb(37, 129, 235)'
+                            }
+                            tbodyDiv.find('tbody').append($('<tr>  <td class=\'yj-county\'>' + item.行政县 + '</td>  <td class=\'ylz-ylz\'>' + item.雨量站 + '</td>  <td class=\'ylz-yellow\'>' + item.一级预警 + '</td> <td class=\'ylz-orange\'>' + item.二级预警 + '</td> <td> <input class=\'ylz-dx\' type=\'button\' value=\'\u77ED\u4FE1\' style=\'cursor: pointer; background: ' + shortMessagebcgrd + ';\'> </td> \n\t\t\t\t\t\t\t </tr>'))
+                        })
+                        // 生成表格头部
+                        $('.jimu-widget-RiskEarlyWarning .risk-early-warning-bottom .table-box>div:eq(0) .one').html("<div class='thead'>" + theadDiv.html() + "</div><div class='tbody'>" + tbodyDiv.html() + "</div>")
+                        that.completeProgram('completeone', 'flagtwo', 'completetwo', 'flagthree', 'completethree')
+                    },
+                    error: function (XMLHttpRequest, textStatus, errorThrown) {
+                        layer.close(that.msgLoading);
+                    }
+                })
             },
 
             // 雨量站事件函数
@@ -4672,8 +5039,9 @@
 
             // 清除所有与 .one 相关得
             clearOneAll: function () {
-                this.tableOneArr = [];
-                this.entityOneContent = [];
+                this.tableOneArr = []
+                this.entityOneContent = []
+                this.entityOneName = []
                 this.clearTimes();
                 this.addOneEntitys.removeAll();
                 $('.jimu-widget-RiskEarlyWarning .risk-early-warning-bottom .table-box>div:eq(0) .one').empty();

--
Gitblit v1.9.3