This commit is contained in:
xuyuncong 2025-11-28 10:21:16 +08:00
parent 8c2993cdbd
commit 9eaf0490db

View File

@ -2,7 +2,7 @@
<div>
<div style="display: flex; align-items: center;">
<el-select v-model="carSelected" clearable style="width: 200px;">
<el-option v-for="car in carList" :key="car.id" :label="car.licenseNumber" :value="car.id"/>
<el-option v-for="car in carList" :key="car.id" :label="car.licenseNumber" :value="car.id" />
</el-select>
<el-button type="primary" size="small" @click="addNewCar" style="margin-left: 8px;">
新增车辆
@ -14,7 +14,7 @@
<script>
import {remindCarMainPage} from "@/api/base/carmain";
import { remindCarMainPage } from "@/api/base/carmain";
import AddCarForm from "./AddCarForm.vue";
export default {
@ -33,7 +33,7 @@ export default {
type: Object,
required: true
},
inList:{
inList: {
type: Object,
default: null,
required: false
@ -53,16 +53,19 @@ export default {
value(val) {
this.carSelected = val ? val.id : null;
},
cusName(val, old) {
if (val !== old) {
// this.carSelected = null
this.getCarList()
}
cusName: {
handler(val, old) {
if (val !== old) {
// this.carSelected = null
this.getCarList()
}
},
immediate: true
},
inList(val){
if (val){
inList(val) {
if (val) {
const flag = this.carList.findIndex(item => item.id === val.id)
if (flag > 0){
if (flag > 0) {
this.carList.splice(flag, 1)
}
this.carList.unshift(val)
@ -108,6 +111,4 @@ export default {
}
</script>
<style scoped lang="scss">
</style>
<style scoped lang="scss"></style>