实现下拉框查询,并且能够输入关键词匹配下拉框数据
效果图 前端VUE:所有关键代码已做处理
JS:
receiptList:[],
receiptForm:{
receiptName:''
},
receiptFormStr:'',
方法:
findAllReceiptInfo(){
util.ajax.post('/aop/aop', {
param:{
createperson:this.$store.state.user.loginUser.tableid
},
className:'Service',
method:'findAllInfo'
}).then(res => {
if (res.data.data != null){
this.receiptList = res.data.data;
} else {
this.receiptList = [];
}
});
},
后端
service:
public Mapxml(忽略Dao)findAllReceiptInfo(String params) throws Exception{ List list = receiptloanDao.findAllReceiptInfo(); List result=new ArrayList (); if(list!=null){ for(ReceiptsEntity obj:list){ SelectBo bo=new SelectBo(); bo.setName(obj.getReceiptName()); bo.setValue(obj.getReceiptName()); result.add(bo); } } Constants.getSuccMsg(resultMap, result); return resultMap; }
因为用了工厂函数封装,所以各位前端URL和后端Controller 还是要根据自己情况写,联系查询跟查字典值一样,把name和id做为字典值的key和value理解就行
重点是前端 Select 选择器 中的 filterable属性:



