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

250 lines
7.0 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="taskQuantity.total">
<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
<span slot="term">完成</span>
{{ taskQuantity.finish }}
<a-divider type="vertical" />
<span slot="term">运行中</span>
{{ taskQuantity.running }}
<a-divider type="vertical" />
<span slot="term">最大次数</span>
{{ taskQuantity.maxRetryCount }}
2023-01-14 21:02:18 +08:00
</div>
</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="dispatchQuantity.total">
<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="dispatchQuantity.successPercent" />
</a-tooltip>
2023-01-14 21:02:18 +08:00
</div>
</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="countActivePodQuantity.total">
<a-tooltip title="总在线机器:注册到系统的客户端和服务端之和" slot="action" >
2023-06-06 23:23:59 +08:00
<a-icon type="info-circle-o" />
</a-tooltip>
<div>
<span slot="term">客户端</span>
{{ countActivePodQuantity.clientTotal }}
<a-divider type="vertical" />
<span slot="term">服务端</span>
{{ countActivePodQuantity.serverTotal }}
</div>
</chart-card>
</a>
2023-01-14 21:02:18 +08:00
</a-col>
</a-row>
<a-card :loading="loading" :bordered="false" :body-style="{padding: '0'}">
<div class="salesCard">
<a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
<div class="extra-wrapper" slot="tabBarExtraContent">
<div class="extra-item">
<a href="#" @click="dataHandler('day')">{{ $t('dashboard.analysis.all-day') }}</a>
<a href="#" @click="dataHandler('week')">{{ $t('dashboard.analysis.all-week') }}</a>
<a href="#" @click="dataHandler('month')">{{ $t('dashboard.analysis.all-month') }}</a>
<a href="#" @click="dataHandler('year')">{{ $t('dashboard.analysis.all-year') }}</a>
2023-01-14 21:02:18 +08:00
</div>
2023-01-14 20:46:02 +08:00
<div class="extra-item">
<a-range-picker :style="{width: '256px'}" @change="dateChange" />
2023-01-14 20:46:02 +08:00
</div>
<a-select placeholder="请输入组名称" @change="value => handleChange(value)" :style="{width: '256px'}">
<a-select-option v-for="item in groupNameList" :value="item" :key="item">{{ item }}</a-select-option>
</a-select>
2023-01-14 21:02:18 +08:00
</div>
<a-tab-pane loading="true" :tab="$t('dashboard.analysis.sales')" key="1">
<a-row>
<a-col :xl="16" :lg="12" :md="12" :sm="24" :xs="24">
<g2-line ref="viewChart" />
2023-01-14 21:02:18 +08:00
</a-col>
<a-col :xl="8" :lg="12" :md="12" :sm="24" :xs="24">
<rank-list :title="$t('dashboard.analysis.sales-ranking')" :list="rankList" />
2023-01-14 21:02:18 +08:00
</a-col>
</a-row>
</a-tab-pane>
</a-tabs>
</div>
</a-card>
</div>
</template>
<script>
import {
ChartCard,
MiniArea,
MiniBar,
MiniProgress,
RankList,
Bar,
NumberInfo,
2023-01-14 20:46:02 +08:00
MiniSmoothArea,
G2Line
2023-01-14 21:02:18 +08:00
} from '@/components'
import { baseMixin } from '@/store/app-mixin'
2023-01-14 20:46:02 +08:00
import { getAllGroupNameList, countTask, countDispatch, countActivePod, rankSceneQuantity } from '@/api/manage'
2023-01-14 21:02:18 +08:00
export default {
name: 'Analysis',
mixins: [baseMixin],
components: {
ChartCard,
MiniArea,
MiniBar,
MiniProgress,
RankList,
Bar,
NumberInfo,
2023-01-14 20:46:02 +08:00
MiniSmoothArea,
G2Line
2023-01-14 21:02:18 +08:00
},
data () {
return {
loading: true,
2023-01-14 20:46:02 +08:00
rankList: [],
groupNameList: [],
taskQuantity: {
total: 0,
running: 0,
finish: 0,
maxRetryCount: 0
},
dispatchQuantity: {
successPercent: '0',
total: 0
},
countActivePodQuantity: {
clientTotal: 0,
serverTotal: 0,
total: 0
},
2023-01-14 21:02:18 +08:00
pieStyle: {
stroke: '#fff',
lineWidth: 1
},
value: ''
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' })
},
dataHandler (type) {
this.$refs.viewChart.getLineDispatchQuantity(this.value, type)
this.getRankSceneQuantity(this.value, type)
},
handleChange (value) {
this.value = value
this.$refs.viewChart.getLineDispatchQuantity(value)
this.getRankSceneQuantity(this.value)
},
dateChange (date, dateString) {
console.log(dateString)
const startTime = dateString[0]
const endTime = dateString[1]
this.$refs.viewChart.getLineDispatchQuantity(this.value, 'others', startTime, endTime)
this.getRankSceneQuantity(this.value, 'day', startTime, endTime)
},
getRankSceneQuantity (groupName, type = 'day', startTime, endTime) {
rankSceneQuantity({
'groupName': groupName,
'type': type,
'startTime': startTime,
'endTime': endTime
}).then(res => {
2023-01-14 20:46:22 +08:00
this.rankList = []
res.data.forEach(res => {
this.rankList.push({
name: res.groupName + '/' + res.sceneName,
total: res.total
})
})
})
}
2023-01-14 21:02:18 +08:00
},
created () {
2023-01-14 20:46:02 +08:00
getAllGroupNameList().then(res => {
this.groupNameList = res.data
})
countTask().then(res => {
this.taskQuantity = res.data
})
countDispatch().then(res => {
this.dispatchQuantity = res.data
})
countActivePod().then(res => {
this.countActivePodQuantity = res.data
})
2023-01-14 20:46:30 +08:00
this.getRankSceneQuantity()
2023-01-14 21:02:18 +08:00
setTimeout(() => {
this.loading = !this.loading
}, 1000)
}
}
</script>
<style lang='less' scoped>
.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>