一键上线

一键离线
一键上报
一键重置路线
一键取消上报
master
DongZeLiang 2023-12-03 00:01:17 +08:00
parent 6bfedab4df
commit f4a8d06943
3 changed files with 169 additions and 25 deletions

View File

@ -85,3 +85,49 @@ export function instanceGear(vin, gear) {
data: { 'vin': vin, 'gear': gear }
})
}
/**
* 一键上线
*/
export function unifiedOnline() {
return request({
url: `/vehicle/instance/unified/online`,
method: 'post'
})
}
/**
* 一键离线
*/
export function unifiedOffline() {
return request({
url: `/vehicle/instance/unified/offline`,
method: 'post'
})
}
/**
* 一键上报
*/
export function unifiedSend() {
return request({
url: `/vehicle/instance/unified/send`,
method: 'post'
})
}
/**
* 一键重置路径
*/
export function unifiedPosition() {
return request({
url: `/vehicle/instance/unified/position`,
method: 'post'
})
}
/**
* 一键取消上报
*/
export function unifiedStop() {
return request({
url: `/vehicle/instance/unified/stop`,
method: 'post'
})
}

View File

@ -4,7 +4,7 @@ import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n
import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n
import '@/styles/index.scss' // global css

View File

@ -2,27 +2,45 @@
<div class="app-container">
<el-row :gutter="10">
<el-col :span="10">
<el-row style="height: 50px;">
<div>
<el-button @click="addVehicleDrawer = true">添加车辆</el-button>
<el-button @click="genVehicleDialog = true" type="primary">生成车辆</el-button>
</div>
<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>
<el-button @click="genVehicleDialog = true" type="primary">生成车辆</el-button>
<el-button @click="vehicleUnifiedOnline" type="success">一键上线</el-button>
<el-button @click="vehicleUnifiedOffline" type="success">一键离线</el-button>
<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-col>
</el-row>
<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>
</el-col>
<el-col :span="6">
<el-switch style="margin: 9px 0;"
v-model="queryParams.online"
active-color="#13ce66"
inactive-text="上线优先展示">
</el-switch>
</el-col>
</el-row>
<el-row :gutter="10" style="margin-bottom: 10px;padding: 0 10px">
<el-pagination
@size-change="pageSizeChange"
@current-change="pageChange"
:current-page="queryParams.page"
:page-sizes="[10, 20, 30, 50, 100]"
:page-size="queryParams.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="vehiclePage.total">
</el-pagination>
</el-row>
</el-row>
<div class="grid-content bg-purple" :style="{'height': contentHeight - 50 +'px'}">
<div class="grid-content bg-purple" :style="{'height': contentHeight - 150 +'px'}">
<el-row :gutter="10">
<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>
</el-col>
<el-col :span="6">
<el-switch style="margin: 9px 0;"
v-model="queryParams.online"
active-color="#13ce66"
inactive-text="上线优先展示">
</el-switch>
</el-col>
</el-row>
<el-col :span="12" v-for="vehicle in vehicleList" style="margin: 0 0 10px 0;">
<el-col :span="12" v-for="vehicle in vehiclePage.rows" style="margin: 0 0 10px 0;">
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-tag :type="!vehicle.online ? 'info' : 'success'" style="padding-left: 0; padding-right: 0">
@ -221,8 +239,8 @@ import {
instanceClientInit, instanceData,
instanceGear,
instanceList,
instanceMsg
} from "@/api/vehicle/instance";
instanceMsg, unifiedOffline, unifiedOnline, unifiedPosition, unifiedSend, unifiedStop
} from '@/api/vehicle/instance'
import {positionList} from "@/api/vehicle/position";
import { create, gen } from '@/api/vehicle/vehicle'
@ -235,9 +253,14 @@ export default {
//
positionCodeList: [],
//
vehicleList: [],
vehiclePage: {
rows: [],
total: 0
},
//
queryParams: {
page: 1,
pageSize: 10,
vin: null,
online: true
},
@ -268,6 +291,82 @@ export default {
this.intervalVehicleDataContinued = setInterval(this.vehicleDataContinued, 1000);
},
methods: {
/**
* 一键上线
*/
vehicleUnifiedOnline(){
unifiedOnline().then(response => {
this.$notify({
title: '操作提示',
message: response.msg,
type: response.code === 200 ? 'success' : 'error'
})
})
},
/**
* 一键离线
*/
vehicleUnifiedOffline(){
unifiedOffline().then(response => {
this.$notify({
title: '操作提示',
message: response.msg,
type: response.code === 200 ? 'success' : 'error'
})
})
},
/**
* 一键上报
*/
vehicleUnifiedSend(){
unifiedSend().then(response => {
this.$notify({
title: '操作提示',
message: response.msg,
type: response.code === 200 ? 'success' : 'error'
})
})
},
/**
* 一键上报
*/
vehicleUnifiedPosition(){
unifiedPosition().then(response => {
this.$notify({
title: '操作提示',
message: response.msg,
type: response.code === 200 ? 'success' : 'error'
})
})
},
/**
* 一键取消上报
*/
vehicleUnifiedStop(){
unifiedStop().then(response => {
this.$notify({
title: '操作提示',
message: response.msg,
type: response.code === 200 ? 'success' : 'error'
})
})
},
/**
* 选择每页数量
* @param val
*/
pageSizeChange(val) {
this.queryParams.pageSize = val;
this.getInstanceList()
},
/**
* 选择页数
* @param val
*/
pageChange(val) {
this.queryParams.page = val;
this.getInstanceList()
},
/**
* 车辆生成
*/
@ -311,7 +410,6 @@ export default {
* @param statusKey 状态Key
*/
statusChange(statusKey) {
debugger
editStatus(this.checkVin, statusKey, this.vehicleData[statusKey]).then(response => {
this.$notify({
title: '操作提示',
@ -384,7 +482,7 @@ export default {
*/
getInstanceList() {
instanceList(this.queryParams).then(response => {
this.vehicleList = response.data;
this.vehiclePage = response.data;
})
},