liuyg
2021-07-16 5db28e39983bb71c6e250b00a5c19fe6b0f82e2d
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
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
<template>
    <div class="bajgxt-home">
        <div class="head-title">
            <span>保安监管系统可视化平台</span>
            <img src="../../../public/img/bajgxt/linkimg.png"
                 @click.stop="goSystemHome"
                 title="进入系统" />
        </div>
        <div class="content">
            <div class="left">
                <div class="left1">
                    <div class="title-pane">
                        <img src="../../../public/img/bajgxt/icon1.png" />
                        <span>业务对象统计--单位</span>
                    </div>
                    <div id="left1Echart"></div>
                </div>
                <div class="left2">
                    <div class="title-pane1">
                        <img src="../../../public/img/bajgxt/icon1.png" />
                        <span>保安员持证情况</span>
                    </div>
                    <div id="left2Echart"></div>
                </div>
            </div>
            <div class="middle">
                <div class="mapimg">
                    <!-- <div></div> -->
                    <div class="mapBtn"
                         @click="getTableData('car')">
                        <img src="../../../public/img/bajgxt/car.png"
                             alt="" />
                        <div class="text">
                            <span>押运车辆</span>
                            <span>700</span>
                        </div>
                    </div>
                    <div class="mapBtn"
                         @click="getTableData('peo')">
                        <img src="../../../public/img/bajgxt/peo.png"
                             alt="" />
                        <div class="text">
                            <span>保安员</span>
                            <span>700</span>
                        </div>
                    </div>
                    <div class="mapBtn"
                         @click="getTableData('gun')">
                        <img src="../../../public/img/bajgxt/gun.png"
                             alt="" />
                        <div class="text">
                            <span>枪支</span>
                            <span>700</span>
                        </div>
                    </div>
                    <div id="map"></div>
                </div>
                <div class="table">
                    <div class="table-title">武装押运实时定位</div>
                    <div class="lefttop"></div>
                    <div class="leftbottom"></div>
                    <div class="righttop"></div>
                    <div class="rightbottom"></div>
                    <el-table :data="tableData"
                              stripe>
                        <el-table-column type="index"
                                         label="序号"
                                         width="50">
                        </el-table-column>
                        <el-table-column v-if="curTableType === 'car'"
                                         prop="carNum"
                                         label="押运车辆车牌号"
                                         width="180">
                        </el-table-column>
                        <el-table-column v-if="curTableType === 'peo'"
                                         prop="name"
                                         label="押运人员名称"
                                         width="180">
                        </el-table-column>
                        <el-table-column v-if="curTableType === 'gun'"
                                         prop="number"
                                         label="枪支编号"
                                         width="180">
                        </el-table-column>
                        <el-table-column prop="location"
                                         label="实时位置">
                        </el-table-column>
                        <el-table-column prop="company"
                                         label="所属公司"> </el-table-column>
                        <el-table-column v-if="curTableType === 'car'"
                                         prop="linkman"
                                         label="联系人">
                        </el-table-column>
                        <el-table-column v-if="curTableType === 'gun'"
                                         prop="linkman"
                                         label="负责人">
                        </el-table-column>
                        <el-table-column prop="tel"
                                         label="联系电话"> </el-table-column>
                        <el-table-column v-if="curTableType === 'peo'"
                                         prop="bz"
                                         label="备注">
                        </el-table-column>
                    </el-table>
                </div>
            </div>
            <div class="right">
                <div class="right1">
                    <div class="title-pane1">
                        <img src="../../../public/img/bajgxt/icon2.png" />
                        <span>保安员预警统计</span>
                        <el-select v-model="value1">
                            <el-option v-for="item in options1"
                                       :key="item.value"
                                       :label="item.label"
                                       :value="item.value">
                            </el-option>
                        </el-select>
                    </div>
                    <div class="card-text">
                        <span>现实表现差</span><span>902,432</span><span>起</span><span>审查情况</span><span>22222</span><span>起</span>
                    </div>
                    <div id="right1Echart"></div>
                </div>
                <div class="right2">
                    <div class="title-pane1">
                        <img src="../../../public/img/bajgxt/icon2.png" />
                        <span>保安公司预警统计</span>
                        <el-select v-model="value2"
                                   placeholder="请选择">
                            <el-option v-for="item in options2"
                                       :key="item.value"
                                       :label="item.label"
                                       :value="item.value">
                            </el-option>
                        </el-select>
                    </div>
                    <div class="card-text">
                        <span>未缴纳社保情况</span><span>902,432</span><span>起</span><span>未持证情况</span><span>22222</span><span>起</span>
                    </div>
                    <div id="right2Echart"></div>
                </div>
                <div class="right3">
                    <div class="title-pane1">
                        <img src="../../../public/img/bajgxt/icon3.png" />
                        <span>分局预警占比情况</span>
                    </div>
                    <div id="right3Echart"></div>
                </div>
            </div>
        </div>
    </div>
