Yansen 2 年前
父节点
当前提交
f7a05e5b6b

+ 8
- 0
config/routes.js 查看文件

@@ -32,6 +32,14 @@ export default [
32 32
     component: './MonitoringScreen',
33 33
     access: 'screen',
34 34
   },
35
+  {
36
+    path: '/MonitoringScreen2',
37
+    layout: false,
38
+    name: '数据大屏2',
39
+    icon: 'DesktopOutlined',
40
+    component: './MonitoringScreen2',
41
+    access: 'screen',
42
+  },
35 43
   {
36 44
     path: '/ContentManagementSystem',
37 45
     name: 'CMS管理',

+ 0
- 1
src/components/AMap/loader.js 查看文件

@@ -1,7 +1,6 @@
1 1
 import AMapLoader from '@amap/amap-jsapi-loader';
2 2
 
3 3
 const WEB_KEY = '7c02d93b855ab284c12911c231aa2233';
4
-// const SERVER_KEY = 'a30b66a26ea1890fd656cf11cb2647fb';
5 4
 
6 5
 export default (plugins, uiPlugins) => {
7 6
   window._AMapSecurityConfig = {

+ 24
- 0
src/components/AMap/service.js 查看文件

@@ -0,0 +1,24 @@
1
+const key = 'a30b66a26ea1890fd656cf11cb2647fb';
2
+
3
+export function regeo(conf = {}) {
4
+  const defCfg = {
5
+    key,
6
+    radius: 1000,
7
+    extensions: 'base',
8
+    batch: true,
9
+    roadlevel: 0,
10
+  };
11
+
12
+  const options = { ...defCfg, ...conf };
13
+  const queryStr = Object.keys(options)
14
+    .map((k) => `${k}=${options[k]}`)
15
+    .join('&');
16
+  const url = `//restapi.amap.com/v3/geocode/regeo?${queryStr}`;
17
+
18
+  return new Promise((resolve, reject) => {
19
+    fetch(url)
20
+      .then((res) => res.json())
21
+      .then(resolve)
22
+      .catch(reject);
23
+  });
24
+}

+ 91
- 0
src/pages/MonitoringScreen2/components/DeviceList.jsx 查看文件

@@ -0,0 +1,91 @@
1
+import React from 'react';
2
+import { Table, Badge } from 'antd';
3
+import { getMachineryList } from '@/services/machinery';
4
+import { regeo } from '@/components/AMap/service';
5
+
6
+export default (props) => {
7
+  const columns = [
8
+    {
9
+      title: '农机',
10
+      key: 'name',
11
+      dataIndex: 'name',
12
+    },
13
+    {
14
+      title: '状态',
15
+      key: 'onlineStatus',
16
+      dataIndex: 'onlineStatus',
17
+      render: (t) =>
18
+        t == 1 ? <Badge status="processing" text="在线" /> : <Badge status="default" text="下线" />,
19
+    },
20
+    {
21
+      title: '位置',
22
+      dataIndex: 'loc',
23
+    },
24
+  ];
25
+
26
+  const [loading, setLoading] = React.useState(false);
27
+  const [data, setData] = React.useState([]);
28
+  const [page, setPage] = React.useState(1);
29
+
30
+  const queryData = React.useCallback((pageNum = 1) => {
31
+    const filter = {
32
+      pageNum,
33
+      pageSize: 10, // 因为高德接口限制, 一次最大只能请求 20 个地址
34
+      isBound: true,
35
+    };
36
+
37
+    setLoading(true);
38
+    getMachineryList(filter)
39
+      .then((res) => {
40
+        const { current, records } = res;
41
+
42
+        setPage(current);
43
+
44
+        const locIds = [];
45
+        const locList = [];
46
+        const list = records || [];
47
+
48
+        for (let item of list) {
49
+          if (item.onlineStatus === 1 && item.location) {
50
+            locIds.push(item.machineryId);
51
+            locList.push(item.location);
52
+          }
53
+        }
54
+
55
+        if (locList.length > 0) {
56
+          // 高德接口, 请求地址的描述
57
+          regeo({ location: locList.join('|') })
58
+            .then((regs) => {
59
+              if (regs.status === '1') {
60
+                regs.regeocodes.forEach((addrs, inx) => {
61
+                  const addr = addrs['formatted_address'];
62
+                  const machine = list.filter((x) => x.machineryId === locIds[inx])[0];
63
+                  machine.loc = addr;
64
+                });
65
+              }
66
+
67
+              setData(list);
68
+              setPage(current);
69
+              setLoading(false);
70
+            })
71
+            .catch((er) => {
72
+              console.error(er);
73
+
74
+              setData(list);
75
+              setPage(current);
76
+              setLoading(false);
77
+            });
78
+        }
79
+      })
80
+      .catch((err) => {
81
+        console.error(err);
82
+        setLoading(false);
83
+      });
84
+  }, []);
85
+
86
+  React.useEffect(() => {
87
+    queryData(page);
88
+  }, [page, queryData]);
89
+
90
+  return <Table columns={columns} dataSource={data} />;
91
+};

+ 740
- 0
src/pages/MonitoringScreen2/components/map/geoData.js 查看文件

@@ -0,0 +1,740 @@
1
+export default {
2
+  type: 'FeatureCollection',
3
+  features: [
4
+    {
5
+      type: 'Feature',
6
+      properties: {
7
+        adcode: 411381,
8
+        name: '邓州市',
9
+        center: [112.092716, 32.681642],
10
+        centroid: [112.050009, 32.680192],
11
+        childrenNum: 0,
12
+        level: 'district',
13
+        acroutes: [100000, 410000, 411300],
14
+        parent: {
15
+          adcode: 411300,
16
+        },
17
+      },
18
+      geometry: {
19
+        type: 'MultiPolygon',
20
+        coordinates: [
21
+          [
22
+            [
23
+              [112.348727, 32.808115],
24
+              [112.348381, 32.809917],
25
+              [112.347113, 32.811663],
26
+              [112.345471, 32.811496],
27
+              [112.3454, 32.81227],
28
+              [112.343637, 32.812257],
29
+              [112.343347, 32.813248],
30
+              [112.342568, 32.813143],
31
+              [112.342314, 32.818839],
32
+              [112.334647, 32.823594],
33
+              [112.326682, 32.83202],
34
+              [112.324721, 32.838878],
35
+              [112.324842, 32.844493],
36
+              [112.330491, 32.846275],
37
+              [112.331121, 32.848051],
38
+              [112.330257, 32.850069],
39
+              [112.325783, 32.85153],
40
+              [112.323829, 32.852582],
41
+              [112.323164, 32.853851],
42
+              [112.322803, 32.857471],
43
+              [112.320849, 32.858802],
44
+              [112.317366, 32.858313],
45
+              [112.313274, 32.857477],
46
+              [112.309671, 32.857335],
47
+              [112.306131, 32.857873],
48
+              [112.302358, 32.860367],
49
+              [112.301423, 32.861921],
50
+              [112.301246, 32.863988],
51
+              [112.301515, 32.869439],
52
+              [112.299392, 32.869093],
53
+              [112.292518, 32.868858],
54
+              [112.288093, 32.869124],
55
+              [112.286061, 32.869767],
56
+              [112.283845, 32.872366],
57
+              [112.283053, 32.874204],
58
+              [112.282961, 32.877824],
59
+              [112.281969, 32.879556],
60
+              [112.279796, 32.880484],
61
+              [112.27775, 32.880045],
62
+              [112.276249, 32.879086],
63
+              [112.275966, 32.878281],
64
+              [112.27654, 32.875107],
65
+              [112.269397, 32.875627],
66
+              [112.258799, 32.87442],
67
+              [112.252555, 32.870949],
68
+              [112.243359, 32.864248],
69
+              [112.233327, 32.859841],
70
+              [112.216493, 32.859761],
71
+              [112.202943, 32.85489],
72
+              [112.18419, 32.856636],
73
+              [112.17985, 32.85731],
74
+              [112.171978, 32.856586],
75
+              [112.166591, 32.851982],
76
+              [112.157657, 32.849419],
77
+              [112.149749, 32.852817],
78
+              [112.145063, 32.860813],
79
+              [112.146599, 32.870442],
80
+              [112.140624, 32.86973],
81
+              [112.130061, 32.866463],
82
+              [112.126026, 32.86663],
83
+              [112.124766, 32.865788],
84
+              [112.124058, 32.863994],
85
+              [112.121495, 32.863338],
86
+              [112.118338, 32.863066],
87
+              [112.11545, 32.863449],
88
+              [112.114197, 32.863938],
89
+              [112.113106, 32.8659],
90
+              [112.111145, 32.872385],
91
+              [112.106891, 32.877502],
92
+              [112.105149, 32.881152],
93
+              [112.103408, 32.882569],
94
+              [112.101716, 32.885625],
95
+              [112.1003, 32.887259],
96
+              [112.099592, 32.887203],
97
+              [112.096541, 32.885403],
98
+              [112.090382, 32.885186],
99
+              [112.084287, 32.885242],
100
+              [112.084336, 32.88453],
101
+              [112.079812, 32.884153],
102
+              [112.07943, 32.885297],
103
+              [112.074036, 32.885242],
104
+              [112.074036, 32.882625],
105
+              [112.069731, 32.881919],
106
+              [112.068266, 32.882408],
107
+              [112.060281, 32.883194],
108
+              [112.058022, 32.881957],
109
+              [112.052408, 32.87968],
110
+              [112.0525, 32.877626],
111
+              [112.051085, 32.876481],
112
+              [112.049938, 32.874959],
113
+              [112.050681, 32.871073],
114
+              [112.048295, 32.869446],
115
+              [112.045711, 32.869347],
116
+              [112.045888, 32.872651],
117
+              [112.042575, 32.874278],
118
+              [112.041867, 32.874006],
119
+              [112.033471, 32.865956],
120
+              [112.031156, 32.866302],
121
+              [112.032657, 32.868536],
122
+              [112.032048, 32.870887],
123
+              [112.036126, 32.872577],
124
+              [112.034682, 32.874693],
125
+              [112.039828, 32.878677],
126
+              [112.039489, 32.880094],
127
+              [112.039375, 32.882965],
128
+              [112.039878, 32.885198],
129
+              [112.040848, 32.886405],
130
+              [112.042101, 32.889325],
131
+              [112.042044, 32.891162],
132
+              [112.041039, 32.89214],
133
+              [112.037698, 32.893068],
134
+              [112.036622, 32.893655],
135
+              [112.034307, 32.894014],
136
+              [112.032268, 32.89488],
137
+              [112.030654, 32.897175],
138
+              [112.030342, 32.899984],
139
+              [112.031107, 32.901648],
140
+              [112.032622, 32.903126],
141
+              [112.032431, 32.904227],
142
+              [112.03122, 32.906349],
143
+              [112.029493, 32.911006],
144
+              [112.028346, 32.912447],
145
+              [112.024459, 32.9139],
146
+              [112.021521, 32.913103],
147
+              [112.019879, 32.910579],
148
+              [112.014102, 32.91001],
149
+              [112.013493, 32.912255],
150
+              [112.012276, 32.912305],
151
+              [112.010492, 32.907351],
152
+              [112.00897, 32.905006],
153
+              [112.007667, 32.904437],
154
+              [112.005968, 32.904493],
155
+              [112.003589, 32.905483],
156
+              [112.00143, 32.907728],
157
+              [112.000099, 32.908148],
158
+              [111.996609, 32.906992],
159
+              [111.995505, 32.907573],
160
+              [111.995108, 32.91006],
161
+              [111.993416, 32.909491],
162
+              [111.991512, 32.913492],
163
+              [111.994556, 32.914408],
164
+              [111.994124, 32.915607],
165
+              [111.992121, 32.91664],
166
+              [111.983123, 32.913536],
167
+              [111.980029, 32.91985],
168
+              [111.990507, 32.921446],
169
+              [111.991399, 32.922738],
170
+              [111.993721, 32.924989],
171
+              [111.99411, 32.932638],
172
+              [111.996503, 32.938389],
173
+              [111.997275, 32.94344],
174
+              [111.995278, 32.950519],
175
+              [111.991632, 32.958957],
176
+              [111.987222, 32.962808],
177
+              [111.983385, 32.964372],
178
+              [111.980603, 32.967549],
179
+              [111.971839, 32.969292],
180
+              [111.965531, 32.972432],
181
+              [111.956441, 32.977605],
182
+              [111.945737, 32.983001],
183
+              [111.934757, 32.98771],
184
+              [111.923515, 32.992418],
185
+              [111.91039, 32.995051],
186
+              [111.907396, 32.99594],
187
+              [111.905605, 32.995434],
188
+              [111.904514, 32.997145],
189
+              [111.897414, 32.994952],
190
+              [111.898745, 32.993802],
191
+              [111.899637, 32.994284],
192
+              [111.901116, 32.990138],
193
+              [111.899672, 32.989798],
194
+              [111.896274, 32.987648],
195
+              [111.895396, 32.985547],
196
+              [111.896897, 32.98368],
197
+              [111.900352, 32.980312],
198
+              [111.902405, 32.977593],
199
+              [111.904734, 32.975331],
200
+              [111.906072, 32.973681],
201
+              [111.906943, 32.97179],
202
+              [111.907289, 32.968835],
203
+              [111.907806, 32.967413],
204
+              [111.90942, 32.965745],
205
+              [111.91102, 32.964725],
206
+              [111.910192, 32.95973],
207
+              [111.909519, 32.95845],
208
+              [111.907608, 32.956528],
209
+              [111.905208, 32.954587],
210
+              [111.9013, 32.951836],
211
+              [111.897923, 32.951193],
212
+              [111.893195, 32.951521],
213
+              [111.886462, 32.953184],
214
+              [111.884395, 32.953511],
215
+              [111.875001, 32.94893],
216
+              [111.861458, 32.945623],
217
+              [111.849027, 32.939347],
218
+              [111.842294, 32.933795],
219
+              [111.834507, 32.926869],
220
+              [111.824801, 32.921297],
221
+              [111.818033, 32.918724],
222
+              [111.811591, 32.913177],
223
+              [111.809538, 32.903992],
224
+              [111.809623, 32.897348],
225
+              [111.808781, 32.894769],
226
+              [111.807032, 32.890698],
227
+              [111.805291, 32.87817],
228
+              [111.798905, 32.876722],
229
+              [111.793666, 32.878479],
230
+              [111.794027, 32.876172],
231
+              [111.795896, 32.872892],
232
+              [111.796753, 32.868814],
233
+              [111.798912, 32.857273],
234
+              [111.798502, 32.851425],
235
+              [111.799047, 32.845415],
236
+              [111.805022, 32.839491],
237
+              [111.806912, 32.838006],
238
+              [111.811662, 32.83553],
239
+              [111.813757, 32.833982],
240
+              [111.816752, 32.827216],
241
+              [111.819272, 32.82365],
242
+              [111.823237, 32.821978],
243
+              [111.825722, 32.821285],
244
+              [111.827187, 32.819941],
245
+              [111.832886, 32.817093],
246
+              [111.833091, 32.815217],
247
+              [111.827753, 32.813917],
248
+              [111.827767, 32.813081],
249
+              [111.831052, 32.810406],
250
+              [111.834026, 32.80848],
251
+              [111.838599, 32.797662],
252
+              [111.840022, 32.792175],
253
+              [111.840907, 32.786223],
254
+              [111.841098, 32.771791],
255
+              [111.84073, 32.757808],
256
+              [111.842754, 32.75883],
257
+              [111.842761, 32.757957],
258
+              [111.843731, 32.758068],
259
+              [111.843979, 32.755094],
260
+              [111.845168, 32.751953],
261
+              [111.841077, 32.748929],
262
+              [111.838436, 32.747963],
263
+              [111.837955, 32.747318],
264
+              [111.835583, 32.746414],
265
+              [111.835293, 32.745645],
266
+              [111.834082, 32.745465],
267
+              [111.83404, 32.743817],
268
+              [111.832206, 32.743421],
269
+              [111.831909, 32.742503],
270
+              [111.82759, 32.742491],
271
+              [111.82752, 32.741109],
272
+              [111.82512, 32.741016],
273
+              [111.825573, 32.736877],
274
+              [111.826982, 32.737267],
275
+              [111.849112, 32.719839],
276
+              [111.870378, 32.710696],
277
+              [111.87917, 32.69033],
278
+              [111.879999, 32.688173],
279
+              [111.879121, 32.685661],
280
+              [111.880714, 32.683349],
281
+              [111.878753, 32.680633],
282
+              [111.873825, 32.67796],
283
+              [111.868148, 32.678053],
284
+              [111.862435, 32.677228],
285
+              [111.856156, 32.674357],
286
+              [111.851448, 32.669166],
287
+              [111.847059, 32.667175],
288
+              [111.840836, 32.666592],
289
+              [111.837041, 32.665966],
290
+              [111.830762, 32.663783],
291
+              [111.818748, 32.661767],
292
+              [111.815846, 32.663107],
293
+              [111.81317, 32.66743],
294
+              [111.808193, 32.670214],
295
+              [111.807436, 32.670332],
296
+              [111.80282, 32.666865],
297
+              [111.799068, 32.662363],
298
+              [111.796328, 32.657959],
299
+              [111.794417, 32.657345],
300
+              [111.788003, 32.658294],
301
+              [111.777306, 32.659044],
302
+              [111.770758, 32.660986],
303
+              [111.761321, 32.661271],
304
+              [111.755509, 32.662257],
305
+              [111.745308, 32.663845],
306
+              [111.729351, 32.665966],
307
+              [111.724254, 32.66627],
308
+              [111.722618, 32.664217],
309
+              [111.721096, 32.660204],
310
+              [111.720261, 32.645522],
311
+              [111.720176, 32.642085],
312
+              [111.714782, 32.637227],
313
+              [111.710017, 32.634665],
314
+              [111.705055, 32.634156],
315
+              [111.69978, 32.6375],
316
+              [111.691922, 32.641756],
317
+              [111.68405, 32.643326],
318
+              [111.672426, 32.642029],
319
+              [111.656582, 32.638505],
320
+              [111.653531, 32.638456],
321
+              [111.649631, 32.63456],
322
+              [111.643316, 32.627716],
323
+              [111.640803, 32.617341],
324
+              [111.641709, 32.611632],
325
+              [111.646402, 32.606189],
326
+              [111.65506, 32.608815],
327
+              [111.658522, 32.614586],
328
+              [111.662734, 32.610689],
329
+              [111.673006, 32.614977],
330
+              [111.682988, 32.61],
331
+              [111.692121, 32.605929],
332
+              [111.699157, 32.60794],
333
+              [111.704311, 32.606897],
334
+              [111.713571, 32.606549],
335
+              [111.724501, 32.600349],
336
+              [111.729237, 32.594006],
337
+              [111.740324, 32.589264],
338
+              [111.747375, 32.577599],
339
+              [111.757519, 32.570143],
340
+              [111.766807, 32.565188],
341
+              [111.775501, 32.562978],
342
+              [111.785058, 32.557333],
343
+              [111.789709, 32.553477],
344
+              [111.803117, 32.54305],
345
+              [111.809135, 32.536697],
346
+              [111.818862, 32.537125],
347
+              [111.821785, 32.535833],
348
+              [111.823768, 32.538076],
349
+              [111.827038, 32.538076],
350
+              [111.827208, 32.532566],
351
+              [111.828242, 32.531274],
352
+              [111.858272, 32.528697],
353
+              [111.862145, 32.524392],
354
+              [111.862746, 32.513632],
355
+              [111.870236, 32.50632],
356
+              [111.889924, 32.503164],
357
+              [111.898554, 32.504151],
358
+              [111.915324, 32.50773],
359
+              [111.925582, 32.511942],
360
+              [111.932322, 32.51521],
361
+              [111.941525, 32.516906],
362
+              [111.948668, 32.516981],
363
+              [111.950509, 32.516428],
364
+              [111.952866, 32.514819],
365
+              [111.953333, 32.513266],
366
+              [111.956441, 32.512278],
367
+              [111.957177, 32.511122],
368
+              [111.958154, 32.506941],
369
+              [111.96146, 32.504182],
370
+              [111.962579, 32.500268],
371
+              [111.963846, 32.498311],
372
+              [111.966805, 32.494924],
373
+              [111.968065, 32.492103],
374
+              [111.970111, 32.485224],
375
+              [111.970295, 32.482813],
376
+              [111.970961, 32.481775],
377
+              [111.973658, 32.479817],
378
+              [111.97426, 32.478207],
379
+              [111.974345, 32.473447],
380
+              [111.975555, 32.471899],
381
+              [111.977382, 32.471141],
382
+              [111.983003, 32.469811],
383
+              [111.99285, 32.467337],
384
+              [111.991739, 32.46403],
385
+              [111.988914, 32.462743],
386
+              [111.988192, 32.461985],
387
+              [111.98805, 32.460704],
388
+              [111.989346, 32.460487],
389
+              [111.989091, 32.459262],
390
+              [111.990287, 32.458448],
391
+              [111.990429, 32.457484],
392
+              [111.99457, 32.458174],
393
+              [111.998514, 32.459436],
394
+              [112.000071, 32.459542],
395
+              [112.00211, 32.45902],
396
+              [112.004729, 32.456371],
397
+              [112.005911, 32.452355],
398
+              [112.007051, 32.451031],
399
+              [112.00977, 32.451479],
400
+              [112.011929, 32.45049],
401
+              [112.014371, 32.450316],
402
+              [112.017741, 32.452324],
403
+              [112.019086, 32.453667],
404
+              [112.023107, 32.457049],
405
+              [112.027121, 32.459971],
406
+              [112.031142, 32.461767],
407
+              [112.033818, 32.463334],
408
+              [112.036508, 32.466715],
409
+              [112.038122, 32.470096],
410
+              [112.043467, 32.471433],
411
+              [112.047984, 32.473739],
412
+              [112.049902, 32.473273],
413
+              [112.05403, 32.471712],
414
+              [112.05735, 32.471576],
415
+              [112.059247, 32.472079],
416
+              [112.064018, 32.474242],
417
+              [112.064479, 32.47303],
418
+              [112.064592, 32.470849],
419
+              [112.065116, 32.469015],
420
+              [112.066638, 32.465341],
421
+              [112.068917, 32.462575],
422
+              [112.069781, 32.461021],
423
+              [112.069838, 32.459989],
424
+              [112.068847, 32.455638],
425
+              [112.068889, 32.453456],
426
+              [112.067919, 32.45128],
427
+              [112.066461, 32.447046],
428
+              [112.065958, 32.44464],
429
+              [112.066418, 32.442296],
430
+              [112.067409, 32.440617],
431
+              [112.070185, 32.439921],
432
+              [112.072478, 32.43905],
433
+              [112.075168, 32.436911],
434
+              [112.076719, 32.436439],
435
+              [112.081646, 32.43578],
436
+              [112.083614, 32.436228],
437
+              [112.086042, 32.435295],
438
+              [112.086771, 32.433852],
439
+              [112.086672, 32.430706],
440
+              [112.085235, 32.42968],
441
+              [112.0836, 32.427796],
442
+              [112.081342, 32.425694],
443
+              [112.080442, 32.423635],
444
+              [112.080839, 32.422485],
445
+              [112.0844, 32.419705],
446
+              [112.087168, 32.419288],
447
+              [112.09143, 32.419388],
448
+              [112.09366, 32.418909],
449
+              [112.094934, 32.418038],
450
+              [112.099231, 32.415824],
451
+              [112.105333, 32.410774],
452
+              [112.108448, 32.404759],
453
+              [112.115039, 32.401413],
454
+              [112.121644, 32.399136],
455
+              [112.124405, 32.398757],
456
+              [112.127046, 32.400946],
457
+              [112.128171, 32.403067],
458
+              [112.130245, 32.403111],
459
+              [112.131895, 32.399864],
460
+              [112.13273, 32.396586],
461
+              [112.13467, 32.39439],
462
+              [112.135654, 32.392312],
463
+              [112.137396, 32.390583],
464
+              [112.140291, 32.389749],
465
+              [112.14216, 32.388362],
466
+              [112.142946, 32.386234],
467
+              [112.145544, 32.383235],
468
+              [112.14708, 32.38219],
469
+              [112.152446, 32.379614],
470
+              [112.155795, 32.377461],
471
+              [112.156871, 32.377101],
472
+              [112.159787, 32.378227],
473
+              [112.160736, 32.379017],
474
+              [112.161777, 32.381468],
475
+              [112.163072, 32.383347],
476
+              [112.16446, 32.384411],
477
+              [112.164092, 32.385624],
478
+              [112.161614, 32.387024],
479
+              [112.161111, 32.387939],
480
+              [112.159922, 32.388499],
481
+              [112.159745, 32.386949],
482
+              [112.159115, 32.386452],
483
+              [112.153444, 32.385301],
484
+              [112.151908, 32.384312],
485
+              [112.150634, 32.384181],
486
+              [112.149919, 32.385046],
487
+              [112.149487, 32.387024],
488
+              [112.153331, 32.388343],
489
+              [112.155151, 32.389376],
490
+              [112.155349, 32.390104],
491
+              [112.154032, 32.392368],
492
+              [112.154032, 32.393743],
493
+              [112.154747, 32.3949],
494
+              [112.156382, 32.396132],
495
+              [112.157579, 32.395528],
496
+              [112.156043, 32.391634],
497
+              [112.157465, 32.391696],
498
+              [112.158542, 32.391105],
499
+              [112.159724, 32.392629],
500
+              [112.161373, 32.39345],
501
+              [112.159724, 32.394377],
502
+              [112.159858, 32.395671],
503
+              [112.161713, 32.399292],
504
+              [112.161437, 32.400107],
505
+              [112.159306, 32.401649],
506
+              [112.158067, 32.401811],
507
+              [112.15675, 32.401189],
508
+              [112.155653, 32.401288],
509
+              [112.154867, 32.402501],
510
+              [112.152616, 32.40112],
511
+              [112.150931, 32.401058],
512
+              [112.148723, 32.40173],
513
+              [112.146924, 32.402682],
514
+              [112.14616, 32.40545],
515
+              [112.144418, 32.406053],
516
+              [112.143625, 32.407011],
517
+              [112.145693, 32.407446],
518
+              [112.145877, 32.408628],
519
+              [112.149232, 32.410451],
520
+              [112.150216, 32.411638],
521
+              [112.1512, 32.41124],
522
+              [112.153402, 32.411483],
523
+              [112.154584, 32.410992],
524
+              [112.156531, 32.409437],
525
+              [112.159731, 32.410892],
526
+              [112.160255, 32.410444],
527
+              [112.160007, 32.408746],
528
+              [112.161394, 32.408703],
529
+              [112.163313, 32.409698],
530
+              [112.164665, 32.41129],
531
+              [112.169146, 32.40971],
532
+              [112.169118, 32.408149],
533
+              [112.170222, 32.406644],
534
+              [112.171893, 32.406656],
535
+              [112.173486, 32.408529],
536
+              [112.174343, 32.407409],
537
+              [112.172481, 32.405898],
538
+              [112.172573, 32.401295],
539
+              [112.171468, 32.399852],
540
+              [112.172169, 32.398352],
541
+              [112.173005, 32.398035],
542
+              [112.17527, 32.398446],
543
+              [112.177507, 32.398327],
544
+              [112.177514, 32.397444],
545
+              [112.176403, 32.3963],
546
+              [112.176757, 32.395354],
547
+              [112.17801, 32.395068],
548
+              [112.179036, 32.392859],
549
+              [112.178824, 32.392125],
550
+              [112.176714, 32.391174],
551
+              [112.175256, 32.391292],
552
+              [112.175079, 32.389239],
553
+              [112.174265, 32.388163],
554
+              [112.172382, 32.387783],
555
+              [112.172764, 32.38517],
556
+              [112.174704, 32.385817],
557
+              [112.181344, 32.387111],
558
+              [112.183737, 32.388455],
559
+              [112.188791, 32.389768],
560
+              [112.191446, 32.389749],
561
+              [112.194235, 32.391435],
562
+              [112.205895, 32.392978],
563
+              [112.208437, 32.391877],
564
+              [112.213732, 32.390035],
565
+              [112.216365, 32.38866],
566
+              [112.220344, 32.387509],
567
+              [112.22273, 32.387043],
568
+              [112.225356, 32.386097],
569
+              [112.226892, 32.386153],
570
+              [112.22685, 32.387472],
571
+              [112.228414, 32.387447],
572
+              [112.229172, 32.39238],
573
+              [112.228967, 32.393755],
574
+              [112.228004, 32.395777],
575
+              [112.224818, 32.400996],
576
+              [112.223742, 32.402234],
577
+              [112.228138, 32.403273],
578
+              [112.227119, 32.405524],
579
+              [112.235529, 32.407913],
580
+              [112.234842, 32.409673],
581
+              [112.237618, 32.409605],
582
+              [112.237554, 32.41088],
583
+              [112.244414, 32.411439],
584
+              [112.244789, 32.408429],
585
+              [112.248654, 32.409088],
586
+              [112.24859, 32.40976],
587
+              [112.255939, 32.409387],
588
+              [112.258325, 32.409617],
589
+              [112.256725, 32.41417],
590
+              [112.257808, 32.415041],
591
+              [112.258105, 32.416807],
592
+              [112.257779, 32.419655],
593
+              [112.262169, 32.419817],
594
+              [112.262204, 32.42501],
595
+              [112.265956, 32.425613],
596
+              [112.266352, 32.427541],
597
+              [112.273899, 32.432403],
598
+              [112.282281, 32.435432],
599
+              [112.289028, 32.438684],
600
+              [112.295477, 32.446741],
601
+              [112.293728, 32.448756],
602
+              [112.293664, 32.45118],
603
+              [112.292751, 32.453878],
604
+              [112.292808, 32.459529],
605
+              [112.291774, 32.459256],
606
+              [112.291201, 32.462308],
607
+              [112.28975, 32.462936],
608
+              [112.289205, 32.469767],
609
+              [112.290281, 32.470289],
610
+              [112.289842, 32.471078],
611
+              [112.290727, 32.471526],
612
+              [112.28999, 32.473005],
613
+              [112.289849, 32.474596],
614
+              [112.288348, 32.475255],
615
+              [112.287937, 32.476107],
616
+              [112.28781, 32.478437],
617
+              [112.287045, 32.479525],
618
+              [112.282798, 32.479718],
619
+              [112.282776, 32.481992],
620
+              [112.286599, 32.482123],
621
+              [112.286649, 32.484143],
622
+              [112.285537, 32.484404],
623
+              [112.285629, 32.486193],
624
+              [112.284985, 32.489704],
625
+              [112.285254, 32.495757],
626
+              [112.28604, 32.501113],
627
+              [112.288893, 32.50074],
628
+              [112.289523, 32.505872],
629
+              [112.28529, 32.507059],
630
+              [112.284171, 32.508494],
631
+              [112.280837, 32.518323],
632
+              [112.282125, 32.525889],
633
+              [112.284539, 32.530715],
634
+              [112.287774, 32.534399],
635
+              [112.290981, 32.541287],
636
+              [112.293601, 32.553446],
637
+              [112.29651, 32.565151],
638
+              [112.299427, 32.573868],
639
+              [112.300185, 32.580014],
640
+              [112.300942, 32.581696],
641
+              [112.302018, 32.582801],
642
+              [112.303781, 32.582392],
643
+              [112.303866, 32.583391],
644
+              [112.301388, 32.58372],
645
+              [112.298365, 32.584887],
646
+              [112.294889, 32.585421],
647
+              [112.293537, 32.586085],
648
+              [112.289516, 32.586855],
649
+              [112.287428, 32.587041],
650
+              [112.287173, 32.588723],
651
+              [112.278989, 32.590257],
652
+              [112.280072, 32.594136],
653
+              [112.276823, 32.594695],
654
+              [112.272427, 32.595949],
655
+              [112.273396, 32.599083],
656
+              [112.274359, 32.601255],
657
+              [112.264434, 32.603781],
658
+              [112.265333, 32.606773],
659
+              [112.261206, 32.607561],
660
+              [112.255365, 32.609112],
661
+              [112.254707, 32.609981],
662
+              [112.254686, 32.611638],
663
+              [112.255316, 32.614009],
664
+              [112.255238, 32.617254],
665
+              [112.253277, 32.617534],
666
+              [112.249709, 32.618551],
667
+              [112.249957, 32.619513],
668
+              [112.251104, 32.619426],
669
+              [112.251635, 32.62104],
670
+              [112.253199, 32.620953],
671
+              [112.253298, 32.622523],
672
+              [112.252059, 32.622585],
673
+              [112.252166, 32.623733],
674
+              [112.24898, 32.624086],
675
+              [112.248661, 32.622758],
676
+              [112.247989, 32.623149],
677
+              [112.249072, 32.626475],
678
+              [112.248817, 32.627139],
679
+              [112.249497, 32.628926],
680
+              [112.253157, 32.627753],
681
+              [112.253688, 32.628039],
682
+              [112.253879, 32.631011],
683
+              [112.256137, 32.631737],
684
+              [112.257744, 32.633449],
685
+              [112.264165, 32.638232],
686
+              [112.265248, 32.640273],
687
+              [112.265128, 32.642283],
688
+              [112.276334, 32.644945],
689
+              [112.279527, 32.644839],
690
+              [112.283222, 32.645007],
691
+              [112.284072, 32.647867],
692
+              [112.281481, 32.648394],
693
+              [112.280816, 32.647947],
694
+              [112.280327, 32.648934],
695
+              [112.274232, 32.652041],
696
+              [112.274465, 32.655062],
697
+              [112.274805, 32.655242],
698
+              [112.277955, 32.654076],
699
+              [112.2794, 32.656129],
700
+              [112.280851, 32.657121],
701
+              [112.283258, 32.656942],
702
+              [112.283258, 32.656464],
703
+              [112.292886, 32.657946],
704
+              [112.294967, 32.661345],
705
+              [112.296291, 32.667994],
706
+              [112.301105, 32.677191],
707
+              [112.304361, 32.680192],
708
+              [112.308418, 32.682282],
709
+              [112.313557, 32.685748],
710
+              [112.315179, 32.688284],
711
+              [112.315971, 32.691955],
712
+              [112.314018, 32.69813],
713
+              [112.311002, 32.702457],
714
+              [112.312857, 32.708427],
715
+              [112.318258, 32.713963],
716
+              [112.323688, 32.716976],
717
+              [112.327468, 32.720211],
718
+              [112.328247, 32.726403],
719
+              [112.327419, 32.729149],
720
+              [112.31566, 32.735024],
721
+              [112.315051, 32.742578],
722
+              [112.315554, 32.74831],
723
+              [112.318265, 32.753372],
724
+              [112.321762, 32.757288],
725
+              [112.327157, 32.764202],
726
+              [112.333627, 32.773866],
727
+              [112.33876, 32.781002],
728
+              [112.343078, 32.787908],
729
+              [112.345478, 32.794113],
730
+              [112.345974, 32.802362],
731
+              [112.3454, 32.805793],
732
+              [112.34848, 32.806195],
733
+              [112.348727, 32.808115],
734
+            ],
735
+          ],
736
+        ],
737
+      },
738
+    },
739
+  ],
740
+};

+ 27
- 0
src/pages/MonitoringScreen2/components/map/index.jsx 查看文件

@@ -0,0 +1,27 @@
1
+import React from 'react';
2
+import Styles from '@/components/GeoMap/style.less';
3
+import Map from './map';
4
+
5
+export default (props) => {
6
+  return (
7
+    <div className={Styles['geo-map-container']}>
8
+      {/* 占位图片 */}
9
+      <div className={Styles['geo-map-header']}>
10
+        <div />
11
+        <div />
12
+        <div />
13
+      </div>
14
+
15
+      <div className={Styles['geo-map-body']}>
16
+        <Map />
17
+      </div>
18
+
19
+      {/* 占位图片 */}
20
+      <div className={Styles['geo-map-footer']}>
21
+        <div />
22
+        <div />
23
+        <div />
24
+      </div>
25
+    </div>
26
+  );
27
+};

+ 56
- 0
src/pages/MonitoringScreen2/components/map/map.jsx 查看文件

@@ -0,0 +1,56 @@
1
+import React from 'react';
2
+import loader from '@/components/AMap/loader';
3
+import geoData from './geoData';
4
+
5
+const dzData = geoData.features[0].geometry.coordinates[0][0];
6
+
7
+const plugins = ['AMap.ToolBar'];
8
+export default (props) => {
9
+  const { style, className } = props;
10
+  const containerRef = React.useRef();
11
+  const mapRef = React.useRef();
12
+  const mapInstRef = React.useRef();
13
+
14
+  React.useEffect(() => {
15
+    loader(plugins)
16
+      .then((AMap) => {
17
+        const mapInst = new AMap.Map(containerRef.current, {
18
+          mapStyle: 'amap://styles/light',
19
+          layers: [
20
+            // 卫星
21
+            new AMap.TileLayer.Satellite(),
22
+            // 路网
23
+            // new AMap.TileLayer.RoadNet(),
24
+          ],
25
+          zoom: 10,
26
+          resizeEnable: true,
27
+          center: [112.092716, 32.681642],
28
+        });
29
+
30
+        // 缩放按钮
31
+        mapInst.addControl(new AMap.ToolBar());
32
+
33
+        // 绘制边线
34
+        const dengzhou = new AMap.Polygon({
35
+          path: dzData,
36
+          fillColor: '#ccebc5',
37
+          strokeOpacity: 1,
38
+          fillOpacity: 0,
39
+          strokeColor: '#ff0000', // '#2b8cbe',
40
+          strokeWeight: 2,
41
+          strokeStyle: 'dashed',
42
+          strokeDasharray: [5, 5],
43
+        });
44
+        mapInst.add(dengzhou);
45
+
46
+        //
47
+        mapRef.current = AMap;
48
+        mapInstRef.current = mapInst;
49
+      })
50
+      .catch((err) => {
51
+        console.log(err.message);
52
+      });
53
+  }, []);
54
+
55
+  return <div style={style} className={className} ref={containerRef}></div>;
56
+};

+ 7
- 53
src/pages/MonitoringScreen2/index.jsx 查看文件

@@ -1,5 +1,5 @@
1 1
 import getWeather from '@/components/AMap/weather';
2
-import GeoMap from '@/components/GeoMap';
2
+// import GeoMap from '@/components/GeoMap';
3 3
 import ScreenHeader from '@/components/ScreenBox/ScreenHeader';
4 4
 import SquareBox from '@/components/ScreenBox/SquareBox';
5 5
 import StatisCard from '@/components/ScreenBox/StatisCard';
@@ -18,11 +18,13 @@ import {
18 18
 import MachineryStatus from './components/MachineryStatus';
19 19
 import MachineryType from './components/MachineryType';
20 20
 import { useParticlesJs } from './hook';
21
+import Map from './components/map';
21 22
 
22 23
 import ColorFont from './components/ColorFont';
23 24
 import List from './components/List';
24 25
 import WorkArea from './components/WorkArea';
25 26
 import WorkData from './components/WorkData';
27
+import DeviceList from './components/DeviceList';
26 28
 import Styles from './style.less';
27 29
 
28 30
 export default (props) => {
@@ -169,16 +171,6 @@ export default (props) => {
169 171
           <ScreenHeader weather={weather} />
170 172
         </div>
171 173
         <div className={classNames(Styles['grail-container'], Styles['mg-tp-30'])}>
172
-          <div className={Styles['grail-left']}>
173
-            <div className="flex flex-column full-height">
174
-              <div className="flex-0" style={{ minHeight: '37%' }}>
175
-                <MachineryType source={machineryTypeData} />
176
-              </div>
177
-              <div className="flex-1" style={{ marginTop: '30px' }}>
178
-                <MachineryStatus source={machineryStatusData} />
179
-              </div>
180
-            </div>
181
-          </div>
182 174
           <div className={classNames(Styles['grail-content'], Styles['pd-lr-40'])}>
183 175
             <div className={Styles['statis-container']}>
184 176
               <StatisCard
@@ -206,50 +198,12 @@ export default (props) => {
206 198
                 title="总服务数"
207 199
               />
208 200
             </div>
209
-            <GeoMap machineTypeList={machineTypeList} orgList={orgList} machineList={machineList} />
210
-          </div>
211
-          <div className={Styles['grail-right']}>
212
-            <div className="flex flex-column full-height">
213
-              <div className="flex-0" style={{ minHeight: '46%' }}>
214
-                <WorkData source={workData} />
215
-              </div>
216
-              <div className="flex-1" style={{ marginTop: '30px' }}>
217
-                <WorkArea source={workAreaData} />
218
-              </div>
219
-            </div>
201
+            {/* <GeoMap machineTypeList={machineTypeList} orgList={orgList} machineList={machineList} /> */}
202
+            <Map />
220 203
           </div>
221 204
         </div>
222
-        <div className={classNames(Styles['grail-footer'], Styles['mg-tp-30'])}>
223
-          <SquareBox>
224
-            <div className="flex" style={{ padding: '20px 0' }}>
225
-              <div className="flex-1">
226
-                <List title="预约订单">
227
-                  {appointList?.map((item) => {
228
-                    return (
229
-                      <div key={item.messageId}>
230
-                        <ColorFont color="#44F68B">[{item.appointTime}]</ColorFont>{' '}
231
-                        <ColorFont color="#F5CC5C">{item.appointPerson}</ColorFont> 预约了一台
232
-                        {item.appointMachineryType}。
233
-                      </div>
234
-                    );
235
-                  })}
236
-                </List>
237
-              </div>
238
-              <div className={classNames('flex-0', Styles['footer-middle'])} />
239
-              <div className="flex-1">
240
-                <List title="作业订单" color="green">
241
-                  {acceptList?.map((item) => {
242
-                    return (
243
-                      <div key={item.messageId}>
244
-                        <ColorFont color="#44F68B">[{item.acceptTime}]</ColorFont>{' '}
245
-                        <ColorFont color="#F5CC5C">{item.acceptPerson}</ColorFont> 接到了一个订单。
246
-                      </div>
247
-                    );
248
-                  })}
249
-                </List>
250
-              </div>
251
-            </div>
252
-          </SquareBox>
205
+        <div>
206
+          <DeviceList />
253 207
         </div>
254 208
       </div>
255 209
     </div>