This commit is contained in:
PQZ 2024-08-07 19:53:01 +08:00
parent 6d153049e3
commit a7cf0cc008
3 changed files with 44 additions and 38 deletions

View File

@ -1,33 +1,54 @@
<template> <template>
<div class="block"> <div class="block">
<el-cascader <el-cascader
placeholder="搜索型号" placeholder="车辆品牌型号"
:options="options" :options="options"
v-model="selectedOptions" v-model="selectedValues"
filterable/> filterable/>
</div> </div>
</template> </template>
<script> <script>
import * as CarBrandSelectorApi from '@/layout/components/CarBrandSelector/Api'; import * as CarBrandSelectorApi from '@/layout/components/CarBrandSelector/Api';
export default { export default {
name: 'CarBrandSelector',
props: {
//v-model
value: {
type: Array,
default: () => [],
},
},
data() {
return {
//
selectedValues:this.value,
options: [], //
};
},
watch: { watch: {
selectedOptions(newVal, oldVal) { value: {
console.log("newS is ", newVal); immediate: true,
handler(newVal) {
this.selectedValues = newVal;
}
},
selectedValues(newVal) {
this.$emit('input', newVal);
} }
}, },
created() { created() {
this.getData(); this.getData();
}, },
methods: { methods: {
//
handleFilter(node, keyword) {
console.log(keyword, 'Filtering:');
//
this.getData(keyword);
},
getData(keyword) { getData(keyword) {
// this.reset()
let param = { let param = {
modelName: keyword, modelName: keyword,
} }
@ -35,18 +56,8 @@
this.options = res.data this.options = res.data
}); });
}, },
}, },
data() {
return {
selectedOptions: [], //
options: [], //
};
}
}; };
</script> </script>

View File

@ -12,10 +12,8 @@
<el-form-item label="车牌号" prop="licenseNumber"> <el-form-item label="车牌号" prop="licenseNumber">
<el-input v-model="formData.licenseNumber" placeholder="请输入车牌号" /> <el-input v-model="formData.licenseNumber" placeholder="请输入车牌号" />
</el-form-item> </el-form-item>
<el-form-item label="车辆型号" prop="carModel"> <el-form-item label="品牌型号" prop="carModel">
<!-- <el-input v-model="formData.carModel" placeholder="请输入车辆型号" /> --> <CarBrandSelector v-model="formData.brandAndModel" ref="brandForm" />
<!-- <CarBrandSelector v-model="formData.carModel" ref="brandForm" /> -->
<CarBrandSelector v-model="tesst" ref="brandForm" />
</el-form-item> </el-form-item>
<el-form-item label="保养日期" prop="maintenanceDate"> <el-form-item label="保养日期" prop="maintenanceDate">
<el-date-picker clearable v-model="formData.maintenanceDate" type="date" value-format="timestamp" <el-date-picker clearable v-model="formData.maintenanceDate" type="date" value-format="timestamp"
@ -105,7 +103,7 @@ export default {
engineNumber: undefined, engineNumber: undefined,
vin: undefined, vin: undefined,
licenseNumber: undefined, licenseNumber: undefined,
carModel: undefined, brandAndModel: [],
maintenanceDate: undefined, maintenanceDate: undefined,
maintenanceMileage: undefined, maintenanceMileage: undefined,
inspectionDate: undefined, inspectionDate: undefined,
@ -146,16 +144,13 @@ export default {
} }
this.title = "新增车辆信息"; this.title = "新增车辆信息";
}, },
/** 提交按钮 */ /** 提交按钮 */
async submitForm() { async submitForm() {
// //
await this.$refs["formRef"].validate(); // await this.$refs["formRef"].validate();
this.formLoading = true; this.formLoading = true;
try { try {
console.log("before",this.formData);
this.formData.carModel = this.formData.carModel[this.formData.carModel.length-1];
console.log("after",this.formData);
const data = this.formData; const data = this.formData;
// //
if (data.id) { if (data.id) {
@ -181,7 +176,7 @@ export default {
engineNumber: undefined, engineNumber: undefined,
vin: undefined, vin: undefined,
licenseNumber: undefined, licenseNumber: undefined,
carModel: undefined, brandAndModel: [],
maintenanceDate: undefined, maintenanceDate: undefined,
maintenanceMileage: undefined, maintenanceMileage: undefined,
inspectionDate: undefined, inspectionDate: undefined,

View File

@ -104,8 +104,8 @@
</el-table-column> </el-table-column>
<el-table-column label="发动机号码" align="center" prop="engineNumber" width="180" /> <el-table-column label="发动机号码" align="center" prop="engineNumber" width="180" />
<el-table-column label="车架号" align="center" prop="vin" width="150" /> <el-table-column label="车架号" align="center" prop="vin" width="150" />
<el-table-column label="车辆品牌" align="center" prop="carBrand" /> <el-table-column label="车辆品牌" align="center" prop="brandStr" />
<el-table-column label="车辆型号" align="center" prop="carModel" /> <el-table-column label="车辆型号" align="center" prop="modelStr" />
<!-- <el-table-column label="保养日期" align="center" prop="maintenanceDate" width="180"> <!-- <el-table-column label="保养日期" align="center" prop="maintenanceDate" width="180">
<template v-slot="scope"> <template v-slot="scope">
<span>{{ parseTime(scope.row.maintenanceDate,'{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.maintenanceDate,'{y}-{m}-{d}') }}</span>
@ -317,7 +317,7 @@ export default {
// this.$message({ // this.$message({
// type: 'info', // type: 'info',
// message: '' // message: ''
// }); // });
}); });
// //
if (optionValue == 1) { if (optionValue == 1) {