This commit is contained in:
“hhk” 2024-08-07 18:51:14 +08:00
parent a271a410e2
commit 6d153049e3
2 changed files with 60 additions and 75 deletions

View File

@ -1,74 +1,52 @@
<template>
<div class="block">
<!-- <el-cascader v-model="selectedOptions" placeholder="请选择" :options="options" :filter-method="handleFilter"-->
<!-- :debounce="500" :show-all-levels="false" filterable clearable/>-->
<el-cascader
placeholder="请选择品牌型号"
:options="options"
filterable></el-cascader>
</div>
</template>
<script>
import * as CarBrandSelectorApi from '@/layout/components/CarBrandSelector/Api';
export default {
watch: {
selectedOptions(newVal, oldVal) {
console.log("newS is ", newVal);
}
},
created() {
this.getData();
},
methods: {
//
handleFilter(node, keyword) {
debugger
console.log(keyword, 'Filtering:');
//
this.getData(keyword);
// this.options =
// const filteredOptions = [
// {
// value: 'filtered1',
// label: `Filtered ${inputValue} 1`,
// children: [
// { value: 'filtered1-1', label: `Filtered ${inputValue} 1-1` },
// { value: 'filtered1-2', label: `Filtered ${inputValue} 1-2` },
// ],
// },
// {
// value: 'filtered2',
// label: `Filtered ${inputValue} 2`,
// children: [
// { value: 'filtered2-1', label: `Filtered ${inputValue} 2-1` },
// { value: 'filtered2-2', label: `Filtered ${inputValue} 2-2` },
// ],
// },
// ];
// this.options = filteredOptions;
},
getData(keyword) {
let param = {
modelName: keyword,
<div class="block">
<el-cascader
placeholder="搜索型号"
:options="options"
v-model="selectedOptions"
filterable/>
</div>
</template>
<script>
import * as CarBrandSelectorApi from '@/layout/components/CarBrandSelector/Api';
export default {
watch: {
selectedOptions(newVal, oldVal) {
console.log("newS is ", newVal);
}
CarBrandSelectorApi.searchBrand(param).then(res => {
this.options = res.data
});
},
},
data() {
return {
selectedOptions: [], //
options: [], //
};
}
};
</script>
created() {
this.getData();
},
methods: {
//
handleFilter(node, keyword) {
console.log(keyword, 'Filtering:');
//
this.getData(keyword);
},
getData(keyword) {
let param = {
modelName: keyword,
}
CarBrandSelectorApi.searchBrand(param).then(res => {
this.options = res.data
});
},
},
data() {
return {
selectedOptions: [], //
options: [], //
};
}
};
</script>

View File

@ -13,7 +13,9 @@
<el-input v-model="formData.licenseNumber" placeholder="请输入车牌号" />
</el-form-item>
<el-form-item label="车辆型号" prop="carModel">
<el-input v-model="formData.carModel" placeholder="请输入车辆型号" />
<!-- <el-input v-model="formData.carModel" placeholder="请输入车辆型号" /> -->
<!-- <CarBrandSelector v-model="formData.carModel" ref="brandForm" /> -->
<CarBrandSelector v-model="tesst" ref="brandForm" />
</el-form-item>
<el-form-item label="保养日期" prop="maintenanceDate">
<el-date-picker clearable v-model="formData.maintenanceDate" type="date" value-format="timestamp"
@ -34,9 +36,9 @@
<el-date-picker clearable v-model="formData.checkDate" type="date" value-format="timestamp"
placeholder="选择二级维护时间" />
</el-form-item>
<el-form-item label="车辆品牌" prop="carBrand">
<!-- <el-form-item label="车辆品牌" prop="carBrand">
<el-input v-model="formData.carBrand" placeholder="请输入车辆品牌" />
</el-form-item>
</el-form-item> -->
<el-form-item label="车辆类别" prop="carCategory">
<el-select v-model="formData.carCategory" placeholder="请选择车辆类别">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.DICT_CAR_CATEGORY)"
@ -71,7 +73,7 @@
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
<CarBrandSelector ref="brandForm"/>
</el-dialog>
</div>
</template>
@ -90,6 +92,7 @@ export default {
},
data() {
return {
tesst:[ "5d8eb726839bbe64a4f405e0cce29274", "7c8493517c4eaa0f0c56f40f0626e8d2" ],
//
dialogTitle: "",
//
@ -149,6 +152,10 @@ export default {
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) {