车辆管理更新

master
shaowenhao 2023-11-29 13:58:21 +08:00
parent 9b54ce9b7a
commit 0a843231d8
5 changed files with 1293 additions and 64 deletions

View File

@ -9,6 +9,14 @@ export function carList(data) {
data data
}) })
} }
//车辆信息列表
export function carHuiList(carVinId) {
return request({
url: 'carBase/car//list/' + carVinId,
method: 'get',
carVinId
})
}
//添加车辆信息管理 //添加车辆信息管理
export function carAdd(data) { export function carAdd(data) {

View File

@ -56,7 +56,45 @@
</div> </div>
</el-dialog> </el-dialog>
<!--1111111111111111111111111111111111修改回显弹窗1111111111111111111111111111-->
<el-dialog title="修改车辆信息管理" :visible.sync="dialogFormVisible1">
<el-form :model="formHui">
<el-form-item label="车辆VIN" :label-width="formLabelWidth">
<el-input v-model="formHui.carVinId" autocomplete="off" />
</el-form-item>
<el-form-item label="车辆类型" :label-width="formLabelWidth">
<el-select v-model="formHui.carTypeId" placeholder="请选择车辆类型">
<el-option label="区域一" value="shanghai" />
<el-option label="区域二" value="beijing" />
</el-select>
</el-form-item>
<el-form-item label="电子围栏" :label-width="formLabelWidth">
<el-select v-model="formHui.fenceId" placeholder="请选择电子围栏">
<el-option label="区域一" value="shanghai" />
<el-option label="区域二" value="beijing" />
</el-select>
</el-form-item>
<el-form-item label="电机厂商" :label-width="formLabelWidth">
<el-input v-model="formHui.motorManufacturer" autocomplete="off" />
</el-form-item>
<el-form-item label="电池厂商" :label-width="formLabelWidth">
<el-input v-model="formHui.batteryManufacturer" autocomplete="off" />
</el-form-item>
<el-form-item label="电机编号" :label-width="formLabelWidth">
<el-input v-model="formHui.motorNumber" autocomplete="off" />
</el-form-item>
<el-form-item label="电池编号" :label-width="formLabelWidth">
<el-input v-model="formHui.batteryNumber" autocomplete="off" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="addCarDialogFormVisible1"> </el-button>
</div>
</el-dialog>
</el-form> </el-form>
<!--1111111111111111111111111111111111 列表展示 1111111111111111111111111111-->
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
<el-table-column label="车辆VIN" width="180"> <el-table-column label="车辆VIN" width="180">
@ -109,9 +147,9 @@
<el-table-column label="操作"> <el-table-column label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" @click="handleShi(scope.$index , scope.row)">实时轨迹</el-button> <el-button size="mini" @click="handleShi(scope.$index , scope.row.carVinId)">实时轨迹</el-button>
<!-- 修改车辆信息--> <!-- 修改车辆信息-->
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">修改</el-button> <el-button size="mini" @click="handleEdit(scope.$index, scope.row.carVinId)">修改</el-button>
<!-- 删除车辆信息--> <!-- 删除车辆信息-->
<el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row.carVinId)">删除</el-button> <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row.carVinId)">删除</el-button>
</template> </template>
@ -123,7 +161,7 @@
<script> <script>
import { carAdd, carList } from '../../api/carList/list' import { carAdd, carDel, carExport, carHuiList, carList, carUpd } from '../../api/carList/list'
export default { export default {
name: 'CarList', name: 'CarList',
@ -156,8 +194,20 @@ export default {
motorNumber: '', motorNumber: '',
batteryNumber: '' batteryNumber: ''
}, },
//
formHui: {
carVinId: '',
carTypeId: '',
fenceId: '',
status: '',
motorManufacturer: '',
batteryManufacturer: '',
motorNumber: '',
batteryNumber: ''
},
tableData: [], tableData: [],
dialogFormVisible: false dialogFormVisible: false,
dialogFormVisible1: false
} }
}, },
created() { created() {
@ -184,7 +234,7 @@ export default {
addCar() { addCar() {
this.dialogFormVisible = true this.dialogFormVisible = true
}, },
// //
addCarDialogFormVisible() { addCarDialogFormVisible() {
carAdd().then(res => { carAdd().then(res => {
debugger debugger
@ -206,13 +256,71 @@ export default {
// //
delListCar() {}, delListCar() {},
// //
handleShi() {}, handleShi(carVinId) {
// this.$router.push('src/views/allCar/operation.vue')
handleEdit() {}, },
//
handleEdit(carVinId) {
this.dialogFormVisible1 = true
carHuiList(carVinId).then(res => {
if (res.data.code === 200) {
this.formHui = res.data.data
} else {
this.$message({
type: 'error',
message: '回显失败失败'
})
}
})
},
//
addCarDialogFormVisible1() {
carUpd().then(res => {
if (res.data.code === 200) {
this.$message({
type: 'success',
message: '修改成功'
})
} else {
this.$message({
type: 'error',
message: '修改失败'
})
}
})
},
// //
handleDelete(carVinId) {}, handleDelete(carVinId) {
carDel(carVinId).then(res => {
if (res.data.code === 200) {
this.$message({
type: 'success',
message: '删除成功'
})
} else {
this.$message({
type: 'error',
message: '删除失败'
})
}
})
},
// //
exportCar() {} exportCar() {
carExport().then(res => {
if (res.data.code === 200) {
this.$message({
type: 'success',
message: '导出成功'
})
} else {
this.$message({
type: 'error',
message: '导出失败'
})
}
})
}
} }
} }
</script> </script>

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,15 @@
<template> <template>
<div> <div>
<div id="container"></div> <div id="container" />
<div class="input-card"> <div class="input-card">
<h4>轨迹回放控制</h4> <h4>轨迹回放控制</h4>
<div class="input-item"> <div class="input-item">
<input type="button" class="btn" value="开始动画" id="start" @click="startAnimation()"/> <input id="start" type="button" class="btn" value="开始动画" @click="startAnimation()">
<input type="button" class="btn" value="暂停动画" id="pause" @click="pauseAnimation()"/> <input id="pause" type="button" class="btn" value="暂停动画" @click="pauseAnimation()">
</div> </div>
<div class="input-item"> <div class="input-item">
<input type="button" class="btn" value="继续动画" id="resume" @click="resumeAnimation()"/> <input id="resume" type="button" class="btn" value="继续动画" @click="resumeAnimation()">
<input type="button" class="btn" value="停止动画" id="stop" @click="stopAnimation()"/> <input id="stop" type="button" class="btn" value="停止动画" @click="stopAnimation()">
</div> </div>
<!-- <div class="input-item">--> <!-- <div class="input-item">-->
<!-- <el-button type="primary" round plain id="start" @click="startAnimation"></el-button>--> <!-- <el-button type="primary" round plain id="start" @click="startAnimation"></el-button>-->
@ -25,7 +25,7 @@
<script> <script>
export default { export default {
components: {}, components: {},
data(){ data() {
return { return {
map: null, map: null,
marker: null, marker: null,
@ -45,78 +45,77 @@ export default {
} }
}, },
created() { created() {
this.socket = new WebSocket('ws://10.100.1.8:9802/websocket/12345'); this.socket = new WebSocket('ws://10.100.1.8:9802/websocket/12345')
}, },
mounted(){ mounted() {
this.socket.onopen = this.handleOpen; this.socket.onopen = this.handleOpen
this.socket.onmessage = this.handleMessage; this.socket.onmessage = this.handleMessage
this.socket.onerror = this.handleError; this.socket.onerror = this.handleError
setTimeout(() =>{ setTimeout(() => {
this.send() this.send()
this.initAMap(); this.initAMap()
},500); }, 500)
}, },
methods:{ methods: {
send(){ send() {
// //
this.socket.send('nihao'); this.socket.send('nihao')
}, },
handleOpen() { handleOpen() {
console.log('WebSocket is open!'); console.log('WebSocket is open!')
}, },
// //
handleMessage(event) { handleMessage(event) {
let lastArr = []; let lastArr = []
this.arr = JSON.parse(event.data) this.arr = JSON.parse(event.data)
let len = this.lineArr.length const len = this.lineArr.length
if (len !== 0){ if (len !== 0) {
lastArr = this.lineArr[len-1]; lastArr = this.lineArr[len - 1]
this.lineArr.length = 0 this.lineArr.length = 0
this.lineArr.push(lastArr) this.lineArr.push(lastArr)
} }
console.log(this.lineArr.toString()) console.log(this.lineArr.toString())
this.lineArr.push(this.arr); // this.lineArr.push(this.arr) //
console.log(this.lineArr.toString()) console.log(this.lineArr.toString())
this.startAnimation() this.startAnimation()
}, },
handleError(error) { handleError(error) {
console.log("异常") console.log('异常')
// console.error(`Error occurred: ${error}`); // console.error(`Error occurred: ${error}`);
}, },
initAMap() { initAMap() {
// JSAPI2.0 使 // JSAPI2.0 使
this.$AMap.plugin('AMap.MoveAnimation', () => { this.$AMap.plugin('AMap.MoveAnimation', () => {
this.map = new this.$AMap.Map("container", { this.map = new this.$AMap.Map('container', {
resizeEnable: true, resizeEnable: true,
center: [116.478935,39.997761], center: [116.478935, 39.997761],
zoom: 17 zoom: 17
}); })
}); })
this.marker = new this.$AMap.Marker({ this.marker = new this.$AMap.Marker({
map: this.map, map: this.map,
position: [116.478935,39.997761], position: [116.478935, 39.997761],
icon: "https://a.amap.com/jsapi_demos/static/demo-center-v2/car.png", icon: 'https://a.amap.com/jsapi_demos/static/demo-center-v2/car.png',
offset: new this.$AMap.Pixel(-13, -26), offset: new this.$AMap.Pixel(-13, -26),
autoRotation: true, autoRotation: true
}); })
this.marker.on('moving', (e) => { this.marker.on('moving', (e) => {
this.passedPolyline.setPath(e.passedPath); this.passedPolyline.setPath(e.passedPath)
this.map.setCenter(e.target.getPosition(),true) this.map.setCenter(e.target.getPosition(), true)
}); })
this.map.setFitView(); this.map.setFitView()
}, },
// //
startAnimation(){ startAnimation() {
this.marker.setPosition(this.arr) this.marker.setPosition(this.arr)
this.marker.on('moving', (e) => { this.marker.on('moving', (e) => {
this.passedPolyline.setPath(e.passedPath); this.passedPolyline.setPath(e.passedPath)
this.map.setCenter(e.target.getPosition(),true) this.map.setCenter(e.target.getPosition(), true)
}); })
this.marker.moveAlong(this.lineArr, this.marker.moveAlong(this.lineArr,
{ {
@ -124,23 +123,22 @@ export default {
}) })
}, },
// //
pauseAnimation() { pauseAnimation() {
this.marker.pauseMove(); this.marker.pauseMove()
}, },
// //
resumeAnimation() { resumeAnimation() {
this.marker.resumeMove(); this.marker.resumeMove()
}, },
// //
stopAnimation() { stopAnimation() {
this.marker.stopMove(); this.marker.stopMove()
}, }
}
},
} }
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="login"> <div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form"> <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">若依后台管理系统</h3> <h3 class="title">智能车联管理系统</h3>
<el-form-item prop="username"> <el-form-item prop="username">
<el-input <el-input
v-model="loginForm.username" v-model="loginForm.username"