增加任务执行逻辑
parent
5f31da6db2
commit
1f3eb43eb8
|
@ -131,3 +131,12 @@ export function unifiedStop() {
|
|||
method: 'post'
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 一键执行任务状态
|
||||
*/
|
||||
export function unifiedStatus() {
|
||||
return request({
|
||||
url: `/vehicle/instance/unified/status`,
|
||||
method: 'GET'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="10">
|
||||
<el-row :gutter="10" style="height: 150px;">
|
||||
<el-row :gutter="10" style="margin-bottom: 10px;padding: 0 10px">
|
||||
<el-col :span="24">
|
||||
<el-button @click="addVehicleDrawer = true">添加车辆</el-button>
|
||||
|
@ -12,8 +9,25 @@
|
|||
<el-button @click="vehicleUnifiedSend" type="primary">一键上报</el-button>
|
||||
<el-button @click="vehicleUnifiedPosition" type="primary">一键重置路径</el-button>
|
||||
<el-button @click="vehicleUnifiedStop" type="warning">一键取消上报</el-button>
|
||||
<el-popover v-if="unifiedInfo.unifiedStatus"
|
||||
style="margin-left: 15px"
|
||||
placement="top-start"
|
||||
title="任务执行状态"
|
||||
width="200"
|
||||
trigger="hover">
|
||||
<el-progress :percentage="(unifiedInfo.taskSuccessSum+unifiedInfo.taskErrorSum)/unifiedInfo.taskExecutionSum*100" :color="customColors"></el-progress>
|
||||
<div style="width: 100%; margin: 5px 0">任务描述:<el-tag>{{unifiedInfo.taskName}}</el-tag></div>
|
||||
<div style="width: 100%; margin: 5px 0">任务总数:<el-tag>{{unifiedInfo.taskExecutionSum}}</el-tag></div>
|
||||
<div style="width: 100%; margin: 5px 0">成功总数:<el-tag>{{unifiedInfo.taskSuccessSum}}</el-tag></div>
|
||||
<div style="width: 100%; margin: 5px 0">失败总数:<el-tag>{{unifiedInfo.taskErrorSum}}</el-tag></div>
|
||||
|
||||
<el-button slot="reference">有任务在执行</el-button>
|
||||
</el-popover>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="10">
|
||||
<el-row :gutter="10" style="height: 100px;">
|
||||
<el-row :gutter="10" style="margin-bottom: 10px;padding: 0 10px">
|
||||
<el-col :span="6">
|
||||
<el-input v-model="queryParams.vin" prefix-icon="el-icon-search" placeholder="VIN检索(模糊)"></el-input>
|
||||
|
@ -240,7 +254,7 @@ import {
|
|||
instanceClientInit, instanceData,
|
||||
instanceGear,
|
||||
instanceList,
|
||||
instanceMsg, unifiedOffline, unifiedOnline, unifiedPosition, unifiedSend, unifiedStop
|
||||
instanceMsg, unifiedOffline, unifiedOnline, unifiedPosition, unifiedSend, unifiedStatus, unifiedStop
|
||||
} from '@/api/vehicle/instance'
|
||||
import {positionList} from "@/api/vehicle/position";
|
||||
import { create, gen } from '@/api/vehicle/vehicle'
|
||||
|
@ -282,7 +296,25 @@ export default {
|
|||
// 生成车辆表单
|
||||
genForm: {
|
||||
number: 0
|
||||
}
|
||||
},
|
||||
// 任务进度
|
||||
unifiedInfo: {
|
||||
unifiedStatus: false,
|
||||
taskName: null,
|
||||
taskExecutionSum: null,
|
||||
taskStartTime: null,
|
||||
taskSuccessSum: null,
|
||||
taskErrorSum: null
|
||||
},
|
||||
unifiedInfoInterval: null,
|
||||
// 进度条颜色
|
||||
customColors: [
|
||||
{ color: '#f56c6c', percentage: 20 },
|
||||
{ color: '#e6a23c', percentage: 40 },
|
||||
{ color: '#1989fa', percentage: 60 },
|
||||
{ color: '#6f7ad3', percentage: 80 },
|
||||
{ color: '#5cb87a', percentage: 100 }
|
||||
]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -292,6 +324,17 @@ export default {
|
|||
this.intervalVehicleDataContinued = setInterval(this.vehicleDataContinued, 1000);
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 获取状态
|
||||
*/
|
||||
vehicleUnifiedStatus() {
|
||||
unifiedStatus().then(response => {
|
||||
this.unifiedInfo = response.data;
|
||||
if (!this.unifiedInfo.unifiedStatus){
|
||||
clearInterval(this.unifiedInfoInterval);
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 一键上线
|
||||
*/
|
||||
|
@ -302,6 +345,7 @@ export default {
|
|||
message: response.msg,
|
||||
type: response.code === 200 ? 'success' : 'error'
|
||||
})
|
||||
this.unifiedInfoInterval = setInterval(this.vehicleUnifiedStatus, 100)
|
||||
})
|
||||
},
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue