From cca4ca2151f5f2c721662691f2ff5eb4f27147bb Mon Sep 17 00:00:00 2001
From: seatonwan9 <seatonwan9@163.com>
Date: 星期日, 30 五月 2021 13:34:10 +0800
Subject: [PATCH] 新增治理设施测试

---
 /dev/null                                               |   36 ------------------
 src/components/LayerController/logic/GovernEquipment.js |   60 ++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 36 deletions(-)

diff --git a/src/components/LayerController/logic/GovernEquipment.js b/src/components/LayerController/logic/GovernEquipment.js
new file mode 100644
index 0000000..3770e07
--- /dev/null
+++ b/src/components/LayerController/logic/GovernEquipment.js
@@ -0,0 +1,60 @@
+/**
+ * 姹℃煋婧�
+ */
+// 淇℃伅缁勪欢
+// const SourcePollutionIndex = require('../../base-page/RiskSource/RiskSourceIndex.vue').default
+// 浣跨敤灏佽鏂规硶
+const AnimalService = require('../service/AnimalService').default
+// 璇锋眰鎺ュ彛鏁版嵁
+const mapApi = require('../../../api/mapApi').default
+// 鍏叡鏂规硶 panTo() 寮曠敤
+// const { setPanTo } = require('../../../utils/utils')
+
+module.exports = function () {
+  /**
+   * 鍒濆鍖栧苟鍔犺浇鍥惧眰
+   * @param L leaflet瀵硅薄
+   */
+  this.init = async (layer, L) => {
+    this.animalService = new AnimalService({
+      L: L,
+      layer: layer
+    })
+    const result = await mapApi.getEnvironmentRiskPoint()
+    const data = result[0]
+    for (let i = 0; i < data.length; i++) {
+      const postion = [data[i].Latitude, data[i].Longitude] // 鍧愭爣
+      const iconUrl = this.sourcePollutionIconUrl(1) // 娌荤悊璁炬柦鍥炬爣
+      const marker = L.marker(postion, {
+        totransferData: data[i],
+        icon: L.icon({
+          iconUrl: iconUrl,
+          iconSize: [20, 20],
+          iconAnchor: [10, 10]
+        })
+      })
+      layer.addLayer(marker)
+    }
+  }
+
+  /**
+   * 娌荤悊璁炬柦鍥炬爣閰嶇疆
+   * @param t
+   * @returns {string}
+   */
+  this.sourcePollutionIconUrl = (t) => {
+    let iconUrl = null
+    switch (t) {
+      case 1:
+        iconUrl = ''
+        break
+      case 2:
+        iconUrl = ''
+        break
+      default:
+        iconUrl = ''
+        break
+    }
+    return iconUrl
+  }
+}
diff --git a/src/components/LayerController/logic/SourcesPollution.js b/src/components/LayerController/logic/SourcesPollution.js
deleted file mode 100644
index 27899ce..0000000
--- a/src/components/LayerController/logic/SourcesPollution.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 姹℃煋婧�
- *  */
-
-// 璇锋眰鎺ュ彛鏁版嵁
-const mapApi = require('../../../api/mapApi').default
-// 浣跨敤灏佽鏂规硶
-const AnimalService = require('../service/AnimalService').default
-
-module.exports = function () {
-  this.init = async (layer, L) => {
-    this.animalService = new AnimalService({
-      L: L,
-      layer: layer
-    })
-    const result = await mapApi.getSourcesPoll()
-    // console.log(result)
-    const resultData = result.Result.DataInfo || []
-    const polygon = L.polygon(resultData, { color: 'yellow' })
-    polygon.addTo(layer)
-  }
-  this.bindTooltip = (layer) => {
-    return 'layer'
-  }
-  this.click = () => {
-    window.$layer.open({
-      content: {
-        content: 'Popup', // 缁勪欢
-        data: { // 浼犻�掔殑鍙傛暟
-          datas: 'popupDatas'
-        }
-      },
-      title: ''
-    })
-  }
-}

--
Gitblit v1.8.0