This commit is contained in:
PQZ 2024-08-07 18:16:02 +08:00
parent 14404f023e
commit a271a410e2
2 changed files with 67 additions and 133 deletions

View File

@ -1,140 +1,74 @@
<template>
<div class="block">
<el-cascader v-model="selectedOptions" placeholder="请选择" :options="options" :filter-method="handleFilter"
:debounce="500" :show-all-levels="false" filterable clearable />
</div>
<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) {
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
this.options = res.data
});
},
changedOptionsForTest() {
this.options = [{
value: 'zhinan',
label: '指北',
children: [{
value: 'shejiyuanze',
label: '指北1',
children: [{
value: 'yizhi',
label: '一致',
children: [{
value: 'sadme',
label: 'how sad me'
}]
}, {
value: 'fankui',
label: '反馈'
}, {
value: 'xiaolv',
label: '效率'
}, {
value: 'kekong',
label: '可控'
}]
}, {
value: 'daohang',
label: '指北2',
children: [{
value: 'cexiangdaohang',
label: '侧向导航'
}, {
value: 'dingbudaohang',
label: '顶部导航'
}]
}]
},]
},
},
data() {
return {
selectedOptions: [], //
options: [{
value: 'zhinan',
label: '指北',
children: [{
value: 'shejiyuanze',
label: '指北1',
children: [{
value: 'yizhi',
label: '一致',
children: [{
value: 'sadme',
label: 'how sad me'
}]
}, {
value: 'fankui',
label: '反馈'
}, {
value: 'xiaolv',
label: '效率'
}, {
value: 'kekong',
label: '可控'
}]
}, {
value: 'daohang',
label: '指北2',
children: [{
value: 'cexiangdaohang',
label: '侧向导航'
}, {
value: 'dingbudaohang',
label: '顶部导航'
}]
}]
},], //
};
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,
}
CarBrandSelectorApi.searchBrand(param).then(res => {
this.options = res.data
});
},
},
data() {
return {
selectedOptions: [], //
options: [], //
};
}
};
</script>

View File

@ -71,7 +71,7 @@
<el-button type="primary" @click="submitForm" :disabled="formLoading"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
<CarBrandSelector/>
<CarBrandSelector ref="brandForm"/>
</el-dialog>
</div>
</template>