新增加系统表导出功能
This commit is contained in:
parent
156b4b5222
commit
b2099eaf19
@ -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));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出Excel
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="list"></param>
|
||||
/// <param name="sheetName"></param>
|
||||
/// <param name="fileName"></param>
|
||||
protected string ExportExcel<T>(List<T> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,5 +107,20 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
|
||||
return SUCCESS(SysDictService.DeleteDictTypeByIds(idss));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字典导出
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,5 +120,20 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
List<SysPost> posts = PostService.GetAll();
|
||||
return SUCCESS(posts);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 岗位导出
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,5 +166,20 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
|
||||
return ToResponse(ToJson(result));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色导出
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
/// <returns></returns>
|
||||
[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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,5 +265,20 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
|
||||
return ToResponse(taskResult);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定时任务导出
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,5 +76,20 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
tasksLogService.DeleteTable();
|
||||
return SUCCESS(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 定时任务日志导出
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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
|
||||
/// </summary>
|
||||
/// <param name="infoIds"></param>
|
||||
/// <returns></returns>
|
||||
[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));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录日志导出
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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<SysLogininfor>()
|
||||
.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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -67,5 +74,19 @@ namespace ZR.Admin.WebApi.Controllers.monitor
|
||||
return ToJson(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导出操作日志
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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 });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 = "演示模式 , 不允许操作" });
|
||||
|
||||
@ -30,7 +30,7 @@ namespace ZR.Model.System
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 搜素时间起始时间
|
||||
/// 搜索时间起始时间
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Write:需穿一个bool值,false时insert,update等操作会忽略此列(和Computed的作用差不多,看了源码也没发现与Computed有什么不一样的地方,有了解的朋友可以赐教下哈)
|
||||
|
||||
@ -12,6 +12,11 @@ namespace ZR.Repository.System
|
||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysDictRepository : BaseRepository<SysDictType>
|
||||
{
|
||||
public List<SysDictType> GetAll()
|
||||
{
|
||||
return Context.Queryable<SysDictType>().ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询字段类型列表
|
||||
/// </summary>
|
||||
|
||||
@ -10,6 +10,7 @@ namespace ZR.Service.System.IService
|
||||
/// </summary>
|
||||
public interface ISysDictService
|
||||
{
|
||||
public List<SysDictType> GetAll();
|
||||
public List<SysDictType> SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -7,7 +7,7 @@ using ZR.Model.System;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
public interface ISysLoginService
|
||||
public interface ISysLoginService: IBaseService<SysLogininfor>
|
||||
{
|
||||
public SysUser Login(LoginBodyDto loginBody, SysLogininfor logininfor);
|
||||
|
||||
|
||||
@ -23,6 +23,10 @@ namespace ZR.Service.System
|
||||
this.DictRepository = sysDictRepository;
|
||||
this.DictDataRepository = dictDataRepository;
|
||||
}
|
||||
public List<SysDictType> GetAll()
|
||||
{
|
||||
return DictRepository.GetAll();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询字段类型列表
|
||||
|
||||
@ -15,7 +15,7 @@ namespace ZR.Service.System
|
||||
/// 登录
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysLoginService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysLoginService: ISysLoginService
|
||||
public class SysLoginService: BaseService<SysLogininfor>, ISysLoginService
|
||||
{
|
||||
private SysLogininfoRepository SysLogininfoRepository;
|
||||
|
||||
|
||||
@ -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 }
|
||||
|
||||
@ -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
|
||||
})
|
||||
}
|
||||
|
||||
@ -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
|
||||
})
|
||||
|
||||
@ -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 )
|
||||
|
||||
@ -23,6 +23,9 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPermi="['monitor:job:delete']" plain type="danger" icon="el-icon-remove" size="mini" @click="handleDelete(null)" :disabled="single">删除</el-button>
|
||||
</el-col>-->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['monitor:job:export']">导出</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button v-hasPermi="['monitor:job:query']" type="info" icon="el-icon-s-operation" size="mini" @click="handleJobLog({id: 1})">日志</el-button>
|
||||
</el-col>
|
||||
@ -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)
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -30,6 +30,9 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleClean" :disabled="total <= 0" v-hasPermi="['PRIV_JOBLOG_REMOVE']">清空</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['PRIV_JOBLOG_EXPORT']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
@ -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);
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@ -28,6 +28,9 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" @click="handleClean" v-hasPermi="['monitor:logininfor:remove']">清空</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:logininfor:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
@ -180,7 +183,7 @@ export default {
|
||||
return exportLogininfor(queryParams);
|
||||
})
|
||||
.then((response) => {
|
||||
this.download(response.msg);
|
||||
this.download(response.data.path);
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@ -34,6 +34,9 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" @click="handleClean" v-hasPermi="['monitor:operlog:remove']">清空</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:operlog:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
@ -119,9 +122,10 @@ 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 },
|
||||
@ -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("导出失败");
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -31,6 +31,9 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:dict:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:dict:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
@ -281,7 +284,7 @@ export default {
|
||||
return exportType(queryParams);
|
||||
})
|
||||
.then((response) => {
|
||||
this.download(response.msg);
|
||||
this.download(response.data.path);
|
||||
});
|
||||
},
|
||||
showDictData(row) {
|
||||
|
||||
@ -28,9 +28,9 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['system:post:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:post:export']">导出</el-button>
|
||||
</el-col> -->
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
@ -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
|
||||
);
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
@ -21,6 +21,9 @@
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:role:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['system:role:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@ -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);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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);
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user