wangrong
2021-11-24 130b72d6c5734f8acaac0214b6dfe5c8bfa319c3
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
<template>
  <div ref="mainBlcok">
    <el-table
      :data="tableData"
      style="width: 96%; margin-left: 2%; margin-top: 20px、"
      border
      :max-height="bodyHeight - 40"
      :header-cell-style="handerMethod"
      :row-style="{
        backgroundColor: 'transparent',
        color: '#FFF',
        height: '30px',
      }"
      :cell-style="{ padding: '0' }"
      v-loading="loading"
      element-loading-background="rgba(0, 0, 0, 0.8)"
      element-loading-text="正在加载数据"
      element-loading-spinner="el-icon-loading"
    >
      <el-table-column prop="frequency" label="频率"> </el-table-column>
      <el-table-column prop="coverrate" label="压制覆盖率"> </el-table-column>
      <el-table-column prop="area" label="区县"> </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  watch: {
    frequencyValue: {
      handler(n, o) {
        this.getInfo();
      },
      deep: true,
      immediate: true,
    },
    timeValue: {
      handler(n, o) {
        this.getInfo();
      },
      deep: true,
      immediate: true,
    },
    switchValue: {
      handler(n, o) {
        this.getInfo();
      },
      deep: true,
      immediate: true,
    },
  },
  props: {
    bodyHeight: {
      type: Number,
      default: 0,
    },
    frequencyValue: {
      type: Number,
      default: 1557,
    },
    timeValue: {
      type: String,
      default: "2021-06-30 17:00",
    },
    switchValue: {
      type: Number,
      default: 1,
    },
  },
  data() {
    return {
      tableData: [],
      loading: true,
    };
  },
  mounted() {
    this.getInfo();
  },
  methods: {
    getInfo() {
      this.loading = true;
      let param = new URLSearchParams();
      if (this.switchValue == 1) {
        param.append("bid", "getCoverByArea");
      }
      if (this.switchValue == 0) {
        param.append("bid", "getCoverByArea_auto");
      }
      param.append("frequencystr", this.frequencyValue);
      param.append("pressMode", this.switchValue);
      param.append("wdate", this.timeValue.split(" ")[0]);
      param.append("whour", this.timeValue.split(" ")[1].split(":")[0]);
 
      this.$getJSON(
        window.backstageURL + "dataservice/getNoTokenData",
        param
      ).then((res) => {
        if (res.code == "20000") {
          this.tableData = res.data.data;
          this.loading = false;
        }
      });
    },
 
    handerMethod({ rowIndex }) {
      return {
        backgroundColor: "rgba(90,130, 252,1)",
        color: "#FFF",
        height: "30px",
        padding: "0",
      };
    },
  },
};
</script>
<style lang="scss" scoped>
.el-table,
.el-table__expanded-cell {
  background-color: transparent;
}
 
.el-table th,
.el-table tr {
  background-color: transparent;
}
 
/deep/ .el-table .el-table__body tr:hover td {
  background-color: rgba(77, 214, 182, 1) !important;
  color: white;
}
</style>