菜单树功能初步完成

pull/1/head
iamsongpeng 2020-03-02 13:29:40 +08:00
parent a846932e04
commit b2bc8b2b44
10 changed files with 409 additions and 90 deletions

View File

@ -10,7 +10,7 @@ Target Server Type : MYSQL
Target Server Version : 50729
File Encoding : 65001
Date: 2020-02-28 15:04:38
Date: 2020-03-02 10:40:19
*/
SET FOREIGN_KEY_CHECKS=0;
@ -29,9 +29,9 @@ CREATE TABLE `sp_sys_dict` (
`parent_id` varchar(64) DEFAULT '""' COMMENT '父级id',
`is_deleted` char(2) NOT NULL COMMENT '逻辑删除1 表示删除0 表示未删除2 表示禁用',
`create_time` datetime NOT NULL COMMENT '创建时间',
`create_user_id` varchar(64) NOT NULL COMMENT '创建人',
`create_username` varchar(64) NOT NULL COMMENT '创建人',
`update_time` datetime NOT NULL COMMENT '最后更新时间',
`update_user_id` varchar(64) NOT NULL COMMENT '最后更新人',
`update_username` varchar(64) NOT NULL COMMENT '最后更新人',
PRIMARY KEY (`id`),
KEY `idx_sp_sys_dict_name` (`name`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统字典表';
@ -58,9 +58,9 @@ CREATE TABLE `sp_sys_menu` (
`icon` varchar(255) DEFAULT '""' COMMENT '菜单图标',
`descr` varchar(255) DEFAULT '""' COMMENT '描述',
`created` datetime NOT NULL COMMENT '创建时间',
`created_user_id` varchar(64) NOT NULL COMMENT '创建人',
`last_upd` datetime NOT NULL COMMENT '最后更新时间',
`last_upd_user_id` varchar(64) NOT NULL COMMENT '最后更新人',
`created_username` varchar(64) NOT NULL COMMENT '创建人',
`update_time` datetime NOT NULL COMMENT '最后更新时间',
`update_username` varchar(64) NOT NULL COMMENT '最后更新人',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_sp_sys_menu_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
@ -81,9 +81,9 @@ CREATE TABLE `sp_sys_role` (
`descr` varchar(255) DEFAULT '""' COMMENT '角色描述',
`is_deleted` varchar(2) NOT NULL COMMENT '逻辑删除1 表示删除0 表示未删除2 表示禁用',
`create_time` datetime NOT NULL COMMENT '创建时间',
`create_user_id` varchar(64) NOT NULL COMMENT '创建人',
`create_username` varchar(64) NOT NULL COMMENT '创建人',
`update_time` datetime NOT NULL COMMENT '最后更新时间',
`update_user_id` varchar(64) DEFAULT NULL COMMENT '最后更新人',
`update_username` varchar(64) DEFAULT NULL COMMENT '最后更新人',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_sp_sys_role_name` (`name`),
UNIQUE KEY `idx_sp_sys_role_code` (`code`)
@ -92,8 +92,8 @@ CREATE TABLE `sp_sys_role` (
-- ----------------------------
-- Records of sp_sys_role
-- ----------------------------
INSERT INTO `sp_sys_role` VALUES ('1185025876737396738', '超级管理员', 'admin', '超级管理员', '1', '2019-10-18 10:52:40', 'SongPeng', '2020-02-26 15:03:57', 'admin');
INSERT INTO `sp_sys_role` VALUES ('1232532514523213826', '体验者', 'experience', '体验者', '1', '2020-02-26 13:07:05', 'admin', '2020-02-26 15:03:54', 'admin');
INSERT INTO `sp_sys_role` VALUES ('1185025876737396738', '超级管理员', 'admin', '超级管理员', '1', '2019-10-18 10:52:40', 'SongPeng', '2020-02-29 16:38:36', 'admin');
INSERT INTO `sp_sys_role` VALUES ('1232532514523213826', '体验者', 'experience', '体验者', '1', '2020-02-26 13:07:05', 'admin', '2020-02-29 16:38:41', 'admin');
-- ----------------------------
-- Table structure for sp_sys_role_menu
@ -104,9 +104,9 @@ CREATE TABLE `sp_sys_role_menu` (
`role_id` varchar(64) NOT NULL COMMENT '角色id',
`menu_id` varchar(64) NOT NULL COMMENT '菜单id',
`create_time` datetime NOT NULL COMMENT '创建时间',
`create_user_id` varchar(64) NOT NULL COMMENT '创建人',
`create_username` varchar(64) NOT NULL COMMENT '创建人',
`update_time` datetime NOT NULL COMMENT '最后更新时间',
`update_user_id` varchar(64) NOT NULL COMMENT '最后更新人',
`update_username` varchar(64) NOT NULL COMMENT '最后更新人',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
@ -141,9 +141,9 @@ CREATE TABLE `sp_sys_user` (
`descr` varchar(255) DEFAULT '""' COMMENT '描述',
`is_deleted` varchar(1) NOT NULL COMMENT '逻辑删除1 表示删除0 表示未删除2 表示禁用',
`create_time` datetime NOT NULL COMMENT '创建时间',
`create_user_id` varchar(64) NOT NULL COMMENT '创建人',
`create_username` varchar(64) NOT NULL COMMENT '创建人',
`update_time` datetime NOT NULL COMMENT '最后更新时间',
`update_user_id` varchar(64) NOT NULL COMMENT '最后更新人',
`update_username` varchar(64) NOT NULL COMMENT '最后更新人',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_sp_sys_user_username` (`username`) COMMENT '用户名唯一索引',
UNIQUE KEY `idx_sp_sys_user_mobile` (`mobile`) COMMENT '用户手机号唯一索引',
@ -154,9 +154,9 @@ CREATE TABLE `sp_sys_user` (
-- ----------------------------
-- Records of sp_sys_user
-- ----------------------------
INSERT INTO `sp_sys_user` VALUES ('1184009088826392578', '宋鹏', 'iamsongpeng', '9d7281eeaebded0b091340cfa658a7e8', '', '', '13776337795', '', '1', null, '', '', '', '', '', '', '', '', '', '1', '2019-10-15 15:32:19', 'SongPeng', '2020-02-26 15:03:47', 'admin');
INSERT INTO `sp_sys_user` VALUES ('1184010472443396098', '猴子', 'monkey', '9d7281eeaebded0b091340cfa658a7e8', '123', '', '137763377', '', '0', null, '', '', '', '', '', '', '', '', '', '1', '2019-10-15 15:37:52', 'SongPeng', '2020-02-26 15:03:32', 'admin');
INSERT INTO `sp_sys_user` VALUES ('1184019107907227649', '超级管理员', 'admin', '9d7281eeaebded0b091340cfa658a7e8', '11', '', '13776337796', '44', '0', null, '55', '66', '77', '88', '99', '10', '11', '12', '13', '1', '2019-10-15 16:12:08', 'SongPeng', '2020-02-26 15:03:39', 'admin');
INSERT INTO `sp_sys_user` VALUES ('1184009088826392578', '宋鹏', 'iamsongpeng', '9d7281eeaebded0b091340cfa658a7e8', '', '', '13776337795', '', '1', null, '', '', '', '', '', '', '', '', '', '0', '2019-10-15 15:32:19', 'SongPeng', '2020-02-28 16:44:59', 'admin');
INSERT INTO `sp_sys_user` VALUES ('1184010472443396098', '猴子', 'monkey', '9d7281eeaebded0b091340cfa658a7e8', '123', '', '137763377', '', '0', null, '', '', '', '', '', '', '', '', '', '0', '2019-10-15 15:37:52', 'SongPeng', '2020-02-26 15:03:32', 'admin');
INSERT INTO `sp_sys_user` VALUES ('1184019107907227649', '超级管理员', 'admin', '9d7281eeaebded0b091340cfa658a7e8', '11', '', '13776337796', '44', '0', null, '55', '66', '77', '88', '99', '10', '11', '12', '13', '0', '2019-10-15 16:12:08', 'SongPeng', '2020-02-26 15:03:39', 'admin');
-- ----------------------------
-- Table structure for sp_sys_user_role
@ -167,9 +167,9 @@ CREATE TABLE `sp_sys_user_role` (
`user_id` varchar(64) NOT NULL COMMENT '用户id',
`role_id` varchar(64) NOT NULL COMMENT '角色id',
`create_time` datetime NOT NULL COMMENT '创建时间',
`create_user_id` varchar(64) NOT NULL COMMENT '创建人',
`create_username` varchar(64) NOT NULL COMMENT '创建人',
`update_time` datetime NOT NULL COMMENT '最后更新时间',
`update_user_id` varchar(64) NOT NULL COMMENT '最后更新人',
`update_username` varchar(64) NOT NULL COMMENT '最后更新人',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

View File

@ -0,0 +1,87 @@
package com.songpeng.sparchetype.common.util;
import com.songpeng.sparchetype.system.vo.TreeVO;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class TreeUtil {
public static <T> TreeVO<T> build(List<TreeVO<T>> nodes) {
if (nodes == null) {
return null;
}
List<TreeVO<T>> topNodes = new ArrayList<TreeVO<T>>();
for (TreeVO<T> children : nodes) {
String pid = children.getParentId();
if (pid == null || "0".equals(pid)) {
topNodes.add(children);
continue;
}
for (TreeVO<T> parent : nodes) {
String id = parent.getId();
if (id != null && id.equals(pid)) {
parent.getChildren().add(children);
children.setHasParent(true);
parent.setHasChildren(true);
continue;
}
}
}
TreeVO<T> root = new TreeVO<T>();
if (topNodes.size() == 1) {
root = topNodes.get(0);
} else {
root.setId("-1");
root.setParentId("");
root.setHasParent(false);
root.setHasChildren(true);
root.setChecked(true);
root.setChildren(topNodes);
root.setName("顶级节点");
}
return root;
}
public static <T> List<TreeVO<T>> buildList(List<TreeVO<T>> nodes, String idParam) {
if (nodes == null) {
return null;
}
List<TreeVO<T>> topNodes = new ArrayList<TreeVO<T>>();
for (TreeVO<T> children : nodes) {
String pid = children.getParentId();
if (pid == null || idParam.equals(pid)) {
topNodes.add(children);
continue;
}
for (TreeVO<T> parent : nodes) {
String id = parent.getId();
if (id != null && id.equals(pid)) {
parent.getChildren().add(children);
children.setHasParent(true);
parent.setHasChildren(true);
continue;
}
}
}
return topNodes;
}
}

View File

@ -9,6 +9,7 @@ import com.songpeng.sparchetype.common.BaseController;
import com.songpeng.sparchetype.common.Result;
import com.songpeng.sparchetype.system.entity.SysMenu;
import com.songpeng.sparchetype.system.service.ISysMenuService;
import com.songpeng.sparchetype.system.vo.TreeVO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@ -21,6 +22,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* <p>
*
@ -67,48 +70,8 @@ public class SysMenuController extends BaseController {
@ApiOperation("系统菜单树")
@GetMapping("/tree")
@ResponseBody
public Result tree() {
JSONObject jsonObject = JSONUtil.parseObj("{\n" +
" \"code\": 200,\n" +
" \"msg\": \"ok\",\n" +
" \"data\": [\n" +
" {\n" +
" \"id\": \"1\",\n" +
" \"name\": \"xxx\",\n" +
" \"state\": 0,\n" +
" \"createTime\": \"2019/11/18 10:44:00\",\n" +
" \"haveChild\": true\n" +
" },\n" +
" {\n" +
" \"id\": \"2\",\n" +
" \"name\": \"xxx\",\n" +
" \"state\": 0,\n" +
" \"createTime\": \"2019/11/18 10:44:00\",\n" +
" \"haveChild\": true\n" +
" },\n" +
" {\n" +
" \"id\": \"3\",\n" +
" \"name\": \"xxx\",\n" +
" \"state\": 0,\n" +
" \"createTime\": \"2019/11/18 10:44:00\",\n" +
" \"haveChild\": true\n" +
" },\n" +
" {\n" +
" \"id\": \"4\",\n" +
" \"name\": \"xxx\",\n" +
" \"state\": 0,\n" +
" \"createTime\": \"2019/11/18 10:44:00\",\n" +
" \"haveChild\": false\n" +
" },\n" +
" {\n" +
" \"id\": \"5\",\n" +
" \"name\": \"xxx\",\n" +
" \"state\": 0,\n" +
" \"createTime\": \"2019/11/18 10:44:00\",\n" +
" \"haveChild\": false\n" +
" }\n" +
" ]\n" +
"}");
return Result.success(jsonObject);
public Result tree() throws Exception {
List<TreeVO<SysMenu>> sysMenus = sysMenuService.listMenuTree();
return Result.success(sysMenus);
}
}

View File

@ -2,8 +2,9 @@ package com.songpeng.sparchetype.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.songpeng.sparchetype.system.entity.SysMenu;
import com.songpeng.sparchetype.system.vo.TreeVO;
import java.util.Set;
import java.util.List;
/**
* <p>
@ -16,11 +17,10 @@ import java.util.Set;
public interface ISysMenuService extends IService<SysMenu> {
/**
* id
*
*
* @param id
* @return
* @throws Exception
* @return
* @throws Exception
*/
Set<String> getMenusByUserId(String userId) throws Exception;
List<TreeVO<SysMenu>> listMenuTree() throws Exception;
}

View File

@ -1,11 +1,16 @@
package com.songpeng.sparchetype.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.songpeng.sparchetype.common.util.TreeUtil;
import com.songpeng.sparchetype.system.entity.SysMenu;
import com.songpeng.sparchetype.system.mapper.SysMenuMapper;
import com.songpeng.sparchetype.system.service.ISysMenuService;
import com.songpeng.sparchetype.system.vo.TreeVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
@ -19,15 +24,27 @@ import java.util.Set;
@Service
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements ISysMenuService {
@Autowired
private SysMenuMapper sysMenuMapper;
/**
* id
*
*
* @param id
* @return
* @throws Exception
* @return
* @throws Exception
*/
@Override
public Set<String> getMenusByUserId(String userId) throws Exception {
return null;
public List<TreeVO<SysMenu>> listMenuTree() throws Exception {
List<TreeVO<SysMenu>> menus = new ArrayList<>();
List<SysMenu> sysMenus = sysMenuMapper.selectList(null);
for (SysMenu m : sysMenus) {
TreeVO<SysMenu> tree = new TreeVO<>();
tree.setId(m.getId());
tree.setParentId(m.getParentId());
tree.setName(m.getName());
tree.setUrl(m.getUrl());
menus.add(tree);
}
return TreeUtil.buildList(menus, "0");
}
}

View File

@ -0,0 +1,114 @@
package com.songpeng.sparchetype.system.vo;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @param <T>
*/
public class TreeVO<T> {
/**
* ID
*/
private String id;
/**
*
*/
private String name;
/**
* true false
*/
private boolean checked = false;
/**
*
*/
private String url;
/**
* ID
*/
private String parentId;
/**
*
*/
private boolean hasParent = false;
/**
*
*/
private boolean hasChildren = false;
/**
*
*/
private List<TreeVO<T>> children = new ArrayList<TreeVO<T>>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public boolean isHasParent() {
return hasParent;
}
public void setHasParent(boolean hasParent) {
this.hasParent = hasParent;
}
public boolean isHasChildren() {
return hasChildren;
}
public void setHasChildren(boolean hasChildren) {
this.hasChildren = hasChildren;
}
public List<TreeVO<T>> getChildren() {
return children;
}
public void setChildren(List<TreeVO<T>> children) {
this.children = children;
}
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.songpeng.sparchetype.system.mapper.SysMenuMapper">
<resultMap id="menuResultMap" type="com.songpeng.sparchetype.system.dto.SysMenuDTO">
<resultMap id="resultMap" type="com.songpeng.sparchetype.system.entity.SysMenu">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="url" property="url"/>
@ -12,10 +12,17 @@
<result column="permission" property="permission"/>
<result column="icon" property="icon"/>
<result column="descr" property="descr"/>
<result column="create_username" property="createUsername"/>
<result column="create_time" property="createTime"/>
<result column="update_username" property="updateUsername"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<resultMap id="dtoResultMap" extends="resultMap" type="com.songpeng.sparchetype.system.dto.SysMenuDTO">
</resultMap>
<!--根据角色id查询菜单列表-->
<select id="selectMenuByRoleId" parameterType="java.lang.String" resultMap="menuResultMap">
<select id="selectMenuByRoleId" parameterType="java.lang.String" resultMap="dtoResultMap">
SELECT t.* FROM sp_sys_menu t
LEFT JOIN sp_sys_role_menu ssrm
ON ssrm.role_id = #{roleId}

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.songpeng.sparchetype.system.mapper.SysUserMapper">
<resultMap id="userRoleResultMap" type="com.songpeng.sparchetype.system.dto.SysUserDTO">
<resultMap id="resultMap" type="com.songpeng.sparchetype.system.entity.SysUser">
<id column="user_id" property="id"/>
<result column="name" property="name"/>
<result column="username" property="username"/>
@ -23,6 +23,13 @@
<result column="street_number" property="streetNumber"/>
<result column="descr" property="descr"/>
<result column="is_deleted" property="deleted"/>
<result column="create_username" property="createUsername"/>
<result column="create_time" property="createTime"/>
<result column="update_username" property="updateUsername"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<resultMap id="userRoleResultMap" extends="resultMap" type="com.songpeng.sparchetype.system.dto.SysUserDTO">
<collection property="sysRoleDtos" ofType="com.songpeng.sparchetype.system.dto.SysRoleDTO">
<id column="role_id" property="id"/>
<result column="role_name" property="name"/>

View File

@ -5,7 +5,7 @@ var spUtil = {};
* 提交表单
* @param param
*/
spUtil.submitForm = function(param) {
spUtil.submitForm = function(options) {
// 默认配置
var defaultConfig = {
type: "POST",
@ -31,7 +31,7 @@ spUtil.submitForm = function(param) {
}
};
var config = $.extend({}, defaultConfig, param, {
var config = $.extend({}, defaultConfig, options, {
// 此处写覆盖默认和传参配置
});
@ -41,6 +41,86 @@ spUtil.submitForm = function(param) {
/**
* Ajax 请求
*/
spUtil.ajax = function (options) {
var _this = this, loadingIndex;
var opt = $.extend({}, {
async: true,
dataType: 'json',
type: 'GET',
serializable: false,
selfProcessShow: false
}, options);
opt.beforeSend = function () {
if (options.showLoading) {
loadingIndex = layer.load();
}
options.beforeSend && options.beforeSend();
};
// 获取请求地址
opt.url = _this.generateUrl(options.url);
// 成功回调
opt.success = function (data) {
if (data.code === 0) {
options.success && options.success(data);
} else {
if (!options.errNoTip) {
tnComp.operationTip(data.msg, 'error');
layer.alert('操作失败,请重试!', {
icon: 2
});
}
}
};
// 失败回调
opt.error = function (jqXHR, textStatus, errorThrown) {
if (_this.sessionCheck(jqXHR, textStatus, errorThrown, options.sessionNoTip)) {
return;
}
if (options.error) {
options.error();
} else {
layer.alert('操作失败,请重试!', {
icon: 2
});
}
};
// 请求完成回调
opt.complete = function () {
options.complete && options.complete();
options.showLoading ? layer.close(loadingIndex) : '';
};
// json参数序列化
if (opt.serializable) {
opt.contentType = 'application/json';
opt.data = JSON.stringify(opt.data);
}
var ajax = $.ajax(opt);
return ajax;
};
/**
* session失效处理
* @returns {boolean}
*/
spUtil.sessionCheck = function (jqXHR, textStatus, errorThrown, sessionNoTip) {
if (jqXHR.status === 401) {
if (!sessionNoTip) {
tnComp.operationTipCallback('登录状态已失效,请重新登录!', 'error', function () {
top.location = '/';
});
} else {
// session超时不提示直接跳转
top.location = '/';
}
return true;
}
};
/**
* 将对象转为url路径字符串参数编码之后的字符串

View File

@ -24,7 +24,7 @@
<button class="layui-btn" id="btn-expand">全部展开</button>
<button class="layui-btn" id="btn-fold">全部折叠</button>
</div>
<table id="munu-table" class="layui-table" lay-filter="munu-table"></table>
<table id="demoTreeTable1" class="layui-table" lay-filter="demoTreeTable1"></table>
</div>
</div>
</div>
@ -32,6 +32,7 @@
<script type="text/html" id="demoTreeTableBar1">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="add">添加</a>
</script>
<!-- 表格状态列 -->
@ -44,24 +45,67 @@
var table = layui.table,
treeTable = layui.treeTable;
treeData = [];
// TODO 封装ajax
<#--$.ajax({-->
<#-- type: "GET",-->
<#-- url: "${request.contextPath}/admin/sys/menu/tree",-->
<#-- async: false,-->
<#-- success: function(result) {-->
<#-- console.log(result);-->
<#-- if (result.code === 0) {-->
<#-- treeData = result.data.data;-->
<#-- } else {-->
<#-- layer.alert(result.msg, {-->
<#-- icon: 2-->
<#-- })-->
<#-- }-->
<#-- },-->
<#-- error: function(e){-->
<#-- layer.alert(e, {-->
<#-- icon: 2-->
<#-- })-->
<#-- }-->
<#--});-->
// 渲染表格
var insTb = treeTable.render({
elem: '#munu-table',
elem: '#demoTreeTable1',
// data: treeData,
tree: {
iconIndex: 1
iconIndex: 1,
idName: 'id', // 自定义id字段的名称
pidName: 'parentId', // 自定义标识是否还有子节点的字段名称
haveChildName: 'hasChildren', // 自定义标识是否还有子节点的字段名称
isPidData: true // 是否是pid形式数据
},
cols: [
{type: 'numbers'},
{field: 'id', title: 'ID'},
{field: 'name', title: 'name', width: 160, edit: 'text'},
{field: 'createTime', title: '创建时间', width: 180, edit: 'text'},
{templet: '#demoTreeTableState1', title: '状态', width: 100},
{align: 'center', toolbar: '#demoTreeTableBar1', title: '操作', width: 120}
{align: 'center', toolbar: '#demoTreeTableBar1', title: '操作', width: 150}
],
reqData: function (data, callback) {
$.get('${request.contextPath}/admin/sys/menu/tree', function (res) {
console.log(res.data.data)
callback(res.data.data);
$.ajax({
type: "GET",
url: "${request.contextPath}/admin/sys/menu/tree",
async: true,
success: function(result) {
console.log(result);
if (result.code === 0) {
callback(result.data);
} else {
layer.alert(result.msg, {
icon: 2
})
}
},
error: function(e){
layer.alert(e, {
icon: 2
})
}
});
},
style: 'margin-top:0;'