lixuliang
2024-07-30 0c74e7ac7f00ae90077374d62bc3a7a499b5b7b8
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
<template>
  <div class="contentBox">
    <div class="meuItem">
      <div class="userInfo"></div>
      <div class="userMesg">
        <div>
          <div>用户名:{{ userNmae }}</div>
          <div>职位:{{ userInfo }}</div>
        </div>
      </div>
      <div class="userMenu">
        <span>{{ loginTime }}</span>
        <el-button plain type="info" size="small">登出</el-button>
      </div>
    </div>
    <div class="menuList">
      <div class="itemMenu" v-for="(item, key) in menuList" :key="key">
        <div>{{ item.name }}</div>
        <div>{{ item.val }}</div>
      </div>
    </div>
    <div class="menuBox">
      <div class="title">常用系统统计</div>
      <div class="menuContent">
        <dv-scroll-board :config="configList1" />
      </div>
    </div>
    <div class="menuBox">
      <div class="title">系统登录日志</div>
      <div class="menuContent">
        <dv-scroll-board :config="configList2" />
      </div>
    </div>
    <div class="menuBox">
      <div class="title">系统状态信息</div>
      <div class="menuEchart">
        <div class="myEcahrt">
          <span>CPU占比</span>
          <div id="echart1"></div>
          <!-- <dv-water-level-pond :config="config" style="width:150px;height:200px" /> -->
          <!-- <div>
            <dv-percent-pond :config="config" style="margin-top:10px;width:70px;height:30px;" />
          </div>-->
        </div>
        <div class="myEcahrt">
          <span>内存占比</span>
          <div id="echart2"></div>
        </div>
        <div class="myEcahrt">
          <span>性能占比</span>
          <div id="echart3"></div>
        </div>
      </div>
    </div>
  </div>
</template>
 
<script>
import * as echarts from "echarts";
import "echarts-liquidfill";
export default {
  data() {
    return {
      loginTime: null,
      userNmae: "Admin",
      userInfo: "系统管理员",
      menuList: [
        { name: "PV统计", val: 30 },
        { name: "访问数量", val: 30 },
        { name: "新增用户统计", val: 30 }
      ],
      config: {
        data: [66, 45],
        shape: "roundRect"
      },
      configList1: {
        // header: ["列1", "列2", "列3"],
        data: [
          ["行1列1", "行1列2", "行1列3"],
          ["行2列1", "行2列2", "行2列3"],
          ["行3列1", "行3列2", "行3列3"],
          ["行4列1", "行4列2", "行4列3"],
          ["行5列1", "行5列2", "行5列3"],
          ["行6列1", "行6列2", "行6列3"]
        ],
        index: false,
        align: ["center"]
      },
      configList2: {
        // header: ["列1", "列2", "列3"],
        data: [
          ["行1列1", "行1列2", "行1列3"],
          ["行2列1", "行2列2", "行2列3"],
          ["行3列1", "行3列2", "行3列3"],
          ["行4列1", "行4列2", "行4列3"],
          ["行5列1", "行5列2", "行5列3"],
          ["行6列1", "行6列2", "行6列3"]
        ],
        index: true,
        align: ["center"]
      },
 
      config1: {
        data: [
          {
            name: "CPU占比",
            value: 55
          }
        ],
        digitalFlopStyle: {
          fontSize: 20
        }
      }
    };
  },
  mounted() {
    this.getLoginTime();
    this.setMyChcart1();
    this.setMyChcart2();
    this.setMyChcart3();
  },
  methods: {
    getLoginTime() {
      let date = new Date(),
        year = date.getFullYear(), //获取完整的年份(4位)
        month = date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
        strDate = date.getDate(); // 获取当前日(1-31)
      if (month < 10) month = `0${month}`; // 如果月份是个位数,在前面补0
      if (strDate < 10) strDate = `0${strDate}`; // 如果日是个位数,在前面补0
 
      this.loginTime = year + "/" + month + "/" + strDate;
    },
    setMyChcart1() {
      var chart = echarts.init(document.getElementById("echart1"));
      // 指定图表的配置项和数据
      var option = this.getOption(0.8);
      // 使用指定的配置项和数据显示图表。
      chart.setOption(option);
    },
    setMyChcart2() {
      var chart = echarts.init(document.getElementById("echart2"));
      // 指定图表的配置项和数据
      var option = this.getOption(0.5);
      // 使用指定的配置项和数据显示图表。
      chart.setOption(option);
    },
    setMyChcart3() {
      var chart = echarts.init(document.getElementById("echart3"));
      // 指定图表的配置项和数据
      var option = this.getOption(0.4);
      // 使用指定的配置项和数据显示图表。
      chart.setOption(option);
    },
 
    getOption(res) {
      return {
        series: [
          {
            type: "liquidFill",
            data: [res], // 水纹占比数据
            outline: {
              borderDistance: 0,
              itemStyle: {
                borderColor: "#156ACF",
                borderWidth: 2
              }
            },
            backgroundStyle: {
              color: "rgba(255, 255, 255,.4)",
              textStyle: {
                color: "#293441"
              }
            },
            label: {
              normal: {
                textStyle: {
                  color: "#293441",
                  insideColor: "#fff",
                  fontSize: 18
                }
              }
            }
          }
        ]
      };
    }
  }
};
</script>
 
<style lang="less" scoped>
.contentBox {
  // background-color: #fff;
  width: calc(100%);
  height: calc(100%);
  display: flex;
  flex-direction: column;
  padding: 15px;
  justify-content: space-between;
 
  .meuItem {
    width: calc(100% - 60px);
    height: calc(15% - 60px);
    background: url("../assets/img/index//boxBg.png") center center/100% 100%
      no-repeat;
    display: flex;
    padding: 30px;
 
    .userInfo {
      width: 15%;
      height: 100%;
      background: red;
    }
 
    .userMesg {
      flex: 1;
      margin: 0px 10px;
      display: flex;
      align-items: center;
      justify-content: center;
 
      div {
        line-height: 30px;
        font-family: AdobeHeitiStd-Regular;
        color: #fff;
        font-size: 18px;
      }
    }
 
    .userMenu {
      display: flex;
      align-items: center;
 
      span {
        color: white;
        margin: 0px 10px;
      }
    }
  }
 
  .menuList {
    width: calc(100%);
    height: calc(10%);
    //
    display: flex;
    line-height: 30px;
 
    color: #fff;
    justify-content: space-around;
 
    .itemMenu {
      height: calc(100% - 40px);
      width: 30%;
      background: url("../assets/img/index//boxBg.png") center center/100% 100%
        no-repeat;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      padding: 20px 0px;
 
      div {
        width: 100%;
        display: flex;
        justify-content: center;
        font-family: AdobeHeitiStd-Regular;
      }
 
      :first-child {
        font-size: 17px;
      }
    }
  }
 
  .menuBox {
    height: calc(22% - 50px);
    width: calc(100% - 50px);
    background: url("../assets/img/index//boxBg.png") center center/100% 100%
      no-repeat;
    padding: 25px;
    font-family: AdobeHeitiStd-Regular;
    color: #fff;
    display: flex;
    flex-direction: column;
 
    .title {
      font-size: 20px;
      margin-bottom: 10px;
    }
 
    .menuContent {
      flex: 1;
    }
 
    .menuEchart {
      flex: 1;
      display: flex;
      justify-content: space-between;
 
      .myEcahrt {
        width: 32%;
        height: 100%;
        position: relative;
 
        div {
          width: 100%;
          height: 100%;
          position: absolute;
        }
      }
    }
  }
}
</style>