派生自 wuyushui/SewerAndRainNetwork

chenzeping
2021-03-25 cd5666538670a6624cd194e26c50594f2ab712ec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
// /* -------------------------------------------------------------------------------------------------------------------------- */
// import { requestSolidWaste } from '@/api/request'
//
// /* -------------------------------------------------------------------------------------------------------------------------- */
// import '@components/BaseNav/style.css'
//
// /* -------------------------------------------------------------------------------------------------------------------------- */
// // 展示图片
// import defaultImg from '@components/BaseNav/magicMarker.png'
// import Setting from '@components/BaseNav/voc.png'
//
// /* -------------------------------------------------------------------------------------------------------------------------- */
//
// // 底图业务展示点
// class AddSolidWasteHelper {
//   /* -------------------------------------------------------------------------------------------------------------------------- */
//   constructor (options) {
//     this.map = options.map
//     this.L = window.L
//     this.SolidWasteLayerGroup = this.L.layerGroup().addTo(this.map)
//     this.SolidWastePopup = null
//     this.L.sgis = this.L.sgis || this.L
//     this.solidWasteMarkersLabels = []
//     this.pulseHeighLightMarker = null
//   }
//
//   /* -------------------------------------------------------------------------------------------------------------------------- */
//
//   // 请求数据 data 为参数, 请求后台数据时 携带data参数
//   requestData () {
//     requestSolidWaste().then(res => {
//       // console.log(res)
//       this.DrawTheSolidWasteContent(res.Result.DataInfo)
//     }).catch(err => {
//       console.log(err)
//     })
//   }
//
//   /* -------------------------------------------------------------------------------------------------------------------------- */
//
//   // 根据获取数据 画出 内容
//   DrawTheSolidWasteContent (data) {
//     // 图标样式扩展
//     var SolidWasteIcon = this.SolidWasteIcon()
//
//     // //加载数据前如果存在图层组 那么清除掉
//     if (this.SolidWasteLayerGroup) {
//       this.SolidWasteLayerGroup.clearLayers()
//     }
//     for (let i = 0; i < data.length; i++) {
//       // 经纬度 位置
//       const positionX = data[i].positionX
//       const positionY = data[i].positionY
//
//       // 判断 经纬度位置信息是否存在
//       if (positionX != null && positionY != null) {
//         // 用于 判断 => 判断是否展示脉冲效果 => temp(临时)
//         const determineValueOne = data[i].LongDayWarning
//         var determineValueTwo = data[i].StorageQty
//         const positionArea = [positionX, positionY]
//
//         // 图标展示
//         var iconUrl = this.SolidWasteIconUrl(determineValueOne, determineValueTwo, positionArea)
//         var Icon = new SolidWasteIcon({ iconUrl: iconUrl })
//         // var url = Icon.options.iconUrl
//
//         // 弹出框div内容
//         // var storevoinfo=null,storevodelinfo=[];
//         // for(var j=0;j<storevo.length;j++){
//         //   if(itm.StoragePlaceId==storevo[j].StoragePlaceId){
//         //     storevoinfo=storevo[j];
//         //   }
//         // }
//         // for(var k=0;k<storedel.length;k++){
//         //   if(itm.StoragePlaceId==storedel[k].StoragePlaceId){
//         //     storevodelinfo.push(storedel[k]);
//         //   }
//         // }
//         const content = this.solidWastePpopupContent(data[i], 'c', 'z')
//         // console.log(content)
//
//         const marker = this.L.marker([positionX, positionY], { icon: Icon })
//
//         marker.bindPopup(content, () => {
//           return this.SolidWastePopup.$el
//         }, {
//           className: 's-map-popup',
//           minWidth: 200,
//           closeButton: true,
//           autoClose: false
//         })
//         // // 划过出现 展示数据
//         marker.bindTooltip(data[i].StoragePlaceName, {
//           permanent: true,
//           offset: [0, -16],
//           direction: 'top',
//           className: ''
//         })
//         // 点击 事件
//         marker.on('click', (e) => {
//           try {
//             // console.log(e)
//             // this.SolidWastePopup.SetDisplayContent(content)
//             this.EffectOfPulse(e.target.getLatLng())
//           } catch (error) {
//             console.log(error)
//           }
//         })
//         marker.on('popupopen', (e) => {
//           try {
//             this.solidWastePpopupContent(content)
//           } catch (e) {
//             console.log(e)
//           }
//         })
//         // 设置内容添加到图层
//         // this.solidWasteMarkersLabels.push(marker)
//         this.SolidWasteLayerGroup.addLayer(marker)
//       }
//     }
//   }
//
//   /* -------------------------------------------------------------------------------------------------------------------------- */
//
//   // 固废点击进行的 内容的设置
//   SetSolidWasteContent (config, containerPopup) {
//     this.SolidWastePopup = containerPopup
//   }
//
//   /* -------------------------------------------------------------------------------------------------------------------------- */
//
//   // 图标样式扩展 => 光圈 图标脉冲
//   SolidWasteIcon () {
//     return this.L.Icon.extend({
//       options: {
//         iconSize: [40, 40],
//         iconAnchor: [20, 20]
//       }
//     })
//   }
//
//   /* -------------------------------------------------------------------------------------------------------------------------- */
//
//   // 根据类型返回图片加载url
//   SolidWasteIconUrl (determineValueOne, determineValueTwo, position) {
//     var EffectOfChange
//     if (determineValueOne === 1 || determineValueTwo === 1) {
//       EffectOfChange = defaultImg
//       this.EffectOfPulse(position, 'SolidWaste', this.solidWasteMarkersLabels, this.SolidWasteLayerGroup)
//     } else {
//       EffectOfChange = Setting
//     }
//     return EffectOfChange
//   }
//
//   /* -------------------------------------------------------------------------------------------------------------------------- */
//
//   // 脉冲效果设置实现
//   EffectOfPulse (position, name, markers, layerGroup) {
//     // // 区分直接执行 和判断执行的不同区别
//     var differentColor = ''
//     if (markers) {
//       differentColor = '#ff0000' // 有内容 ,直接为报警 执行报警的内容
//     } else {
//       differentColor = '#98FB98' // 否则 为点击执行
//     }
//     // 坐标数据:报警传进来的是数组 / 点击传进来的是object
//     var FinalPosition = position instanceof Array ? {
//       lat: position[0],
//       lng: position[1]
//     } : position
//     // 插件 效果实现
//     var pulsingIcon = this.L.icon.pulse({
//       iconSize: [25, 25],
//       color: differentColor,
//       fillColor: ' '
//     })
//     if (markers) {
//       markers.push(this.L.marker(FinalPosition, { icon: pulsingIcon }))
//       this.L.layerGroup(markers).addLayer(layerGroup)
//     } else {
//       var picGroupMarker = new this.L.FeatureGroup()
//       this.L.marker(FinalPosition, { icon: pulsingIcon }).addTo(picGroupMarker)
//       this.pulseHeighLightMarker = picGroupMarker.addTo(this.SolidWasteLayerGroup)
//       this.PulseCountSetting()
//     }
//   }
//
//   /* -------------------------------------------------------------------------------------------------------------------------- */
//
//   // 对图标脉冲 进行set设置  // 高亮图层
//   PulseCountSetting () {
//     var HeightLightTime = 1
//     var PulseNumber = 5
//     const pulseinterver = setInterval(() => {
//       if (PulseNumber > 0) {
//         PulseNumber--
//       } else {
//         this.pulseClear(pulseinterver)
//         PulseNumber = HeightLightTime
//       }
//     }, 1000)
//   }
//
//   /* -------------------------------------------------------------------------------------------------------------------------- */
//
//   // 清除 图层
//   pulseClear (pulseinterver) {
//     clearInterval(pulseinterver)
//     pulseinterver = null
//
//     if (this.SolidWasteLayerGroup) {
//       // this.SolidWasteLayerGroup.clearLayers()
//     } else {
//       this.SolidWasteLayerGroup = this.L.layerGroup().addTo(this.map)
//     }
//     if ((this.pulseHeighLightMarker)) {
//       this.pulseHeighLightMarker.remove()
//     }
//   }
//
//   /* -------------------------------------------------------------------------------------------------------------------------- */
//
//   // 点击业务内容 弹出数据的数据进行修改
//   solidWastePpopupContent (data) {
//     console.log(data)
//     const html = data.StoragePlaceName
//     return html
//   }
//
//   /* -------------------------------------------------------------------------------------------------------------------------- */
// }
//
// export default AddSolidWasteHelper
 
