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> <template>
<div class="block"> <div class="block">
<!-- <el-cascader v-model="selectedOptions" placeholder="请选择" :options="options" :filter-method="handleFilter"--> <el-cascader
<!-- :debounce="500" :show-all-levels="false" filterable clearable/>--> placeholder="搜索型号"
<el-cascader :options="options"
placeholder="请选择品牌型号" v-model="selectedOptions"
:options="options" filterable/>
</div>
filterable></el-cascader>
</div> </template>
<script>
</template> import * as CarBrandSelectorApi from '@/layout/components/CarBrandSelector/Api';
<script>
import * as CarBrandSelectorApi from '@/layout/components/CarBrandSelector/Api'; export default {
watch: {
export default { selectedOptions(newVal, oldVal) {
watch: { console.log("newS is ", newVal);
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,
} }
CarBrandSelectorApi.searchBrand(param).then(res => {
this.options = res.data
});
}, },
created() {
this.getData();
}, },
methods: {
data() { //
return { handleFilter(node, keyword) {
selectedOptions: [], // console.log(keyword, 'Filtering:');
//
options: [], // this.getData(keyword);
},
}; getData(keyword) {
} let param = {
}; modelName: keyword,
</script> }
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-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="请输入车辆型号" /> <!-- <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>
<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"
@ -34,9 +36,9 @@
<el-date-picker clearable v-model="formData.checkDate" type="date" value-format="timestamp" <el-date-picker clearable v-model="formData.checkDate" type="date" value-format="timestamp"
placeholder="选择二级维护时间" /> placeholder="选择二级维护时间" />
</el-form-item> </el-form-item>
<el-form-item label="车辆品牌" prop="carBrand"> <!-- <el-form-item label="车辆品牌" prop="carBrand">
<el-input v-model="formData.carBrand" placeholder="请输入车辆品牌" /> <el-input v-model="formData.carBrand" placeholder="请输入车辆品牌" />
</el-form-item> </el-form-item> -->
<el-form-item label="车辆类别" prop="carCategory"> <el-form-item label="车辆类别" prop="carCategory">
<el-select v-model="formData.carCategory" placeholder="请选择车辆类别"> <el-select v-model="formData.carCategory" placeholder="请选择车辆类别">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.DICT_CAR_CATEGORY)" <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 type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button> <el-button @click="dialogVisible = false"> </el-button>
</div> </div>
<CarBrandSelector ref="brandForm"/>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -90,6 +92,7 @@ export default {
}, },
data() { data() {
return { return {
tesst:[ "5d8eb726839bbe64a4f405e0cce29274", "7c8493517c4eaa0f0c56f40f0626e8d2" ],
// //
dialogTitle: "", dialogTitle: "",
// //
@ -149,6 +152,10 @@ export default {
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) {