月球大数据地理空间分析展示平台-【中台】
Surpriseplus
2023-06-14 a7ceb07fdcbcac1edcecb8c96bfa7808ea7670c5
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
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
<template>
  <div class="current">
    <div class="leftarrow">
      <img
        :src="leftImg"
        @click="ChangeLeft"
      />
    </div>
    <div
      class="leftContainer"
      v-if="currentDisplay == '大屏' && ChartDisplay"
    >
      <div
        class="current1 current1-1"
        id="leftCurrent1"
      >
        <div class="aside-title">数据申请次数</div>
        <count-data-apply></count-data-apply>
      </div>
      <div
        class="current1 current1-2"
        id="leftCurrent2"
      >
        <div class="aside-title">用户访问量</div>
        <service-type></service-type>
      </div>
      <div
        class="current1 current1-3"
        id="leftCurrent3"
      >
        <div class="aside-title">项目存储信息</div>
        <data-storage></data-storage>
      </div>
    </div>
    <!-- 全球、全国统计次数 -->
    <div
      class="leftContainer"
      v-if="currentDisplay == '项目'"
    >
      <div
        class="current1"
        id="leftCurrent1"
      >
        <div class="aside-title">数据总览</div>
        <div class="wrapper">
          <div class="title">{{ currentProject }}</div>
          <dv-digital-flop
            style="height: 40px"
            :config="xmCountConfig"
          />
        </div>
      </div>
      <div
        class="current1"
        id="leftCurrent2"
      >
        <div class="aside-title">存储信息</div>
        <base-line-chart
          :requsetFn="requsetFn"
          :project="currentProject"
          title="数据存储量"
        ></base-line-chart>
      </div>
      <div
        class="current1"
        id="leftCurrent3"
      >
        <div class="aside-title">数据存储量</div>
        <data-storage-type></data-storage-type>
      </div>
    </div>
    <!-- 全球、全国管网图 -->
    <div
      class="leftContainer"
      v-if="currentDisplay == '管网'"
    >
      <div
        class="current1"
        id="leftCurrent1"
      >
        <div class="aside-title">数据总览</div>
        <div class="wrapper">
          <div class="title">{{ currentProject }}</div>
          <dv-digital-flop
            style="height: 40px"
            :config="xmCountConfig"
          />
        </div>
      </div>
      <div
        class="current1"
        id="leftCurrent2"
      >
        <div class="aside-title">管网长度</div>
        <base-line-chart
          :requsetFn="requsetFn"
          :project="currentProject"
          title="管网长度"
        ></base-line-chart>
        <!-- <base-pie-chart :project="currentProject"></base-pie-chart> -->
        <!-- <service-type></service-type> -->
      </div>
      <div
        class="current1"
        id="leftCurrent3"
      >
        <div class="aside-title">数据存储量</div>
        <data-storage-type></data-storage-type>
      </div>
    </div>
    <!-- 单个工程展示 -->
    <div
      class="leftContainer"
      v-if="currentDisplay == '工程'"
    >
      <div class="current1">
        <div class="aside-title">工程简介</div>
        <projectintroduction></projectintroduction>
      </div>
      <div class="current1">
        <div class="aside-title">项目状态</div>
        <projectState></projectState>
      </div>
      <div class="current1">
        <div class="aside-title">建设工期</div>
        <projectTime></projectTime>
      </div>
    </div>
  </div>
</template>
<script>
import ProjectTree from "./ProjectTree.vue"
import countDataApply from "@/components/chart/CountDataApply.vue"
import ServiceType from "../chart/ServiceType.vue"
import DataStorage from "../chart/DataStorage.vue"
import DataStorageType from "../chart/DataStorageType.vue"
 
