layui+java怎么实现树形表格
发表于:2024-10-11 作者:千家信息网编辑
千家信息网最后更新 2024年10月11日,本篇内容主要讲解"layui+java怎么实现树形表格",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"layui+java怎么实现树形表格"吧!treeTa
千家信息网最后更新 2024年10月11日layui+java怎么实现树形表格
本篇内容主要讲解"layui+java怎么实现树形表格",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"layui+java怎么实现树形表格"吧!
treeTable 模块下载: https://gitee.com/whvse/treetable-lay/tree/master/2.x
下载后,treeTable.js、treeTable.css 的放置目录分别为: layuiadmin/modules/treeTable.js layuiadmin/modules/treeTable/treeTable.css
页面元素:
定义:
layui.config({ base: '${ctxLayui}/layuiadmin/'}).extend({ index: 'lib/index'}).use(['index', 'table','dict','laydate','util','treeTable'], function(){ var $ = layui.$,table = layui.table,form = layui.form; var dict = layui.dict; var laydate = layui.laydate; var admin = layui.admin; var util = layui.util; var treeTable = layui.treeTable;
渲染:
var insTb = treeTable.render({ elem: '#businessConfigListTable', tree: { iconIndex: 1, // 折叠图标显示在第几列 idName: 'id', // 自定义id字段的名称 pidName: 'parentId', // 自定义标识是否还有子节点的字段名称 }, cols: [ {type: 'checkbox', fixed: 'left'}, {type: 'numbers',width: 120,style:'text-align:left'},// {field: 'id', title: 'ID',width: 180}, {field: 'type', title: '类型', width: 120,templet:tplType}, {field: 'name', title: '名称', width: 200}, {field: 'value', title: '值'}, {field: 'sortOrder', title: '排序', width: 120}, {field: 'status', title: '状态', width: 150,templet:tplStatus}, {title:'操作', toolbar: '#businessConfigListTable-bar', width:120} ], reqData: function(data, callback) { // 在这里写ajax请求,通过callback方法回调数据 var url = ctx+'/business/businessConfig/businessConfigTreeList'; var rtn = admin.syncReq(url,{}); var rtnData = rtn.data; for(var i=0;i接口:business/businessConfig/businessConfigTreeList, 如下:
@RequestMapping(value = "businessConfigTreeList")@ResponseBodypublic BaseResp businessConfigTreeList(@ModelAttribute("command") BusinessConfigQo command){ BaseResp resp = new BaseResp(); try{ Listlist = businessConfigService.businessConfigTreeList(command); resp.setData(list); }catch (Exception e){ error(logger,resp,e); } return resp;} 其中 BaseResp 结构:
/** * 应答返回码 */private int code = RC_OK;/** * 应答返回消息 */private String msg;/** * 跳转url */private String url = "";private int count;private boolean success = false;// 是否成功private Object data;service层获取数据,递归:
public ListbusinessConfigTreeList(BusinessConfigQo command) throws Exception{ command.setParentId(0l); command.setLimit(99999); List list = this.businessConfigMapper.query(command); for(BusinessConfigPo rec:list){ List children = getChildrenConfig(rec); rec.setChildren(children); } return list;}private List getChildrenConfig(BusinessConfigPo rec) throws Exception{ BusinessConfigQo qo = new BusinessConfigQo(); qo.setLimit(99999); qo.setParentId(rec.getId()); List list = this.businessConfigMapper.query(qo); if(list==null){ return null; } for(BusinessConfigPo child:list){ List children = getChildrenConfig(child); child.setChildren(children); } return list;} 到此,相信大家对"layui+java怎么实现树形表格"有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
树形
表格
名称
内容
字段
数据
方法
学习
实用
更深
成功
元素
兴趣
图标
实用性
实际
接口
操作简单
更多
朋友
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
网络安全法教案幼儿
蓟州区网络安全宣传
软件开发相关标准质量
互联网 农业 科技推广建议
电脑的数据库无法读取
万师傅网络技术有限公司
无尽的拉格朗日国际版服务器已满
华为存储服务器管理口ip
上位机软件开发是什么专业
支持建设网络安全相关学科专业
mamp 连接数据库
文件管理云服务器
数据库管理系统模型
软件开发项目管理人员配置
互联网科技视频素材
java软件开发毕业开题
数据库 语言 数据引擎
服务器 带gpu
微盟平台用什么数据库
网络技术基础水光针效果
软件开发预算案例
创建数据库及数据库操作功能
我的世界1.17服务器pc
螳螂下载软件开发
什么是数据库管理系统 它的主要功能有哪些
软件开发属于什么学校
宽城区软件开发培训班
科技有限公司可以做软件开发吗
绍兴esop软件开发
数据库cadcade