gtsoft-snail-job-server/frontend/src/views/dashboard/Analysis.vue

226 lines
5.7 KiB
Vue
Raw Normal View History

2023-01-14 21:02:18 +08:00
<template>
<div>
<a-row :gutter="24">
2023-01-14 20:46:02 +08:00
<a-col :sm="24" :md="12" :xl="8" :style="{ marginBottom: '24px' }">
<chart-card :loading="loading" :title="$t('dashboard.analysis.total-sales')" :total="retryTask.totalNum">
<a-tooltip title="总任务量: 重试/回调任务量" slot="action">
2023-01-14 21:02:18 +08:00
<a-icon type="info-circle-o" />
</a-tooltip>
<div class="antv-chart-mini">
<div class="chart-wrapper" :style="{ height: 46 }">
<v-chart :force-fit="true" :height="height" :data="retryTaskBarList" :padding="[36, 5, 18, 5]">
<v-tooltip />
<v-bar position="x*y" />
</v-chart>
</div>
2023-01-14 21:02:18 +08:00
</div>
<template slot="footer">
<div>
<span slot="term">完成</span>
{{ retryTask.finishNum }}
<a-divider type="vertical" />
<span slot="term">运行中</span>
{{ retryTask.runningNum }}
<a-divider type="vertical" />
<span slot="term">最大次数</span>
{{ retryTask.maxCountNum }}
<a-divider type="vertical" />
<span slot="term">暂停重试</span>
{{ retryTask.suspendNum }}
</div>
</template>
2023-01-14 21:02:18 +08:00
</chart-card>
</a-col>
2023-01-14 20:46:02 +08:00
<a-col :sm="24" :md="12" :xl="8" :style="{ marginBottom: '24px' }">
<chart-card :loading="loading" title="定时任务" :total="jobTask.totalNum">
<a-tooltip title="成功率:总完成/总调度量;" slot="action">
2023-01-14 21:02:18 +08:00
<a-icon type="info-circle-o" />
</a-tooltip>
<div>
2023-01-14 20:46:02 +08:00
<a-tooltip title="成功率">
<a-progress stroke-linecap="square" :percent="jobTask.successRate" />
2023-01-14 20:46:02 +08:00
</a-tooltip>
2023-01-14 21:02:18 +08:00
</div>
<template slot="footer">
{{ $t('dashboard.analysis.job_success') }}
<span>{{ jobTask.successNum }}</span>
<a-divider type="vertical" />
{{ $t('dashboard.analysis.job_fail') }}
<span>{{ jobTask.failNum }}</span>
</template>
2023-01-14 21:02:18 +08:00
</chart-card>
</a-col>
2023-01-14 20:46:02 +08:00
<a-col :sm="24" :md="12" :xl="8" :style="{ marginBottom: '24px' }">
2023-06-06 23:23:59 +08:00
<a href="#" @click="jumpPosList">
<chart-card :loading="loading" title="总在线机器" :total="onLineService.total">
<a-tooltip title="总在线机器:注册到系统的客户端和服务端之和" slot="action" >
2023-06-06 23:23:59 +08:00
<a-icon type="info-circle-o" />
</a-tooltip>
<template slot="footer">
<div>
<span slot="term">客户端</span>
{{ onLineService.clientTotal }}
<a-divider type="vertical" />
<span slot="term">服务端</span>
{{ onLineService.serverTotal }}
</div>
</template>
2023-06-06 23:23:59 +08:00
</chart-card>
</a>
2023-01-14 21:02:18 +08:00
</a-col>
</a-row>
<a-card :loading="loading" :bordered="true" :body-style="{padding: '0'}">
2023-01-14 21:02:18 +08:00
<div class="salesCard">
<a-tabs>
<a-tab-pane loading="true" :tab="$t('dashboard.analysis.sales')" v-if="$auth('RetryAnalysis.retry')" key="1">
<div>
<retry-analysis />
2023-01-14 21:02:18 +08:00
</div>
</a-tab-pane>
<a-tab-pane :tab="$t('dashboard.analysis.visits')" v-if="$auth('JobAnalysis.job')" key="2">
<div>
<job-analysis />
2023-01-14 20:46:02 +08:00
</div>
2023-01-14 21:02:18 +08:00
</a-tab-pane>
</a-tabs>
</div>
</a-card>
</div>
</template>
<script>
import {
ChartCard,
MiniArea,
MiniProgress,
Bar,
Trend,
2023-01-14 21:02:18 +08:00
NumberInfo,
MiniSmoothArea
2023-01-14 21:02:18 +08:00
} from '@/components'
import {
getDashboardTaskRetryJob
} from '@/api/manage'
import RetryAnalysis from '@/views/dashboard/RetryAnalysis.vue'
import JobAnalysis from '@/views/dashboard/JobAnalysis.vue'
2023-01-14 21:02:18 +08:00
export default {
name: 'Analysis',
components: {
RetryAnalysis,
JobAnalysis,
2023-01-14 21:02:18 +08:00
ChartCard,
MiniArea,
MiniProgress,
Bar,
Trend,
2023-01-14 21:02:18 +08:00
NumberInfo,
MiniSmoothArea
2023-01-14 21:02:18 +08:00
},
data () {
return {
loading: true,
height: 100,
retryTaskBarList: [],
retryTask: {
totalNum: 0,
runningNum: 0,
finishNum: 0,
maxCountNum: 0,
suspendNum: 0
2023-01-14 20:46:02 +08:00
},
jobTask: {
successRate: 0,
successNum: 0,
failNum: 0,
totalNum: 0
2023-01-14 20:46:02 +08:00
},
onLineService: {
2023-01-14 20:46:02 +08:00
clientTotal: 0,
serverTotal: 0,
total: 0
}
2023-01-14 21:02:18 +08:00
}
},
computed: {
},
2023-01-14 20:46:02 +08:00
methods: {
2023-06-06 23:23:59 +08:00
jumpPosList () {
this.$router.push({ path: '/dashboard/pods' })
}
2023-01-14 21:02:18 +08:00
},
created () {
getDashboardTaskRetryJob().then(res => {
this.retryTask = res.data.retryTask
this.jobTask = res.data.jobTask
this.onLineService = res.data.onLineService
this.retryTaskBarList = res.data.retryTaskBarList
2023-01-14 20:46:02 +08:00
})
2023-01-14 21:02:18 +08:00
setTimeout(() => {
this.loading = !this.loading
}, 1000)
}
}
</script>
<style lang='less' scoped>
.antv-chart-mini {
position: relative;
width: 100%;
.chart-wrapper {
position: absolute;
bottom: -28px;
width: 100%;
}
}
.extra-wrapper {
line-height: 55px;
padding-right: 24px;
2023-01-14 21:02:18 +08:00
.extra-item {
display: inline-block;
margin-right: 24px;
2023-01-14 21:02:18 +08:00
a {
margin-left: 24px;
2023-01-14 21:02:18 +08:00
}
}
}
2023-01-14 21:02:18 +08:00
.antd-pro-pages-dashboard-analysis-twoColLayout {
position: relative;
display: flex;
display: block;
flex-flow: row wrap;
}
.antd-pro-pages-dashboard-analysis-salesCard {
height: calc(100% - 24px);
/deep/ .ant-card-head {
2023-01-14 21:02:18 +08:00
position: relative;
}
}
2023-01-14 21:02:18 +08:00
.dashboard-analysis-iconGroup {
i {
margin-left: 16px;
color: rgba(0, 0, 0, .45);
cursor: pointer;
transition: color .32s;
color: black;
2023-01-14 21:02:18 +08:00
}
}
2023-01-14 21:02:18 +08:00
.analysis-salesTypeRadio {
position: absolute;
right: 54px;
bottom: 12px;
}
2023-01-14 21:02:18 +08:00
</style>