diff --git a/src/api/vehicle/vehicle.js b/src/api/vehicle/vehicle.js
index edc1f78..92451a7 100644
--- a/src/api/vehicle/vehicle.js
+++ b/src/api/vehicle/vehicle.js
@@ -14,3 +14,10 @@ export function gen(number) {
method: 'GET'
})
}
+
+export function remove(vin) {
+ return request({
+ url: `/vehicle/${vin}`,
+ method: 'DELETE'
+ })
+}
diff --git a/src/utils/request.js b/src/utils/request.js
index 2be05bf..b98dc93 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -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
})
diff --git a/src/views/vehicle/index.vue b/src/views/vehicle/index.vue
index 628bd26..e953168 100644
--- a/src/views/vehicle/index.vue
+++ b/src/views/vehicle/index.vue
@@ -60,6 +60,9 @@
{{ vehicle.vin }}
+ 删除
+ |
{{checkVin === vehicle.vin ? "已选择" : "选择"}}
|
@@ -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'
+ })
+ })
+ },
/**
* 获取车辆数据