import BaseBarChart from "../chart/BaseBarChart.vue"
import BaseLineChart from "../chart/BaseLineChart.vue"
import BasePieChart from "../chart/BasePieChart .vue"
import projectintroduction from "../chart/projectintroduction.vue"
import projectState from "../chart/projectState.vue"
import projectTime from "../chart/projectTime.vue"
import {
  countCountryDimension,
  countProvinceDimension,
  countZhPipeStations,
  countZhPipeMapLength,
} from "@/api/screen.js"
function formatter(number) {
  const numbers = number.toString().split("").reverse()
  const segs = []
 
  while (numbers.length) segs.push(numbers.splice(0, 3).join(""))
 
  return segs.join(",").split("").reverse().join("")
}
export default {
  components: {
    ProjectTree,
    countDataApply,
    ServiceType,
    DataStorage,
    BaseBarChart,
    BaseLineChart,
    BasePieChart,
    projectintroduction,
    projectState,
    projectTime,
    DataStorageType
  },
  data() {
    return {
      leftMessage: "init",
      ChartDisplay: true,
      ProjectreeDisplay: false,
      GlobleChartDisplay: false,
      CountryChartDisplay: false,
      leftImg: require("../../assets/img/Screen/rightArrow.png"),
      currentProject: "全球项目",
      currentDisplay: "大屏",
      requsetFn: countZhPipeMapLength,
      xmCountConfig: {
        number: [0],
        content: "{nt}",
        formatter,
      },
    }
  },
  mounted() {
    this.OpenLeftInit()
    // this.OpenLeftInitChart();
 
    this.$bus.$on("changeProject", name => {
      if (name.includes("全球管网") || name.includes("全国管网")) {
        this.currentDisplay = "管网"
      } else if (name.includes("全球项目") || name.includes("全国项目")) {
        this.currentDisplay = "项目"
      } else {
        this.currentDisplay = "工程"
      }
 
      this.currentProject = name
    })
    this.$bus.$on("changeCount", count => {
      if (typeof count == "number") {
        this.xmCountConfig.number = [count]
        this.xmCountConfig = {
          ...this.xmCountConfig,
        }
      }
    })
    this.$bus.$on("closeLeftAndRightMenu", (res) => {
      this.ChartDisplay = res;
      this.ProjectreeDisplay = res;
      this.ChangeLeft();
    })
  },
  methods: {
    ChangeLeft() {
      if (this.leftMessage == "init") {
        if (this.ChartDisplay) {
          this.leftImg = require("../../assets/img/Screen/leftArrow.png")
        } else {
          this.leftImg = require("../../assets/img/Screen/rightArrow.png")
        }
        this.ChartDisplay = !this.ChartDisplay
      }
 
      if (this.leftMessage == "projectree") {
        if (this.ProjectreeDisplay) {
          this.leftImg = require("../../assets/img/Screen/leftArrow.png")
        } else {
          this.leftImg = require("../../assets/img/Screen/rightArrow.png")
        }
        this.ProjectreeDisplay = !this.ProjectreeDisplay
      }
 
      this.$parent.ChangeWidth("left")
    },
    //打开大屏左侧界面
    OpenLeftInit() {
      this.currentDisplay = "大屏"
 
      this.ChartDisplay = true
      this.ProjectreeDisplay = false
      this.leftMessage = "init"
      // this.OpenLeftInitChart();
      this.$parent.ChangeWidth("leftView")
      this.GlobleChartDisplay = false
    },
    //打开工程树
    OpenLeftProjectTree() {
      this.ChartDisplay = false
      this.ProjectreeDisplay = true
      this.leftMessage = "projectree"
      this.$parent.ChangeWidth("leftTree")
    },
    //大屏界面图表
    OpenLeftInitChart() {
      //左一图
      let option1 = {
        title: {
          text: "项目分类",
          padding: [10, 30],
          textStyle: {
            color: "#fff",
            fontSize: 15,
          },
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
          },
        },
        grid: {
          left: "2%",
          right: "4%",
          bottom: "0%",
          containLabel: true,
        },
        xAxis: {
          type: "value",
          boundaryGap: [0, 0.01],
          axisLine: {
            lineStyle: {
              color: "#ccc",
            },
          },
          axisLabel: {
            show: true,
            textStyle: {
              color: "#fff",
            },
          },
        },
        yAxis: {
          type: "category",
          data: [
            "管道类",
            "管网类",
            "基建类",
            "航空测量",
            "风险排查",
            "工程培训",
          ],
          axisLine: {
            lineStyle: {
              color: "#ccc",
            },
          },
          axisLabel: {
            show: true,
            textStyle: {
              color: "#fff",
            },
          },
        },
        series: [
          {
            name: "项目分类",
            type: "bar",
            barWidth: 20,
            data: [36, 45, 25, 15, 49, 33],
            itemStyle: {
              normal: {
                // 柱形图圆角,初始化效果
                barBorderRadius: [0, 90, 90, 0],
                color: params => {
                  var colorList = [
                    ["#00FCFF", "#008297"],
                    ["#0091FF", "#005EA4"],
                    ["#901698", "#F157EE"],
                    ["#40FBCB", "#009871"],
                    ["#FF515A", "#FFDD53"],
                    ["#6574E2", "#261164"],
                  ]
                  var colorItem = colorList[params.dataIndex]
                  return new this.$echarts.graphic.LinearGradient(
                    1,
                    0,
                    0,
                    0,
                    [
                      {
                        offset: 0,
                        color: colorItem[0],
                      },
                      {
                        offset: 1,
                        color: colorItem[1],
                      },
                    ],
                    false
                  )
                },
              },
            },
          },
        ],
      }
      let myChart1 = this.$echarts.init(document.getElementById("leftCurrent1"))
      myChart1.setOption(option1)
      window.addEventListener("resize", function () {
        myChart1.resize()
      })
 
      //左二图
      let dataAxis = [
        "中俄东线管道工程南段",
        "中俄东线管道工程中段",
        "广州站",
        "唐山LNG",
        "新疆连木沁站场",
        "中缅天然气管道风险排查航空摄影测量",
      ]
      let data = [0.4, 0.2, 0.7, 0.65, 0.5, 0.1]
      let yMax = 500
      let dataShadow = []
      for (let i = 0; i < data.length; i++) {
        dataShadow.push(yMax)
      }
      let option2 = {
        title: {
          text: "项目完成度",
          padding: [10, 30],
          textStyle: {
            color: "#fff",
            fontSize: 15,
          },
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
          },
        },
        grid: {
          left: "3%",
          right: "0%",
          bottom: "0%",
          containLabel: true,
        },
        xAxis: {
          type: "category",
          data: dataAxis,
          axisLabel: {
            show: true,
            textStyle: {
              color: "#fff",
            },
            formatter: function (params) {
              var newParamsName = "" // 最终拼接成的字符串
              var paramsNameNumber = params.length // 实际标签的个数
              var provideNumber = 4 // 每行能显示的字的个数
              var rowNumber = Math.ceil(paramsNameNumber / provideNumber) // 换行的话,需要显示几行,向上取整
              /**
               * 判断标签的个数是否大于规定的个数, 如果大于,则进行换行处理 如果不大于,即等于或小于,就返回原标签
               */
              // 条件等同于rowNumber>1
              if (paramsNameNumber > provideNumber) {
                /** 循环每一行,p表示行 */
                for (var p = 0; p < rowNumber; p++) {
                  var tempStr = "" // 表示每一次截取的字符串
                  var start = p * provideNumber // 开始截取的位置
                  var end = start + provideNumber // 结束截取的位置
                  // 此处特殊处理最后一行的索引值
                  if (p == rowNumber - 1) {
                    // 最后一次不换行
                    tempStr = params.substring(start, paramsNameNumber)
                  } else {
                    // 每一次拼接字符串并换行
                    tempStr = params.substring(start, end) + "\n"
                  }
                  newParamsName += tempStr // 最终拼成的字符串
                }
              } else {
                // 将旧标签的值赋给新标签
                newParamsName = params
              }
              //将最终的字符串返回
              return newParamsName
            },
          },
        },
        yAxis: {
          axisLine: {
            show: true,
          },
 
          splitLine: {
            show: false,
          },
          axisTick: {
            show: false,
          },
 
          axisLabel: {
            show: true,
            textStyle: {
              color: "#fff",
            },
          },
        },
        dataZoom: [
          {
            type: "inside",
          },
        ],
        series: [
          {
            type: "bar",
            barWidth: "40%",
            showBackground: true,
            itemStyle: {
              color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
                { offset: 0, color: "#83bff6" },
                { offset: 0.5, color: "#188df0" },
                { offset: 1, color: "#188df0" },
              ]),
            },
            emphasis: {
              itemStyle: {
                color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
                  { offset: 0, color: "#2378f7" },
                  { offset: 0.7, color: "#2378f7" },
                  { offset: 1, color: "#83bff6" },
                ]),
              },
            },
            data: data,
          },
        ],
      }
      const zoomSize = 6
      let myChart2 = this.$echarts.init(document.getElementById("leftCurrent2"))
      myChart2.on("click", function (params) {
        myChart2.dispatchAction({
          type: "dataZoom",
          startValue: dataAxis[Math.max(params.dataIndex - zoomSize / 2, 0)],
          endValue:
            dataAxis[
            Math.min(params.dataIndex + zoomSize / 2, data.length - 1)
            ],
        })
      })
 
      myChart2.setOption(option2)
      window.addEventListener("resize", function () {
        myChart2.resize()
      })
 
      //左三图
      var legendData = ["人员", "变更后人员"] //图例
 
      var indicator = [
        { name: "中缅天然气管道风险排查航空摄影测量", max: 80 },
        { name: "唐山LNG", max: 80 },
        { name: "中俄东线管道工程南段", max: 160 },
        { name: "中俄东线管道工程中段", max: 100 },
        { name: "新疆连木沁站场", max: 40 },
        { name: "广州站", max: 40 },
      ]
      var dataArr = [
        {
          value: [35, 30, 80, 70, 15, 15],
          name: legendData[0],
          itemStyle: {
            normal: {
              lineStyle: {
                color: "#4A99FF",
                // shadowColor: '#4A99FF',
                // shadowBlur: 10,
              },
              shadowColor: "#4A99FF",
              shadowBlur: 10,
            },
          },
          areaStyle: {
            normal: {
              // 单项区域填充样式
              color: {
                type: "linear",
                x: 0, //右
                y: 0, //下
                x2: 1, //左
                y2: 1, //上
                colorStops: [
                  {
                    offset: 0,
                    color: "#4A99FF",
                  },
                  {
                    offset: 0.5,
                    color: "rgba(0,0,0,0)",
                  },
                  {
                    offset: 1,
                    color: "#4A99FF",
                  },
                ],
                globalCoord: false,
              },
              opacity: 1, // 区域透明度
            },
          },
          //在拐点处显示数值
          label: {
            show: true,
            formatter: function (params) {
              return params.value
            },
          },
        },
        {
          value: [40, 25, 110, 60, 18, 12],
          name: legendData[1],
          itemStyle: {
            normal: {
              lineStyle: {
                color: "#4BFFFC",
                // shadowColor: '#4BFFFC',
                // shadowBlur: 10,
              },
              shadowColor: "#4BFFFC",
              shadowBlur: 10,
            },
          },
          areaStyle: {
            normal: {
              // 单项区域填充样式
              color: {
                type: "linear",
                x: 0, //右
                y: 0, //下
                x2: 1, //左
                y2: 1, //上
                colorStops: [
                  {
                    offset: 0,
                    color: "#4BFFFC",
                  },
                  {
                    offset: 0.5,
                    color: "rgba(0,0,0,0)",
                  },
                  {
                    offset: 1,
                    color: "#4BFFFC",
                  },
                ],
                globalCoord: false,
              },
              opacity: 1, // 区域透明度
            },
          },
          //在拐点处显示数值
          label: {
            show: true,
            formatter: function (params) {
              return params.value
            },
          },
        },
      ]
      var colorArr = ["#4A99FF", "#4BFFFC"] //颜色
      let option3 = {
        title: {
          text: "人员变动",
          padding: [10, 30],
          textStyle: {
            color: "#fff",
            fontSize: 15,
          },
        },
        color: colorArr,
        radar: {
          // shape: 'circle',
          name: {
            textStyle: {
              color: "#fff",
              fontSize: 12,
            },
          },
          radius: 75,
          nameGap: 2, // 图中工艺等字距离图的距离
          splitNumber: 4, // 网格线的个数
          center: ["50%", "63%"], // 图的位置
 
          indicator: indicator,
          splitArea: {
            // 坐标轴在 grid 区域中的分隔区域,默认不显示。
            show: true,
            areaStyle: {
              // 分隔区域的样式设置。
              color: ["rgba(255,255,255,0)", "rgba(255,255,255,0)"], // 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
            },
          },
          axisLine: {
            //指向外圈文本的分隔线样式
            lineStyle: {
              color: "#153269",
            },
          },
          splitLine: {
            lineStyle: {
              color: "#113865", // 分隔线颜色
              width: 1, // 分隔线线宽
            },
          },
        },
        series: [
          {
            type: "radar",
            symbolSize: 4,
            // symbol: 'angle',
            data: dataArr,
          },
        ],
      }
 
      let myChart3 = this.$echarts.init(document.getElementById("leftCurrent3"))
      myChart3.setOption(option3)
      window.addEventListener("resize", function () {
        myChart3.resize()
      })
    },
  },
}
</script>
<style lang="less">
.current {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
 
  .leftarrow {
    width: 36px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
 
    img {
      width: 30px;
      height: 120px;
      cursor: pointer;
    }
  }
 
  .leftContainer {
    height: 100%;
    width: calc(100% - 45px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
 
    .current1 {
      height: 32%;
      width: 100%;
      background: url(../../assets/img/Screen/chartbg.png);
      background-size: 100% 100%;
      background-repeat: no-repeat;
      overflow: hidden;
    }
    .content {
      width: 100%;
      background: url(../../assets/img/Screen/contentBg.png);
      background-size: 100% 100%;
      background-repeat: no-repeat;
    }
    .wrapper {
      display: flex;
      flex-direction: column;
      justify-content: center;
      margin: 15px auto;
      width: 180px;
      height: 180px;
      background: url(../../assets/img/Screen/all.png);
      background-size: 100% 100%;
      background-repeat: no-repeat;
      .title {
        color: #fff;
        font-size: 20px;
        width: 100%;
        text-align: center;
      }
    }
  }
}
@media (max-width: 1400px) {
  .current .leftContainer .current1-1 {
    height: 28%;
  }
  .current .leftContainer .current1-2 {
    
     height: 42%;
  }
  .current .leftContainer .current1-3 {
   height: 28%;
  }
}
</style>