Merge branch 'master' of https://gitee.com/izory/ZrAdminNetCore
This commit is contained in:
commit
5aa229c381
@ -97,7 +97,7 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="formFile"></param>
|
/// <param name="formFile"></param>
|
||||||
/// <param name="fileDir">存储目录</param>
|
/// <param name="fileDir">存储目录</param>
|
||||||
/// <param name="fileName">文件名</param>
|
/// <param name="fileName">自定义文件名</param>
|
||||||
/// <param name="uploadType">上传类型 1、发送邮件</param>
|
/// <param name="uploadType">上传类型 1、发送邮件</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost()]
|
[HttpPost()]
|
||||||
@ -152,16 +152,17 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
/// 存储文件到阿里云
|
/// 存储文件到阿里云
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="formFile"></param>
|
/// <param name="formFile"></param>
|
||||||
|
/// <param name="fileName">自定义文件名</param>
|
||||||
/// <param name="fileDir">上传文件夹路径</param>
|
/// <param name="fileDir">上传文件夹路径</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Verify]
|
[Verify]
|
||||||
[ActionPermissionFilter(Permission = "common")]
|
[ActionPermissionFilter(Permission = "common")]
|
||||||
public IActionResult UploadFileAliyun([FromForm(Name = "file")] IFormFile formFile, string fileDir = "")
|
public IActionResult UploadFileAliyun([FromForm(Name = "file")] IFormFile formFile, string fileName = "", string fileDir = "")
|
||||||
{
|
{
|
||||||
if (formFile == null) throw new CustomException(ResultCode.PARAM_ERROR, "上传文件不能为空");
|
if (formFile == null) throw new CustomException(ResultCode.PARAM_ERROR, "上传文件不能为空");
|
||||||
string fileExt = Path.GetExtension(formFile.FileName);
|
string fileExt = Path.GetExtension(formFile.FileName);
|
||||||
string[] AllowedFileExtensions = new string[] { ".jpg", ".gif", ".png", ".jpeg", ".webp", ".svga", ".xls", ".doc", ".zip", ".json", ".txt" };
|
string[] AllowedFileExtensions = new string[] { ".jpg", ".gif", ".png", ".jpeg", ".webp", ".svga", ".xls", ".doc", ".zip", ".json", ".txt", ".bundle" };
|
||||||
int MaxContentLength = 1024 * 1024 * 15;
|
int MaxContentLength = 1024 * 1024 * 15;
|
||||||
double fileSize = formFile.Length / 1024;
|
double fileSize = formFile.Length / 1024;
|
||||||
if (!AllowedFileExtensions.Contains(fileExt))
|
if (!AllowedFileExtensions.Contains(fileExt))
|
||||||
@ -174,7 +175,7 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
return ToResponse(ResultCode.CUSTOM_ERROR, "上传文件过大,不能超过 " + (MaxContentLength / 1024).ToString() + " MB");
|
return ToResponse(ResultCode.CUSTOM_ERROR, "上传文件过大,不能超过 " + (MaxContentLength / 1024).ToString() + " MB");
|
||||||
}
|
}
|
||||||
|
|
||||||
(bool, string, string) result = SysFileService.SaveFile(fileDir, formFile);
|
(bool, string, string) result = SysFileService.SaveFile(fileDir, formFile, fileName);
|
||||||
long fileId = SysFileService.InsertFile(new SysFile()
|
long fileId = SysFileService.InsertFile(new SysFile()
|
||||||
{
|
{
|
||||||
AccessUrl = result.Item2,
|
AccessUrl = result.Item2,
|
||||||
|
|||||||
@ -43,6 +43,7 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
predicate = predicate.AndIF(parm.BeginCreate_time != null, it => it.Create_time >= parm.BeginCreate_time);
|
predicate = predicate.AndIF(parm.BeginCreate_time != null, it => it.Create_time >= parm.BeginCreate_time);
|
||||||
predicate = predicate.AndIF(parm.EndCreate_time != null, it => it.Create_time <= parm.EndCreate_time);
|
predicate = predicate.AndIF(parm.EndCreate_time != null, it => it.Create_time <= parm.EndCreate_time);
|
||||||
predicate = predicate.AndIF(parm.StoreType != null, m => m.StoreType == parm.StoreType);
|
predicate = predicate.AndIF(parm.StoreType != null, m => m.StoreType == parm.StoreType);
|
||||||
|
predicate = predicate.AndIF(parm.FileId != null, m => m.Id == parm.FileId);
|
||||||
|
|
||||||
//搜索条件查询语法参考Sqlsugar
|
//搜索条件查询语法参考Sqlsugar
|
||||||
var response = _SysFileService.GetPages(predicate.ToExpression(), parm);
|
var response = _SysFileService.GetPages(predicate.ToExpression(), parm);
|
||||||
@ -59,7 +60,7 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
public IActionResult GetSysFile(int Id)
|
public IActionResult GetSysFile(int Id)
|
||||||
{
|
{
|
||||||
var response = _SysFileService.GetFirst(x => x.Id == Id);
|
var response = _SysFileService.GetFirst(x => x.Id == Id);
|
||||||
|
|
||||||
return SUCCESS(response);
|
return SUCCESS(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using ZR.Admin.WebApi.Filters;
|
|||||||
using ZR.Model.System.Dto;
|
using ZR.Model.System.Dto;
|
||||||
using ZR.Model.System;
|
using ZR.Model.System;
|
||||||
using ZR.Service.System.IService;
|
using ZR.Service.System.IService;
|
||||||
|
using ZR.Model;
|
||||||
|
|
||||||
namespace ZR.Admin.WebApi.Controllers.System
|
namespace ZR.Admin.WebApi.Controllers.System
|
||||||
{
|
{
|
||||||
@ -32,10 +33,10 @@ namespace ZR.Admin.WebApi.Controllers.System
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[ActionPermissionFilter(Permission = "system:menu:list")]
|
[ActionPermissionFilter(Permission = "system:menu:list")]
|
||||||
[HttpGet("list")]
|
[HttpGet("list")]
|
||||||
public IActionResult MenuList([FromQuery] SysMenu menu)
|
public IActionResult TreeMenuList([FromQuery] SysMenu menu)
|
||||||
{
|
{
|
||||||
long userId = HttpContext.GetUId();
|
long userId = HttpContext.GetUId();
|
||||||
return SUCCESS(sysMenuService.SelectMenuList(menu, userId), "yyyy-MM-dd HH:mm:ss");
|
return SUCCESS(sysMenuService.SelectTreeMenuList(menu, userId), "yyyy-MM-dd HH:mm:ss");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -74,7 +75,7 @@ namespace ZR.Admin.WebApi.Controllers.System
|
|||||||
public IActionResult RoleMenuTreeselect(int roleId)
|
public IActionResult RoleMenuTreeselect(int roleId)
|
||||||
{
|
{
|
||||||
long userId = HttpContext.GetUId();
|
long userId = HttpContext.GetUId();
|
||||||
var menus = sysMenuService.SelectMenuList(userId);
|
var menus = sysMenuService.SelectMenuList(new SysMenu(), userId);
|
||||||
var checkedKeys = sysRoleService.SelectUserRoleMenus(roleId);
|
var checkedKeys = sysRoleService.SelectUserRoleMenus(roleId);
|
||||||
return SUCCESS(new
|
return SUCCESS(new
|
||||||
{
|
{
|
||||||
|
|||||||
@ -45,8 +45,7 @@ $if(column.CsharpType == "string")
|
|||||||
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.${column.CsharpField}), ${codeTool.QueryExp(column.CsharpField, column.QueryType)};
|
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.${column.CsharpField}), ${codeTool.QueryExp(column.CsharpField, column.QueryType)};
|
||||||
$elseif(column.CsharpType == "DateTime")
|
$elseif(column.CsharpType == "DateTime")
|
||||||
predicate = predicate.AndIF(parm.Begin${column.CsharpField} == null, it => it.${column.CsharpField} >= DateTime.Now.AddDays(-1));
|
predicate = predicate.AndIF(parm.Begin${column.CsharpField} == null, it => it.${column.CsharpField} >= DateTime.Now.AddDays(-1));
|
||||||
predicate = predicate.AndIF(parm.Begin${column.CsharpField} != null, it => it.${column.CsharpField} >= parm.Begin${column.CsharpField});
|
predicate = predicate.AndIF(parm.Begin${column.CsharpField} != null, it => it.${column.CsharpField} >= parm.Begin${column.CsharpField} && it.${column.CsharpField} <= parm.End${column.CsharpField});
|
||||||
predicate = predicate.AndIF(parm.End${column.CsharpField} != null, it => it.${column.CsharpField} <= parm.End${column.CsharpField});
|
|
||||||
$elseif(column.CsharpType == "int" || column.CsharpType == "long")
|
$elseif(column.CsharpType == "int" || column.CsharpType == "long")
|
||||||
predicate = predicate.AndIF(parm.${column.CsharpField} != null, ${codeTool.QueryExp(column.CsharpField, column.QueryType)};
|
predicate = predicate.AndIF(parm.${column.CsharpField} != null, ${codeTool.QueryExp(column.CsharpField, column.QueryType)};
|
||||||
$end
|
$end
|
||||||
@ -54,7 +53,7 @@ $end
|
|||||||
$end
|
$end
|
||||||
$if(genTable.SortField != "" && genTable.SortField != null)
|
$if(genTable.SortField != "" && genTable.SortField != null)
|
||||||
var response = _${replaceDto.ModelTypeName}repository
|
var response = _${replaceDto.ModelTypeName}repository
|
||||||
.GetPages(predicate.ToExpression(), parm, x => x.${genTable.SortField}, "${genTable.SortType}");
|
.GetPages(predicate.ToExpression(), parm, it => it.${genTable.SortField}, "${genTable.SortType}");
|
||||||
$else
|
$else
|
||||||
var response = _${replaceDto.ModelTypeName}repository
|
var response = _${replaceDto.ModelTypeName}repository
|
||||||
.Queryable()
|
.Queryable()
|
||||||
|
|||||||
@ -25,5 +25,6 @@ namespace ZR.Model.System.Dto
|
|||||||
public DateTime? BeginCreate_time { get; set; }
|
public DateTime? BeginCreate_time { get; set; }
|
||||||
public DateTime? EndCreate_time { get; set; }
|
public DateTime? EndCreate_time { get; set; }
|
||||||
public int? StoreType { get; set; }
|
public int? StoreType { get; set; }
|
||||||
|
public int? FileId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace ZR.Model.System
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarTable("sys_menu")]
|
[SugarTable("sys_menu")]
|
||||||
[Tenant("0")]
|
[Tenant("0")]
|
||||||
public class SysMenu: SysBase
|
public class SysMenu : SysBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 菜单ID
|
/// 菜单ID
|
||||||
@ -84,6 +84,7 @@ namespace ZR.Model.System
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 子菜单
|
/// 子菜单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<SysMenu> children = new List<SysMenu>();
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public List<SysMenu> children { get; set; } = new List<SysMenu>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,41 @@ namespace ZR.Repository.System
|
|||||||
/// 获取所有菜单(菜单管理)
|
/// 获取所有菜单(菜单管理)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
public List<SysMenu> SelectTreeMenuList(SysMenu menu)
|
||||||
|
{
|
||||||
|
return Context.Queryable<SysMenu>()
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(menu.menuName), it => it.menuName.Contains(menu.menuName))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(menu.visible), it => it.visible == menu.visible)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(menu.status), it => it.status == menu.status)
|
||||||
|
.OrderBy(it => new { it.parentId, it.orderNum })
|
||||||
|
.ToTree(it => it.children, it => it.parentId, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据用户查询系统菜单列表(菜单管理)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sysMenu"></param>
|
||||||
|
/// <param name="roles">用户角色集合</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<SysMenu> SelectTreeMenuListByUserId(SysMenu sysMenu, List<long> roles)
|
||||||
|
{
|
||||||
|
var roleMenus = Context.Queryable<SysRoleMenu>()
|
||||||
|
.Where(r => roles.Contains(r.Role_id));
|
||||||
|
|
||||||
|
return Context.Queryable<SysMenu>()
|
||||||
|
.InnerJoin(roleMenus, (c, j) => c.menuId == j.Menu_id)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(sysMenu.menuName), (c, j) => c.menuName.Contains(sysMenu.menuName))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(sysMenu.visible), (c, j) => c.visible == sysMenu.visible)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(sysMenu.status), (c, j) => c.status == sysMenu.status)
|
||||||
|
.OrderBy((c, j) => new { c.parentId, c.orderNum })
|
||||||
|
.Select(c => c)
|
||||||
|
.ToTree(it => it.children, it => it.parentId, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取所有菜单
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public List<SysMenu> SelectMenuList(SysMenu menu)
|
public List<SysMenu> SelectMenuList(SysMenu menu)
|
||||||
{
|
{
|
||||||
return Context.Queryable<SysMenu>()
|
return Context.Queryable<SysMenu>()
|
||||||
@ -32,22 +67,21 @@ namespace ZR.Repository.System
|
|||||||
/// 根据用户查询系统菜单列表
|
/// 根据用户查询系统菜单列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sysMenu"></param>
|
/// <param name="sysMenu"></param>
|
||||||
/// <param name="userId">用户id</param>
|
/// <param name="roles">用户角色集合</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<SysMenu> SelectMenuListByUserId(SysMenu sysMenu, long userId)
|
public List<SysMenu> SelectMenuListByRoles(SysMenu sysMenu, List<long> roles)
|
||||||
{
|
{
|
||||||
return Context.Queryable<SysMenu, SysRoleMenu, SysUserRole, SysRole>((menu, roleMenu, userRole, role) => new JoinQueryInfos(
|
var roleMenus = Context.Queryable<SysRoleMenu>()
|
||||||
JoinType.Left, menu.menuId == roleMenu.Menu_id,
|
.Where(r => roles.Contains(r.Role_id));
|
||||||
JoinType.Left, roleMenu.Role_id == userRole.RoleId,
|
|
||||||
JoinType.Left, userRole.RoleId == role.RoleId
|
return Context.Queryable<SysMenu>()
|
||||||
))
|
.InnerJoin(roleMenus, (c, j) => c.menuId == j.Menu_id)
|
||||||
.Where((menu, roleMenu, userRole, role) => userRole.UserId == userId)
|
.Where((c, j) => c.status == "0")
|
||||||
.WhereIF(!string.IsNullOrEmpty(sysMenu.menuName), (menu, roleMenu, userRole, role) => menu.menuName.Contains(sysMenu.menuName))
|
.WhereIF(!string.IsNullOrEmpty(sysMenu.menuName), (c, j) => c.menuName.Contains(sysMenu.menuName))
|
||||||
.WhereIF(!string.IsNullOrEmpty(sysMenu.visible), (menu, roleMenu, userRole, role) => menu.visible == sysMenu.visible)
|
.WhereIF(!string.IsNullOrEmpty(sysMenu.visible), (c, j) => c.visible == sysMenu.visible)
|
||||||
.WhereIF(!string.IsNullOrEmpty(sysMenu.status), (menu, roleMenu, userRole, role) => menu.status == sysMenu.status)
|
.OrderBy((c, j) => new { c.parentId, c.orderNum })
|
||||||
.OrderBy((menu, roleMenu, userRole, role) => new { menu.parentId, menu.orderNum })
|
.Select(c => c)
|
||||||
//.Distinct()
|
.ToList();
|
||||||
.Select((menu, roleMenu, userRole, role) => menu).ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 左侧菜单树
|
#region 左侧菜单树
|
||||||
@ -68,11 +102,11 @@ namespace ZR.Repository.System
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据用户角色获取左侧菜单树
|
/// 根据用户角色获取左侧菜单树
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId"></param>
|
/// <param name="roleIds"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<SysMenu> SelectMenuTreeByRoleIds(List<long> roleIds)
|
public List<SysMenu> SelectMenuTreeByRoleIds(List<long> roleIds)
|
||||||
{
|
{
|
||||||
var menuTypes = new string[] { "M", "C"};
|
var menuTypes = new string[] { "M", "C" };
|
||||||
return Context.Queryable<SysMenu, SysRoleMenu>((menu, roleMenu) => new JoinQueryInfos(
|
return Context.Queryable<SysMenu, SysRoleMenu>((menu, roleMenu) => new JoinQueryInfos(
|
||||||
JoinType.Left, menu.menuId == roleMenu.Menu_id
|
JoinType.Left, menu.menuId == roleMenu.Menu_id
|
||||||
))
|
))
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using Infrastructure.Model;
|
using Infrastructure.Model;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using ZR.Model;
|
using ZR.Model;
|
||||||
using ZR.Model.System;
|
using ZR.Model.System;
|
||||||
|
|
||||||
@ -110,6 +111,16 @@ namespace ZR.Repository.System
|
|||||||
return Context.Queryable<SysRoleMenu>().Where(it => it.Role_id == roleId).ToList();
|
return Context.Queryable<SysRoleMenu>().Where(it => it.Role_id == roleId).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据用户所有角色获取菜单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="roleIds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<SysRoleMenu> SelectRoleMenuByRoleIds(long[] roleIds)
|
||||||
|
{
|
||||||
|
return Context.Queryable<SysRoleMenu>().Where(it => roleIds.Contains(it.Role_id)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 批量插入用户菜单
|
/// 批量插入用户菜单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -16,7 +16,7 @@ namespace ZR.Service.System.IService
|
|||||||
/// <param name="formFile"></param>
|
/// <param name="formFile"></param>
|
||||||
/// <returns>结果、地址、文件名</returns>
|
/// <returns>结果、地址、文件名</returns>
|
||||||
(bool, string, string) SaveFile(string picdir, IFormFile formFile);
|
(bool, string, string) SaveFile(string picdir, IFormFile formFile);
|
||||||
|
(bool, string, string) SaveFile(string picdir, IFormFile formFile, string customFileName);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 按时间来创建文件夹
|
/// 按时间来创建文件夹
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -8,34 +8,34 @@ namespace ZR.Service.System.IService
|
|||||||
{
|
{
|
||||||
public interface ISysMenuService
|
public interface ISysMenuService
|
||||||
{
|
{
|
||||||
public List<SysMenu> SelectMenuList(long userId);
|
//List<SysMenu> SelectMenuList(long userId);
|
||||||
|
|
||||||
public List<SysMenu> SelectMenuList(SysMenu menu, long userId);
|
List<SysMenu> SelectMenuList(SysMenu menu, long userId);
|
||||||
|
List<SysMenu> SelectTreeMenuList(SysMenu menu, long userId);
|
||||||
|
|
||||||
public SysMenu GetMenuByMenuId(int menuId);
|
SysMenu GetMenuByMenuId(int menuId);
|
||||||
|
int AddMenu(SysMenu menu);
|
||||||
|
|
||||||
public int AddMenu(SysMenu menu);
|
int EditMenu(SysMenu menu);
|
||||||
|
|
||||||
public int EditMenu(SysMenu menu);
|
int DeleteMenuById(int menuId);
|
||||||
|
|
||||||
public int DeleteMenuById(int menuId);
|
string CheckMenuNameUnique(SysMenu menu);
|
||||||
|
|
||||||
public string CheckMenuNameUnique(SysMenu menu);
|
int ChangeSortMenu(MenuDto menuDto);
|
||||||
|
|
||||||
public int ChangeSortMenu(MenuDto menuDto);
|
bool HasChildByMenuId(long menuId);
|
||||||
|
|
||||||
public bool HasChildByMenuId(long menuId);
|
List<SysMenu> SelectMenuTreeByUserId(long userId);
|
||||||
|
|
||||||
public List<SysMenu> SelectMenuTreeByUserId(long userId);
|
List<SysMenu> SelectMenuPermsListByUserId(long userId);
|
||||||
|
|
||||||
public List<SysMenu> SelectMenuPermsListByUserId(long userId);
|
List<string> SelectMenuPermsByUserId(long userId);
|
||||||
|
|
||||||
public List<string> SelectMenuPermsByUserId(long userId);
|
bool CheckMenuExistRole(long menuId);
|
||||||
|
|
||||||
public bool CheckMenuExistRole(long menuId);
|
List<RouterVo> BuildMenus(List<SysMenu> menus);
|
||||||
|
|
||||||
public List<RouterVo> BuildMenus(List<SysMenu> menus);
|
List<TreeSelectVo> BuildMenuTreeSelect(List<SysMenu> menus);
|
||||||
|
|
||||||
public List<TreeSelectVo> BuildMenuTreeSelect(List<SysMenu> menus);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,7 +105,7 @@ namespace ZR.Service.System.IService
|
|||||||
/// <param name="userId"></param>
|
/// <param name="userId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<long> SelectUserRoleMenus(long roleId);
|
public List<long> SelectUserRoleMenus(long roleId);
|
||||||
|
List<long> SelectRoleMenuByRoleIds(long[] roleIds);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取用户角色列表
|
/// 获取用户角色列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -10,6 +10,7 @@ using System.Security.Cryptography;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using ZR.Model.System;
|
using ZR.Model.System;
|
||||||
using ZR.Repository.System;
|
using ZR.Repository.System;
|
||||||
|
using Infrastructure.Extensions;
|
||||||
|
|
||||||
namespace ZR.Service.System
|
namespace ZR.Service.System
|
||||||
{
|
{
|
||||||
@ -35,9 +36,13 @@ namespace ZR.Service.System
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public (bool, string, string) SaveFile(string picdir, IFormFile formFile)
|
public (bool, string, string) SaveFile(string picdir, IFormFile formFile)
|
||||||
{
|
{
|
||||||
// eg: idcard/2020/08/18
|
return SaveFile(picdir, formFile, "");
|
||||||
|
}
|
||||||
|
public (bool, string, string) SaveFile(string picdir, IFormFile formFile, string customFileName)
|
||||||
|
{
|
||||||
|
// eg: uploads/2020/08/18
|
||||||
string dir = GetdirPath(picdir.ToString());
|
string dir = GetdirPath(picdir.ToString());
|
||||||
string tempName = HashFileName();
|
string tempName = customFileName.IsEmpty() ? HashFileName() : customFileName;
|
||||||
string fileExt = Path.GetExtension(formFile.FileName);
|
string fileExt = Path.GetExtension(formFile.FileName);
|
||||||
string fileName = $"{tempName}{fileExt}";
|
string fileName = $"{tempName}{fileExt}";
|
||||||
string webUrl = $"{domainUrl}/{dir}/{fileName}";
|
string webUrl = $"{domainUrl}/{dir}/{fileName}";
|
||||||
@ -46,7 +51,6 @@ namespace ZR.Service.System
|
|||||||
|
|
||||||
return (statusCode == HttpStatusCode.OK, webUrl, fileName);
|
return (statusCode == HttpStatusCode.OK, webUrl, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetdirPath(string path = "")
|
public string GetdirPath(string path = "")
|
||||||
{
|
{
|
||||||
DateTime date = DateTime.Now;
|
DateTime date = DateTime.Now;
|
||||||
|
|||||||
@ -4,7 +4,6 @@ using System.Linq;
|
|||||||
using ZR.Model.System.Dto;
|
using ZR.Model.System.Dto;
|
||||||
using ZR.Model.System;
|
using ZR.Model.System;
|
||||||
using ZR.Model.System.Vo;
|
using ZR.Model.System.Vo;
|
||||||
using ZR.Model.Vo;
|
|
||||||
using ZR.Model.Vo.System;
|
using ZR.Model.Vo.System;
|
||||||
using ZR.Repository.System;
|
using ZR.Repository.System;
|
||||||
using ZR.Service.System.IService;
|
using ZR.Service.System.IService;
|
||||||
@ -30,31 +29,39 @@ namespace ZR.Service
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据用户查询系统菜单列表
|
/// 获取所有菜单数(菜单管理)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="menu"></param>
|
|
||||||
/// <param name="userId"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<SysMenu> SelectMenuList(long userId)
|
public List<SysMenu> SelectTreeMenuList(SysMenu menu, long userId)
|
||||||
{
|
{
|
||||||
return SelectMenuList(new SysMenu(), userId);
|
List<SysMenu> menuList;
|
||||||
|
if (SysRoleService.IsAdmin(userId))
|
||||||
|
{
|
||||||
|
menuList = MenuRepository.SelectTreeMenuList(menu);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var userRoles = SysRoleService.SelectUserRoles(userId);
|
||||||
|
menuList = MenuRepository.SelectTreeMenuListByUserId(menu, userRoles);
|
||||||
|
}
|
||||||
|
return menuList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取所有菜单(菜单管理)
|
/// 获取所有菜单列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<SysMenu> SelectMenuList(SysMenu menu, long userId)
|
public List<SysMenu> SelectMenuList(SysMenu menu, long userId)
|
||||||
{
|
{
|
||||||
List<SysMenu> menuList;
|
List<SysMenu> menuList;
|
||||||
//if (SysUser.IsAdmin(userId))
|
|
||||||
if (SysRoleService.IsAdmin(userId))
|
if (SysRoleService.IsAdmin(userId))
|
||||||
{
|
{
|
||||||
menuList = MenuRepository.SelectMenuList(menu);
|
menuList = MenuRepository.SelectMenuList(menu);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
menuList = MenuRepository.SelectMenuListByUserId(menu, userId);
|
var userRoles = SysRoleService.SelectUserRoles(userId);
|
||||||
|
menuList = MenuRepository.SelectMenuListByRoles(menu, userRoles);
|
||||||
}
|
}
|
||||||
return menuList;
|
return menuList;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -216,7 +216,7 @@ namespace ZR.Service
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 判断是否是管理员
|
/// 判断是否是管理员
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userid"></param>
|
/// <param name="roleid"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool IsRoleAdmin(long roleid)
|
public bool IsRoleAdmin(long roleid)
|
||||||
{
|
{
|
||||||
@ -228,13 +228,25 @@ namespace ZR.Service
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取角色菜单id集合
|
/// 获取角色菜单id集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userId"></param>
|
/// <param name="roleId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<long> SelectUserRoleMenus(long roleId)
|
public List<long> SelectUserRoleMenus(long roleId)
|
||||||
{
|
{
|
||||||
var list = SysRoleRepository.SelectRoleMenuByRoleId(roleId);
|
var list = SysRoleRepository.SelectRoleMenuByRoleId(roleId);
|
||||||
|
|
||||||
return list.Select(x => x.Menu_id).ToList();
|
return list.Select(x => x.Menu_id).Distinct().ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据用户所有角色获取菜单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="roleIds"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<long> SelectRoleMenuByRoleIds(long[] roleIds)
|
||||||
|
{
|
||||||
|
return SysRoleRepository.SelectRoleMenuByRoleIds(roleIds)
|
||||||
|
.Select(x => x.Menu_id)
|
||||||
|
.Distinct().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -270,6 +282,11 @@ namespace ZR.Service
|
|||||||
return list.Select(x => x.RoleKey).ToList();
|
return list.Select(x => x.RoleKey).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取用户所有角色名
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public List<string> SelectUserRoleNames(long userId)
|
public List<string> SelectUserRoleNames(long userId)
|
||||||
{
|
{
|
||||||
var list = SelectUserRoleListByUserId(userId);
|
var list = SelectUserRoleListByUserId(userId);
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import request from '@/utils/request'
|
|||||||
|
|
||||||
export function upload(data) {
|
export function upload(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/upload/saveFile',
|
url: '/common/UploadFile',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: data,
|
data: data,
|
||||||
headers: { "Content-Type": "multipart/form-data" },
|
headers: { "Content-Type": "multipart/form-data" },
|
||||||
|
|||||||
@ -58,7 +58,7 @@ export default {
|
|||||||
// 上传地址
|
// 上传地址
|
||||||
uploadUrl: {
|
uploadUrl: {
|
||||||
type: String,
|
type: String,
|
||||||
default: process.env.VUE_APP_UPLOAD_URL ?? "/Common/UploadFile",
|
default: process.env.VUE_APP_UPLOAD_URL,
|
||||||
},
|
},
|
||||||
// form 列名
|
// form 列名
|
||||||
column: [String],
|
column: [String],
|
||||||
@ -100,6 +100,12 @@ export default {
|
|||||||
deep: true,
|
deep: true,
|
||||||
immediate: true,
|
immediate: true,
|
||||||
},
|
},
|
||||||
|
uploadUrl: {
|
||||||
|
handler(val){
|
||||||
|
this.uploadFileUrl = process.env.VUE_APP_BASE_API + val;
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// 是否显示提示
|
// 是否显示提示
|
||||||
@ -156,7 +162,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.msgSuccess("上传成功");
|
this.msgSuccess("上传成功");
|
||||||
this.fileList.push({ name: res.data.fileName, url: res.data.url, path: res.data.path });
|
this.fileList.push({ name: res.data.fileName, url: res.data.url, path: res.data.path });
|
||||||
this.$emit("input", this.column, this.listToString(this.fileList));
|
this.$emit("input", this.column, this.listToString(this.fileList), res.data);
|
||||||
},
|
},
|
||||||
// 上传进度
|
// 上传进度
|
||||||
uploadProcess(event, file, fileList) {
|
uploadProcess(event, file, fileList) {
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
<el-input v-model="name" style="position: relative;" clearable placeholder="请输入图标名称" @clear="filterIcons" @input.native="filterIcons">
|
<el-input v-model="name" style="position: relative;" clearable placeholder="请输入图标名称" @clear="filterIcons" @input.native="filterIcons">
|
||||||
<i slot="suffix" class="el-icon-search el-input__icon" />
|
<i slot="suffix" class="el-icon-search el-input__icon" />
|
||||||
</el-input>
|
</el-input>
|
||||||
|
<el-link type="danger" @click="selectedIcon('')">清空</el-link>
|
||||||
<div class="icon-list">
|
<div class="icon-list">
|
||||||
<div v-for="(item, index) in iconList" :key="index" @click="selectedIcon(item)">
|
<div v-for="(item, index) in iconList" :key="index" @click="selectedIcon(item)">
|
||||||
<svg-icon :icon-class="item" style="height: 30px;width: 16px;" />
|
<svg-icon :icon-class="item" style="height: 30px;width: 16px;" />
|
||||||
|
|||||||
@ -128,10 +128,9 @@ export default {
|
|||||||
$imgAdd(pos, $file) {
|
$imgAdd(pos, $file) {
|
||||||
var formdata = new FormData();
|
var formdata = new FormData();
|
||||||
formdata.append("file", $file);
|
formdata.append("file", $file);
|
||||||
// 这里没有服务器供大家尝试,可将下面上传接口替换为你自己的服务器接口
|
|
||||||
upload(formdata).then((res) => {
|
upload(formdata).then((res) => {
|
||||||
console.log(JSON.stringify(res));
|
console.log(JSON.stringify(res));
|
||||||
this.$refs.md.$img2Url(pos, res.data);
|
this.$refs.md.$img2Url(pos, res.data.url);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
change(value, render) {
|
change(value, render) {
|
||||||
|
|||||||
@ -52,10 +52,10 @@
|
|||||||
<el-table-column prop="path" label="路由地址" :show-overflow-tooltip="true"></el-table-column>
|
<el-table-column prop="path" label="路由地址" :show-overflow-tooltip="true"></el-table-column>
|
||||||
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
|
<el-table-column prop="component" label="组件路径" :show-overflow-tooltip="true"></el-table-column>
|
||||||
<el-table-column prop="visible" label="显示" width="70">
|
<el-table-column prop="visible" label="显示" width="70">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="visibleOptions" :value="scope.row.visible" />
|
<dict-tag :options="visibleOptions" :value="scope.row.visible" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态" align="center" prop="status" width="70">
|
<el-table-column label="状态" align="center" prop="status" width="70">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="statusOptions" :value="scope.row.status" />
|
<dict-tag :options="statusOptions" :value="scope.row.status" />
|
||||||
@ -103,11 +103,13 @@
|
|||||||
<el-form-item label="菜单图标" prop="icon">
|
<el-form-item label="菜单图标" prop="icon">
|
||||||
<el-popover placement="bottom-start" width="460" trigger="click" @show="$refs['iconSelect'].reset()">
|
<el-popover placement="bottom-start" width="460" trigger="click" @show="$refs['iconSelect'].reset()">
|
||||||
<IconSelect ref="iconSelect" @selected="selected" />
|
<IconSelect ref="iconSelect" @selected="selected" />
|
||||||
<el-input slot="reference" v-model="form.icon" placeholder="点击选择图标" readonly>
|
<el-input slot="reference" v-model="form.icon" placeholder="点击选择图标" clearable="" readonly>
|
||||||
<svg-icon v-if="form.icon" slot="prefix" :icon-class="form.icon" class="el-input__icon" style="height: 32px;width: 16px;" />
|
<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" />
|
<i v-else slot="prefix" class="el-icon-search el-input__icon"></i>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
|
|
||||||
|
<!-- <el-link type="danger" @click="form.icon = ''">清空</el-link> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="24">
|
<el-col :lg="24">
|
||||||
@ -221,7 +223,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|||||||
import IconSelect from "@/components/IconSelect";
|
import IconSelect from "@/components/IconSelect";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "menu",
|
name: "menu1",
|
||||||
components: { Treeselect, IconSelect },
|
components: { Treeselect, IconSelect },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -289,7 +291,8 @@ export default {
|
|||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listMenu(this.queryParams).then((response) => {
|
listMenu(this.queryParams).then((response) => {
|
||||||
this.menuList = this.handleTree(response.data, "menuId");
|
this.menuList = response.data;
|
||||||
|
// this.menuList = this.handleTree(response.data, "menuId");
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -309,7 +312,8 @@ export default {
|
|||||||
listMenu().then((response) => {
|
listMenu().then((response) => {
|
||||||
this.menuOptions = [];
|
this.menuOptions = [];
|
||||||
const menu = { menuId: 0, menuName: "根菜单", children: [] };
|
const menu = { menuId: 0, menuName: "根菜单", children: [] };
|
||||||
menu.children = this.handleTree(response.data, "menuId");
|
menu.children = response.data;
|
||||||
|
//menu.children = this.handleTree(response.data, "menuId");
|
||||||
this.menuOptions.push(menu);
|
this.menuOptions.push(menu);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
<!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
|
||||||
<el-form :model="queryParams" label-position="left" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" @submit.native.prevent>
|
<el-form :model="queryParams" label-position="left" inline ref="queryForm" :label-width="labelWidth" v-show="showSearch" @submit.native.prevent>
|
||||||
|
<el-form-item label="文件id" prop="fileId">
|
||||||
|
<el-input v-model="queryParams.fileId" placeholder="请输入文件id" clearable size="small" />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="上传时间">
|
<el-form-item label="上传时间">
|
||||||
<el-date-picker v-model="dateRangeCreate_time" size="small" value-format="yyyy-MM-dd" type="daterange" range-separator="-"
|
<el-date-picker v-model="dateRangeCreate_time" size="small" value-format="yyyy-MM-dd" type="daterange" range-separator="-"
|
||||||
start-placeholder="开始日期" end-placeholder="结束日期" placeholder="请选择上传时间"></el-date-picker>
|
start-placeholder="开始日期" end-placeholder="结束日期" placeholder="请选择上传时间"></el-date-picker>
|
||||||
@ -11,11 +14,10 @@
|
|||||||
<el-option v-for="item in storeTypeOptions" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
|
<el-option v-for="item in storeTypeOptions" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
<el-row class="mb8" style="text-align:center">
|
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-row>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<!-- 工具区域 -->
|
<!-- 工具区域 -->
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
@ -168,6 +170,7 @@ export default {
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
storeType: 1,
|
storeType: 1,
|
||||||
|
fileId: undefined,
|
||||||
},
|
},
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: "",
|
||||||
@ -256,13 +259,13 @@ export default {
|
|||||||
// 重置数据表单
|
// 重置数据表单
|
||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
fileName: undefined,
|
fileName: "",
|
||||||
fileUrl: undefined,
|
fileUrl: "",
|
||||||
storePath: "uploads",
|
storePath: "uploads",
|
||||||
fileSize: undefined,
|
fileSize: 0,
|
||||||
fileExt: undefined,
|
fileExt: "",
|
||||||
storeType: 1,
|
storeType: 1,
|
||||||
accessUrl: undefined,
|
accessUrl: "",
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@ -317,9 +320,9 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
//上传成功方法
|
//上传成功方法
|
||||||
handleUploadSuccess(columnName, filelist) {
|
handleUploadSuccess(columnName, filelist, data) {
|
||||||
this.form[columnName] = filelist;
|
this.form[columnName] = filelist;
|
||||||
|
this.queryParams.fileId = data.fileId;
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
@ -328,6 +331,7 @@ export default {
|
|||||||
return this.selectDictLabel(this.storeTypeOptions, row.storeType);
|
return this.selectDictLabel(this.storeTypeOptions, row.storeType);
|
||||||
},
|
},
|
||||||
handleSelectStore(val) {
|
handleSelectStore(val) {
|
||||||
|
this.queryParams.storeType = val;
|
||||||
if (val == 1) {
|
if (val == 1) {
|
||||||
this.uploadUrl = "/common/uploadFile";
|
this.uploadUrl = "/common/uploadFile";
|
||||||
} else if (val == 2) {
|
} else if (val == 2) {
|
||||||
|
|||||||
@ -2,11 +2,12 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
|
||||||
<el-form ref="codeform" :inline="true" :rules="rules" :model="queryParams" size="small">
|
<el-form ref="codeform" :inline="true" :rules="rules" :model="queryParams" size="small">
|
||||||
<el-form-item label="表名">
|
<el-form-item label="表名" prop="tableName">
|
||||||
<el-input v-model="queryParams.tableName" clearable placeholder="输入要查询的表名" />
|
<el-input v-model="queryParams.tableName" clearable placeholder="输入要查询的表名" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button size="mini" type="primary" icon="el-icon-search" @click="handleSearch()">查询</el-button>
|
<el-button size="mini" type="primary" icon="el-icon-search" @click="handleSearch()">查询</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
<!-- <el-button type="default" icon="el-icon-refresh" size="small" @click="loadTableData()">刷新</el-button> -->
|
<!-- <el-button type="default" icon="el-icon-refresh" size="small" @click="loadTableData()">刷新</el-button> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -76,7 +77,7 @@ import hljs from "highlight.js";
|
|||||||
import "highlight.js/styles/idea.css"; //这里有多个样式,自己可以根据需要切换
|
import "highlight.js/styles/idea.css"; //这里有多个样式,自己可以根据需要切换
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "code_generator",
|
name: "gen",
|
||||||
components: { importTable, hljs },
|
components: { importTable, hljs },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -133,6 +134,9 @@ export default {
|
|||||||
* 编辑表格
|
* 编辑表格
|
||||||
*/
|
*/
|
||||||
handleEditTable(row) {
|
handleEditTable(row) {
|
||||||
|
this.queryParams.tableName = row.tableName;
|
||||||
|
this.handleSearch();
|
||||||
|
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: "/gen/editTable",
|
path: "/gen/editTable",
|
||||||
query: { tableId: row.tableId },
|
query: { tableId: row.tableId },
|
||||||
@ -158,7 +162,6 @@ export default {
|
|||||||
* 点击生成服务端代码
|
* 点击生成服务端代码
|
||||||
*/
|
*/
|
||||||
handleGenTable(row) {
|
handleGenTable(row) {
|
||||||
console.log(JSON.stringify(this.currentSelected));
|
|
||||||
this.currentSelected = row;
|
this.currentSelected = row;
|
||||||
if (!this.currentSelected) {
|
if (!this.currentSelected) {
|
||||||
this.msgError("请先选择要生成代码的数据表");
|
this.msgError("请先选择要生成代码的数据表");
|
||||||
@ -179,7 +182,6 @@ export default {
|
|||||||
tableName: this.currentSelected.name,
|
tableName: this.currentSelected.name,
|
||||||
// queryColumn: this.checkedQueryColumn,
|
// queryColumn: this.checkedQueryColumn,
|
||||||
};
|
};
|
||||||
console.log(JSON.stringify(seachdata));
|
|
||||||
|
|
||||||
codeGenerator(seachdata)
|
codeGenerator(seachdata)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@ -205,6 +207,11 @@ export default {
|
|||||||
this.showGenerate = false;
|
this.showGenerate = false;
|
||||||
this.currentSelected = {};
|
this.currentSelected = {};
|
||||||
},
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryParams");
|
||||||
|
this.handleSearch();
|
||||||
|
},
|
||||||
/** 打开导入表弹窗 */
|
/** 打开导入表弹窗 */
|
||||||
openImportTable() {
|
openImportTable() {
|
||||||
this.$refs.import.show();
|
this.$refs.import.show();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user