From b2099eaf19deda29a37539afe028a9a4ca6afae1 Mon Sep 17 00:00:00 2001
From: izory <791736813@qq.com>
Date: Sun, 21 Nov 2021 15:48:24 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=A0=E7=B3=BB=E7=BB=9F?=
=?UTF-8?q?=E8=A1=A8=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ZR.Admin.WebApi/Controllers/BaseController.cs | 33 ++++++++++
.../System/SysDictTypeController.cs | 15 +++++
.../Controllers/System/SysPostController.cs | 15 +++++
.../Controllers/System/SysRoleController.cs | 15 +++++
.../Controllers/System/SysUserController.cs | 58 ++++++++++--------
.../Controllers/System/TasksController.cs | 15 +++++
.../Controllers/System/TasksLogController.cs | 15 +++++
.../System/monitor/SysLogininforController.cs | 31 +++++++++-
.../System/monitor/SysOperlogController.cs | 23 ++++++-
.../Filters/ActionPermissionFilter.cs | 2 +-
ZR.Model/System/SysBase.cs | 2 +-
ZR.Repository/System/SysDictRepository.cs | 5 ++
ZR.Service/System/IService/ISysDictService.cs | 1 +
.../System/IService/ISysLoginService.cs | 2 +-
ZR.Service/System/SysDictService.cs | 4 ++
ZR.Service/System/SysLoginService.cs | 2 +-
ZR.Vue/src/api/monitor/job.js | 48 ++++++++++++++-
ZR.Vue/src/api/monitor/operlog.js | 14 ++---
ZR.Vue/src/api/system/role.js | 2 +-
ZR.Vue/src/utils/ruoyi.js | 3 +-
ZR.Vue/src/views/monitor/job/index.vue | 16 +++++
ZR.Vue/src/views/monitor/job/log.vue | 9 ++-
ZR.Vue/src/views/monitor/logininfor/index.vue | 5 +-
ZR.Vue/src/views/monitor/operlog/index.vue | 45 +++++++++-----
ZR.Vue/src/views/system/dict/index.vue | 7 ++-
ZR.Vue/src/views/system/post/index.vue | 12 +++-
ZR.Vue/src/views/system/role/index.vue | 32 +++++-----
ZR.Vue/src/views/system/user/index.vue | 4 +-
document/admin-mysql.sql | 13 ++--
document/admin-sqlserver.sql | Bin 110328 -> 113428 bytes
30 files changed, 357 insertions(+), 91 deletions(-)
diff --git a/ZR.Admin.WebApi/Controllers/BaseController.cs b/ZR.Admin.WebApi/Controllers/BaseController.cs
index 5a318df..f19cc41 100644
--- a/ZR.Admin.WebApi/Controllers/BaseController.cs
+++ b/ZR.Admin.WebApi/Controllers/BaseController.cs
@@ -1,9 +1,14 @@
using Infrastructure;
using Infrastructure.Model;
+using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
+using OfficeOpenXml;
+using System;
+using System.Collections.Generic;
+using System.IO;
using ZR.Admin.WebApi.Filters;
namespace ZR.Admin.WebApi.Controllers
@@ -99,5 +104,33 @@ namespace ZR.Admin.WebApi.Controllers
{
return ToResponse(GetApiResult(resultCode, msg));
}
+
+ ///
+ /// 导出Excel
+ ///
+ ///
+ ///
+ ///
+ ///
+ protected string ExportExcel(List list, string sheetName, string fileName)
+ {
+ IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment));
+ string sFileName = $"{fileName}{DateTime.Now:yyyyMMddHHmmss}.xlsx";
+ string newFileName = Path.Combine(webHostEnvironment.WebRootPath, "export", sFileName);
+ //调试模式需要加上
+ ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
+ Directory.CreateDirectory(Path.GetDirectoryName(newFileName));
+ using (ExcelPackage package = new ExcelPackage(new FileInfo(newFileName)))
+ {
+ // 添加worksheet
+ ExcelWorksheet worksheet = package.Workbook.Worksheets.Add(sheetName);
+
+ //全部字段导出
+ worksheet.Cells.LoadFromCollection(list, true);
+ package.Save();
+ }
+
+ return sFileName;
+ }
}
}
diff --git a/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs b/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs
index cee2abf..7efaf3f 100644
--- a/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/SysDictTypeController.cs
@@ -107,5 +107,20 @@ namespace ZR.Admin.WebApi.Controllers.System
return SUCCESS(SysDictService.DeleteDictTypeByIds(idss));
}
+
+ ///
+ /// 字典导出
+ ///
+ ///
+ [Log(BusinessType = BusinessType.EXPORT, IsSaveResponseData = false, Title = "字典导出")]
+ [HttpGet("export")]
+ [ActionPermissionFilter(Permission = "system:dict:export")]
+ public IActionResult Export()
+ {
+ var list = SysDictService.GetAll();
+
+ string sFileName = ExportExcel(list, "sysdictType", "字典");
+ return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
+ }
}
}
diff --git a/ZR.Admin.WebApi/Controllers/System/SysPostController.cs b/ZR.Admin.WebApi/Controllers/System/SysPostController.cs
index b573aef..b87ebfa 100644
--- a/ZR.Admin.WebApi/Controllers/System/SysPostController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/SysPostController.cs
@@ -120,5 +120,20 @@ namespace ZR.Admin.WebApi.Controllers.System
List posts = PostService.GetAll();
return SUCCESS(posts);
}
+
+ ///
+ /// 岗位导出
+ ///
+ ///
+ [Log(BusinessType = BusinessType.EXPORT, IsSaveResponseData = false, Title= "岗位导出")]
+ [HttpGet("export")]
+ [ActionPermissionFilter(Permission = "system:post:export")]
+ public IActionResult Export()
+ {
+ var list = PostService.GetAll();
+
+ string sFileName = ExportExcel(list, "syspost", "岗位");
+ return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
+ }
}
}
diff --git a/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs b/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs
index 171b9db..5242149 100644
--- a/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs
@@ -166,5 +166,20 @@ namespace ZR.Admin.WebApi.Controllers.System
return ToResponse(ToJson(result));
}
+
+ ///
+ /// 角色导出
+ ///
+ ///
+ [Log(BusinessType = BusinessType.EXPORT, IsSaveResponseData = false, Title = "角色导出")]
+ [HttpGet("export")]
+ [ActionPermissionFilter(Permission = "system:role:export")]
+ public IActionResult Export()
+ {
+ var list = sysRoleService.SelectRoleAll();
+
+ string sFileName = ExportExcel(list, "sysrole", "角色");
+ return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
+ }
}
}
diff --git a/ZR.Admin.WebApi/Controllers/System/SysUserController.cs b/ZR.Admin.WebApi/Controllers/System/SysUserController.cs
index 474518a..9d333f6 100644
--- a/ZR.Admin.WebApi/Controllers/System/SysUserController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/SysUserController.cs
@@ -16,7 +16,7 @@ using ZR.Service.System.IService;
namespace ZR.Admin.WebApi.Controllers.System
{
- //[Verify]
+ [Verify]
[Route("system/user")]
public class SysUserController : BaseController
{
@@ -217,6 +217,7 @@ namespace ZR.Admin.WebApi.Controllers.System
///
[HttpGet("export")]
[Log(Title = "用户导出", BusinessType = BusinessType.EXPORT)]
+ [ActionPermissionFilter(Permission = "system:user:export")]
public IActionResult UserExport([FromQuery] SysUser user)
{
string sFileName = $"用户列表{DateTime.Now:yyyyMMddHHmmss}.xlsx";
@@ -230,35 +231,38 @@ namespace ZR.Admin.WebApi.Controllers.System
{
// 添加worksheet
ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("sysuser");
-
+ #region 自定义导出
//添加头
- worksheet.Cells[1, 1].Value = "用户id";
- worksheet.Cells[1, 2].Value = "用户名称";
- worksheet.Cells[1, 3].Value = "用户昵称";
- worksheet.Cells[1, 4].Value = "部门";
- worksheet.Cells[1, 5].Value = "手机号码";
- worksheet.Cells[1, 6].Value = "性别";
- worksheet.Cells[1, 7].Value = "状态";
- worksheet.Cells[1, 8].Value = "添加时间";
- worksheet.Cells[1, 9].Value = "登录IP";
- worksheet.Cells[1, 10].Value = "最后登录时间";
- for (int i = 0; i < list.Count; i++)
- {
- var item = list[i];
- worksheet.Cells[$"A{i + 2}"].Value = item.UserId;
- worksheet.Cells[$"B{i + 2}"].Value = item.UserName;
- worksheet.Cells[$"C{i + 2}"].Value = item.NickName;
- worksheet.Cells[$"D{i + 2}"].Value = item.DeptName;
- worksheet.Cells[$"E{i + 2}"].Value = item.Phonenumber;
- worksheet.Cells[$"F{i + 2}"].Value = item.Sex;
- worksheet.Cells[$"G{i + 2}"].Value = item.Status;
- worksheet.Cells[$"H{i + 2}"].Value = item.Create_time.ToString();
- worksheet.Cells[$"I{i + 2}"].Value = item.LoginIP;
- worksheet.Cells[$"J{i + 2}"].Value = item.LoginDate.ToString();
- }
+ //worksheet.Cells[1, 1].Value = "用户id";
+ //worksheet.Cells[1, 2].Value = "用户名称";
+ //worksheet.Cells[1, 3].Value = "用户昵称";
+ //worksheet.Cells[1, 4].Value = "部门";
+ //worksheet.Cells[1, 5].Value = "手机号码";
+ //worksheet.Cells[1, 6].Value = "性别";
+ //worksheet.Cells[1, 7].Value = "状态";
+ //worksheet.Cells[1, 8].Value = "添加时间";
+ //worksheet.Cells[1, 9].Value = "登录IP";
+ //worksheet.Cells[1, 10].Value = "最后登录时间";
+ //for (int i = 0; i < list.Count; i++)
+ //{
+ // var item = list[i];
+ // //worksheet.Cells[i + 2, 1].Value = item.UserId;
+ // //worksheet.Cells[i + 2, 2].Value = item.UserName;
+ // //worksheet.Cells[i + 2, 3].Value = item.NickName;
+ // //worksheet.Cells[i + 2, 4].Value = item.DeptName;
+ // //worksheet.Cells[i + 2, 5].Value = item.Phonenumber;
+ // //worksheet.Cells[i + 2, 6].Value = item.Sex;
+ // //worksheet.Cells[i + 2, 7].Value = item.Status;
+ // //worksheet.Cells[i + 2, 8].Value = item.Create_time.ToString();
+ // //worksheet.Cells[i + 2, 9].Value = item.LoginIP;
+ // //worksheet.Cells[i + 2, 10].Value = item.LoginDate.ToString();
+ //}
+ #endregion
+ //全部字段导出
+ worksheet.Cells.LoadFromCollection(list, true);
package.Save();
}
- return SUCCESS(new { zipPath = "/export/" + sFileName, fileName = sFileName });
+ return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
}
}
}
diff --git a/ZR.Admin.WebApi/Controllers/System/TasksController.cs b/ZR.Admin.WebApi/Controllers/System/TasksController.cs
index 8b8cf2d..4ec1e09 100644
--- a/ZR.Admin.WebApi/Controllers/System/TasksController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/TasksController.cs
@@ -265,5 +265,20 @@ namespace ZR.Admin.WebApi.Controllers
return ToResponse(taskResult);
}
+
+ ///
+ /// 定时任务导出
+ ///
+ ///
+ [Log(BusinessType = BusinessType.EXPORT, IsSaveResponseData = false, Title = "定时任务导出")]
+ [HttpGet("export")]
+ [ActionPermissionFilter(Permission = "monitor:job:export")]
+ public IActionResult Export()
+ {
+ var list = _tasksQzService.GetAll();
+
+ string sFileName = ExportExcel(list, "monitorjob", "定时任务");
+ return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
+ }
}
}
diff --git a/ZR.Admin.WebApi/Controllers/System/TasksLogController.cs b/ZR.Admin.WebApi/Controllers/System/TasksLogController.cs
index 916d052..3ce61dd 100644
--- a/ZR.Admin.WebApi/Controllers/System/TasksLogController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/TasksLogController.cs
@@ -76,5 +76,20 @@ namespace ZR.Admin.WebApi.Controllers.System
tasksLogService.DeleteTable();
return SUCCESS(1);
}
+
+ ///
+ /// 定时任务日志导出
+ ///
+ ///
+ [Log(BusinessType = BusinessType.EXPORT, IsSaveResponseData = false, Title = "定时任务日志导出")]
+ [HttpGet("export")]
+ [ActionPermissionFilter(Permission = "PRIV_JOBLOG_EXPORT")]
+ public IActionResult Export()
+ {
+ var list = tasksLogService.GetAll();
+
+ string sFileName = ExportExcel(list, "jobLog", "定时任务日志");
+ return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
+ }
}
}
diff --git a/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs b/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs
index a60033d..38be60d 100644
--- a/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs
@@ -1,5 +1,9 @@
-using Infrastructure.Attribute;
+using Infrastructure;
+using Infrastructure.Attribute;
+using Infrastructure.Enums;
using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
+using System.Linq.Expressions;
using ZR.Admin.WebApi.Filters;
using ZR.Common;
using ZR.Model;
@@ -44,7 +48,7 @@ namespace ZR.Admin.WebApi.Controllers.monitor
/// /monitor/logininfor/clean
///
///
- [Log(Title = "清空登录日志")]
+ [Log(Title = "清空登录日志", BusinessType= BusinessType.CLEAN)]
[ActionPermissionFilter(Permission = "monitor:logininfor:remove")]
[HttpDelete("clean")]
public IActionResult CleanLoginInfo()
@@ -58,7 +62,7 @@ namespace ZR.Admin.WebApi.Controllers.monitor
///
///
///
- [Log(Title = "删除登录日志")]
+ [Log(Title = "删除登录日志", BusinessType = BusinessType.DELETE)]
[HttpDelete("{infoIds}")]
[ActionPermissionFilter(Permission = "monitor:logininfor:remove")]
public IActionResult Remove(string infoIds)
@@ -67,5 +71,26 @@ namespace ZR.Admin.WebApi.Controllers.monitor
return SUCCESS(sysLoginService.DeleteLogininforByIds(infoIdss));
}
+ ///
+ /// 登录日志导出
+ ///
+ ///
+ [Log(BusinessType = BusinessType.EXPORT, IsSaveResponseData = false, Title = "登录日志导出")]
+ [HttpGet("export")]
+ [ActionPermissionFilter(Permission = "monitor:logininfor:export")]
+ public IActionResult Export([FromQuery] SysLogininfor logininfoDto)
+ {
+ logininfoDto.BeginTime = DateTimeHelper.GetBeginTime(logininfoDto.BeginTime, -1);
+ logininfoDto.EndTime = DateTimeHelper.GetBeginTime(logininfoDto.EndTime, 1);
+ var exp = Expressionable.Create()
+ .And(it => it.loginTime >= logininfoDto.BeginTime && it.loginTime <= logininfoDto.EndTime);
+
+ var list = sysLoginService.Queryable().Where(exp.ToExpression())
+ .IgnoreColumns(it => new { it.Create_by, it.Create_time, it.Update_by, it.Update_time, it.Remark })
+ .ToList();
+
+ string sFileName = ExportExcel(list, "loginlog", "登录日志");
+ return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
+ }
}
}
diff --git a/ZR.Admin.WebApi/Controllers/System/monitor/SysOperlogController.cs b/ZR.Admin.WebApi/Controllers/System/monitor/SysOperlogController.cs
index 437aaa4..09ecf62 100644
--- a/ZR.Admin.WebApi/Controllers/System/monitor/SysOperlogController.cs
+++ b/ZR.Admin.WebApi/Controllers/System/monitor/SysOperlogController.cs
@@ -9,6 +9,11 @@ using ZR.Model.System.Dto;
using ZR.Model.System;
using ZR.Model.Vo;
using ZR.Service.System.IService;
+using System;
+using System.IO;
+using OfficeOpenXml;
+using Microsoft.AspNetCore.Hosting;
+using System.Collections.Generic;
namespace ZR.Admin.WebApi.Controllers.monitor
{
@@ -17,10 +22,12 @@ namespace ZR.Admin.WebApi.Controllers.monitor
public class SysOperlogController : BaseController
{
private ISysOperLogService sysOperLogService;
+ private IWebHostEnvironment WebHostEnvironment;
- public SysOperlogController(ISysOperLogService sysOperLogService)
+ public SysOperlogController(ISysOperLogService sysOperLogService, IWebHostEnvironment hostEnvironment)
{
this.sysOperLogService = sysOperLogService;
+ WebHostEnvironment = hostEnvironment;
}
///
@@ -67,5 +74,19 @@ namespace ZR.Admin.WebApi.Controllers.monitor
return ToJson(1);
}
+ ///
+ /// 导出操作日志
+ ///
+ ///
+ [Log(Title = "操作日志", BusinessType = BusinessType.EXPORT)]
+ [ActionPermissionFilter(Permission = "monitor:operlog:export")]
+ [HttpGet("export")]
+ public IActionResult Export([FromQuery] SysOperLogDto sysOperLog)
+ {
+ var list = sysOperLogService.SelectOperLogList(sysOperLog, new PagerInfo(1, 10000));
+ string sFileName = ExportExcel(list, "operlog", "操作日志");
+ return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
+ }
+
}
}
diff --git a/ZR.Admin.WebApi/Filters/ActionPermissionFilter.cs b/ZR.Admin.WebApi/Filters/ActionPermissionFilter.cs
index 16f5ae7..3cf32ca 100644
--- a/ZR.Admin.WebApi/Filters/ActionPermissionFilter.cs
+++ b/ZR.Admin.WebApi/Filters/ActionPermissionFilter.cs
@@ -55,7 +55,7 @@ namespace ZR.Admin.WebApi.Filters
bool isDemoMode = ConfigUtils.Instance.GetAppConfig("DemoMode", false);
//演示公开环境屏蔽权限
- string[] denyPerms = new string[] { "update", "add", "remove", "add", "edit", "delete", "import", "run", "start", "stop", "clear", "send" };
+ string[] denyPerms = new string[] { "update", "add", "remove", "add", "edit", "delete", "import", "run", "start", "stop", "clear", "send" ,"export"};
if (isDemoMode && (denyPerms.Any(f => Permission.ToLower().Contains(f.ToLower())) || Permission.Equals("system")))
{
context.Result = new JsonResult(new { code = ResultCode.FORBIDDEN, msg = "演示模式 , 不允许操作" });
diff --git a/ZR.Model/System/SysBase.cs b/ZR.Model/System/SysBase.cs
index 22faa64..d7ea4fe 100644
--- a/ZR.Model/System/SysBase.cs
+++ b/ZR.Model/System/SysBase.cs
@@ -30,7 +30,7 @@ namespace ZR.Model.System
public string Remark { get; set; }
///
- /// 搜素时间起始时间
+ /// 搜索时间起始时间
///
///
/// Write:需穿一个bool值,false时insert,update等操作会忽略此列(和Computed的作用差不多,看了源码也没发现与Computed有什么不一样的地方,有了解的朋友可以赐教下哈)
diff --git a/ZR.Repository/System/SysDictRepository.cs b/ZR.Repository/System/SysDictRepository.cs
index b792879..648db57 100644
--- a/ZR.Repository/System/SysDictRepository.cs
+++ b/ZR.Repository/System/SysDictRepository.cs
@@ -12,6 +12,11 @@ namespace ZR.Repository.System
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysDictRepository : BaseRepository
{
+ public List GetAll()
+ {
+ return Context.Queryable().ToList();
+ }
+
///
/// 查询字段类型列表
///
diff --git a/ZR.Service/System/IService/ISysDictService.cs b/ZR.Service/System/IService/ISysDictService.cs
index a6bd282..d1728f1 100644
--- a/ZR.Service/System/IService/ISysDictService.cs
+++ b/ZR.Service/System/IService/ISysDictService.cs
@@ -10,6 +10,7 @@ namespace ZR.Service.System.IService
///
public interface ISysDictService
{
+ public List GetAll();
public List SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager);
///
diff --git a/ZR.Service/System/IService/ISysLoginService.cs b/ZR.Service/System/IService/ISysLoginService.cs
index d80d99c..48b39c6 100644
--- a/ZR.Service/System/IService/ISysLoginService.cs
+++ b/ZR.Service/System/IService/ISysLoginService.cs
@@ -7,7 +7,7 @@ using ZR.Model.System;
namespace ZR.Service.System.IService
{
- public interface ISysLoginService
+ public interface ISysLoginService: IBaseService
{
public SysUser Login(LoginBodyDto loginBody, SysLogininfor logininfor);
diff --git a/ZR.Service/System/SysDictService.cs b/ZR.Service/System/SysDictService.cs
index 96a3395..e90db62 100644
--- a/ZR.Service/System/SysDictService.cs
+++ b/ZR.Service/System/SysDictService.cs
@@ -23,6 +23,10 @@ namespace ZR.Service.System
this.DictRepository = sysDictRepository;
this.DictDataRepository = dictDataRepository;
}
+ public List GetAll()
+ {
+ return DictRepository.GetAll();
+ }
///
/// 查询字段类型列表
diff --git a/ZR.Service/System/SysLoginService.cs b/ZR.Service/System/SysLoginService.cs
index 3a8056e..020e14b 100644
--- a/ZR.Service/System/SysLoginService.cs
+++ b/ZR.Service/System/SysLoginService.cs
@@ -15,7 +15,7 @@ namespace ZR.Service.System
/// 登录
///
[AppService(ServiceType = typeof(ISysLoginService), ServiceLifetime = LifeTime.Transient)]
- public class SysLoginService: ISysLoginService
+ public class SysLoginService: BaseService, ISysLoginService
{
private SysLogininfoRepository SysLogininfoRepository;
diff --git a/ZR.Vue/src/api/monitor/job.js b/ZR.Vue/src/api/monitor/job.js
index 4273f5b..09107ff 100644
--- a/ZR.Vue/src/api/monitor/job.js
+++ b/ZR.Vue/src/api/monitor/job.js
@@ -15,6 +15,11 @@ export function getTasks(id) {
})
}
+/**
+ *
+ * 获取所有任务
+ * @returns
+ */
export function getAllTasks() {
return request({
url: '/system/tasks/getAll',
@@ -22,6 +27,11 @@ export function getAllTasks() {
})
}
+/**
+ * 创建任务
+ * @param {*} data
+ * @returns
+ */
export function createTasks(data) {
return request({
url: '/system/tasks/create',
@@ -30,6 +40,11 @@ export function createTasks(data) {
})
}
+/**
+ * 更新任务
+ * @param {*} data
+ * @returns
+ */
export function updateTasks(data) {
return request({
url: '/system/tasks/update',
@@ -38,6 +53,11 @@ export function updateTasks(data) {
})
}
+/**
+ * 删除任务
+ * @param {*} id
+ * @returns
+ */
export function deleteTasks(id) {
return request({
url: '/system/tasks/delete?id=' + id,
@@ -45,6 +65,11 @@ export function deleteTasks(id) {
})
}
+/**
+ * 启动任务
+ * @param {*} id
+ * @returns
+ */
export function startTasks(id) {
return request({
url: '/system/tasks/start?id=' + id,
@@ -52,6 +77,11 @@ export function startTasks(id) {
})
}
+/**
+ * 停止任务
+ * @param {*} id
+ * @returns
+ */
export function stopTasks(id) {
return request({
url: '/system/tasks/stop?id=' + id,
@@ -59,11 +89,27 @@ export function stopTasks(id) {
})
}
+/**
+ * 运行一次
+ * @param {*} id
+ * @returns
+ */
export function runTasks(id) {
return request({
url: '/system/tasks/run?id=' + id,
method: 'get'
})
}
+/**
+ * 导出
+ * @returns
+ */
+export function exportTasks() {
+ return request({
+ url: '/system/tasks/export',
+ method: 'get'
+ })
+}
-export default { queryTasks, getTasks, getAllTasks, createTasks, updateTasks, deleteTasks, startTasks, stopTasks, runTasks }
+
+export default { queryTasks, getTasks, getAllTasks, createTasks, updateTasks, deleteTasks, startTasks, stopTasks, runTasks, exportTasks }
diff --git a/ZR.Vue/src/api/monitor/operlog.js b/ZR.Vue/src/api/monitor/operlog.js
index 58def23..07e27ab 100644
--- a/ZR.Vue/src/api/monitor/operlog.js
+++ b/ZR.Vue/src/api/monitor/operlog.js
@@ -26,10 +26,10 @@ export function cleanOperlog() {
}
// 导出操作日志
-// export function exportOperlog(query) {
-// return request({
-// url: '/monitor/operlog/export',
-// method: 'get',
-// params: query
-// })
-// }
+export function exportOperlog(query) {
+ return request({
+ url: '/monitor/operlog/export',
+ method: 'get',
+ params: query
+ })
+}
diff --git a/ZR.Vue/src/api/system/role.js b/ZR.Vue/src/api/system/role.js
index 788fcbf..25b8d1e 100644
--- a/ZR.Vue/src/api/system/role.js
+++ b/ZR.Vue/src/api/system/role.js
@@ -68,7 +68,7 @@ export function delRole(roleId) {
// 导出角色
export function exportRole(query) {
return request({
- url: '/system/sysRole/export',
+ url: '/system/role/export',
method: 'get',
params: query
})
diff --git a/ZR.Vue/src/utils/ruoyi.js b/ZR.Vue/src/utils/ruoyi.js
index 2e8b635..5e04dae 100644
--- a/ZR.Vue/src/utils/ruoyi.js
+++ b/ZR.Vue/src/utils/ruoyi.js
@@ -103,7 +103,8 @@ export function showColumn(columns, value) {
// 通用下载方法
export function download(fileName) {
// window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true;
- window.open(baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true)
+ // window.open(baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true)
+ window.open(baseURL + fileName)
}
// 字符串格式化(%s )
diff --git a/ZR.Vue/src/views/monitor/job/index.vue b/ZR.Vue/src/views/monitor/job/index.vue
index 646b951..06257f9 100644
--- a/ZR.Vue/src/views/monitor/job/index.vue
+++ b/ZR.Vue/src/views/monitor/job/index.vue
@@ -23,6 +23,9 @@
删除
-->
+
+ 导出
+
日志
@@ -152,6 +155,7 @@ import {
startTasks,
stopTasks,
runTasks,
+ exportTasks
} from "@/api/monitor/job";
export default {
name: "tasks",
@@ -458,6 +462,18 @@ export default {
this.reset();
this.getList();
},
+ /** 导出按钮操作 */
+ handleExport() {
+ this.$confirm("是否确认导出所有任务?", "警告", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ }).then(() => {
+ return exportTasks();
+ }).then(response => {
+ this.download(response.data.path)
+ });
+ },
},
};
diff --git a/ZR.Vue/src/views/monitor/job/log.vue b/ZR.Vue/src/views/monitor/job/log.vue
index b0ef53d..58c13d8 100644
--- a/ZR.Vue/src/views/monitor/job/log.vue
+++ b/ZR.Vue/src/views/monitor/job/log.vue
@@ -30,6 +30,9 @@
清空
+
+ 导出
+
@@ -41,7 +44,7 @@
-
+
{{ scope.row.elapsed }} ms
@@ -137,7 +140,7 @@ export default {
jobName: undefined,
jobGroup: undefined,
status: undefined,
- jobId: undefined
+ jobId: undefined,
},
};
},
@@ -239,7 +242,7 @@ export default {
return exportJobLog(queryParams);
})
.then((response) => {
- this.download(response.msg);
+ this.download(response.data.path);
});
},
},
diff --git a/ZR.Vue/src/views/monitor/logininfor/index.vue b/ZR.Vue/src/views/monitor/logininfor/index.vue
index b887f7c..4aca6f9 100644
--- a/ZR.Vue/src/views/monitor/logininfor/index.vue
+++ b/ZR.Vue/src/views/monitor/logininfor/index.vue
@@ -28,6 +28,9 @@
清空
+
+ 导出
+
@@ -180,7 +183,7 @@ export default {
return exportLogininfor(queryParams);
})
.then((response) => {
- this.download(response.msg);
+ this.download(response.data.path);
});
},
},
diff --git a/ZR.Vue/src/views/monitor/operlog/index.vue b/ZR.Vue/src/views/monitor/operlog/index.vue
index f9d03f8..d6eba23 100644
--- a/ZR.Vue/src/views/monitor/operlog/index.vue
+++ b/ZR.Vue/src/views/monitor/operlog/index.vue
@@ -34,13 +34,16 @@
清空
+
+ 导出
+
-
+
@@ -52,7 +55,7 @@
{{ scope.row.elapsed }} ms
-
+
{{ parseTime(scope.row.operTime) }}
@@ -119,12 +122,13 @@ import {
list,
delOperlog,
cleanOperlog,
- // exportOperlog,
+ exportOperlog,
} from "@/api/monitor/operlog";
-import DateRangePicker from '@/components/DateRangePicker'
+import DateRangePicker from "@/components/DateRangePicker";
+import { downloadFile } from "@/utils/zipdownload.js";
export default {
- components: { DateRangePicker},
+ components: { DateRangePicker },
name: "Operlog",
data() {
return {
@@ -253,18 +257,25 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
- // const queryParams = this.queryParams;
- // this.$confirm("是否确认导出所有操作日志数据项?", "警告", {
- // confirmButtonText: "确定",
- // cancelButtonText: "取消",
- // type: "warning",
- // })
- // .then(function () {
- // return exportOperlog(queryParams);
- // })
- // .then((response) => {
- // this.download(response.msg);
- // });
+ const queryParams = this.queryParams;
+ this.$confirm("是否确认导出所有操作日志?", "警告", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ }).then(() => {
+ exportOperlog(queryParams).then((response) => {
+ const { code, data } = response;
+ if (code == 200) {
+ this.msgSuccess("导出成功");
+ downloadFile(
+ process.env.VUE_APP_BASE_API + data.path,
+ data.fileName
+ );
+ } else {
+ this.msgError("导出失败");
+ }
+ });
+ });
},
},
};
diff --git a/ZR.Vue/src/views/system/dict/index.vue b/ZR.Vue/src/views/system/dict/index.vue
index ee64a5a..e3d7ef5 100644
--- a/ZR.Vue/src/views/system/dict/index.vue
+++ b/ZR.Vue/src/views/system/dict/index.vue
@@ -31,12 +31,15 @@
删除
+
+ 导出
+
-
+
{{ scope.row.dictType }}
@@ -281,7 +284,7 @@ export default {
return exportType(queryParams);
})
.then((response) => {
- this.download(response.msg);
+ this.download(response.data.path);
});
},
showDictData(row) {
diff --git a/ZR.Vue/src/views/system/post/index.vue b/ZR.Vue/src/views/system/post/index.vue
index e92cd6c..9513c8d 100644
--- a/ZR.Vue/src/views/system/post/index.vue
+++ b/ZR.Vue/src/views/system/post/index.vue
@@ -28,9 +28,9 @@
删除
-
+
@@ -98,6 +98,7 @@ import {
updatePost,
exportPost,
} from "@/api/system/post";
+import { downloadFile } from "@/utils/zipdownload.js";
export default {
name: "Post",
@@ -268,7 +269,12 @@ export default {
return exportPost(queryParams);
})
.then((response) => {
- this.download(response.msg);
+ console.log(response)
+ // this.download(response.msg);
+ downloadFile(
+ process.env.VUE_APP_BASE_API + response.data.path,
+ response.data.fileName
+ );
});
},
},
diff --git a/ZR.Vue/src/views/system/role/index.vue b/ZR.Vue/src/views/system/role/index.vue
index 18e3a56..88cdcfe 100644
--- a/ZR.Vue/src/views/system/role/index.vue
+++ b/ZR.Vue/src/views/system/role/index.vue
@@ -21,6 +21,9 @@
新增
+
+
+ 导出
@@ -116,6 +119,7 @@ import {
// treeselect as deptTreeselect,
// roleDeptTreeselect,
// } from "@/api/system/dept";
+import { downloadFile } from "@/utils/zipdownload.js";
export default {
name: "Role",
@@ -483,20 +487,20 @@ export default {
});
},
/** 导出按钮操作 */
- // handleExport() {
- // const queryParams = this.queryParams;
- // this.$confirm("是否确认导出所有角色数据项?", "警告", {
- // confirmButtonText: "确定",
- // cancelButtonText: "取消",
- // type: "warning",
- // })
- // .then(function () {
- // return exportRole(queryParams);
- // })
- // .then((response) => {
- // this.download(response.msg);
- // });
- // },
+ handleExport() {
+ const queryParams = this.queryParams;
+ this.$confirm("是否确认导出所有角色数据项?", "警告", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(function () {
+ return exportRole(queryParams);
+ })
+ .then((response) => {
+ this.download(response.data.path);
+ });
+ },
},
};
diff --git a/ZR.Vue/src/views/system/user/index.vue b/ZR.Vue/src/views/system/user/index.vue
index 00a5a0e..71da5d1 100644
--- a/ZR.Vue/src/views/system/user/index.vue
+++ b/ZR.Vue/src/views/system/user/index.vue
@@ -215,7 +215,7 @@ import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
-import { downLoadExcel, downloadFile } from "@/utils/zipdownload.js";
+import { downloadFile } from "@/utils/zipdownload.js";
export default {
name: "User",
@@ -553,7 +553,7 @@ export default {
if (code == 200) {
this.msgSuccess("导出成功");
downloadFile(
- process.env.VUE_APP_BASE_API + data.zipPath,
+ process.env.VUE_APP_BASE_API + data.path,
data.fileName
);
} else {
diff --git a/document/admin-mysql.sql b/document/admin-mysql.sql
index 1fcf868..a83b1cd 100644
--- a/document/admin-mysql.sql
+++ b/document/admin-mysql.sql
@@ -298,16 +298,18 @@ INSERT INTO sys_menu VALUES (1022, '岗位查询', 104, 1, '', '', 0, 0, 'F', '0
INSERT INTO sys_menu VALUES (1023, '岗位添加', 104, 2, '', '', 0, 0, 'F', '0', '0', 'system:post:add', NULL, '', SYSDATE(), '', NULL, NULL);
INSERT INTO sys_menu VALUES (1024, '岗位删除', 104, 3, '', '', 0, 0, 'F', '0', '0', 'system:post:remove', NULL, '', SYSDATE(), '', NULL, NULL);
INSERT INTO sys_menu VALUES (1025, '岗位编辑', 104, 4, '', '', 0, 0, 'F', '0', '0', 'system:post:edit', '', '', SYSDATE(), '', NULL, NULL);
+INSERT INTO sys_menu VALUES (1070, '岗位导出', 104, 4, '', '', 0, 0, 'F', '0', '0', 'system:post:export', '', '', SYSDATE(), '', NULL, NULL);
-- 字典管理 按钮
INSERT INTO sys_menu VALUES (1026, '字典新增', 105, 1, '', '', 0, 0, 'F', '0', '0', 'system:dict:add', NULL, '', SYSDATE(), '', NULL, NULL);
INSERT INTO sys_menu VALUES (1027, '字典修改', 105, 2, '', '', 0, 0, 'F', '0', '0', 'system:dict:edit', NULL, '', SYSDATE(), '', NULL, NULL);
INSERT INTO sys_menu VALUES (1028, '字典删除', 105, 3, '', '', 0, 0, 'F', '0', '0', 'system:dict:remove', NULL, '', SYSDATE(), '', NULL, NULL);
+INSERT INTO sys_menu VALUES (1071, '字典导出', 105, 3, '', '', 0, 0, 'F', '0', '0', 'system:dict:export', NULL, '', SYSDATE(), '', NULL, NULL);
-- 分配用户 按钮
INSERT INTO sys_menu VALUES (1029, '新增用户', 106, 1, '', '', 0, 0, 'F', '0', '0', 'system:roleusers:add', NULL, '', SYSDATE(), '', NULL, NULL);
INSERT INTO sys_menu VALUES (1030, '删除用户', 106, 2, '', '', 0, 0, 'F', '0', '0', 'system:roleusers:del', NULL, '', SYSDATE(), '', NULL, NULL);
INSERT INTO sys_menu VALUES (1031, '查询用户', 106, 3, '', '', 0, 0, 'F', '0', '0', 'system:roleusers:query', '', '', SYSDATE(), '', NULL, NULL);
-- 定时任务 按钮
-INSERT INTO sys_menu values (1032, '任务查询', 110, 1, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:job:list', '#', 'admin', sysdate(), '', null, '');
+INSERT INTO sys_menu values (1032, '任务查询', 110, 1, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:job:list', '#', '', sysdate(), '', null, '');
INSERT INTO sys_menu VALUES (1033, '任务新增', 110, 2, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:job:add', '', '', SYSDATE(), '', NULL, NULL);
INSERT INTO sys_menu VALUES (1034, '任务删除', 110, 3, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:job:delete', '', '', SYSDATE(), '', NULL, NULL);
INSERT INTO sys_menu VALUES (1035, '任务修改', 110, 4, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:job:edit', '', '', SYSDATE(), '', NULL, NULL);
@@ -315,12 +317,15 @@ INSERT INTO sys_menu VALUES (1036, '任务启动', 110, 5, '#', NULL, 0, 0, 'F',
INSERT INTO sys_menu VALUES (1037, '任务运行', 110, 7, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:job:run', NULL, '', SYSDATE(), '', NULL, NULL);
INSERT INTO sys_menu VALUES (1038, '任务停止', 110, 8, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:job:stop', NULL, '', SYSDATE(), '', NULL, NULL);
INSERT INTO sys_menu VALUES (1039, '任务日志', 2, 0, 'job/log', 'monitor/job/log', 0, 0, 'C', '1', '0', 'monitor:job:query', 'log', '', SYSDATE(), '', NULL, NULL);
+INSERT INTO sys_menu VALUES (1040, '任务导出', 110, 10, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:job:export', NULL, '', SYSDATE(), '', NULL, NULL);
-- 操作日志 按钮
-INSERT INTO sys_menu values (1041, '操作查询', 500, 1, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', sysdate(), '', null, '');
-INSERT INTO sys_menu VALUES (1042, '操作删除', 500, 1, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:operlog:remove', NULL, '', SYSDATE(), '', NULL, NULL);
+INSERT INTO sys_menu values (1041, '操作查询', 500, 1, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:operlog:query', '', '', sysdate(), '', null, NULL);
+INSERT INTO sys_menu VALUES (1042, '操作删除', 500, 2, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:operlog:remove', '', '', SYSDATE(), '', NULL, NULL);
+INSERT INTO sys_menu VALUES (1043, '操作日志导出', 500,3, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:operlog:export', '', '', SYSDATE(), '', NULL, NULL);
-- 登录日志 按钮
-INSERT INTO sys_menu values (1044, '登录查询', 501, 1, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', sysdate(), '', null, '');
+INSERT INTO sys_menu values (1044, '登录查询', 501, 1, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:logininfor:query', '', '', sysdate(), '', null, NULL);
INSERT INTO sys_menu VALUES (1045, '登录删除', 501, 1, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:logininfor:remove', '', '', SYSDATE(), '', NULL, NULL);
+INSERT INTO sys_menu VALUES (1046, '登录日志导出', 501, 1, '#', NULL, 0, 0, 'F', '0', '0', 'monitor:logininfor:export', '', '', SYSDATE(), '', NULL, NULL);
-- 文章管理 按钮
INSERT INTO sys_menu VALUES (1047, '发布文章', 4, 1, 'publish', 'system/article/publish', 0, 0, 'C', '1', '0', 'system:article:publish', 'log', '', SYSDATE(), '', NULL, NULL);
INSERT INTO sys_menu VALUES (1048, '文章新增', 118, 2, '#', NULL, 0, 0, 'F', '0', '0', 'system:article:add', '', '', SYSDATE(), '', NULL, NULL);
diff --git a/document/admin-sqlserver.sql b/document/admin-sqlserver.sql
index b178680883a03479b005d224a06fceea65149baf..5e891d1790478cba58b606ef802a89bfdef229a1 100644
GIT binary patch
delta 356
zcmexymu<>7whf=|Y%Vz0$0%gZV8EcmpunKcFg?cC|4;OR`Sh&xXH#PQpQc`q
zN7!Quv<2bwhf=|OrCI(ZFAgxH+C>X