Merge remote-tracking branch 'origin/server_ui_liuyunhu' into server_five_ui
commit
9b23a7a736
|
@ -0,0 +1,19 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询车辆列表
|
||||||
|
export function list(vehicleListParams) {
|
||||||
|
return request({
|
||||||
|
url: '/vehicle/vehicle/list',
|
||||||
|
method: 'post',
|
||||||
|
data: vehicleListParams
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据车辆id进行删除
|
||||||
|
export function deleteById(vehicleId) {
|
||||||
|
return request({
|
||||||
|
url: '/vehicle/vehicle/deleteById/' + vehicleId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -1,11 +1,189 @@
|
||||||
<script setup>
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<div>
|
||||||
|
<h1>车辆管理页面</h1>
|
||||||
|
<!-- {{ vehicleList }}-->
|
||||||
|
|
||||||
|
<el-table :data="vehicleList" style="width: 100%" border>
|
||||||
|
<el-table-column label="车辆id" width="90" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span style="margin-left: 10px">{{ scope.row.vehicleId }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<!-- TODO 暂时显示车辆类型id,待处理-->
|
||||||
|
<el-table-column label="车辆类型" width="90" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span style="margin-left: 10px">{{ scope.row.vehicleTypeName }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="电机厂商" width="150" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span style="margin-left: 10px">{{ scope.row.motorManufacturer }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="电池厂商" width="150" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span style="margin-left: 10px">{{ scope.row.batteryManufacturer }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="电机编号" width="180" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span style="margin-left: 10px">{{ scope.row.motorNumber }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="电池编号" width="180" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span style="margin-left: 10px">{{ scope.row.batteryNumber }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="vin码" width="180" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span style="margin-left: 10px">{{ scope.row.vin }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="车辆状态" width="120" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span style="margin-left: 10px" v-if="1==scope.row.vehicleState">
|
||||||
|
<el-tag type="success">在线</el-tag>
|
||||||
|
</span>
|
||||||
|
<span style="margin-left: 10px" v-if="0==scope.row.vehicleState">
|
||||||
|
<el-tag type="danger">离线</el-tag>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="180" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button size="mini" @click="">编辑</el-button>
|
||||||
|
<el-button size="mini" type="danger" @click="deleteById(scope.row.vehicleId)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<script>
|
||||||
|
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等),
|
||||||
|
//例如:import 《组件名称》 from '《组件路径》,
|
||||||
|
import {deleteById, list} from "@/api/system/vehicle";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
//import引入的组件需要注入到对象中才能使用"
|
||||||
|
components: {},
|
||||||
|
props: {},
|
||||||
|
data() {
|
||||||
|
//这里存放数据"
|
||||||
|
return {
|
||||||
|
//车辆列表
|
||||||
|
vehicleList: [],
|
||||||
|
|
||||||
|
//查询列表的入参
|
||||||
|
vehicleListParams: {
|
||||||
|
//车辆类型
|
||||||
|
vehicleType: '',
|
||||||
|
//车辆状态 0离线 1在线
|
||||||
|
vehicleState: '',
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
//编辑、新增车辆的入参
|
||||||
|
vehicle: {
|
||||||
|
//车辆id
|
||||||
|
vehicleId: '',
|
||||||
|
|
||||||
|
//车辆类型
|
||||||
|
vehicleType: '',
|
||||||
|
|
||||||
|
//电机厂商
|
||||||
|
motorManufacturer: '',
|
||||||
|
|
||||||
|
//电池厂商
|
||||||
|
batteryManufacturer: '',
|
||||||
|
|
||||||
|
//电机编号
|
||||||
|
motorNumber: '',
|
||||||
|
|
||||||
|
//电池编号
|
||||||
|
batteryNumber: '',
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
//计算属性 类似于data概念",
|
||||||
|
computed: {},
|
||||||
|
//监控data中的数据变化",
|
||||||
|
watch: {},
|
||||||
|
//方法集合",
|
||||||
|
methods: {
|
||||||
|
//获取车辆列表
|
||||||
|
getVehicleList() {
|
||||||
|
list(this.vehicleListParams).then(
|
||||||
|
res => {
|
||||||
|
this.vehicleList = res.data;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
|
//根据车辆id进行删除
|
||||||
|
deleteById(vehicleId) {
|
||||||
|
this.$confirm('此操作将永久删除该数据,是否继续?', "提示", {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
deleteById(vehicleId).then(
|
||||||
|
res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
//刷新列表
|
||||||
|
this.getVehicleList();
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '删除成功!'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$message({
|
||||||
|
type: 'error',
|
||||||
|
message: '删除失败!'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消删除'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
//生命周期 - 创建完成(可以访问当前this实例)",
|
||||||
|
created() {
|
||||||
|
//获取车辆列表
|
||||||
|
this.getVehicleList()
|
||||||
|
},
|
||||||
|
//生命周期 - 挂载完成(可以访问DOM元素)",
|
||||||
|
mounted() {
|
||||||
|
},
|
||||||
|
beforeCreate() {
|
||||||
|
}, //生命周期 - 创建之前",
|
||||||
|
beforeMount() {
|
||||||
|
}, //生命周期 - 挂载之前",
|
||||||
|
beforeUpdate() {
|
||||||
|
}, //生命周期 - 更新之前",
|
||||||
|
updated() {
|
||||||
|
}, //生命周期 - 更新之后",
|
||||||
|
beforeDestroy() {
|
||||||
|
}, //生命周期 - 销毁之前",
|
||||||
|
destroyed() {
|
||||||
|
}, //生命周期 - 销毁完成",
|
||||||
|
activated() {
|
||||||
|
} //如果页面有keep-alive缓存功能,这个函数会触发",
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue