提交 639246df authored 作者: taojinlong's avatar taojinlong

Merge branch 'main' of github.com:dataease/dataease into main

......@@ -7,6 +7,7 @@ import io.dataease.commons.utils.BeanUtils;
import io.dataease.controller.sys.request.MenuCreateRequest;
import io.dataease.controller.sys.request.MenuDeleteRequest;
import io.dataease.controller.sys.response.MenuNodeResponse;
import io.dataease.controller.sys.response.MenuTreeNode;
import io.dataease.service.sys.MenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -62,6 +63,12 @@ public class SysMenuController {
sets.add(pid);
return sets;
}
@PostMapping("/nodesByMenuId/{menuId}")
public List<MenuTreeNode> nodesByMenuId(@PathVariable("menuId") Long menuId) {
return menuService.searchTree(menuId);
}
}
package io.dataease.controller.sys.response;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class MenuTreeNode implements Serializable {
private Long id;
private String label;
private Boolean hasChildren;
private List<MenuTreeNode> children;
public List<MenuTreeNode> toList(){
List<MenuTreeNode> lists = new ArrayList<>();
lists.add(this);
return lists;
}
}
......@@ -81,7 +81,15 @@ public class DataSetTableService {
saveTableField(datasetTable);
}
} else {
datasetTableMapper.updateByPrimaryKeySelective(datasetTable);
int update = datasetTableMapper.updateByPrimaryKeySelective(datasetTable);
// sql 更新
if (update == 1) {
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
// 删除所有字段,重新抽象
dataSetTableFieldsService.deleteByTableId(datasetTable.getId());
saveTableField(datasetTable);
}
}
}
return datasetTable;
}
......@@ -262,7 +270,7 @@ public class DataSetTableService {
DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(ds);
String sql = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class).getSql();
datasourceRequest.setQuery(sql);
datasourceRequest.setQuery("SELECT * FROM (" + sql + ") AS tmp LIMIT 0,1000");
Map<String, List> result = datasourceProvider.fetchResultAndField(datasourceRequest);
List<String[]> data = result.get("dataList");
List<TableFiled> fields = result.get("fieldList");
......
package io.dataease.service.sys;
import io.dataease.base.domain.SysDept;
import io.dataease.base.domain.SysMenu;
import io.dataease.base.domain.SysMenuExample;
import io.dataease.base.mapper.SysMenuMapper;
......@@ -7,8 +8,10 @@ import io.dataease.base.mapper.ext.ExtMenuMapper;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.controller.sys.request.MenuCreateRequest;
import io.dataease.controller.sys.request.MenuDeleteRequest;
import io.dataease.controller.sys.response.DeptTreeNode;
import io.dataease.controller.sys.response.MenuNodeResponse;
import io.dataease.controller.sys.response.MenuTreeNode;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
......@@ -16,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
......@@ -121,6 +125,24 @@ public class MenuService {
return responses;
}
public List<MenuTreeNode> searchTree(Long menuId) {
List<SysMenu> roots = nodesByPid(0L);
if (menuId == MENU_ROOT_PID) return roots.stream().map(this::format).collect(Collectors.toList());
SysMenu sysMenu = sysMenuMapper.selectByPrimaryKey(menuId);
if (roots.stream().anyMatch(node -> node.getMenuId() == menuId)) return roots.stream().map(this::format).collect(Collectors.toList());
SysMenu current = sysMenu;
MenuTreeNode currentNode = format(sysMenu);
while (current.getPid() != MENU_ROOT_PID){
SysMenu parent = sysMenuMapper.selectByPrimaryKey(current.getPid()); //pid上有索引 所以效率不会太差
MenuTreeNode parentNode = format(parent);
parentNode.setChildren(currentNode.toList());
current = parent;
currentNode = parentNode;
}
MenuTreeNode targetRootNode = currentNode;
return roots.stream().map(node -> node.getMenuId() == targetRootNode.getId() ? targetRootNode : format(node)).collect(Collectors.toList());
}
private Set<SysMenu> getChilds(List<SysMenu> lists, Set<SysMenu> sets){
lists.forEach(menu -> {
sets.add(menu);
......@@ -132,6 +154,15 @@ public class MenuService {
return sets;
}
private MenuTreeNode format(SysMenu sysMenu) {
MenuTreeNode menuTreeNode = new MenuTreeNode();
menuTreeNode.setId(sysMenu.getMenuId());
menuTreeNode.setLabel(sysMenu.getName());
menuTreeNode.setHasChildren(false);
Optional.ofNullable(sysMenu.getMenuSort()).ifPresent(num -> menuTreeNode.setHasChildren(num > 0));
return menuTreeNode;
}
public List<MenuNodeResponse> convert(List<SysMenu> menus){
return menus.stream().map(node -> {
MenuNodeResponse menuNodeResponse = BeanUtils.copyBean(new MenuNodeResponse(), node);
......
DROP TABLE IF EXISTS `sys_dept` ;
-- ----------------------------
-- Table structure for sys_dept
-- ----------------------------
DROP TABLE IF EXISTS `sys_dept`;
CREATE TABLE `sys_dept` (
`dept_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`pid` bigint(20) DEFAULT NULL COMMENT '上级部门',
......@@ -16,16 +18,25 @@ CREATE TABLE `sys_dept` (
KEY `inx_enabled` (`enabled`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='部门';
INSERT INTO `sys_dept` (`dept_id`, `pid`, `sub_count`, `name`, `dept_sort`, `enabled`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('18','0','1','上海飞致云','1',b'1',null,null,'1614048906358','1614048906358');
INSERT INTO `sys_dept` (`dept_id`, `pid`, `sub_count`, `name`, `dept_sort`, `enabled`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('19','0','1','北京飞致云','2',b'1',null,null,'1614048918465','1614048918465');
INSERT INTO `sys_dept` (`dept_id`, `pid`, `sub_count`, `name`, `dept_sort`, `enabled`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('20','18','1','营销部','1',b'1',null,null,'1614048946370','1614049006759');
INSERT INTO `sys_dept` (`dept_id`, `pid`, `sub_count`, `name`, `dept_sort`, `enabled`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('21','19','0','综合部','3',b'1',null,null,'1614048963483','1615783363091');
INSERT INTO `sys_dept` (`dept_id`, `pid`, `sub_count`, `name`, `dept_sort`, `enabled`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('25','20','0','售前组','1',b'1',null,null,'1615791706945','1615791706945');
-- ----------------------------
-- Records of sys_dept
-- ----------------------------
BEGIN;
INSERT INTO `sys_dept` VALUES (18, 0, 1, '上海飞致云', 1, b'1', NULL, NULL, 1614048906358, 1614048906358);
INSERT INTO `sys_dept` VALUES (19, 0, 1, '北京飞致云', 2, b'1', NULL, NULL, 1614048918465, 1614048918465);
INSERT INTO `sys_dept` VALUES (20, 18, 1, '营销部', 1, b'1', NULL, NULL, 1614048946370, 1614049006759);
INSERT INTO `sys_dept` VALUES (21, 19, 0, '综合部', 3, b'1', NULL, NULL, 1614048963483, 1619667528267);
INSERT INTO `sys_dept` VALUES (25, 20, 0, '售前组', 1, b'1', NULL, NULL, 1615791706945, 1615791706945);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
DROP TABLE IF EXISTS `sys_menu` ;
-- ----------------------------
-- Table structure for sys_menu
-- ----------------------------
DROP TABLE IF EXISTS `sys_menu`;
CREATE TABLE `sys_menu` (
`menu_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`pid` bigint(20) DEFAULT NULL COMMENT '上级菜单ID',
......@@ -49,44 +60,55 @@ CREATE TABLE `sys_menu` (
UNIQUE KEY `uniq_title` (`title`),
UNIQUE KEY `uniq_name` (`name`),
KEY `inx_pid` (`pid`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统菜单';
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('1','0','3','0','系统管理','系统管理','Layout','5','system','/system',null,b'0',b'0','dir:sys',null,null,null,'1614916695777');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('2','1','4','1','用户管理','用户管理','system/user/index','2','peoples','user',null,b'0',b'0','user:read',null,null,null,'1615786052463');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('3','1','3','1','菜单管理','菜单管理','system/menu/index','2','menu','menu',null,b'0',b'0','menu:read',null,null,null,null);
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('4','1','3','1','组织管理','组织管理','system/dept/index','3','dept','dept',null,b'0',b'0','dept:read',null,null,null,null);
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('5','1','3','1','角色管理','角色管理','system/role/index','4','role','role',b'0',b'0',b'0','role:read',null,null,'1614683852133','1614683852133');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('6','1','0','1','参数管理','参数管理','system/systemParamSettings/index','13','sys-tools','systemParamSettings',null,b'0',b'0','sysparam:read',null,null,null,'1615790294169');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('7','0','1','0','数据集','数据管理','Layout','3','dataset','/dataset',null,b'0',b'0','dir:data',null,null,null,'1619081474697');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('8','7','0','1','数据管理1','数据管理1','dataset/index','1','dataset','index',null,b'0',b'0','data:read',null,null,null,'1614916684821');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('9','0','1','0','视图','视图管理','Layout','2','chart','/chart',null,b'0',b'0','dir:chart',null,null,null,'1619081462127');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('10','9','0','1','视图1','视图1','chart/index','1','chart','index',null,b'0',b'0','chart:read',null,null,null,'1614915491036');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('12','3','0','2','创建菜单',null,null,'999',null,null,b'0',b'0',b'0','menu:add',null,null,'1614924617327','1614924617327');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('13','3','0','2','删除菜单',null,null,'999',null,null,b'0',b'0',b'0','menu:del',null,null,'1614924667808','1614924667808');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('14','3','0','2','编辑菜单',null,null,'999',null,null,b'0',b'0',b'0','menu:edit',null,null,'1614930734224','1614936429773');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('15','2','0','2','创建用户',null,null,'999',null,null,b'0',b'0',b'0','user:add',null,null,'1614930862373','1614930862373');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('16','2','0','2','删除用户',null,null,'999',null,null,b'0',b'0',b'0','user:del',null,null,'1614930903502','1614930903502');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('17','2','0','2','编辑用户',null,null,'999',null,null,b'0',b'0',b'0','user:edit',null,null,'1614930935529','1614930935529');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('18','4','0','2','创建组织',null,null,'999',null,null,b'0',b'0',b'0','dept:add',null,null,'1614930976297','1614930976297');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('19','4','0','2','删除组织',null,null,'999',null,null,b'0',b'0',b'0','dept:del',null,null,'1614930997130','1614930997130');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('20','4','0','2','编辑组织',null,null,'999',null,null,b'0',b'0',b'0','dept:edit',null,null,'1614931022967','1614931022967');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('21','5','0','2','创建角色',null,null,'999',null,null,b'0',b'0',b'0','role:add',null,null,'1614931069408','1614931069408');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('22','5','0','2','删除角色',null,null,'999',null,null,b'0',b'0',b'0','role:del',null,null,'1614931097720','1614931097720');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('23','5','0','2','编辑角色',null,null,'999',null,null,b'0',b'0',b'0','role:edit',null,null,'1614931124782','1614931124782');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('24','34','0','2','创建连接',null,null,'997',null,null,b'0',b'0',b'0','datasource:add',null,null,'1614931168956','1615783705537');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('25','34','0','2','删除连接',null,null,'999',null,null,b'0',b'0',b'0','datasource:del',null,null,'1614931205899','1614931205899');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('26','34','0','2','编辑连接',null,null,'999',null,null,b'0',b'0',b'0','datasource:edit',null,null,'1614931234105','1614931234105');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('27','34','0','2','校验连接',null,null,'999',null,null,b'0',b'0',b'0','datasource:validate',null,null,'1614931268578','1614931268578');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('28','2','0','2','修改密码',null,null,'999',null,null,b'0',b'0',b'0','user:editPwd',null,null,'1615275128262','1615275128262');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('29','0','1','0','仪表盘','仪表盘管理','Layout','1',null,'/panel',null,b'0',b'0','panel:read',null,null,null,'1619081454146');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('30','29','0','1','仪表盘1','仪表盘','panel/index','1',null,'index',b'0',b'0',b'0','panel:read',null,null,null,'1619081449067');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('33','0','1','0','数据源','数据源','Layout','4',null,'/datasource',b'0',b'0',b'0','dir:datasource',null,null,'1619083205537','1619083205537');
INSERT INTO `sys_menu` (`menu_id`, `pid`, `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('34','33','4','1','数据源1','数据源1','system/datasource/index','1',null,'index',b'0',b'0',b'0','datasource:read',null,null,null,null);
DROP TABLE IF EXISTS `sys_user` ;
) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统菜单';
-- ----------------------------
-- Records of sys_menu
-- ----------------------------
BEGIN;
INSERT INTO `sys_menu` VALUES (1, 0, 3, 0, '系统管理', '系统管理', 'Layout', 5, 'system', '/system', NULL, b'0', b'0', 'dir:sys', NULL, NULL, NULL, 1614916695777);
INSERT INTO `sys_menu` VALUES (2, 1, 4, 1, '用户管理', '用户管理', 'system/user/index', 2, 'peoples', 'user', NULL, b'0', b'0', 'user:read', NULL, NULL, NULL, 1615786052463);
INSERT INTO `sys_menu` VALUES (3, 1, 3, 1, '菜单管理', '菜单管理', 'system/menu/index', 2, 'menu', 'menu', NULL, b'0', b'0', 'menu:read', NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (4, 1, 3, 1, '组织管理', '组织管理', 'system/dept/index', 3, 'dept', 'dept', NULL, b'0', b'0', 'dept:read', NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (5, 1, 3, 1, '角色管理', '角色管理', 'system/role/index', 4, 'role', 'role', b'0', b'0', b'0', 'role:read', NULL, NULL, 1614683852133, 1614683852133);
INSERT INTO `sys_menu` VALUES (6, 1, 0, 1, '参数管理', '参数管理', 'system/systemParamSettings/index', 13, 'sys-tools', 'systemParamSettings', NULL, b'0', b'0', 'sysparam:read', NULL, NULL, NULL, 1615790294169);
INSERT INTO `sys_menu` VALUES (7, 0, 1, 0, '数据集', '数据管理', 'Layout', 3, 'dataset', '/dataset', NULL, b'0', b'0', 'dir:data', NULL, NULL, NULL, 1619081474697);
INSERT INTO `sys_menu` VALUES (8, 7, 0, 1, '数据管理1', '数据管理1', 'dataset/index', 1, 'dataset', 'index', NULL, b'0', b'0', 'data:read', NULL, NULL, NULL, 1614916684821);
INSERT INTO `sys_menu` VALUES (9, 0, 1, 0, '视图', '视图管理', 'Layout', 2, 'chart', '/chart', NULL, b'0', b'0', 'dir:chart', NULL, NULL, NULL, 1619081462127);
INSERT INTO `sys_menu` VALUES (10, 9, 0, 1, '视图1', '视图1', 'chart/index', 1, 'chart', 'index', NULL, b'0', b'0', 'chart:read', NULL, NULL, NULL, 1614915491036);
INSERT INTO `sys_menu` VALUES (12, 3, 0, 2, '创建菜单', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'menu:add', NULL, NULL, 1614924617327, 1614924617327);
INSERT INTO `sys_menu` VALUES (13, 3, 0, 2, '删除菜单', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'menu:del', NULL, NULL, 1614924667808, 1614924667808);
INSERT INTO `sys_menu` VALUES (14, 3, 0, 2, '编辑菜单', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'menu:edit', NULL, NULL, 1614930734224, 1614936429773);
INSERT INTO `sys_menu` VALUES (15, 2, 0, 2, '创建用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:add', NULL, NULL, 1614930862373, 1614930862373);
INSERT INTO `sys_menu` VALUES (16, 2, 0, 2, '删除用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:del', NULL, NULL, 1614930903502, 1614930903502);
INSERT INTO `sys_menu` VALUES (17, 2, 0, 2, '编辑用户', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:edit', NULL, NULL, 1614930935529, 1614930935529);
INSERT INTO `sys_menu` VALUES (18, 4, 0, 2, '创建组织', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'dept:add', NULL, NULL, 1614930976297, 1614930976297);
INSERT INTO `sys_menu` VALUES (19, 4, 0, 2, '删除组织', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'dept:del', NULL, NULL, 1614930997130, 1614930997130);
INSERT INTO `sys_menu` VALUES (20, 4, 0, 2, '编辑组织', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'dept:edit', NULL, NULL, 1614931022967, 1614931022967);
INSERT INTO `sys_menu` VALUES (21, 5, 0, 2, '创建角色', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'role:add', NULL, NULL, 1614931069408, 1614931069408);
INSERT INTO `sys_menu` VALUES (22, 5, 0, 2, '删除角色', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'role:del', NULL, NULL, 1614931097720, 1614931097720);
INSERT INTO `sys_menu` VALUES (23, 5, 0, 2, '编辑角色', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'role:edit', NULL, NULL, 1614931124782, 1614931124782);
INSERT INTO `sys_menu` VALUES (24, 34, 0, 2, '创建连接', NULL, NULL, 997, NULL, NULL, b'0', b'0', b'0', 'datasource:add', NULL, NULL, 1614931168956, 1615783705537);
INSERT INTO `sys_menu` VALUES (25, 34, 0, 2, '删除连接', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'datasource:del', NULL, NULL, 1614931205899, 1614931205899);
INSERT INTO `sys_menu` VALUES (26, 34, 0, 2, '编辑连接', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'datasource:edit', NULL, NULL, 1614931234105, 1614931234105);
INSERT INTO `sys_menu` VALUES (27, 34, 0, 2, '校验连接', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'datasource:validate', NULL, NULL, 1614931268578, 1614931268578);
INSERT INTO `sys_menu` VALUES (28, 2, 0, 2, '修改密码', NULL, NULL, 999, NULL, NULL, b'0', b'0', b'0', 'user:editPwd', NULL, NULL, 1615275128262, 1615275128262);
INSERT INTO `sys_menu` VALUES (29, 0, 1, 0, '仪表盘', '仪表盘管理', 'Layout', 1, NULL, '/panel', NULL, b'0', b'0', 'panel:read', NULL, NULL, NULL, 1619081454146);
INSERT INTO `sys_menu` VALUES (30, 29, 0, 1, '仪表盘1', '仪表盘', 'panel/index', 1, NULL, 'index', b'0', b'0', b'0', 'panel:read', NULL, NULL, NULL, 1619081449067);
INSERT INTO `sys_menu` VALUES (33, 0, 1, 0, '数据源', '数据源', 'Layout', 4, NULL, '/datasource', b'0', b'0', b'0', 'dir:datasource', NULL, NULL, 1619083205537, 1619083205537);
INSERT INTO `sys_menu` VALUES (34, 33, 4, 1, '数据源1', '数据源1', 'system/datasource/index', 1, NULL, 'index', b'0', b'0', b'0', 'datasource:read', NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (35, 1, 0, 1, '用户表单', '用户表单', 'system/user/form', 10, 'peoples', 'user-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (36, 1, 0, 1, '菜单表单', '菜单表单', 'system/menu/form', 11, 'menu', 'menu-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (37, 1, 0, 1, '组织表单', '组织表单', 'system/dept/form', 12, 'dept', 'dept-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (38, 1, 0, 1, '角色表单', '角色表单', 'system/role/form', 13, 'role', 'role-form', b'0', b'0', b'1', NULL, NULL, NULL, NULL, NULL);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user` (
`user_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`dept_id` bigint(20) DEFAULT NULL COMMENT '部门名称',
......@@ -110,15 +132,23 @@ CREATE TABLE `sys_user` (
UNIQUE KEY `uniq_email` (`email`),
KEY `FK5rwmryny6jthaaxkogownknqp` (`dept_id`) USING BTREE,
KEY `inx_enabled` (`enabled`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统用户';
INSERT INTO `sys_user` (`user_id`, `dept_id`, `username`, `nick_name`, `gender`, `phone`, `email`, `password`, `is_admin`, `enabled`, `create_by`, `update_by`, `pwd_reset_time`, `create_time`, `update_time`) VALUES ('4','0','admin','管理员','男',null,'admin@fit2cloud.com','e10adc3949ba59abbe56e057f20f883e',b'1','1',null,null,null,null,'1615184951534');
INSERT INTO `sys_user` (`user_id`, `dept_id`, `username`, `nick_name`, `gender`, `phone`, `email`, `password`, `is_admin`, `enabled`, `create_by`, `update_by`, `pwd_reset_time`, `create_time`, `update_time`) VALUES ('19','25','demo','demo','男',null,'demo@fit2cloud.com','e10adc3949ba59abbe56e057f20f883e',b'0','1',null,null,null,'1619086036234','1619086036234');
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='系统用户';
-- ----------------------------
-- Records of sys_user
-- ----------------------------
BEGIN;
INSERT INTO `sys_user` VALUES (4, 0, 'admin', '管理员', '男', NULL, 'admin@fit2cloud.com', 'e10adc3949ba59abbe56e057f20f883e', b'1', 1, NULL, NULL, NULL, NULL, 1615184951534);
INSERT INTO `sys_user` VALUES (19, 25, 'demo', 'demo', '男', NULL, 'demo@fit2cloud.com', 'e10adc3949ba59abbe56e057f20f883e', b'0', 0, NULL, NULL, NULL, 1619086036234, 1619086036234);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
DROP TABLE IF EXISTS `sys_role` ;
-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP TABLE IF EXISTS `sys_role`;
CREATE TABLE `sys_role` (
`role_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`code` varchar(100) NOT NULL COMMENT '代码',
......@@ -131,15 +161,23 @@ CREATE TABLE `sys_role` (
PRIMARY KEY (`role_id`) USING BTREE,
UNIQUE KEY `uniq_name` (`name`),
KEY `role_name_index` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色表';
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色表';
INSERT INTO `sys_role` (`role_id`, `code`, `name`, `description`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('3','admin','管理员',null,null,null,null,null);
INSERT INTO `sys_role` (`role_id`, `code`, `name`, `description`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES ('4','emp','普通员工',null,null,null,null,null);
-- ----------------------------
-- Records of sys_role
-- ----------------------------
BEGIN;
INSERT INTO `sys_role` VALUES (3, 'admin', '管理员', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_role` VALUES (4, 'emp', '普通员工', NULL, NULL, NULL, NULL, NULL);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
DROP TABLE IF EXISTS `sys_roles_menus` ;
-- ----------------------------
-- Table structure for sys_roles_menus
-- ----------------------------
DROP TABLE IF EXISTS `sys_roles_menus`;
CREATE TABLE `sys_roles_menus` (
`menu_id` bigint(20) NOT NULL COMMENT '菜单ID',
`role_id` bigint(20) NOT NULL COMMENT '角色ID',
......@@ -147,46 +185,54 @@ CREATE TABLE `sys_roles_menus` (
KEY `FKcngg2qadojhi3a651a5adkvbq` (`role_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色菜单关联';
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('1','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('2','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('3','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('4','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('5','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('6','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('7','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('8','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('9','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('10','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('11','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('14','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('15','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('16','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('17','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('18','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('19','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('20','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('21','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('22','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('23','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('24','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('25','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('26','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('27','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('28','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('29','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('30','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('31','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('32','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('33','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('34','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('101','3');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('29','4');
INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES ('30','4');
DROP TABLE IF EXISTS `sys_users_roles` ;
-- ----------------------------
-- Records of sys_roles_menus
-- ----------------------------
BEGIN;
INSERT INTO `sys_roles_menus` VALUES (1, 3);
INSERT INTO `sys_roles_menus` VALUES (2, 3);
INSERT INTO `sys_roles_menus` VALUES (3, 3);
INSERT INTO `sys_roles_menus` VALUES (4, 3);
INSERT INTO `sys_roles_menus` VALUES (5, 3);
INSERT INTO `sys_roles_menus` VALUES (6, 3);
INSERT INTO `sys_roles_menus` VALUES (7, 3);
INSERT INTO `sys_roles_menus` VALUES (8, 3);
INSERT INTO `sys_roles_menus` VALUES (9, 3);
INSERT INTO `sys_roles_menus` VALUES (10, 3);
INSERT INTO `sys_roles_menus` VALUES (11, 3);
INSERT INTO `sys_roles_menus` VALUES (14, 3);
INSERT INTO `sys_roles_menus` VALUES (15, 3);
INSERT INTO `sys_roles_menus` VALUES (16, 3);
INSERT INTO `sys_roles_menus` VALUES (17, 3);
INSERT INTO `sys_roles_menus` VALUES (18, 3);
INSERT INTO `sys_roles_menus` VALUES (19, 3);
INSERT INTO `sys_roles_menus` VALUES (20, 3);
INSERT INTO `sys_roles_menus` VALUES (21, 3);
INSERT INTO `sys_roles_menus` VALUES (22, 3);
INSERT INTO `sys_roles_menus` VALUES (23, 3);
INSERT INTO `sys_roles_menus` VALUES (24, 3);
INSERT INTO `sys_roles_menus` VALUES (25, 3);
INSERT INTO `sys_roles_menus` VALUES (26, 3);
INSERT INTO `sys_roles_menus` VALUES (27, 3);
INSERT INTO `sys_roles_menus` VALUES (28, 3);
INSERT INTO `sys_roles_menus` VALUES (29, 3);
INSERT INTO `sys_roles_menus` VALUES (30, 3);
INSERT INTO `sys_roles_menus` VALUES (31, 3);
INSERT INTO `sys_roles_menus` VALUES (32, 3);
INSERT INTO `sys_roles_menus` VALUES (33, 3);
INSERT INTO `sys_roles_menus` VALUES (34, 3);
INSERT INTO `sys_roles_menus` VALUES (101, 3);
INSERT INTO `sys_roles_menus` VALUES (29, 4);
INSERT INTO `sys_roles_menus` VALUES (30, 4);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
-- ----------------------------
-- Table structure for sys_users_roles
-- ----------------------------
DROP TABLE IF EXISTS `sys_users_roles`;
CREATE TABLE `sys_users_roles` (
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
`role_id` bigint(20) NOT NULL COMMENT '角色ID',
......@@ -194,6 +240,12 @@ CREATE TABLE `sys_users_roles` (
KEY `FKq4eq273l04bpu4efj0jd0jb98` (`role_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='用户角色关联';
INSERT INTO `sys_users_roles` (`user_id`, `role_id`) VALUES ('4','3');
INSERT INTO `sys_users_roles` (`user_id`, `role_id`) VALUES ('19','4');
-- ----------------------------
-- Records of sys_users_roles
-- ----------------------------
BEGIN;
INSERT INTO `sys_users_roles` VALUES (4, 3);
INSERT INTO `sys_users_roles` VALUES (19, 4);
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
......@@ -46,4 +46,11 @@ export function editMenu(data) {
})
}
export default { addMenu, editMenu, delMenu, getMenusTree, getChild }
export function treeByMenuId(menuId) {
return request({
url: '/api/menu/nodesByMenuId/' + menuId,
method: 'post'
})
}
export default { addMenu, editMenu, delMenu, getMenusTree, getChild, treeByMenuId }
......@@ -46,9 +46,13 @@ export default {
type: Array,
default: () => []
},
// eslint-disable-next-line vue/require-default-prop
localKey: String, // 如果需要记住选择的列,则这里添加一个唯一的Key
// eslint-disable-next-line vue/require-default-prop
header: String,
// eslint-disable-next-line vue/require-default-prop
searchConfig: Object,
// eslint-disable-next-line vue/require-default-prop
paginationConfig: Object
},
data() {
......
......@@ -88,9 +88,9 @@ export const BASE_BAR = {
title: {
text: ''
},
grid: {
containLabel: true
},
// grid: {
// containLabel: true
// },
tooltip: {},
legend: {
show: true,
......@@ -117,9 +117,9 @@ export const HORIZONTAL_BAR = {
title: {
text: ''
},
grid: {
containLabel: true
},
// grid: {
// containLabel: true
// },
tooltip: {},
legend: {
show: true,
......@@ -147,9 +147,9 @@ export const BASE_LINE = {
title: {
text: ''
},
grid: {
containLabel: true
},
// grid: {
// containLabel: true
// },
tooltip: {},
legend: {
show: true,
......@@ -178,9 +178,9 @@ export const BASE_PIE = {
title: {
text: ''
},
grid: {
containLabel: true
},
// grid: {
// containLabel: true
// },
tooltip: {},
legend: {
show: true,
......@@ -211,9 +211,9 @@ export const BASE_FUNNEL = {
title: {
text: ''
},
grid: {
containLabel: true
},
// grid: {
// containLabel: true
// },
tooltip: {
trigger: 'item'
},
......@@ -267,9 +267,9 @@ export const BASE_RADAR = {
title: {
text: ''
},
grid: {
containLabel: true
},
// grid: {
// containLabel: true
// },
tooltip: {},
legend: {
show: true,
......
......@@ -19,10 +19,10 @@
<el-row>
<el-col style="width: 500px;">
<el-form :inline="true" size="mini" class="row-style">
<el-form-item>
<el-form-item class="form-item">
<el-input v-model="name" :placeholder="$t('commons.name')" />
</el-form-item>
<el-form-item>
<el-form-item class="form-item">
<el-upload
:action="baseUrl+'dataset/table/excel/upload'"
:multiple="false"
......@@ -41,7 +41,7 @@
</el-row>
</el-row>
<el-row>
<el-row style="margin-top: 10px;">
<el-card class="box-card dataPreview" shadow="never">
<div slot="header" class="clearfix">
<span>{{ $t('dataset.data_preview') }}</span>
......@@ -100,27 +100,13 @@ export default {
}
},
watch: {
// dataSource(val) {
// if (val) {
// post('/datasource/getTables', { id: val }).then(response => {
// this.tables = response.data
// this.tableData = JSON.parse(JSON.stringify(this.tables))
// })
// }
// },
// searchTable(val) {
// if (val && val !== '') {
// this.tableData = JSON.parse(JSON.stringify(this.tables.filter(ele => { return ele.includes(val) })))
// } else {
// this.tableData = JSON.parse(JSON.stringify(this.tables))
// }
// }
},
mounted() {
// this.initDataSource()
},
activated() {
// this.initDataSource()
window.onresize = () => {
this.calHeight()
}
this.calHeight()
},
methods: {
// initDataSource() {
......@@ -128,6 +114,13 @@ export default {
// this.options = response.data
// })
// },
calHeight() {
const that = this
setTimeout(function() {
const currentHeight = document.documentElement.clientHeight
that.height = currentHeight - 56 - 30 - 26 - 25 - 35 - 10 - 37 - 20 - 10
}, 10)
},
uploadSuccess(response, file, fileList) {
// console.log(response)
// console.log(file)
......
......@@ -76,6 +76,11 @@
/>
</ux-grid>
</div>
<span class="table-count">
{{ $t('dataset.preview_show') }}
<span class="span-number">1000</span>
{{ $t('dataset.preview_item') }}
</span>
</el-card>
</el-row>
</el-row>
......@@ -155,11 +160,9 @@ export default {
},
mounted() {
window.onresize = () => {
return (() => {
this.height = window.innerHeight / 2
})()
this.calHeight()
}
this.height = window.innerHeight / 2
this.calHeight()
this.initDataSource()
this.$refs.myCm.codemirror.on('keypress', () => {
this.$refs.myCm.codemirror.showHint()
......@@ -168,6 +171,13 @@ export default {
this.initTableInfo()
},
methods: {
calHeight() {
const that = this
setTimeout(function() {
const currentHeight = document.documentElement.clientHeight
that.height = currentHeight - 56 - 30 - 26 - 25 - 43 - 160 - 10 - 37 - 20 - 10 - 16
}, 10)
},
initDataSource() {
listDatasource().then(response => {
this.options = response.data
......@@ -303,4 +313,10 @@ export default {
span{
font-size: 14px;
}
.span-number{
color: #f18126;
}
.table-count{
color: #606266;
}
</style>
......@@ -160,7 +160,7 @@ export default {
float: right;
}
span{
font-size: 14px;
font-size: 12px;
}
.span-number{
color: #f18126;
......
<template>
<layout-content :header="formType=='add' ? $t('organization.create') : $t('organization.modify')" back-name="组织管理">
<el-form ref="deptForm" :model="form" :rules="rule" size="small" label-width="auto" label-position="right">
<el-form-item label="组织名称" prop="name">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="组织排序" prop="deptSort">
<el-input-number
v-model.number="form.deptSort"
:min="0"
:max="999"
controls-position="right"
/>
</el-form-item>
<el-form-item label="顶级组织" prop="top">
<el-radio-group v-model="form.top" @change="topChange">
<el-radio :label="true"></el-radio>
<el-radio :label="false"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="状态" prop="enabled">
<el-radio-group v-model="form.enabled" disabled>
<el-radio :label="true">启用</el-radio>
<el-radio :label="false">停用</el-radio>
</el-radio-group>
<!-- <el-radio v-for="item in dict.dept_status" :key="item.id" v-model="form.enabled" :label="item.value">{{ item.label }}</el-radio> -->
</el-form-item>
<el-form-item v-if="!form.top" label="上级组织" prop="pid">
<treeselect
v-model="form.pid"
:auto-load-root-options="false"
:load-options="loadDepts"
:options="depts"
placeholder="选择上级类目"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="save">保存</el-button>
<el-button @click="reset">重置</el-button>
</el-form-item>
</el-form>
</layout-content>
</template>
<script>
import LayoutContent from '@/components/business/LayoutContent'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { LOAD_CHILDREN_OPTIONS, LOAD_ROOT_OPTIONS } from '@riophae/vue-treeselect'
import { getDeptTree, treeByDeptId, addDept, editDept } from '@/api/system/dept'
export default {
components: { LayoutContent, Treeselect },
data() {
return {
defaultForm: { deptId: null, top: true, enabled: true, pid: null },
maps: new Map(),
form: {},
rule: {
name: [
{ required: true, message: this.$t('organization.input_name'), trigger: 'blur' },
{ min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur' }
],
description: [
{ max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur' }
]
},
depts: null,
formType: 'add'
}
},
created() {
if (this.$router.currentRoute.params && this.$router.currentRoute.params.deptId) {
const row = this.$router.currentRoute.params
this.edit(row)
} else {
this.create()
}
},
methods: {
create() {
this.formType = 'add'
this.form = Object.assign({}, this.defaultForm)
},
edit(row) {
this.formType = 'modify'
this.form = Object.assign({}, row)
this.initDeptTree()
},
initDeptTree() {
treeByDeptId(this.form.pid || 0).then(res => {
const results = res.data.map(node => {
if (node.hasChildren && !node.children) {
node.children = null
}
return node
})
this.depts = results
})
},
// 获取弹窗内部门数据
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_ROOT_OPTIONS && !this.form.pid) {
const _self = this
treeByDeptId(0).then(res => {
const results = res.data.map(node => {
if (node.hasChildren && !node.children) {
node.children = null
}
return node
})
_self.depts = results
callback()
})
}
if (action === LOAD_CHILDREN_OPTIONS) {
const _self = this
getDeptTree(parentNode.id).then(res => {
parentNode.children = res.data.map(function(obj) {
return _self.normalizer(obj)
})
callback()
})
}
},
normalizer(node) {
if (node.hasChildren) {
node.children = null
}
return {
id: node.deptId,
label: node.name,
children: node.children
}
},
topChange(value) {
if (!value) {
this.form.pid = null
this.depts = null
}
},
reset() {
this.$refs.deptForm.resetFields()
},
save() {
this.$refs.deptForm.validate(valid => {
if (valid) {
const method = this.formType === 'add' ? addDept : editDept
method(this.form).then(res => {
this.$success(this.$t('commons.save_success'))
this.backToList()
})
} else {
return false
}
})
},
backToList() {
this.$router.push({ name: '组织管理' })
}
}
}
</script>
......@@ -203,17 +203,23 @@ export default {
this.search()
},
methods: {
// create() {
// this.form = Object.assign({}, this.defaultForm)
// this.dialogOrgAddVisible = true
// this.formType = 'add'
// },
// edit(row) {
// this.dialogOrgAddVisible = true
// this.formType = 'modify'
// this.oldPid = row.pid
// this.form = Object.assign({}, row)
// this.treeByRow(row)
// },
create() {
this.form = Object.assign({}, this.defaultForm)
this.dialogOrgAddVisible = true
this.formType = 'add'
this.$router.push({ name: '组织表单' })
},
edit(row) {
this.dialogOrgAddVisible = true
this.formType = 'modify'
this.oldPid = row.pid
this.form = Object.assign({}, row)
this.treeByRow(row)
this.$router.push({ name: '组织表单', params: row })
},
treeByRow(row) {
......
<template>
<layout-content :header="formType=='add' ? $t('menu.create') : $t('menu.modify')" back-name="菜单管理">
<el-form ref="menuForm" :model="form" :rules="rule" size="small" label-width="auto" label-position="right">
<el-form-item label="菜单类型" prop="type">
<el-radio-group v-model="form.type" size="mini" :disabled="formType!=='add'">
<el-radio-button label="0">目录</el-radio-button>
<el-radio-button label="1">菜单</el-radio-button>
<el-radio-button label="2">按钮</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item v-if="form.type!== 2" label="菜单图标" prop="icon">
<el-popover
placement="bottom-start"
width="425"
trigger="click"
@show="$refs['iconSelect'].reset()"
>
<IconSelect ref="iconSelect" @selected="selected" />
<el-input slot="reference" v-model="form.icon" placeholder="点击选择图标" readonly>
<svg-icon v-if="form.icon" slot="prefix" :icon-class="form.icon" class="el-input__icon" style="height: 32px;width: 16px;" />
<i v-else slot="prefix" class="el-icon-search el-input__icon" />
</el-input>
</el-popover>
</el-form-item>
<el-form-item v-if="form.type !== 2" label="菜单标题" prop="title">
<el-input v-model="form.title" placeholder="菜单标题" />
</el-form-item>
<el-form-item v-if="form.type === 2" label="按钮名称" prop="title">
<el-input v-model="form.title" placeholder="按钮名称" />
</el-form-item>
<el-form-item v-if="form.type !== 0" label="权限标识" prop="permission">
<el-input v-model="form.permission" :disabled="form.iframe || formType!=='add'" placeholder="权限标识" />
</el-form-item>
<el-form-item v-if="form.type !== 2" label="路由地址" prop="path">
<el-input v-model="form.path" placeholder="路由地址" :disabled="formType!=='add'" />
</el-form-item>
<el-form-item label="菜单排序" prop="menuSort">
<el-input-number v-model.number="form.menuSort" :min="0" :max="999" controls-position="right" />
</el-form-item>
<el-form-item v-if="!form.iframe && form.type === 1" label="组件名称" prop="componentName">
<el-input v-model="form.componentName" :disabled="formType!=='add'" placeholder="匹配组件内Name字段" />
</el-form-item>
<el-form-item v-if="!form.iframe && form.type === 1" label="组件路径" prop="component">
<el-input v-model="form.component" :disabled="formType!=='add'" placeholder="组件路径" />
</el-form-item>
<el-form-item label="上级类目" prop="pid">
<treeselect
v-model="form.pid"
:disabled="formType!=='add'"
:options="menus"
:load-options="loadMenus"
placeholder="选择上级类目"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="save">保存</el-button>
<el-button @click="reset">重置</el-button>
</el-form-item>
</el-form>
</layout-content>
</template>
<script>
import LayoutContent from '@/components/business/LayoutContent'
import Treeselect from '@riophae/vue-treeselect'
import IconSelect from '@/components/IconSelect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { LOAD_CHILDREN_OPTIONS, LOAD_ROOT_OPTIONS } from '@riophae/vue-treeselect'
import { addMenu, editMenu, getMenusTree, treeByMenuId } from '@/api/system/menu'
export default {
components: { LayoutContent, Treeselect, IconSelect },
data() {
return {
topMunu: { id: 0, label: '顶级目录', children: null },
defaultForm: { menuId: null, title: null, menuSort: 999, path: null, component: null, componentName: null, iframe: false, pid: 0, icon: null, cache: false, hidden: false, type: 0, permission: null },
form: {},
rule: {
name: [
{ required: true, message: this.$t('organization.input_name'), trigger: 'blur' },
{ min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur' }
],
description: [
{ max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur' }
]
},
menus: null,
maps: new Map(),
formType: 'add'
}
},
created() {
if (this.$router.currentRoute.params && this.$router.currentRoute.params.menuId) {
const row = this.$router.currentRoute.params
this.edit(row)
} else {
this.create()
}
this.initData()
},
methods: {
create() {
this.formType = 'add'
this.form = Object.assign({}, this.defaultForm)
},
edit(row) {
this.formType = 'modify'
this.form = Object.assign({}, row)
this.initMenuTree()
},
initMenuTree() {
treeByMenuId(this.form.pid || 0).then(res => {
const results = res.data.map(node => {
if (node.hasChildren && !node.children) {
node.children = null
}
return node
})
this.menus = results
})
},
// 获取弹窗内部门数据
loadMenus({ action, parentNode, callback }) {
if (action === LOAD_ROOT_OPTIONS) {
const _self = this
!this.menus && getMenusTree('0').then(res => {
_self.menus = res.data.map(node => _self.normalizer(node))
callback()
})
}
if (action === LOAD_CHILDREN_OPTIONS) {
const _self = this
getMenusTree(parentNode.id).then(res => {
parentNode.children = res.data.map(function(obj) {
return _self.normalizer(obj)
})
callback()
})
}
},
initData() {
this.menus = []
this.menus.push(this.topMunu)
},
normalizer(node) {
if (node.hasChildren) {
node.children = null
}
return {
id: node.menuId,
label: node.title,
children: node.children
}
},
selected(name) {
this.form.icon = name
},
reset() {
this.$refs.menuForm.resetFields()
},
save() {
this.$refs.menuForm.validate(valid => {
if (valid) {
const method = this.formType === 'add' ? addMenu : editMenu
method(this.form).then(res => {
this.$success(this.$t('commons.save_success'))
this.backToList()
})
} else {
return false
}
})
},
backToList() {
this.$router.push({ name: '菜单管理' })
}
}
}
</script>
......@@ -199,21 +199,27 @@ export default {
this.initTableData()
},
methods: {
// create() {
// this.form = Object.assign({}, this.defaultForm)
// this.dialogVisible = true
// this.formType = 'add'
// },
create() {
this.form = Object.assign({}, this.defaultForm)
this.dialogVisible = true
this.formType = 'add'
this.$router.push({ name: '菜单表单' })
},
search(condition) {
console.log(condition)
},
// edit(row) {
// this.dialogVisible = true
// this.formType = 'modify'
// this.oldPid = row.pid
// this.form = Object.assign({}, row)
// this.treeByRow(row)
// },
edit(row) {
this.dialogVisible = true
this.formType = 'modify'
this.oldPid = row.pid
this.form = Object.assign({}, row)
this.treeByRow(row)
this.$router.push({ name: '菜单表单', params: row })
},
treeByRow(row) {
......
<template>
<layout-content :header="formType=='add' ? $t('role.add') : $t('role.modify')" back-name="角色管理">
<el-form ref="roleForm" :model="form" :rules="rule" size="small" label-width="auto" label-position="right">
<el-form-item label="角色名称" prop="name">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="角色代码" prop="code">
<el-input v-model="form.code" :disabled="formType !== 'add'" />
</el-form-item>
<el-form-item label="描述信息" prop="description">
<el-input v-model="form.description" type="textarea" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="save">保存</el-button>
<el-button @click="reset">重置</el-button>
</el-form-item>
</el-form>
</layout-content>
</template>
<script>
import LayoutContent from '@/components/business/LayoutContent'
import { addRole, editRole } from '@/api/system/user'
export default {
components: { LayoutContent },
data() {
return {
form: {},
rule: {
name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
],
code: [{ required: true, message: '请输入代码', trigger: 'blur' }]
}
}
},
created() {
if (this.$router.currentRoute.params && this.$router.currentRoute.params.roleId) {
const row = this.$router.currentRoute.params
this.edit(row)
} else {
this.create()
}
},
methods: {
create() {
this.formType = 'add'
},
edit(row) {
this.formType = 'modify'
this.form = Object.assign({}, row)
},
reset() {
this.$refs.roleForm.resetFields()
},
save() {
this.$refs.roleForm.validate(valid => {
if (valid) {
const method = this.formType === 'add' ? addRole : editRole
method(this.form).then(res => {
this.$success(this.$t('commons.save_success'))
this.backToList()
})
} else {
return false
}
})
},
backToList() {
this.$router.push({ name: '角色管理' })
}
}
}
</script>
......@@ -152,10 +152,13 @@ export default {
handleClick(tab, event) {
console.log(tab, event)
},
// create() {
// this.form = {}
// this.formType = 'add'
// this.dialogVisible = true
// },
create() {
this.form = {}
this.formType = 'add'
this.dialogVisible = true
this.$router.push({ name: '角色表单' })
},
search(condition) {
const temp = formatCondition(condition)
......@@ -167,10 +170,13 @@ export default {
})
},
// edit(row) {
// this.formType = 'modify'
// this.dialogVisible = true
// this.form = Object.assign({}, row)
// },
edit(row) {
this.formType = 'modify'
this.dialogVisible = true
this.form = Object.assign({}, row)
this.$router.push({ name: '角色表单', params: row })
},
saveRole(roleForm) {
......
......@@ -31,7 +31,7 @@
v-model="form.deptId"
:options="depts"
:load-options="loadDepts"
:auto-load-root-options="false"
placeholder="选择部门"
/>
</el-form-item>
......@@ -182,6 +182,7 @@ export default {
const results = res.data.map(node => {
if (node.hasChildren && !node.children) {
node.children = null
// delete node.children
}
return node
})
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论