> 自媒体 > AI人工智能 > Vue+Spring Boot巧妙的设计参照数据的绑定查看
Vue+Spring Boot巧妙的设计参照数据的绑定查看
来源:ChatAIAI臻选
2023-04-08
268
管理

一、后端接口定义

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.绑定数据

1
点赞
赏钱
0
收藏
免责声明:本文仅代表作者个人观点,与华威派无关。其原创性以及文中陈述文字和内容未经本网证实,对本文以及其中全部或者 部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
凡本网注明 “来源:XXX(非华威派)”的作品,均转载自其它媒体,转载目的在于传递更多信息,并不代表本网赞同其观点和对 其真实性负责。
如因作品内容、版权和其它问题需要同本网联系的,请在一周内进行,以便我们及时处理。
QQ:2443165046 邮箱:info@goodmaoning.com
关于作者
细雨入梦(普通会员)
点击领取今天的签到奖励!
签到排行
1
0
分享
请选择要切换的马甲:

个人中心

每日签到

我的消息

内容搜索