地质所 沉降监测网建设项目
chenhuan
2024-05-20 c6f79f5720c5d4a700b8b759a93393559409fd1c
javaweb-plus/javaweb-admin/src/main/resources/templates/main.html
@@ -71,15 +71,14 @@
   <th:block th:include="include :: sparkline-js" />
   <th:block th:include="include :: footer" />
<script type="text/javascript">
   <script th:inline="javascript">
   $(function() {
      loadMap();
      getReallyData();
      totalProcess();
      stationProcess();
      //getRegulatoryUnitChartData("","");
      //bindEvent();
   })
   // 加载地图
   let map=null;
@@ -169,17 +168,23 @@
   }
   function infoWindowProject(e){
      let ids = e.ids + "";
      var sContent =
            "<div style='margin:0px;'>" +
            "<div>" +
            "<div style='margin:5px 0px 5px 5px;'>" +
            "<div style='margin:1px 0px 1px 2px;width: 200px;'>" +
            "<font style='font-weight: bolder;'>场地编号 :</font>" + e.code + "<br>" +
            "<font style='font-weight: bolder;'>场地名字 :</font>" + e.fullName + "<br>" +
            "<font style='font-weight: bolder;'>负责人 :</font>" + e.leader + "<br>" +
            "<a class='btn' onclick=viewdata(" +"'" + ids+ "'" + ")>场地数据</a>" +
            "</div>" +
            "</div>" +
            "</div>";
      return sContent;
   }
   function viewdata (id) {
      $.modal.openTab("场地导航",ctx+ "/geo/project/navigate?ids="+id);
   }
   function addClickHandler(content, marker) {
@@ -194,41 +199,17 @@
      map.openInfoWindow(markerInfoWin, point); //开启信息窗口
   }
   // 页面数据赋值
   function pageAssignment(reallyData) {
      for ( let key in reallyData) {
         let className = "." + key;
         $(className).text(reallyData[key]);
      }
   }
   //查询监管单位项目统计图表数据
   function getRegulatoryUnitChartData(startTime,endTime){
      let url = window.location.protocol + "//" + window.location.host + "/bjfw/geotdp/index/indexProjectNumsCollect";
      $.get(url,{
         startTime: startTime,
         endTime: endTime
      },function(res){
         if(res.status && res.message === "操作成功"){
            let chartData = {};
            chartData.yData = res.result.map((item)=>{
               return item.fullName;
            })
            chartData.xData = res.result.map((item)=>{
               return item.projectNums;
            })
            loadRegulatoryUnitChart(chartData);
         }else{
            $.modal.alertError("请求出错");
         }
      })
   }
   //总进度仪表盘
   function totalProcess() {
      var Chart1 = echarts.init(document.getElementById('Chart1'));
      var pointerData = 36; // 仪表指针数据
      var pointerData = 0; // 仪表指针数据
      let url = ctx + "/system/totalProcess";
      $.ajaxSettings.async = false;
      $.get(url,{},function(res){
         pointerData = res.pointerData;
         pointerData = (pointerData*100).toFixed(0);
      })
      $.ajaxSettings.async = false;
      var option = {
         backgroundColor: "#fff",
         series: [
@@ -410,12 +391,10 @@
      { ranking: 32, station: '场地032', value: 18.48 },
      { ranking: 33, station: '场地033', value: 13.03 },
      { ranking: 34, station: '场地034', value: 18.48 },
   ];
   var seriesName = ['',''];
   var seriesName = ['已完成进度','总进度'];
   var attackSourcesColor1 = ['#FF557F','#FFAA00','#5470C6','#1E9FFF'];
   var attackSourcesColor = [
@@ -438,9 +417,17 @@
   ];
   
   function stationProcess() {
      let url = ctx + "/system/projectProcess";
      $.ajaxSettings.async = false;
      $.get(url,{},function(res){
         console.log(res.projectData);
         datas = res.projectData;
      })
      $.ajaxSettings.async = false;
      var Chart2 = echarts.init(document.getElementById('Chart2'));
      var rankings = [];
      var stationData = [];
      var values = [];
@@ -450,7 +437,6 @@
         stationData.push(it.station);
         values.push(it.value);
      });
      option = {
         // backgroundColor: '#000',
@@ -657,192 +643,8 @@
      return false;
   }
   //加载监管单位项目统计图表
   function loadRegulatoryUnitChart(chartData){
      var myChart = echarts.init(document.getElementById('rank_chart'));
      let beginColor = "rgb(255,140,0,0.1)",
            endColor = "rgb(255,140,0,1)",
            endPix = "";
      //let endZom = 50;
      let option = {
         title: {
            show: false,
         },
         dataZoom: [
            {
               type: "inside",
               start: 0,
               //   end: endZom,
               orient: "vertical",
               zoomOnMouseWheel: false, ////滚轮是否触发缩放
            },
         ],
         tooltip: {
            trigger: "axis",
            axisPointer: {
               type: "shadow",
            },
         },
         legend: {
            bottom: 20,
            right: 0,
            textStyle: {
               color: "#666",
               fontSize: 18,
            },
            orient: "vertical",
         },
         grid: {
            borderWidth: 0,
            top: "8%",
            left: "1%",
            right: "8%",
            bottom: "2%",
         },
         color: "#fff",
         yAxis: [
            {
               type: "category",
               inverse: true,
               axisLine: {
                  show: false,
               },
               splitLine: {
                  show: false,
               },
               axisTick: {
                  show: false,
               },
               axisLabel: {
                  show: false,
               },
               data: chartData.yData,
            },
         ],
         xAxis: {
            type: "value",
            axisTick: {
               show: false,
            },
            axisLine: {
               show: false,
            },
            splitLine: {
               show: false,
            },
            axisLabel: {
               show: false,
            },
         },
         series: [
            {
               name: "累计",
               type: "bar",
               barWidth: "10px",
               itemStyle: {
                  normal: {
                     show: true,
                     color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                        {
                           offset: 0,
                           color: beginColor,
                        },
                        {
                           offset: 1,
                           color: endColor,
                        },
                     ]),
                     barBorderRadius: [0, 5, 5, 0],
                  },
                  emphasis: {
                     shadowBlur: 15,
                     shadowColor: "rgba(0, 0, 0, 0.1)",
                  },
               },
               data: chartData.xData,
               animationDuration: 1500,
               label: {
                  normal: {
                     color: "black",
                     show: true,
                     position: "right",
                     fontSize: 18,
                     fontStyle: "italic",
                     formatter: function (para) {
                        return para.data + endPix;
                     },
                  },
               },
            },
            {
               type: "bar",
               barGap: "0",
               barWidth: 10,
               animation: false,
               itemStyle: {
                  color: "transparent",
               },
               tooltip: {
                  show: false,
               },
               label: {
                  show: true,
                  position: ["0", "-35"],
                  fontSize: 13,
                  color: "rgb(0,0,0,0.7)",
                  formatter: function (param) {
                     return param.dataIndex + 1 + " " + param.name;
                  },
               },
               data: chartData.xData,
            },
         ],
         animationEasing: "cubicOut",
      };
      myChart.setOption(option);
   }
   //绑定事件
   function bindEvent(){
      $(".statistic-btn .btn").on("click",function(){
         if(this.innerText === "总计"){
            getRegulatoryUnitChartData("","");
         }else if(this.innerText === "本年度"){
            let d = new Date();
            let n = d.getFullYear();
            let startTime = n + "-01-01 00:00:00";
            let endTime = n + "-12-31 23:59:59";
            getRegulatoryUnitChartData(startTime,endTime);
         }else{
            let startTime = getFirstDay() + " 00:00:00";
            let endTime = getLastDay() + " 23:59:59";
            getRegulatoryUnitChartData(startTime,endTime);
         }
      })
   }
   //获取本月第一天
   function getFirstDay(){
      var y = new Date().getFullYear(); //获取年份
      var m = new Date().getMonth() + 1; //获取月份
      var d = '01'
      m = m < 10 ? '0' + m : m; //月份补 0
      return [y,m,d].join("-")
   }
   //获取本月最后一天
   function getLastDay(){
      var y = new Date().getFullYear(); //获取年份
      var m = new Date().getMonth() + 1; //获取月份
      var d = new Date(y, m, 0).getDate(); //获取当月最后一日
      m = m < 10 ? '0' + m : m; //月份补 0
      d = d < 10 ? '0' + d : d; //日数补 0
      return [y,m,d].join("-");
   }
</script>