diff --git a/src/api/vehicle/vehicle.js b/src/api/vehicle/vehicle.js new file mode 100644 index 0000000..060d407 --- /dev/null +++ b/src/api/vehicle/vehicle.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' + +export function create(params) { + return request({ + url: '/vehicle/create', + method: 'post', + data: params + }) +} diff --git a/src/views/vehicle/index.vue b/src/views/vehicle/index.vue index a226227..82c7bf3 100644 --- a/src/views/vehicle/index.vue +++ b/src/views/vehicle/index.vue @@ -4,18 +4,23 @@
- 添加车辆 + 添加车辆
+ + + + +
{{ vehicle.vin }} - 选择 + 选择 | 上线 @@ -158,6 +163,26 @@
+ + + +

一行一个VIN,多VIN进行换行

+ + + + + + 添加车辆 + 取消 + + +
+
+
@@ -172,20 +197,32 @@ import { instanceMsg } from "@/api/vehicle/instance"; import {positionList} from "@/api/vehicle/position"; +import {create} from "@/api/vehicle/vehicle"; export default { data() { return { contentHeight: 1024, + // 选中的VIN checkVin: null, + // 路径列表 positionCodeList: [], + // 车辆列表 vehicleList: [], + // 查询 queryParams: { vin: null, }, + // 定时获取车辆列表 intervalInstanceList: null, + // 定时获取车辆数据 intervalVehicleDataContinued: null, - vehicleData: {} + // 车辆模拟数据 + vehicleData: {}, + // 添加车辆抽屉 + addVehicleDrawer: false, + // 添加表单 + addForm: {} } }, created() { @@ -196,6 +233,19 @@ export default { }, methods: { + /** + * 车辆添加 + */ + vehicleCreate(){ + create(this.addForm).then(response => { + this.$notify({ + title: '操作提示', + message: response.msg, + type: response.code === 200 ? 'success' : 'error' + }) + }) + }, + /** * 获取车辆数据 */ @@ -211,7 +261,7 @@ export default { * 状态发生改变 * @param statusKey 状态Key */ - statusChange(statusKey){ + statusChange(statusKey) { debugger editStatus(this.checkVin, statusKey, this.vehicleData[statusKey]).then(response => { this.$notify({ @@ -310,6 +360,10 @@ export default { clientClose(vin){ instanceClientClose(vin).then(response => { this.getInstanceList(); + // 如果下线的是本车则关闭实时车况查看 + if (vin === this.checkVin){ + this.checkVin = null + } this.$notify({ title: '操作提示', message: response.msg,