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

View File

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

View File

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