|
@@ -5,6 +5,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+const moment = require('moment');
|
|
|
import echarts from 'echarts/lib/echarts';
|
|
|
import 'echarts/lib/chart/bar';
|
|
|
import 'echarts/lib/chart/pie';
|
|
@@ -31,17 +32,22 @@ export default {
|
|
|
async created() {
|
|
|
await this.init();
|
|
|
},
|
|
|
- async mounted() {
|
|
|
- this.channel();
|
|
|
- if (this.serveTime) {
|
|
|
- this.searchNode();
|
|
|
- this.searchNode = false;
|
|
|
- }
|
|
|
- },
|
|
|
+ async mounted() {},
|
|
|
methods: {
|
|
|
- ...topmessage(['query', 'querytwo']),
|
|
|
+ ...topmessage(['query', 'querytwo', 'qnodesCount', 'topCount']),
|
|
|
async init() {
|
|
|
- let res = await this.query();
|
|
|
+ const today = moment().format('YYYY-MM-DD');
|
|
|
+ let qnodesCount = 0;
|
|
|
+ let topCount = 0;
|
|
|
+ const qr = await this.qnodesCount({ time: today });
|
|
|
+ if (this.$checkRes(qr)) {
|
|
|
+ qnodesCount = qr.data;
|
|
|
+ }
|
|
|
+ const tr = await this.topCount({ date: today });
|
|
|
+ if (this.$checkRes(tr)) {
|
|
|
+ topCount = tr.data;
|
|
|
+ }
|
|
|
+ let res = await this.query({ date: today });
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.myChart = echarts.init(document.getElementById('chart'));
|
|
|
const option = {
|
|
@@ -64,9 +70,9 @@ export default {
|
|
|
},
|
|
|
type: 'bar',
|
|
|
data: [
|
|
|
- { name: '活跃用户', value: res.total, itemStyle: { color: '#7cb5ec' } },
|
|
|
- { name: '活跃节点', value: this.hyjdTotal, itemStyle: { color: '#ffa94b' } },
|
|
|
- { name: '活跃应用', value: res.total, itemStyle: { color: '#346da4' } },
|
|
|
+ { name: '活跃用户', value: topCount, itemStyle: { color: '#7cb5ec' } },
|
|
|
+ { name: '活跃节点', value: qnodesCount, itemStyle: { color: '#ffa94b' } },
|
|
|
+ { name: '活跃应用', value: topCount, itemStyle: { color: '#346da4' } },
|
|
|
],
|
|
|
animationType: 'scale',
|
|
|
},
|
|
@@ -80,7 +86,9 @@ export default {
|
|
|
},
|
|
|
// 页面一次性请求
|
|
|
async searchNode() {
|
|
|
- let res = await this.querytwo();
|
|
|
+ const today = moment().format('YYYY-MM-DD');
|
|
|
+ let res = await this.querytwo({ time: today });
|
|
|
+ this.$set(this, 'hyjdTotal', res.data.length);
|
|
|
},
|
|
|
channel() {
|
|
|
this.$stomp({
|