From 4d8c6dd77427e8e581fda17b6b65ba86bfb7a815 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 27 Feb 2023 14:30:01 +0800
Subject: [PATCH] 洪水淹没

---
 corelib/common/popup/js/evaluateAnalysis.js |  116 +++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 75 insertions(+), 41 deletions(-)

diff --git a/corelib/common/popup/js/evaluateAnalysis.js b/corelib/common/popup/js/evaluateAnalysis.js
index 473254b..73fb800 100644
--- a/corelib/common/popup/js/evaluateAnalysis.js
+++ b/corelib/common/popup/js/evaluateAnalysis.js
@@ -22,36 +22,6 @@
     //初始化
     init()
 
-    // change事件
-    $('input[type=radio][name=value]').change(function () {
-        if (this.value == 'list') {
-            $('.evaluate-echarts').hide()
-            // $('.evaluate-box-top-left').css('visibility', 'visible')
-            $('.evaluate-table').show()
-            $('.flood-analysis-pagination').show()
-        } else {
-            $('.evaluate-table').hide()
-            // $('.evaluate-box-top-left').css('visibility', 'hidden')
-            $('.flood-analysis-pagination').hide()
-            recharts_z()
-            loadEcharts()
-            $('.evaluate-echarts').show()
-        }
-    });
-
-    //淹没图弹窗事件
-    $('#create-flood-image').click(function () {
-        exportPicture()
-    })
-
-    $('#save-btn').click(function () {
-        confirmPopup()
-    })
-
-    $('#export-img').click(function () {
-        exportPicture()
-    })
-
     //确认弹窗
     function confirmPopup() {
         const self = this
@@ -129,7 +99,7 @@
             verticalAlign: app.config.verticalAlign,
             rotate: app.config.rotate,
             formatter: '{c}  {name|{a}}',
-            fontSize: 16,
+            fontSize: 13,
             rich: {
                 name: {}
             }
@@ -141,7 +111,10 @@
                     type: 'shadow'
                 }
             },
-            legend: {},
+            legend: {
+                left: 'left',
+                width: "70%"
+            },
             xAxis: [
                 {
                     type: 'value',
@@ -198,9 +171,10 @@
         echartsOption && myChart.setOption(echartsOption, true);
     }
 
+    //控制echarts图的长宽
     function recharts_z() {
-        var width = $(window).width() * 0.45;
-        var height = ($(window).height() - 50) - 80;
+        var width = $(window).width();
+        var height = $(window).height() - 400
 
         $('#evaluate-echarts').empty();
         $('#evaluate-echarts').removeAttr("_echarts_instance_").empty();
@@ -213,7 +187,7 @@
         myChartPie.resize(resize);
     }
 
-    //获取参数
+    //获取url携带参数
     function GetQueryString(name) {
         var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
         var r = decodeURI(window.location.search).substr(1).match(reg);
@@ -238,12 +212,59 @@
         a.dispatchEvent(event)
     }
 
+    //初始化
     function init() {
+
+        $('#list').click(function () {
+            $('.evaluate-echarts').hide()
+            $('.evaluate-table').show()
+            $('.flood-analysis-pagination').show()
+            $('.list').addClass('choose-button')
+            $('.list').removeClass('unchoose-button')
+            $('.echarts').addClass('unchoose-button')
+            $('.echarts').removeClass('choose-button')
+        })
+
+        $('#echarts').click(function () {
+            $('.evaluate-table').hide()
+            $('.flood-analysis-pagination').hide()
+            recharts_z()
+            loadEcharts()
+            $('.evaluate-echarts').show()
+
+            $('.echarts').addClass('choose-button')
+            $('.echarts').removeClass('unchoose-button')
+            $('.list').addClass('unchoose-button')
+            $('.list').removeClass('choose-button')
+        })
+
+        //淹没图弹窗事件
+        $('#create-flood-image').click(function () {
+            exportPicture()
+        })
+
+        //保存按钮点击事件
+        $('#save-btn').click(function () {
+            confirmPopup()
+        })
+
+        //导出按钮点击事件
+        $('#export-img').click(function () {
+            exportPicture()
+        })
+
+
+        //图片展示
         $('#show-img').prop('src', 'image/floodAnalysisEvaluate-2.png')
-        loadSumData()
+        $('.list').addClass('choose-button')
+        $('.list').removeClass('unchoose-button')
+        $('.echarts').addClass('unchoose-button')
+        $('.echarts').removeClass('choose-button')
         loadPagination()
+        loadSumData()
     }
 
+    //加载表格
     function loadTable(listData) {
         // $('#evaluate-tbody').remove()
         var table = ""
@@ -269,6 +290,7 @@
         $('#evaluate-tbody').html(table)
     }
 
+    //加载总和数据
     function loadSumData() {
         var house = 0
         var people = 0
@@ -281,13 +303,25 @@
             money = floatAdd(money, evaluateData[i].value)
         }
 
-        $(".house").html(house + '户')
-        $(".people").html(people + '人')
-        $(".area").html(area + 'km²')
-        $(".money").html(money + '万元')
-        $('.description').html("该站位于" + hd.riverway + ",河段长" + hd.river_length + "m,预计会造成受灾户数" + house + "户,受灾人口" + people + "人,受灾面积" + area + "km²,房屋价值" + money + "万元")
+        let table = '<tr>' +
+            '<td><div>合计</div></td>' +
+            '<td><div>' + house + '</div></td>' +
+            '<td><div>' + people + '</div></td>' +
+            '<td><div>' + area + '</div></td>' +
+            '<td><div>' + money + '</div></td>' +
+            '</tr>'
+
+        $('#evaluate-tbody').append(table)
+
+        // $(".house").html(house + '户')
+        // $(".people").html(people + '人')
+        // $(".area").html(area + 'km²')
+        // $(".money").html(money + '万元')
+
+        $('.description').html("&nbsp&nbsp该站位于" + hd.riverway + ",靠近"+hd.stnm.trim()+"水文站,起始距为"+hd.gl_qdj+"m,河段长" + hd.river_length + "m,淹没面积" + house + "km²,淹没耕地面积" + people + "km²,影响" + area + "万人,淹没区GDP总计" + money + "亿元")
     }
 
+    //加载分页
     function loadPagination() {
         if (evaluateData.length <= 0) return
         var count = Math.ceil(evaluateData.length / 10);

--
Gitblit v1.9.3