From 63ad2c3598400370dd7da5534659fd7e768a0a4a Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Mon, 16 May 2022 17:29:46 +0800
Subject: [PATCH] 地址替换

---
 public/map/widgets/alertSecurity/AlertSecurity.js |   93 +++++++++++++++++++++++-----------------------
 1 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/public/map/widgets/alertSecurity/AlertSecurity.js b/public/map/widgets/alertSecurity/AlertSecurity.js
index bfa0a0e..360b409 100644
--- a/public/map/widgets/alertSecurity/AlertSecurity.js
+++ b/public/map/widgets/alertSecurity/AlertSecurity.js
@@ -198,57 +198,58 @@
       var oneId = that.getQueryStringByKey('oneId');
       var baid = that.getQueryStringByKey('baid');
 
-      that.addPoint(that.addEntitys, lgtd, lttd, './images/jingbaored.png');
-      that.createEntitys(that.addEntitys, lgtd, lttd, './images/real-time-callPolice-opcity.png');
-      that.createTwinkleEntitys(that.addEntitys, lgtd, lttd, './images/real-time-callPolice-opcity.png');
-      // console.log(deptId,153454)
-      $.ajax({
-        url: "http://s16s652780.51mypc.cn/api/blade-user/pages?current=1&size=9999&work_status=&deptId=" + deptId,
-        type: 'get',
-        dataType: 'JSON',
-        success: function (res) {
+      if (baid != null && baid != "") {
+        $.ajax({
+          url: "http://61.131.136.25:2082/api/routeIn/routein/selectList?id=" + baid,
+          type: 'post',
+          dataType: 'JSON',
+          success: function (res) {
+            var entityData = '';
+            var entityArr = [];
+            entityData = res.data[0].routeInfo.match(/\(([^)]*)\)/);
 
-          // console.log(res.data.records, oneId)
+            // 此时result=["(dsfasjfj3124123)", "dsfasjfj3124123"];
+            if (entityData && entityData != '') {
+              entityData = entityData[1].split(',');
 
-          res.data.records.forEach((item) => {
-            if (item.id == oneId) {
-              that.addPoints(that.addEntitys, item.jd, item.wd, './images/security.png')
-            }
-          });
+              for (var j = 0; j < entityData.length; j++) {
+                entityArr.push([Number(entityData[j].split(' ')[0]), Number(entityData[j].split(' ')[1])]);
 
-          res.data.records.forEach((item) => {
-            if (item.roleName == "处警员" && item.id != oneId) {
-              that.addPoints(that.addEntitys, item.jd, item.wd, './images/security.png')
-            }
-          });
-          if (baid != null && baid != ""){
-            $.ajax({
-              url: "http://localhost:82/routeIn/routein/selectList?id=" + baid,
-              type: 'post',
-              dataType: 'JSON',
-              success: function (res) {
-                var entityData = '';
-                var entityArr = [];
-                entityData = res.data[0].routeInfo.match(/\(([^)]*)\)/);
-
-                // 此时result=["(dsfasjfj3124123)", "dsfasjfj3124123"];
-                if (entityData && entityData != '') {
-                  entityData = entityData[1].split(',');
-
-                  for (var j = 0; j < entityData.length; j++) {
-                    entityArr.push([Number(entityData[j].split(' ')[0]), Number(entityData[j].split(' ')[1])]);
-
-                    // entityArr.push([Number(b[0]), Number(b[1])]);
-                  }
-
-                }
-                that.addPolygonAll(that.addEntitys, entityArr);
-
+                // entityArr.push([Number(b[0]), Number(b[1])]);
               }
-            })
+
+            }
+            that.addPolygonAll(that.addEntitys, entityArr);
+            that._map.centerAndZoom(new esri.geometry.Point(entityArr[Math.ceil(entityArr.length / 2)][0], entityArr[Math.ceil(entityArr.length / 2)][1], new esri.SpatialReference({wkid: 4326})), 14);
           }
-        }
-      });
+        })
+      } else {
+        that.addPoint(that.addEntitys, lgtd, lttd, './images/jingbaored.png');
+        that.createEntitys(that.addEntitys, lgtd, lttd, './images/real-time-callPolice-opcity.png');
+        that.createTwinkleEntitys(that.addEntitys, lgtd, lttd, './images/real-time-callPolice-opcity.png');
+        // console.log(deptId,153454)
+        $.ajax({
+          url: "http://61.131.136.25:2082/api/blade-user/pages?current=1&size=9999&work_status=&deptId=" + deptId,
+          type: 'get',
+          dataType: 'JSON',
+          success: function (res) {
+
+            // console.log(res.data.records, oneId)
+
+            res.data.records.forEach((item) => {
+              if (item.id == oneId) {
+                that.addPoints(that.addEntitys, item.jd, item.wd, './images/security.png')
+              }
+            });
+
+            res.data.records.forEach((item) => {
+              if (item.roleName == "处警员" && item.id != oneId) {
+                that.addPoints(that.addEntitys, item.jd, item.wd, './images/security.png')
+              }
+            });
+          }
+        })
+      }
 
     },
     close: function () {

--
Gitblit v1.9.3