一、后端接口定义
public Map findChildRens(String codes) { Map params = new HashMap(2); params.put("EQ_is_Enable", ConstValue.IS_ENABLE); params.put("IN_parentId", codes); List lstData = this.findAll(params, "code"); Map mapVal = new HashMap(2); String[] strList = codes.split(","); String[] var6 = strList; int var7 = strList.length; for(int var8 = 0; var8 < var7; var8) { String code = var6[var8]; if (!mapVal.containsKey(code)) { List subList = (List)lstData.stream().filter((p) -> { return p.getParentId().equals(code); }).collect(Collectors.toList()); mapVal.put(code, subList); } } return mapVal;}代码解读:
根据转入的编码,获取参照数据,并且更加编码来排序。Map的键已编码为名称,方便前端应用数据。
二、前端设计
1.定义
constantList:{khflCode:[],khgmCode:[],khlyCode:[],zbsxCode:[],zfxzCode:[],zjlxCode:[],ztlxCode:[],zzlxCode:[]},
2.获取数据
this.$ajax.get("constant/findChildRens?codes=khflCode,khgmCode,khlyCode,zbsxCode,zfxzCode,zjlxCode,ztlxCode,zzlxCode").then(res => {
this.constantList=res.data;
});
3.绑定数据