</template>
 
<script>
import "ol/ol.css";
import * as echarts from "echarts";
import optionJs from "./indexEchart";
import TileLayer from "ol/layer/Tile";
import { transform } from "ol/proj";
import XYZ from "ol/source/XYZ";
import { Map, View } from "ol";
import { Tile, Group } from "ol/layer";
import { OSM, TileJSON } from "ol/source";
import VectorLayer from "ol/layer/Vector";
import VectorSource from "ol/source/Vector";
import { Fill, Stroke, Circle, Style } from "ol/style";
import GeoJSON from "ol/format/GeoJSON";
import axios from "../../router/axios";
import { securityTotal, holderNum, securityPer } from "../../api/index/index";
export default {
    data () {
        return {
            map: null,
            curTableType: "car",
            tableData: [],
            value1: "1",
            options1: [
                {
                    value: "1",
                    label: "南昌市"
                },
                {
                    value: "2",
                    label: "赣州市"
                }
            ],
            value2: "1",
            options2: [
                {
                    value: "1",
                    label: "南昌市"
                },
                {
                    value: "2",
                    label: "赣州市"
                }
            ]
        };
    },
    methods: {
        initEchart () {
            securityTotal().then(res => {
                if (res.data.code == 200) {
                    let securityData = res.data.data;
                    let left1Echart = echarts.init(
                        document.getElementById("left1Echart")
                    );
                    left1Echart.setOption(optionJs.left1Data(securityData));
                } else {
                    this.$message.error(res.msg);
                }
            });
 
            holderNum().then(res => {
                if (res.data.code === 200) {
                    let data = res.data.data;
                    let left2Echart = echarts.init(
                        document.getElementById("left2Echart")
                    );
                    left2Echart.setOption(optionJs.left2Data(data));
                } else {
                    this.$message.error(res.msg);
                }
            });
            // securityPer().then(res => {
            //   if (res.data.code === 200) {
            //     let data = res.data.data;
            let data = [];
            let right1Echart = echarts.init(document.getElementById("right1Echart"));
            right1Echart.setOption(optionJs.right1Data(data));
            //   }
            // });
 
            let right2Echart = echarts.init(document.getElementById("right2Echart"));
            right2Echart.setOption(optionJs.right2Data(data));
            let right3Echart = echarts.init(document.getElementById("right3Echart"));
            right3Echart.setOption(optionJs.right3Data(data));
        },
 
        getTableData (type) {
            this.curTableType = type;
            if (type === "car") {
                this.tableData = [
                    {
                        carNum: "111111111111",
                        location: "红谷滩",
                        company: "公司",
                        linkman: "小李",
                        tel: "13999999999"
                    },
                    {
                        carNum: "111111111111",
                        location: "红谷滩",
                        company: "公司",
                        linkman: "小李",
                        tel: "13999999999"
                    },
                    {
                        carNum: "111111111111",
                        location: "红谷滩",
                        company: "公司",
                        linkman: "小李",
                        tel: "13999999999"
                    },
                    {
                        carNum: "111111111111",
                        location: "红谷滩",
                        company: "公司",
                        linkman: "小李",
                        tel: "13999999999"
                    },
                    {
                        carNum: "111111111111",
                        location: "红谷滩",
                        company: "公司",
                        linkman: "小李",
                        tel: "13999999999"
                    }
                ];
            } else if (type === "peo") {
                this.tableData = [
                    {
                        name: "小张",
                        location: "红谷滩",
                        company: "公司",
                        tel: "13999999999",
                        bz: "zzz"
                    },
                    {
                        name: "小张",
                        location: "红谷滩",
                        company: "公司",
                        tel: "13999999999",
                        bz: "zzz"
                    },
                    {
                        name: "小张",
                        location: "红谷滩",
                        company: "公司",
                        tel: "13999999999",
                        bz: "zzz"
                    },
                    {
                        name: "小张",
                        location: "红谷滩",
                        company: "公司",
                        tel: "13999999999",
                        bz: "zzz"
                    },
                    {
                        name: "小张",
                        location: "红谷滩",
                        company: "公司",
                        tel: "13999999999",
                        bz: "zzz"
                    },
                    {
                        name: "小张",
                        location: "红谷滩",
                        company: "公司",
                        tel: "13999999999",
                        bz: "zzz"
                    }
                ];
            } else if (type === "gun") {
                this.tableData = [
                    {
                        number: "Q1111",
                        location: "红谷滩",
                        company: "公司",
                        linkman: "张强",
                        tel: "13999999999"
                    },
                    {
                        number: "Q1111",
                        location: "红谷滩",
                        company: "公司",
                        linkman: "张强",
                        tel: "13999999999"
                    },
                    {
                        number: "Q1111",
                        location: "红谷滩",
                        company: "公司",
                        linkman: "张强",
                        tel: "13999999999"
                    },
                    {
                        number: "Q1111",
                        location: "红谷滩",
                        company: "公司",
                        linkman: "张强",
                        tel: "13999999999"
                    },
                    {
                        number: "Q1111",
                        location: "红谷滩",
                        company: "公司",
                        linkman: "张强",
                        tel: "13999999999"
                    },
                    {
                        number: "Q1111",
                        location: "红谷滩",
                        company: "公司",
                        linkman: "张强",
                        tel: "13999999999"
                    }
                ];
            }
        },
 
        initMap () {
            this.map = new Map({
                target: "map", // 对应页面里 id 为 map 的元素
                layers: [
                    // 图层
                    new Tile({
                        source: new OSM() // 图层数据源
                    })
                ],
                view: new View({
                    // 地图视图
                    projection: "EPSG:4326", // 坐标系,有EPSG:4326和EPSG:3857
                    center: [115.892151, 28.676493], //坐标 厦门
                    // minZoom: 10, // 地图缩放最小级别
                    zoom: 11 //地图缩放级别
                })
            });
            var image = new Circle({
                radius: 5,
                fill: new Fill({
                    color: "rgba(255, 0, 0, 1)"
                }),
                stroke: new Stroke({ color: "red", width: 1 })
            });
 
            var styles = {
                Point: new Style({
                    image: image
                })
            };
            axios.get("./nc.json").then(res => {
                let data = res.data.features;
                let vectorSource = new VectorSource({
                    features: new GeoJSON().readFeatures(data)
                });
                let vectorLayer = new VectorLayer({
                    source: vectorSource,
                    style: styles
                });
                this.map.addLayer(vectorLayer);
            });
            // var center = new transform(
            //   [104.06667, 30.66667],
            //   "EPSG:4326",
            //   "EPSG:3857"
            // );
            // this.map = new Map({
            //   view: new View({
            //     center: center,
            //     zoom: 4
            //   }),
            //   target: "map"
            // });
            // var offlineMapLayer = new TileLayer({
            //   source: new XYZ({
            //     url: "./offlineMapTiles/{z}/{x}/{y}.png"
            //   })
            // });
            // this.map.addLayer(offlineMapLayer);
        },
 
        goSystemHome () {
            this.$router.push({ path: '/register/index' });
        }
    },
    mounted () {
        this.initEchart();
        this.getTableData("car");
        this.initMap();
    }
};
</script>
 
<style lang="scss" scoped>
@import './index.scss';
/deep/ .el-select-dropdown {
    border: 1px solid #9199ab;
    background-color: #022c53;
}
/deep/ .el-select-dropdown__item.hover,
/deep/ .el-select-dropdown__item:hover {
    background-color: #03203e;
}
</style>