燕山石化溯源三维电子沙盘-【前端】-Web
surprise
2024-03-27 08d0c4ca9064c27be7b3e488bec497e87a05cc18
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
<template>
  <div class="zdmax">
    <div class="title">当天监测站点最大值TOP10</div>
    <dv-scroll-board :config="config" />
  </div>
</template>
 
<script>
import dayjs from "dayjs";
 
import { getdayTop } from "@/api/api.js";
import { de } from "element-plus/es/locale";
export default {
  data() {
    return {
      config: {
        header: ["名称", "数值", "日期"],
        data: [],
        // index: true,
        columnWidth: [],
        align: ["center", "center", "center"],
        headerBGC: "transparent",
        oddRowBGC: "transparent",
        evenRowBGC: "transparent",
        rowNum: 10,
      },
    };
  },
  mounted() {
    // this.getList();
    this.getWaringList();
  },
  methods: {
    sequence(a, b) {
      // console.log(a, b);
      return b[1] - a[1];
    },
    async getWaringList() {
      let dt = await getdayTop();
      if (dt.code === 200 && dt.result.length > 0) {
        const sotrArr = dt.result.sort((a, b) => b - a);
        let result = sotrArr.slice(0, 10);
        const data = result.map((item) => {
          item.value = Number(item.value).toFixed(2);
          item.time =
            item.time.slice(0, 4) +
            "-" +
            item.time.slice(4, 6) +
            "-" +
            item.time.slice(6, 8)
            +
            " "+
            item.time.slice(8,10);
          return [item.name, item.value, item.time];
        });
        data.sort(this.sequence);
 
        this.config.data = data;
        this.config = { ...this.config };
      }
    },
  },
};
</script>
 
<style lang="less" scoped>
.zdmax {
  // position: absolute;
  // top: 1049px;
  // right: 70px;
  width: 763px;
  height: 684px;
  background: url("~@/assets/img/xgzs/gjfx.png");
  background-size: 100% 100%;
  box-sizing: border-box;
  padding: 40px;
  .title {
    font-size: 30px;
    font-weight: bold;
    color: #ffffff;
    padding-bottom: 10px;
  }
  :deep(.dv-scroll-board) {
    margin: 10px;
    width: 100%;
    height: 550px;
    .header {
      font-size: 24px;
    }
    .rows {
      height: 449px;
      .row-item {
        font-size: 24px;
      }
    }
  }
}
</style>