|
|
@@ -1,62 +1,78 @@
|
|
|
<template>
|
|
|
<div class="app-container" style="background-color: #F7F7F7;height: 100%;overflow: auto;">
|
|
|
- <div class="gw-statistic-row" style="height: 12vh;">
|
|
|
+ <div class="gw-statistic-row" style="height: 10vh;">
|
|
|
<gw-statistic v-for="item in statisticData" :key="item.name" :name="item.name" :value="item.value"
|
|
|
:color="item.color"></gw-statistic>
|
|
|
</div>
|
|
|
- <el-card>
|
|
|
- <el-table
|
|
|
- :data="tableData"
|
|
|
- height="59vh"
|
|
|
- :cell-style="{ padding: '5px' }"
|
|
|
- :header-cell-style="{ height: heightAll * 0.01 + 'px' }"
|
|
|
- :row-style="{ fontSize: '1rem', textAlign:'center' }"
|
|
|
- border>
|
|
|
- <el-table-column prop="jobName" label="任务名称" width="160"></el-table-column>
|
|
|
- <el-table-column prop="taskType" label="任务类型" width="170">
|
|
|
- <template #default="scope">
|
|
|
- <el-tag v-if="scope.row.taskType==1" type="success">集群</el-tag>
|
|
|
- <el-tag v-if="scope.row.taskType==2" type="info">广播</el-tag>
|
|
|
- <el-tag v-if="scope.row.taskType==3" type="warning">Sharding</el-tag>
|
|
|
- <el-tag v-if="scope.row.taskType==4" type="danger">Map</el-tag>
|
|
|
- <el-tag v-if="scope.row.taskType==5">MapReduce</el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="triggerType" label="触发类型" width="170">
|
|
|
- <template #default="scope">
|
|
|
- <el-tag v-if="scope.row.triggerType==2">固定时间</el-tag>
|
|
|
- <el-tag v-if="scope.row.triggerType==3">CRON 表达式</el-tag>
|
|
|
- <el-tag v-if="scope.row.triggerType==99">工作流</el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="retryInterval" label="间隔时长" width="170"/>
|
|
|
- <el-table-column prop="blockStrategy" label="阻塞策略" width="170">
|
|
|
- <template #default="scope">
|
|
|
- <el-tag v-if="scope.row.blockStrategy==1">丢弃</el-tag>
|
|
|
- <el-tag v-if="scope.row.blockStrategy==2">覆盖</el-tag>
|
|
|
- <el-tag v-if="scope.row.blockStrategy==3">并行</el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="executorTimeout" label="超时时间(秒)" width="170"/>
|
|
|
- <el-table-column prop="executionTime" label="执行时间" width="240"/>
|
|
|
- <el-table-column align="center" prop="taskStatus" label="执行状态" width="80">
|
|
|
- <template #default="scope">
|
|
|
- <el-tag v-if="scope.row.taskStatus == 3">成功</el-tag>
|
|
|
- <el-tag v-else type="danger">失败</el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="resultMessage" label="执行结果" width="170"/>
|
|
|
- </el-table>
|
|
|
- <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
|
|
- v-model:limit="queryParams.pageSize" @pagination="getTaskData"/>
|
|
|
- </el-card>
|
|
|
+ <div class="gw-statistic-row" style="height: 34vh;">
|
|
|
+ <gw-card>
|
|
|
+ <template v-slot:title>
|
|
|
+ <div style="display: flex;align-items: center;justify-content: space-between;">
|
|
|
+ <div>
|
|
|
+ <span>任务统计</span>
|
|
|
+ </div>
|
|
|
+ <el-segmented v-model="task" :options="taskOptions" @change="initChartTop5"/>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <gw-echart ref="top5Ref"></gw-echart>
|
|
|
+ </gw-card>
|
|
|
+ </div>
|
|
|
+ <div class="gw-statistic-row" style="height: 36vh;">
|
|
|
+ <gw-card>
|
|
|
+ <el-table
|
|
|
+ :data="tableData"
|
|
|
+ height="24vh"
|
|
|
+ :cell-style="{ padding: '5px' }"
|
|
|
+ :header-cell-style="{ height: heightAll * 0.01 + 'px' }"
|
|
|
+ :row-style="{ fontSize: '1rem', textAlign:'center' }"
|
|
|
+ border>
|
|
|
+ <el-table-column prop="jobName" label="任务名称"></el-table-column>
|
|
|
+ <el-table-column prop="taskType" label="任务类型" width="170">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-tag v-if="scope.row.taskType==1" type="success">集群</el-tag>
|
|
|
+ <el-tag v-if="scope.row.taskType==2" type="info">广播</el-tag>
|
|
|
+ <el-tag v-if="scope.row.taskType==3" type="warning">Sharding</el-tag>
|
|
|
+ <el-tag v-if="scope.row.taskType==4" type="danger">Map</el-tag>
|
|
|
+ <el-tag v-if="scope.row.taskType==5">MapReduce</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="triggerType" label="触发类型" width="170">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-tag v-if="scope.row.triggerType==2">固定时间</el-tag>
|
|
|
+ <el-tag v-if="scope.row.triggerType==3">CRON 表达式</el-tag>
|
|
|
+ <el-tag v-if="scope.row.triggerType==99">工作流</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="retryInterval" label="间隔时长" width="170"/>
|
|
|
+ <el-table-column prop="blockStrategy" label="阻塞策略" width="170">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-tag v-if="scope.row.blockStrategy==1">丢弃</el-tag>
|
|
|
+ <el-tag v-if="scope.row.blockStrategy==2">覆盖</el-tag>
|
|
|
+ <el-tag v-if="scope.row.blockStrategy==3">并行</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="executorTimeout" label="超时时间(秒)" width="170"/>
|
|
|
+ <el-table-column prop="executionTime" label="执行时间" width="240"/>
|
|
|
+ <el-table-column align="center" prop="taskStatus" label="执行状态" width="80">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-tag v-if="scope.row.taskStatus == 3">成功</el-tag>
|
|
|
+ <el-tag v-else type="danger">失败</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
|
|
+ v-model:limit="queryParams.pageSize" @pagination="getTaskData"/>
|
|
|
+ </gw-card>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup>
|
|
|
import {onMounted} from 'vue';
|
|
|
import GwStatistic from "@/views/monitor/service/GwStatistic.vue";
|
|
|
import Pagination from "@/components/Pagination/index.vue";
|
|
|
-import {snailJobLogList, snailJobStatistics} from "@/api/service/timing.js";
|
|
|
+import {snailJobLine, snailJobLogList, snailJobTaskRetryJob} from "@/api/service/timing.js";
|
|
|
+import GwCard from "@/views/monitor/service/GwCard.vue";
|
|
|
+import GwEchart from "@/components/chart/GwEchart.vue";
|
|
|
|
|
|
const statisticData = ref([
|
|
|
{name: '任务数据总数', value: 0, color: '#477ACF'},
|
|
|
@@ -70,6 +86,14 @@ const queryParams = ref({
|
|
|
})
|
|
|
const tableData = ref([])
|
|
|
const total = ref(0)
|
|
|
+const top5Ref = ref(null)
|
|
|
+const task = ref('MONTH')
|
|
|
+const taskOptions = ref([
|
|
|
+ {label: '今日', value: 'DAY'},
|
|
|
+ {label: '最近一周', value: 'WEEK'},
|
|
|
+ {label: '最近一月', value: 'MONTH'},
|
|
|
+ {label: '全年', value: 'YEAR'},
|
|
|
+])
|
|
|
|
|
|
function getTaskData() {
|
|
|
snailJobLogList(queryParams.value).then(res => {
|
|
|
@@ -79,18 +103,80 @@ function getTaskData() {
|
|
|
}
|
|
|
|
|
|
function getStatistics() {
|
|
|
- snailJobStatistics().then(res => {
|
|
|
+ snailJobTaskRetryJob().then(res => {
|
|
|
+ res.data.successRate = (res.data.successNum / res.data.totalNum * 100).toFixed(2) + '%'
|
|
|
statisticData.value = [
|
|
|
- {name: '任务数据总数', value: res.data.total, color: '#477ACF'},
|
|
|
- {name: '任务被执行次数', value: res.data.runTotal, color: '#40B0D7'},
|
|
|
- {name: '日执行量', value: res.data.nowRunTotal, color: '#2DBEA2'},
|
|
|
- {name: '月执行量', value: res.data.monthRunTotal, color: '#487ACF'},
|
|
|
+ {name: '任务总数', value: res.data.totalNum, color: '#477ACF'},
|
|
|
+ {name: '任务成功', value: res.data.successNum, color: '#2DBEA2'},
|
|
|
+ {name: '任务失败', value: res.data.failNum, color: '#F56C6C'},
|
|
|
+ {name: '任务停止', value: res.data.stopNum, color: '#E6A23C'},
|
|
|
+ {name: '人工取消', value: res.data.cancelNum, color: '#909399'},
|
|
|
+ {name: '任务成功率', value: res.data.successRate, color: '#487ACF'},
|
|
|
]
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+function initChartTop5() {
|
|
|
+ snailJobLine({type: task.value}).then(res => {
|
|
|
+ const chartData = res.data
|
|
|
+ const option = {
|
|
|
+ color: ['#2dbea2', '#f56c6c', '#b686d4', '#e6a23c'],
|
|
|
+ legend: {},
|
|
|
+ grid: {
|
|
|
+ left: '5%',
|
|
|
+ right: '5%',
|
|
|
+ bottom: '10%',
|
|
|
+ top: '15%',
|
|
|
+ containLabel: true
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ trigger: 'axis'
|
|
|
+ },
|
|
|
+ dataset: {
|
|
|
+ source: [
|
|
|
+ ['时间', ...chartData.map(item => item.createDt)],
|
|
|
+ ['成功', ...chartData.map(item => item.success)],
|
|
|
+ ['失败', ...chartData.map(item => item.failNum)],
|
|
|
+ ['停止', ...chartData.map(item => item.stop)],
|
|
|
+ ['取消', ...chartData.map(item => item.cancel)],
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ xAxis: {type: 'category'},
|
|
|
+ yAxis: {gridIndex: 0},
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ seriesLayoutBy: 'row',
|
|
|
+ emphasis: {focus: 'series'},
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ seriesLayoutBy: 'row',
|
|
|
+ emphasis: {focus: 'series'}
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ seriesLayoutBy: 'row',
|
|
|
+ emphasis: {focus: 'series'}
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'line',
|
|
|
+ smooth: true,
|
|
|
+ seriesLayoutBy: 'row',
|
|
|
+ emphasis: {focus: 'series'}
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ top5Ref.value.loadChart(option);
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
getStatistics()
|
|
|
+ initChartTop5()
|
|
|
getTaskData()
|
|
|
});
|
|
|
</script>
|