seimin 2 years ago
parent
commit
56abc9e775
3 changed files with 140 additions and 9 deletions
  1. 114 7
      assets/js/controllers/charts3.js
  2. 24 1
      assets/js/main.js
  3. 2 1
      index.html

+ 114 - 7
assets/js/controllers/charts3.js

@@ -1,5 +1,5 @@
1 1
 'use strict';
2
-app.controller('charts3Ctrl', ["$scope", "$rootScope", "$state", "$timeout", "$interval", "$http", "$cookieStore", "Restangular", "api_hkreport", "api_wechat_operate", function ($scope, $rootScope, $state, $timeout, $interval, $http, $cookieStore, Restangular, api_hkreport, api_wechat_operate) {
2
+app.controller('charts3Ctrl', ["$scope", "$rootScope", "$state", "$timeout", "$interval", "$http", "$cookieStore", "Restangular", "api_hkreport", "api_wechat_operate", "api_newreport", function ($scope, $rootScope, $state, $timeout, $interval, $http, $cookieStore, Restangular, api_hkreport, api_wechat_operate, api_newreport) {
3 3
     $scope.ceshi = ["110", "105", "84", "125", "110", "92", "98"];
4 4
     // 来电趋势图
5 5
     var dom_laidianqushitu = document.getElementById("laidianqushitu");
@@ -1061,18 +1061,36 @@ app.controller('charts3Ctrl', ["$scope", "$rootScope", "$state", "$timeout", "$i
1061 1061
         } else {
1062 1062
             $scope.slideBoxLeft2 = 0;
1063 1063
         }
1064
-
1064
+    }
1065
+    function move2() {
1065 1066
         if ($scope.slideBoxLeft3 >= 0) {
1066 1067
             $scope.slideBoxLeft3++;
1067 1068
             if($scope.slideBoxLeft3 == 6){
1068 1069
                 $scope.slideBoxLeft3 = 0;
1069 1070
             }
1070
-            // console.log($scope.slideBoxLeft3, '$scope.slideBoxLeft3')
1071
-            if($scope.slideBoxLeft3 == 0 || $scope.slideBoxLeft3 == 1 || $scope.slideBoxLeft3 == 2){
1072
-                $scope.cloudMap.goTo(114.41276, 30.51515, 1, 16);//主校区
1071
+            console.log($scope.slideBoxLeft3, '$scope.slideBoxLeft3')
1072
+            
1073
+            // 聚合点信息获取
1074
+            // 实时信息
1075
+            if($scope.slideBoxLeft3 == 0 || $scope.slideBoxLeft3 == 3){
1076
+                map_time_area({
1077
+                    "startTime": moment(new Date().getTime()).format("YYYY-MM-DD") + ' 00:00:00',
1078
+                    "endTime": moment(new Date().getTime()).format("YYYY-MM-DD HH:mm:ss")
1079
+                }, $scope.slideBoxLeft3)
1073 1080
             }
1074
-            if($scope.slideBoxLeft3 == 3 || $scope.slideBoxLeft3 == 4 || $scope.slideBoxLeft3 == 5){
1075
-                $scope.cloudMap.goTo(114.254, 30.5855, 3, 16);//同济校区
1081
+            // 30天信息
1082
+            if($scope.slideBoxLeft3 == 1 || $scope.slideBoxLeft3 == 4){
1083
+                map_time_area({
1084
+                    "startTime": lastMonth + " 00:00:00",
1085
+                    "endTime": yesterDay + " 23:59:59"
1086
+                }, $scope.slideBoxLeft3)
1087
+            }
1088
+            // 一年信息
1089
+            if($scope.slideBoxLeft3 == 2 || $scope.slideBoxLeft3 == 5){
1090
+                map_time_area({
1091
+                    "startTime": lastYear + " 00:00:00",
1092
+                    "endTime": yesterDay + " 23:59:59"
1093
+                }, $scope.slideBoxLeft3)
1076 1094
             }
1077 1095
         }
1078 1096
     }
@@ -1230,6 +1248,75 @@ app.controller('charts3Ctrl', ["$scope", "$rootScope", "$state", "$timeout", "$i
1230 1248
     setInterval(() => {
1231 1249
         move1()
1232 1250
     }, 15000); //15秒
1251
+    $scope.timer = setTimeout(() => {
1252
+        move2()
1253
+    }, 15000); //15秒
1254
+
1255
+    // 地图聚合点信息----------------------------------------start
1256
+    // // 获取近一个月建单总数数据
1257
+    // // 开始
1258
+    // $scope.incident_total_month = "";
1259
+
1260
+    // function getYear_incident_total_month(time) {
1261
+    //     api_hkreport.incidentreport(time, 'large_screen_year_incident_total').then(function (res) {
1262
+    //         $scope.incident_total_month = res.data[0].sum
1263
+    //     })
1264
+    // }
1265
+    // getYear_incident_total_month({
1266
+    //     "start": lastMonth + " 00:00:00",
1267
+    //     "end": yesterDay + " 23:59:59"
1268
+    // })
1269
+    // 结束
1270
+
1271
+    // // 开始
1272
+    function map_time_area(time, slideBoxLeft3) {
1273
+        api_newreport.fetchDataList('oneMapData', time).then(function (res) {
1274
+            console.log(res)
1275
+            if(res.status == 200){
1276
+                for (let name in res.data) {
1277
+                    let GLIDList = [];
1278
+                    let dataList = [];
1279
+                    res.data[name].forEach(function(v){
1280
+                        GLIDList.push(v[2]);
1281
+                        dataList.push(v[3]);
1282
+                    })
1283
+                    $scope.addClusterLayer(GLIDList, dataList, name);
1284
+                }
1285
+                // 地址切换
1286
+                if(slideBoxLeft3 === 0 || slideBoxLeft3 === 1 || slideBoxLeft3 === 2){
1287
+                    $scope.cloudMap.goTo(114.41276, 30.51515, 1, 16);//主校区
1288
+                    clearTimeout($scope.timer);
1289
+                    setTimeout(() => {
1290
+                        for (let name in res.data) {
1291
+                            $scope.delClusterLayer(name);
1292
+                        }
1293
+                        move2()
1294
+                    }, 15000); //15秒
1295
+                }
1296
+                if(slideBoxLeft3 === 3 || slideBoxLeft3 === 4 || slideBoxLeft3 === 5){
1297
+                    $scope.cloudMap.goTo(114.254, 30.5855, 3, 16);//同济校区
1298
+                    clearTimeout($scope.timer);
1299
+                    setTimeout(() => {
1300
+                        for (let name in res.data) {
1301
+                            $scope.delClusterLayer(name);
1302
+                        }
1303
+                        move2()
1304
+                    }, 15000); //15秒
1305
+                }
1306
+            }
1307
+        })
1308
+    }
1309
+    // map_time_area({
1310
+    //     "startTime": lastMonth + " 00:00:00",
1311
+    //     "endTime": yesterDay + " 23:59:59"
1312
+    // })
1313
+    // map_time_area({
1314
+    //     "startTime": lastYear + " 00:00:00",
1315
+    //     "endTime": yesterDay + " 23:59:59"
1316
+    // })
1317
+    
1318
+    // 结束
1319
+    // 地图聚合点信息----------------------------------------end
1233 1320
 
1234 1321
     // 获取地图token
1235 1322
     api_wechat_operate.mapToken({active: 1}, 'mapToken').then(function (res) {
@@ -1259,6 +1346,20 @@ app.controller('charts3Ctrl', ["$scope", "$rootScope", "$state", "$timeout", "$i
1259 1346
             baseMap: "dark",
1260 1347
             floorMap: "dark",
1261 1348
         };
1349
+        // 清除聚合图层
1350
+        $scope.delClusterLayer = function(name) { 
1351
+            $scope.cloudMap.removeClusterLayer(name);
1352
+        }
1353
+        //聚合图层
1354
+        $scope.addClusterLayer = function(GLIDList, dataList, name) { 
1355
+            console.log(GLIDList, dataList, name);	
1356
+            // name = '风险点';
1357
+		    //建筑物GLID
1358
+            // GLIDList =["10192","10195","10157","10114","10314","10101","10288","10394","10427"];
1359
+			//建筑物对应的数值,dCount必须为正整数
1360
+            // dataList =[ 23, 15, 5, 6,8,12, 35, 66,1];
1361
+            $scope.cloudMap.addClusterLayer(GLIDList, dataList, name);
1362
+        }
1262 1363
 
1263 1364
         $scope.$watch('$viewContentLoaded', function() {
1264 1365
             console.log('viewContentLoaded');
@@ -1350,7 +1451,13 @@ app.controller('charts3Ctrl', ["$scope", "$rootScope", "$state", "$timeout", "$i
1350 1451
             // );
1351 1452
         });
1352 1453
 
1454
+        
1455
+
1353 1456
         function mapReady() {
1457
+            map_time_area({
1458
+                "startTime": moment(new Date().getTime()).format("YYYY-MM-DD") + ' 00:00:00',
1459
+                "endTime": moment(new Date().getTime()).format("YYYY-MM-DD HH:mm:ss")
1460
+            })
1354 1461
             //cloudMap.changeLayerVisible('建筑物中心点', false);
1355 1462
             //地图加载成功
1356 1463
             // cloudMap.initLayerList("top-right"); //显示图层管理模块,位置top-right,top-left,bottom-right,bottom-right

+ 24 - 1
assets/js/main.js

@@ -163,7 +163,30 @@ app.config(['cfpLoadingBarProvider',
163 163
     }
164 164
 ]);
165 165
 
166
-
166
+// 首页仪表盘
167
+app.factory('ReportnewRestangular', function (Restangular) {
168
+    return Restangular.withConfig(function (RestangularConfigurer) {
169
+        RestangularConfigurer.setBaseUrl(serverIp + '/statistics');
170
+    });
171
+})
172
+// 首页仪表盘
173
+app.factory('api_newreport', ['ReportnewRestangular', function (ReportnewRestangular) {
174
+    var hcService = ReportnewRestangular.all("data");
175
+    return {
176
+        // 事件解决率
177
+        fetchDataList: function (model, data) {
178
+            return hcService.customPOST(data, 'fetchDataList/' + model, {})
179
+        },
180
+        // 首页仪表盘
181
+        addDictionary: function (data) {
182
+            return hcService.customPOST(data, 'addDictionary', {})
183
+        },
184
+        // 首页仪表盘
185
+        upDictionary: function (data) {
186
+            return hcService.customPOST(data, 'upDictionary', {})
187
+        },
188
+    }
189
+}]);
167 190
 
168 191
 /**
169 192
  * // http: //115.156.150.70:9680/api/webservice/data/fetchDataList/queryUser

+ 2 - 1
index.html

@@ -156,7 +156,8 @@
156 156
     <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/extension/bmap.min.js"></script>
157 157
     <script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/simplex.js"></script> -->
158 158
    <!-- 华科地图 -->
159
-   <script src="https://map.hust.edu.cn/CloudMapJS/5.0/mainmap.js"></script>
159
+   <!-- <script src="https://map.hust.edu.cn/CloudMapJS/5.0/mainmap.js"></script> -->
160
+   <script src="https://map.hust.edu.cn/CloudMapJS/5.1/mainmap.js"></script>
160 161
 </body>
161 162
 
162 163
 </html>