增加删除车辆接口

master
dongzeliang 2023-12-06 18:37:54 +08:00
parent 1f3eb43eb8
commit 9bfcfb4d9d
3 changed files with 25 additions and 2 deletions

View File

@ -14,3 +14,10 @@ export function gen(number) {
method: 'GET'
})
}
export function remove(vin) {
return request({
url: `/vehicle/${vin}`,
method: 'DELETE'
})
}

View File

@ -74,7 +74,7 @@ service.interceptors.response.use(
error => {
console.log('err' + error) // for debug
Message({
message: error.msg,
message: error.message,
type: 'error',
duration: 5 * 1000
})

View File

@ -60,6 +60,9 @@
<el-tag :type="!vehicle.online ? 'info' : 'success'" style="padding-left: 0; padding-right: 0">
{{ vehicle.vin }}
</el-tag>
<el-button style="float: right;" type="danger"
@click="vehicleRemove(vehicle.vin)" size="mini">删除</el-button>
<span style="float: right; color: rgba(255,255,255,0)">|</span>
<el-button style="float: right;" :type="checkVin === vehicle.vin ? 'success' : ''"
@click="checkVin = vehicle.vin" size="mini" :disabled="!vehicle.online">{{checkVin === vehicle.vin ? "已选择" : "选择"}}</el-button>
<span style="float: right; color: rgba(255,255,255,0)">|</span>
@ -257,7 +260,7 @@ import {
instanceMsg, unifiedOffline, unifiedOnline, unifiedPosition, unifiedSend, unifiedStatus, unifiedStop
} from '@/api/vehicle/instance'
import {positionList} from "@/api/vehicle/position";
import { create, gen } from '@/api/vehicle/vehicle'
import { create, gen, remove } from '@/api/vehicle/vehicle'
export default {
data() {
@ -440,6 +443,19 @@ export default {
})
})
},
/**
* 车辆删除
*/
vehicleRemove(vin){
remove(vin).then(response => {
this.getInstanceList()
this.$notify({
title: '操作提示',
message: response.msg,
type: response.code === 200 ? 'success' : 'error'
})
})
},
/**
* 获取车辆数据