/**
* 查询字典根据code
* @return
*/
@ArchivesLog(operationType="查询操作:",operationName="查询字典")
@ResponseBody
@RequestMapping(value="/getMapByCode", method = RequestMethod.POST)
public Map<String,String> getMapByCode(DictionaryBean dictionaryBean) {
Json j = new Json();
Map<String,String> map=new HashMap<String,String>();
List<DictionaryBean> list = dictionaryService.selectByCode(dictionaryBean.getCode());
for(DictionaryBean db:list){
map.put(db.getDictionaryKey(), db.getDictionaryValue());
}
j.setObj(map);
return map;
}
//初始化工资类别字典
var dictionaryMap;$(function(){
$.ajax(
{
type: 'POST',
url: path+'/dictionary/getMapByCode/?code=gongzileixing',
data: {},
dataType:'json',
success: function (data) {
dictionaryMap=data;
}
});
})
function formatterWageCategory(value, row, index){
return dictionaryMap[value];
}
<th field="wageCategory" width="100" formatter="formatterWageCategory"
editor=" {
type : 'combobox',
options : {
valueField : 'dictionaryKey',
textField : 'dictionaryValue',
method : 'post',
url : '${path}/dictionary/get/?code=gongzileixing',
//required : true
}
}"
>工资类别</th>