From d74b495736f0c04522ec54274b70fed0ded2878d Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Tue, 27 Jun 2023 11:30:06 +0800
Subject: [PATCH] 任务新增导出

---
 public/map/widgets/alertSecurity/AlertSecurity.js |  360 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 360 insertions(+), 0 deletions(-)

diff --git a/public/map/widgets/alertSecurity/AlertSecurity.js b/public/map/widgets/alertSecurity/AlertSecurity.js
new file mode 100644
index 0000000..360b409
--- /dev/null
+++ b/public/map/widgets/alertSecurity/AlertSecurity.js
@@ -0,0 +1,360 @@
+/*
+ * @Description:
+ * @Version: 1.0
+ * @Author: yangsx
+ * @Date: 2019-12-09 19:01:40
+ * @LastEditors: yangsx
+ * @LastEditTime: 2019-12-14 14:44:57
+ */
+define([
+  "dojo",
+  "dojo/_base/declare",
+  "dojo/_base/lang",
+  "base/BaseWidget",
+  "dojo/text!widgets/alertSecurity/template.html",
+  "base/AppEvent",
+  "base/ConfigData",
+  "widgets/alertSecurity/config",
+  "dojo/dom",
+  "dojo/dom-construct",
+  "dojo/dom-attr",
+  "dojo/dom-style",
+  "dojo/on",
+  "esri/layers/ArcGISDynamicMapServiceLayer",
+  "esri/layers/ArcGISTiledMapServiceLayer",
+  "esri/layers/FeatureLayer",
+  "controls/tab/TabControl",
+  "esri/dijit/SymbolStyler",
+  "esri/styles/basic",
+  "dojo/_base/array",
+  "esri/InfoTemplate",
+  "esri/tasks/query",
+  "esri/tasks/QueryTask",
+  "esri/Color",
+  "esri/toolbars/edit",
+  "esri/graphic",
+  "esri/geometry/Point",
+  "esri/geometry/Polyline",
+  "esri/geometry/Polygon",
+  "esri/geometry/Extent",
+  "esri/tasks/FeatureSet",
+  "esri/renderers/HeatmapRenderer",
+  "esri/symbols/SimpleLineSymbol",
+  "esri/symbols/SimpleFillSymbol",
+  "esri/symbols/PictureMarkerSymbol",
+  "esri/symbols/SimpleMarkerSymbol",
+  "esri/SpatialReference",
+  "esri/tasks/GeometryService",
+  "esri/tasks/ProjectParameters",
+  "esri/layers/GraphicsLayer",
+  "esri/layers/LabelLayer",
+  "esri/symbols/TextSymbol",
+  "esri/renderers/SimpleRenderer",
+  "esri/renderers/ClassBreaksRenderer",
+  "esri/tasks/Geoprocessor",
+  "esri/tasks/DataFile",
+  "esri/geometry/webMercatorUtils",
+  "esri/symbols/Font",
+  "esri/geometry/ScreenPoint",
+  "esri/layers/ImageParameters",
+  "esri/geometry/geometryEngine",
+  "esri/dijit/PopupTemplate",
+  "widgets/clientManagement/FlareClusterLayer_v3",
+  "dojo/domReady!"
+], function (
+  dojo,
+  declare,
+  lang,
+  BaseWidget,
+  template,
+  AppEvent,
+  ConfigData,
+  config,
+  dom,
+  domConstruct,
+  domAttr,
+  domStyle,
+  on,
+  ArcGISDynamicMapServiceLayer,
+  ArcGISTiledMapServiceLayer,
+  FeatureLayer,
+  TabControl,
+  SymbolStyler,
+  basic,
+  arrayUtils,
+  InfoTemplate,
+  Query,
+  QueryTask,
+  Color,
+  Edit,
+  Graphic,
+  Point,
+  Polyline,
+  Polygon,
+  Extent,
+  FeatureSet,
+  HeatmapRenderer,
+  SimpleLineSymbol,
+  SimpleFillSymbol,
+  PictureMarkerSymbol,
+  SimpleMarkerSymbol,
+  SpatialReference,
+  GeometryService,
+  ProjectParameters,
+  GraphicsLayer,
+  LabelLayer,
+  TextSymbol,
+  SimpleRenderer,
+  ClassBreaksRenderer,
+  Geoprocessor,
+  DataFile,
+  webMercatorUtils,
+  Font,
+  ScreenPoint,
+  ImageParameters,
+  geometryEngine,
+  PopupTemplate,
+  FlareClusterLayer
+) {
+  var Widget = declare([BaseWidget], {
+    widgetName: "AlertSecurity",
+    label: "分发处置",
+    templateString: template,
+    _map: null,
+    objThis: null,
+    _siteLayer: new GraphicsLayer(),
+    layuiLayer: null,
+    layuiLadate: null,
+    tabIndex: 0,
+
+    // 保留添加实体图层的变量
+    addEntitys: null,
+    entitysData: [],
+
+
+    // 巡逻区域或者巡逻路线的描述
+    routeOrRegionDescribe: null,
+
+    // 用来记录巡逻区域或者巡逻路线的下标的
+    patrolIndex: 0,
+
+    // 拖拽
+    isDown: false,
+    x: 0,
+    y: 0,
+    offset: null,
+    moveThis: null,
+    // 电子围栏需要新增的Id
+    newElectronicFenceId: null,
+
+    // 新增路线时,派发人员,人员名称,以及人员id
+    peopleRealName: null,
+    pepleRealId: null,
+    constructor: function (options, srcRefNode) {
+      this._map = options.map;
+      objThis = this;
+
+      this.addEntitys = new GraphicsLayer({
+        id: 'addEntitys'
+      });
+
+      // 添加点面线的图层
+      this.addPolygonEntitys = new GraphicsLayer({
+        id: 'addPolygonEntitys'
+      });
+      // 添加所有图层的地方
+      this.entityPolygonAll = new GraphicsLayer({
+        id: 'entityPolygonAll'
+      });
+
+
+      this._map.addLayer(this.addEntitys);
+
+
+      this._map.addLayer(this.addPolygonEntitys);
+      this._map.addLayer(this.entityPolygonAll);
+
+    },
+
+    startup: function () {
+
+      objThis._map.addLayer(objThis._siteLayer);
+
+
+    },
+
+    getQueryStringByKey: function (key) {
+      return (document.location.search.match(new RegExp("(?:^\\?|&)" + key + "=(.*?)(?=&|$)")) || ['', null])[1];
+    },
+
+    open: function () {
+
+      var that = this;
+
+      var openid = that.getQueryStringByKey('id');
+      var lgtd = that.getQueryStringByKey('jd');
+      var lttd = that.getQueryStringByKey('wd');
+      var deptId = that.getQueryStringByKey('deptId').slice(0, 19);//报错deptId格式不对liu.2021.5.7
+      var oneId = that.getQueryStringByKey('oneId');
+      var baid = that.getQueryStringByKey('baid');
+
+      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(/\(([^)]*)\)/);
+
+            // 此时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);
+            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 () {
+
+    },
+    addPolygonAll: function (entitys, rings) {
+      // entitys.clear();
+      var graphic = null;
+      var polylineSymbol = new SimpleLineSymbol();
+      polylineSymbol.color = [255, 0, 0, 1];
+      polylineSymbol.width = 4;
+      var polyline = new Polyline({
+        "paths": [rings],
+        "spatialReference": {
+          "wkid": 4326
+        }
+      });
+      graphic = new Graphic(polyline, polylineSymbol)
+      entitys.add(graphic);
+    },
+    addPoint: function (entitys, lgtd, lttd, img) {
+      var symbol = new esri.symbol.PictureMarkerSymbol(img, 22, 32);
+      symbol.xoffset = 0;
+      symbol.yoffset = -2;
+      var pt = new Point(lgtd, lttd, new SpatialReference({
+        wkid: 4326
+      }));
+      var graphic = new esri.Graphic(pt, symbol);
+      entitys.add(graphic);
+    },
+    /**
+     * 添加实体的公共方法
+     * @param {*} entitys 实体类
+     * @param {Array} entityContent 存放每个点详细数据的数组
+     * @param {string} name 实体的名字
+     * @param {*} item 实体数据
+     * @param {*} lgtd 经度
+     * @param {*} lttd 纬度
+     * @param {*} outlineColors 颜色
+     */
+    createEntitys: function (entitys, lgtd, lttd, image) {
+
+      var symbol = new esri.symbol.PictureMarkerSymbol(image, 44, 44);
+
+      var width = 44;
+      var height = 44;
+      var pt = new Point(lgtd, lttd, new SpatialReference({
+        wkid: 4326
+      }));
+
+      var graphic = new esri.Graphic(pt, symbol);
+
+      setInterval(function () {
+        if (width >= 60) {
+          width = 44;
+          height = 44;
+        }
+        width += 1;
+        height += 1;
+        symbol.width = width;
+        symbol.height = height;
+        graphic.setSymbol(symbol)
+        entitys.add(graphic);
+      }, 50)
+
+    },
+    /**
+     * 添加闪烁实体的公共方法
+     * @param {*} entitys 实体类
+     * @param {*} lgtd 经度
+     * @param {*} lttd 纬度
+     * @param {*} color 颜色
+     */
+    createTwinkleEntitys: function (entitys, lgtd, lttd, image, color) {
+      var symbol = new esri.symbol.PictureMarkerSymbol(image, 64, 64);
+      var width = 64;
+      var height = 64;
+      var pt = new Point(lgtd, lttd, new SpatialReference({
+        wkid: 4326
+      }));
+
+      var graphic = new esri.Graphic(pt, symbol);
+
+      setInterval(function () {
+        if (width >= 80) {
+          width = 64;
+          height = 64;
+        }
+        width += 1;
+        height += 1;
+        symbol.width = width;
+        symbol.height = height;
+        graphic.setSymbol(symbol)
+        entitys.add(graphic);
+      }, 50)
+    },
+
+    addPoints: function (entitys, lgtd, lttd, img) {
+      var symbol = new esri.symbol.PictureMarkerSymbol(img, 20, 20);
+      var pt = new Point(lgtd, lttd, new SpatialReference({
+        wkid: 4326
+      }));
+      var graphic = new esri.Graphic(pt, symbol);
+      entitys.add(graphic);
+    }
+  });
+  return Widget;
+});

--
Gitblit v1.9.3