1、支持手动添加车辆

2、支持vin检索功能
master
DongZeLiang 2023-12-02 09:20:40 +08:00
parent f5be1ea5e6
commit 5061b8bc40
2 changed files with 67 additions and 4 deletions

View File

@ -0,0 +1,9 @@
import request from '@/utils/request'
export function create(params) {
return request({
url: '/vehicle/create',
method: 'post',
data: params
})
}

View File

@ -4,18 +4,23 @@
<el-col :span="10"> <el-col :span="10">
<el-row style="height: 50px;"> <el-row style="height: 50px;">
<div> <div>
<el-button>添加车辆</el-button> <el-button @click="addVehicleDrawer = true">添加车辆</el-button>
</div> </div>
</el-row> </el-row>
<div class="grid-content bg-purple" :style="{'height': contentHeight - 50 +'px'}"> <div class="grid-content bg-purple" :style="{'height': contentHeight - 50 +'px'}">
<el-row :gutter="10"> <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-row>
<el-col :span="12" v-for="vehicle in vehicleList" style="margin: 0 0 10px 0;"> <el-col :span="12" v-for="vehicle in vehicleList" style="margin: 0 0 10px 0;">
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<el-tag :type="!vehicle.online ? 'info' : 'success'" style="padding-left: 0; padding-right: 0"> <el-tag :type="!vehicle.online ? 'info' : 'success'" style="padding-left: 0; padding-right: 0">
{{ vehicle.vin }} {{ vehicle.vin }}
</el-tag> </el-tag>
<el-button style="float: right;" @click="checkVin = vehicle.vin" size="mini">选择</el-button> <el-button style="float: right;" @click="checkVin = vehicle.vin" size="mini" :disabled="!vehicle.online">选择</el-button>
<span style="float: right; color: rgba(255,255,255,0)">|</span> <span style="float: right; color: rgba(255,255,255,0)">|</span>
<el-button v-if="!vehicle.online" style="float: right;" size="mini" @click="clientInit(vehicle.vin)"> <el-button v-if="!vehicle.online" style="float: right;" size="mini" @click="clientInit(vehicle.vin)">
上线 上线
@ -158,6 +163,26 @@
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
<el-drawer
title="添加车辆"
:visible.sync="addVehicleDrawer"
direction="ltr"
size="50%">
<el-row>
<el-col :span="22" :offset="1">
<h3 style="color: red">一行一个VIN多VIN进行换行</h3>
<el-form ref="form" :model="addForm" label-position="top" label-width="80px">
<el-form-item label="车辆VIN">
<el-input type="textarea" v-model="addForm.vinStr"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="vehicleCreate"></el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
</el-drawer>
</div> </div>
</template> </template>
@ -172,20 +197,32 @@ import {
instanceMsg instanceMsg
} from "@/api/vehicle/instance"; } from "@/api/vehicle/instance";
import {positionList} from "@/api/vehicle/position"; import {positionList} from "@/api/vehicle/position";
import {create} from "@/api/vehicle/vehicle";
export default { export default {
data() { data() {
return { return {
contentHeight: 1024, contentHeight: 1024,
// VIN
checkVin: null, checkVin: null,
//
positionCodeList: [], positionCodeList: [],
//
vehicleList: [], vehicleList: [],
//
queryParams: { queryParams: {
vin: null, vin: null,
}, },
//
intervalInstanceList: null, intervalInstanceList: null,
//
intervalVehicleDataContinued: null, intervalVehicleDataContinued: null,
vehicleData: {} //
vehicleData: {},
//
addVehicleDrawer: false,
//
addForm: {}
} }
}, },
created() { created() {
@ -196,6 +233,19 @@ export default {
}, },
methods: { methods: {
/**
* 车辆添加
*/
vehicleCreate(){
create(this.addForm).then(response => {
this.$notify({
title: '操作提示',
message: response.msg,
type: response.code === 200 ? 'success' : 'error'
})
})
},
/** /**
* 获取车辆数据 * 获取车辆数据
*/ */
@ -310,6 +360,10 @@ export default {
clientClose(vin){ clientClose(vin){
instanceClientClose(vin).then(response => { instanceClientClose(vin).then(response => {
this.getInstanceList(); this.getInstanceList();
// 线
if (vin === this.checkVin){
this.checkVin = null
}
this.$notify({ this.$notify({
title: '操作提示', title: '操作提示',
message: response.msg, message: response.msg,