// <template>
//   <div class="full-screen">
//     <div id="map" ref="rootmap"></div>
//     <el-button type="primary" @click="ChangeState">固废</el-button>
//   <SolidContent ref="SolidWastePopup" @callPopup="callPopup"></SolidContent>
// </div>
// </template>
//
// <script>
//   import 'leaflet/dist/leaflet.css'
//   import Sgis from '@/Sgis'
//
//   // 底图业务js逻辑
//   import AddSolidWasteHelper from '@components/BaseNav/SolidWaste'
//
//   // 底图绑定 点击 弹出的数据
//   import SolidContent from '@components/BaseNav/SolidContent'
//
//   export default {
//   name: 'HomePage',
//   components: {
//   SolidContent
// },
//   data () {
//   return {
//   map: null,
//   lcServiceLayerVisible: false,
//   basemapHelper: {},
//   serviceLayerHelper: {},
//   vectorLayerHelper: {}
// }
// },
//   computed: {
//   config () {
//   return this.$store.state.map.config
// },
//   SolidWasteConfig () {
//   return this.$store.state.map.SolidWasteConfig
// }
// },
//   beforeMount () {
//   this.$nextTick(() => {
//   this.init()
// })
// },
//   methods: {
//   init () {
//   const mapcontainer = this.$refs.rootmap
//   this.map = Sgis.initMap(mapcontainer)
//
//   this.basemapHelper = Sgis.initBasemapsHelper(this.map) // 初始化基础底图助手
//   this.basemapHelper.initBasemap(this.config, false) // 第二个参数,表示是否内网底图
//
//   this.ChangeState()
// },
//   ChangeState () {
//   // 请求数据 携带参数 data
//   // const data = {
//   //   // companyId: 3900100145,
//   //   // companyCode: 31800000,
//   //   // monDuration: 4
//   // }
//   // 引入业务逻辑 js
//   const AddSolidWaste = new AddSolidWasteHelper({ map: this.map })
//   // 业务逻辑js 的请求数据 // 并且传递图片 用于创建点的 icon
//   AddSolidWaste.requestData()
//   // // 点击 设置 弹出内容事件 de 设置 console.log(this.$refs.popup.$el)
//   // AddSolidWaste.SetSolidWasteContent(this.SolidWasteConfig, this.$refs.SolidWastePopup)
// },
//   callPopup (val) {
//   console.log(val)
// },
//   displayDefault () {
//   // this.serviceLayerHelper = Sgis.initTileLayersHelper(this.map) // 初始化业务底图助手
//   // this.serviceLayerHelper.initServiceLayers(this.config, this.$refs.popup)
//
//   // this.vectorLayerHelper = Sgis.initVectorLayersHelper(this.map) // 初始化动态要素图层助手
//   // this.vectorLayerHelper.initVectorLayers(this.config)
// }
// }
// }
// </script>
//
// <style lang="less">
//
//   .leaflet-div-icon {
//   background: none;
//   border: none;
// }
//
//   .full-screen {
//   width: 100%;
//   height: 100%;
//   margin: 0;
//   padding: 0;
//   position: absolute;
//
//   button {
//   position: absolute;
//   top: 88px;
//   left: 88px;
//   z-index: 999;
// }
//
//   #map {
//   height: 100%;
//   width: 100%;
// }
//
//   .barline {
//   //width: 100%;
//   //height: 1px;
//   //background-color: #0661AE;
//   border-top: 1px solid #0661AE;
// }
//
//   #map-btn {
//   position: fixed;
//   top: 20px;
//   left: 100px;
//   z-index: 9999;
// }
//
//   .leaflet-custom-icon {
//   background: white;
// }
// }
// </style>