| | |
| | | package com.ruoyi.web.controller.monitor;
|
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.annotation.Log;
|
| | |
| | |
|
| | | @Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysLogininfor logininfor)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysLogininfor logininfor)
|
| | | {
|
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
| | | ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
| | | return util.exportExcel(list, "登录日志");
|
| | | util.exportExcel(response, list, "登录日志");
|
| | | }
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
| | |
| | | package com.ruoyi.web.controller.monitor;
|
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.annotation.Log;
|
| | |
| | |
|
| | | @Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysOperLog operLog)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysOperLog operLog)
|
| | | {
|
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
| | | ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
| | | return util.exportExcel(list, "操作日志");
|
| | | util.exportExcel(response, list, "操作日志");
|
| | | }
|
| | |
|
| | | @Log(title = "操作日志", businessType = BusinessType.DELETE)
|
| | |
| | | package com.ruoyi.web.controller.system;
|
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.annotation.Log;
|
| | | import com.ruoyi.common.annotation.RepeatSubmit;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.core.controller.BaseController;
|
| | | import com.ruoyi.common.core.domain.AjaxResult;
|
| | |
| | |
|
| | | @Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:config:export')")
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysConfig config)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysConfig config)
|
| | | {
|
| | | List<SysConfig> list = configService.selectConfigList(config);
|
| | | ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
| | | return util.exportExcel(list, "参数数据");
|
| | | util.exportExcel(response, list, "参数数据");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @PreAuthorize("@ss.hasPermi('system:config:add')")
|
| | | @Log(title = "参数管理", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | @RepeatSubmit
|
| | | public AjaxResult add(@Validated @RequestBody SysConfig config)
|
| | | {
|
| | | if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
| | |
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | |
| | |
|
| | | @Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')")
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysDictData dictData)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysDictData dictData)
|
| | | {
|
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
| | | ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
| | | return util.exportExcel(list, "字典数据");
|
| | | util.exportExcel(response, list, "字典数据");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | package com.ruoyi.web.controller.system;
|
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | |
| | |
|
| | | @Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')")
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysDictType dictType)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysDictType dictType)
|
| | | {
|
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
| | | ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
| | | return util.exportExcel(list, "字典类型");
|
| | | util.exportExcel(response, list, "字典类型");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | package com.ruoyi.web.controller.system;
|
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | |
| | |
|
| | | @Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:post:export')")
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysPost post)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysPost post)
|
| | | {
|
| | | List<SysPost> list = postService.selectPostList(post);
|
| | | ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
| | | return util.exportExcel(list, "岗位数据");
|
| | | util.exportExcel(response, list, "岗位数据");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | package com.ruoyi.web.controller.system;
|
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | |
| | |
|
| | | @Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:role:export')")
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysRole role)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysRole role)
|
| | | {
|
| | | List<SysRole> list = roleService.selectRoleList(role);
|
| | | ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
| | | return util.exportExcel(list, "角色数据");
|
| | | util.exportExcel(response, list, "角色数据");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | import java.util.List;
|
| | | import java.util.stream.Collectors;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.apache.commons.lang3.ArrayUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | |
| | |
|
| | | @Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:user:export')")
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysUser user)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysUser user)
|
| | | {
|
| | | List<SysUser> list = userService.selectUserList(user);
|
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
| | | return util.exportExcel(list, "用户数据");
|
| | | util.exportExcel(response, list, "用户数据");
|
| | | }
|
| | |
|
| | | @Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
| | |
| | | return AjaxResult.success(message);
|
| | | }
|
| | |
|
| | | @GetMapping("/importTemplate")
|
| | | public AjaxResult importTemplate()
|
| | | @PostMapping("/importTemplate")
|
| | | public void importTemplate(HttpServletResponse response)
|
| | | {
|
| | | ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
| | | return util.importTemplateExcel("用户数据");
|
| | | util.importTemplateExcel(response, "用户数据");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @return 结果
|
| | | * @throws IOException
|
| | | */
|
| | | public void exportExcel(HttpServletResponse response, List<T> list, String sheetName)throws IOException
|
| | | public void exportExcel(HttpServletResponse response, List<T> list, String sheetName)
|
| | | {
|
| | | exportExcel(response, list, sheetName, StringUtils.EMPTY);
|
| | | }
|
| | |
| | | * @return 结果
|
| | | * @throws IOException
|
| | | */
|
| | | public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title) throws IOException
|
| | | public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title)
|
| | | {
|
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
| | | response.setCharacterEncoding("utf-8");
|
| | | this.init(list, sheetName, title, Type.EXPORT);
|
| | | exportExcel(response.getOutputStream());
|
| | | exportExcel(response);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param sheetName 工作表的名称
|
| | | * @return 结果
|
| | | */
|
| | | public void importTemplateExcel(HttpServletResponse response, String sheetName) throws IOException
|
| | | public void importTemplateExcel(HttpServletResponse response, String sheetName)
|
| | | {
|
| | | importTemplateExcel(response, sheetName, StringUtils.EMPTY);
|
| | | }
|
| | |
| | | * @param title 标题
|
| | | * @return 结果
|
| | | */
|
| | | public void importTemplateExcel(HttpServletResponse response, String sheetName, String title) throws IOException
|
| | | public void importTemplateExcel(HttpServletResponse response, String sheetName, String title)
|
| | | {
|
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
| | | response.setCharacterEncoding("utf-8");
|
| | | this.init(null, sheetName, title, Type.IMPORT);
|
| | | exportExcel(response.getOutputStream());
|
| | | exportExcel(response);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | *
|
| | | * @return 结果
|
| | | */
|
| | | public void exportExcel(OutputStream out)
|
| | | public void exportExcel(HttpServletResponse response)
|
| | | {
|
| | | try
|
| | | {
|
| | | writeSheet();
|
| | | wb.write(out);
|
| | | wb.write(response.getOutputStream());
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | |
| | | finally
|
| | | {
|
| | | IOUtils.closeQuietly(wb);
|
| | | IOUtils.closeQuietly(out);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | package ${packageName}.controller; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')") |
| | | @Log(title = "${functionName}", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | public AjaxResult export(${ClassName} ${className}) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, ${ClassName} ${className}) |
| | | { |
| | | List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); |
| | | ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class); |
| | | return util.exportExcel(list, "${functionName}数据"); |
| | | util.exportExcel(response, list, "${functionName}数据"); |
| | | } |
| | | |
| | | /** |
| | |
| | | plain
|
| | | icon="el-icon-download"
|
| | | size="mini"
|
| | | :loading="exportLoading"
|
| | | @click="handleExport"
|
| | | v-hasPermi="['${moduleName}:${businessName}:export']"
|
| | | >导出</el-button>
|
| | |
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
| | | import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
|
| | |
|
| | | export default {
|
| | | name: "${BusinessName}",
|
| | |
| | | return {
|
| | | // 遮罩层
|
| | | loading: true,
|
| | | // 导出遮罩层
|
| | | exportLoading: false,
|
| | | // 选中数组
|
| | | ids: [],
|
| | | #if($table.sub)
|
| | |
| | | #end
|
| | | /** 导出按钮操作 */
|
| | | handleExport() {
|
| | | const queryParams = this.queryParams;
|
| | | this.#[[$modal]]#.confirm('是否确认导出所有${functionName}数据项?').then(() => {
|
| | | this.exportLoading = true;
|
| | | return export${BusinessName}(queryParams);
|
| | | }).then(response => {
|
| | | this.#[[$download]]#.name(response.msg);
|
| | | this.exportLoading = false;
|
| | | }).catch(() => {});
|
| | | this.download('${moduleName}/${businessName}/export', {
|
| | | ...this.queryParams
|
| | | }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
|
| | | }
|
| | | }
|
| | | };
|
| | |
| | | package com.ruoyi.quartz.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.quartz.SchedulerException;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | |
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
| | | @Log(title = "定时任务", businessType = BusinessType.EXPORT)
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysJob sysJob)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysJob sysJob)
|
| | | {
|
| | | List<SysJob> list = jobService.selectJobList(sysJob);
|
| | | ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
| | | return util.exportExcel(list, "定时任务");
|
| | | util.exportExcel(response, list, "定时任务");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | package com.ruoyi.quartz.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.PostMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.annotation.Log;
|
| | |
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
| | | @Log(title = "任务调度日志", businessType = BusinessType.EXPORT)
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysJobLog sysJobLog)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysJobLog sysJobLog)
|
| | | {
|
| | | List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
|
| | | ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
|
| | | return util.exportExcel(list, "调度日志");
|
| | | util.exportExcel(response, list, "调度日志");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | }) |
| | | } |
| | | |
| | | // 导出定时任务调度 |
| | | export function exportJob(query) { |
| | | return request({ |
| | | url: '/monitor/job/export', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // 任务状态修改 |
| | | export function changeJobStatus(jobId, status) { |
| | | const data = { |
| | |
| | | method: 'delete' |
| | | }) |
| | | } |
| | | |
| | | // 导出调度日志 |
| | | export function exportJobLog(query) { |
| | | return request({ |
| | | url: '/monitor/jobLog/export', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | |
| | | method: 'delete'
|
| | | })
|
| | | }
|
| | |
|
| | | // 导出登录日志
|
| | | export function exportLogininfor(query) {
|
| | | return request({
|
| | | url: '/monitor/logininfor/export',
|
| | | method: 'get',
|
| | | params: query
|
| | | })
|
| | | } |
| | |
| | | method: 'delete'
|
| | | })
|
| | | }
|
| | |
|
| | | // 导出操作日志
|
| | | export function exportOperlog(query) {
|
| | | return request({
|
| | | url: '/monitor/operlog/export',
|
| | | method: 'get',
|
| | | params: query
|
| | | })
|
| | | } |
| | |
| | | method: 'delete'
|
| | | })
|
| | | }
|
| | |
|
| | | // 导出参数
|
| | | export function exportConfig(query) {
|
| | | return request({
|
| | | url: '/system/config/export',
|
| | | method: 'get',
|
| | | params: query
|
| | | })
|
| | | } |
| | |
| | | method: 'delete'
|
| | | })
|
| | | }
|
| | |
|
| | | // 导出字典数据
|
| | | export function exportData(query) {
|
| | | return request({
|
| | | url: '/system/dict/data/export',
|
| | | method: 'get',
|
| | | params: query
|
| | | })
|
| | | } |
| | |
| | | })
|
| | | }
|
| | |
|
| | | // 导出字典类型
|
| | | export function exportType(query) {
|
| | | return request({
|
| | | url: '/system/dict/type/export',
|
| | | method: 'get',
|
| | | params: query
|
| | | })
|
| | | }
|
| | |
|
| | | // 获取字典选择框列表
|
| | | export function optionselect() {
|
| | | return request({
|
| | |
| | | method: 'delete'
|
| | | })
|
| | | }
|
| | |
|
| | | // 导出岗位
|
| | | export function exportPost(query) {
|
| | | return request({
|
| | | url: '/system/post/export',
|
| | | method: 'get',
|
| | | params: query
|
| | | })
|
| | | } |
| | |
| | | })
|
| | | }
|
| | |
|
| | | // 导出角色
|
| | | export function exportRole(query) {
|
| | | return request({
|
| | | url: '/system/role/export',
|
| | | method: 'get',
|
| | | params: query
|
| | | })
|
| | | }
|
| | |
|
| | | // 查询角色已授权用户列表
|
| | | export function allocatedUserList(query) {
|
| | | return request({
|
| | |
| | | })
|
| | | }
|
| | |
|
| | | // 导出用户
|
| | | export function exportUser(query) {
|
| | | return request({
|
| | | url: '/system/user/export',
|
| | | method: 'get',
|
| | | params: query
|
| | | })
|
| | | }
|
| | |
|
| | | // 用户密码重置
|
| | | export function resetUserPwd(userId, password) {
|
| | | const data = {
|
| | |
| | | url: '/system/user/profile/avatar',
|
| | | method: 'post',
|
| | | data: data
|
| | | })
|
| | | }
|
| | |
|
| | | // 下载用户导入模板
|
| | | export function importTemplate() {
|
| | | return request({
|
| | | url: '/system/user/importTemplate',
|
| | | method: 'get'
|
| | | })
|
| | | }
|
| | |
|
| | |
| | | import router from './router'
|
| | | import directive from './directive' //directive
|
| | | import plugins from './plugins' // plugins
|
| | | import { download } from '@/utils/request'
|
| | |
|
| | | import './assets/icons' // icon
|
| | | import './permission' // permission control
|
| | |
| | | Vue.prototype.addDateRange = addDateRange
|
| | | Vue.prototype.selectDictLabel = selectDictLabel
|
| | | Vue.prototype.selectDictLabels = selectDictLabels
|
| | | Vue.prototype.download = download
|
| | | Vue.prototype.handleTree = handleTree
|
| | |
|
| | | // 全局组件挂载
|
| | |
| | | import { saveAs } from 'file-saver' |
| | | import axios from 'axios' |
| | | import { getToken } from '@/utils/auth' |
| | | import { Message } from 'element-ui' |
| | | import { saveAs } from 'file-saver' |
| | | import { getToken } from '@/utils/auth' |
| | | import { blobValidate } from "@/utils/ruoyi"; |
| | | |
| | | const baseURL = process.env.VUE_APP_BASE_API |
| | | |
| | |
| | | responseType: 'blob', |
| | | headers: { 'Authorization': 'Bearer ' + getToken() } |
| | | }).then(async (res) => { |
| | | const isLogin = await this.blobValidate(res.data); |
| | | const isLogin = await blobValidate(res.data); |
| | | if (isLogin) { |
| | | const blob = new Blob([res.data], { type: 'application/zip' }) |
| | | this.saveAs(blob, name) |
| | |
| | | }, |
| | | saveAs(text, name, opts) { |
| | | saveAs(text, name, opts); |
| | | }, |
| | | async blobValidate(data) { |
| | | try { |
| | | const text = await data.text(); |
| | | JSON.parse(text); |
| | | return false; |
| | | } catch (error) { |
| | | return true; |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | |
| | |
| | | import axios from 'axios' |
| | | import { Notification, MessageBox, Message } from 'element-ui' |
| | | import { Notification, MessageBox, Message, Loading } from 'element-ui' |
| | | import store from '@/store' |
| | | import { getToken } from '@/utils/auth' |
| | | import errorCode from '@/utils/errorCode' |
| | | import { tansParams, blobValidate } from "@/utils/ruoyi"; |
| | | import { saveAs } from 'file-saver' |
| | | |
| | | let downloadLoadingInstance; |
| | | |
| | | axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' |
| | | // 创建axios实例 |
| | |
| | | // 超时 |
| | | timeout: 10000 |
| | | }) |
| | | |
| | | // request拦截器 |
| | | service.interceptors.request.use(config => { |
| | | // 是否需要设置 token |
| | |
| | | } |
| | | // get请求映射params参数 |
| | | if (config.method === 'get' && config.params) { |
| | | let url = config.url + '?'; |
| | | for (const propName of Object.keys(config.params)) { |
| | | const value = config.params[propName]; |
| | | var part = encodeURIComponent(propName) + "="; |
| | | if (value !== null && typeof(value) !== "undefined") { |
| | | if (typeof value === 'object') { |
| | | for (const key of Object.keys(value)) { |
| | | if (value[key] !== null && typeof (value[key]) !== 'undefined') { |
| | | let params = propName + '[' + key + ']'; |
| | | let subPart = encodeURIComponent(params) + '='; |
| | | url += subPart + encodeURIComponent(value[key]) + '&'; |
| | | } |
| | | } |
| | | } else { |
| | | url += part + encodeURIComponent(value) + "&"; |
| | | } |
| | | } |
| | | } |
| | | let url = config.url + '?' + tansParams(config.params); |
| | | url = url.slice(0, -1); |
| | | config.params = {}; |
| | | config.url = url; |
| | |
| | | const code = res.data.code || 200; |
| | | // 获取错误信息 |
| | | const msg = errorCode[code] || res.data.msg || errorCode['default'] |
| | | // 二进制数据则直接返回 |
| | | if(res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer'){ |
| | | return res.data |
| | | } |
| | | if (code === 401) { |
| | | MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { |
| | | let doms = document.getElementsByClassName('el-message-box')[0] |
| | | if(doms === undefined){ |
| | | MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { |
| | | confirmButtonText: '重新登录', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | } |
| | | ).then(() => { |
| | | store.dispatch('LogOut').then(() => { |
| | | location.href = '/index'; |
| | | }) |
| | | }).catch(() => {}); |
| | | ).then(() => { |
| | | store.dispatch('LogOut').then(() => { |
| | | location.href = '/index'; |
| | | }) |
| | | }).catch(() => {}); |
| | | } |
| | | return Promise.reject('无效的会话,或者会话已过期,请重新登录。') |
| | | } else if (code === 500) { |
| | | Message({ |
| | |
| | | } |
| | | ) |
| | | |
| | | // 通用下载方法 |
| | | export function download(url, params, filename) { |
| | | downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍候", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", }) |
| | | return service.post(url, params, { |
| | | transformRequest: [(params) => { return tansParams(params) }], |
| | | headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, |
| | | responseType: 'blob' |
| | | }).then(async (data) => { |
| | | const isLogin = await blobValidate(data); |
| | | if (isLogin) { |
| | | const blob = new Blob([data]) |
| | | saveAs(blob, filename) |
| | | } else { |
| | | Message.error('无效的会话,或者会话已过期,请重新登录。'); |
| | | } |
| | | downloadLoadingInstance.close(); |
| | | }).catch((r) => { |
| | | console.error(r) |
| | | Message.error('下载文件出现错误,请联系管理员!') |
| | | downloadLoadingInstance.close(); |
| | | }) |
| | | } |
| | | |
| | | export default service |
| | |
| | | } |
| | | return tree; |
| | | } |
| | | |
| | | /** |
| | | * 参数处理 |
| | | * @param {*} params 参数 |
| | | */ |
| | | export function tansParams(params) { |
| | | let result = '' |
| | | for (const propName of Object.keys(params)) { |
| | | const value = params[propName]; |
| | | var part = encodeURIComponent(propName) + "="; |
| | | if (value !== null && typeof (value) !== "undefined") { |
| | | if (typeof value === 'object') { |
| | | for (const key of Object.keys(value)) { |
| | | if (value[key] !== null && typeof (value[key]) !== 'undefined') { |
| | | let params = propName + '[' + key + ']'; |
| | | var subPart = encodeURIComponent(params) + "="; |
| | | result += subPart + encodeURIComponent(value[key]) + "&"; |
| | | } |
| | | } |
| | | } else { |
| | | result += part + encodeURIComponent(value) + "&"; |
| | | } |
| | | } |
| | | } |
| | | return result |
| | | } |
| | | |
| | | // 验证是否为blob格式 |
| | | export async function blobValidate(data) { |
| | | try { |
| | | const text = await data.text(); |
| | | JSON.parse(text); |
| | | return false; |
| | | } catch (error) { |
| | | return true; |
| | | } |
| | | } |
| | |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | :loading="exportLoading" |
| | | @click="handleExport" |
| | | v-hasPermi="['monitor:job:export']" |
| | | >导出</el-button> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { listJob, getJob, delJob, addJob, updateJob, exportJob, runJob, changeJobStatus } from "@/api/monitor/job"; |
| | | import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job"; |
| | | import Crontab from '@/components/Crontab' |
| | | |
| | | export default { |
| | |
| | | return { |
| | | // 遮罩层 |
| | | loading: true, |
| | | // 导出遮罩层 |
| | | exportLoading: false, |
| | | // 选中数组 |
| | | ids: [], |
| | | // 非单个禁用 |
| | |
| | | }, |
| | | /** 导出按钮操作 */ |
| | | handleExport() { |
| | | const queryParams = this.queryParams; |
| | | this.$modal.confirm('是否确认导出所有定时任务数据项?').then(() => { |
| | | this.exportLoading = true; |
| | | return exportJob(queryParams); |
| | | }).then(response => { |
| | | this.$download.name(response.msg); |
| | | this.exportLoading = false; |
| | | }).catch(() => {}); |
| | | this.download('monitor/job/export', { |
| | | ...this.queryParams |
| | | }, `job_${new Date().getTime()}.xlsx`) |
| | | } |
| | | } |
| | | }; |
| | |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | :loading="exportLoading" |
| | | @click="handleExport" |
| | | v-hasPermi="['monitor:job:export']" |
| | | >导出</el-button> |
| | |
| | | |
| | | <script> |
| | | import { getJob} from "@/api/monitor/job"; |
| | | import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/jobLog"; |
| | | import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog"; |
| | | |
| | | export default { |
| | | name: "JobLog", |
| | |
| | | return { |
| | | // 遮罩层 |
| | | loading: true, |
| | | // 导出遮罩层 |
| | | exportLoading: false, |
| | | // 选中数组 |
| | | ids: [], |
| | | // 非多个禁用 |
| | |
| | | }, |
| | | /** 导出按钮操作 */ |
| | | handleExport() { |
| | | const queryParams = this.queryParams; |
| | | this.$modal.confirm('是否确认导出所有调度日志数据项?').then(() => { |
| | | this.exportLoading = true; |
| | | return exportJobLog(queryParams); |
| | | }).then(response => { |
| | | this.$download.name(response.msg); |
| | | this.exportLoading = false; |
| | | }).catch(() => {}); |
| | | this.download('/monitor/jobLog/export', { |
| | | ...this.queryParams |
| | | }, `log_${new Date().getTime()}.xlsx`) |
| | | } |
| | | } |
| | | }; |
| | |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | :loading="exportLoading" |
| | | @click="handleExport" |
| | | v-hasPermi="['monitor:logininfor:export']" |
| | | >导出</el-button> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { list, delLogininfor, cleanLogininfor, exportLogininfor } from "@/api/monitor/logininfor"; |
| | | import { list, delLogininfor, cleanLogininfor } from "@/api/monitor/logininfor"; |
| | | |
| | | export default { |
| | | name: "Logininfor", |
| | |
| | | return { |
| | | // 遮罩层 |
| | | loading: true, |
| | | // 导出遮罩层 |
| | | exportLoading: false, |
| | | // 选中数组 |
| | | ids: [], |
| | | // 非多个禁用 |
| | |
| | | }, |
| | | /** 导出按钮操作 */ |
| | | handleExport() { |
| | | const queryParams = this.queryParams; |
| | | this.$modal.confirm('是否确认导出所有操作日志数据项?').then(() => { |
| | | this.exportLoading = true; |
| | | return exportLogininfor(queryParams); |
| | | }).then(response => { |
| | | this.$download.name(response.msg); |
| | | this.exportLoading = false; |
| | | }).catch(() => {}); |
| | | this.download('monitor/logininfor/export', { |
| | | ...this.queryParams |
| | | }, `logininfor_${new Date().getTime()}.xlsx`) |
| | | } |
| | | } |
| | | }; |
| | |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | :loading="exportLoading" |
| | | @click="handleExport" |
| | | v-hasPermi="['monitor:operlog:export']" |
| | | >导出</el-button> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { list, delOperlog, cleanOperlog, exportOperlog } from "@/api/monitor/operlog"; |
| | | import { list, delOperlog, cleanOperlog } from "@/api/monitor/operlog"; |
| | | |
| | | export default { |
| | | name: "Operlog", |
| | |
| | | return { |
| | | // 遮罩层 |
| | | loading: true, |
| | | // 导出遮罩层 |
| | | exportLoading: false, |
| | | // 选中数组 |
| | | ids: [], |
| | | // 非多个禁用 |
| | |
| | | }, |
| | | /** 导出按钮操作 */ |
| | | handleExport() { |
| | | const queryParams = this.queryParams; |
| | | this.$modal.confirm('是否确认导出所有操作日志数据项?').then(() => { |
| | | this.exportLoading = true; |
| | | return exportOperlog(queryParams); |
| | | }).then(response => { |
| | | this.$download.name(response.msg); |
| | | this.exportLoading = false; |
| | | }).catch(() => {}); |
| | | this.download('monitor/operlog/export', { |
| | | ...this.queryParams |
| | | }, `operlog_${new Date().getTime()}.xlsx`) |
| | | } |
| | | } |
| | | }; |
| | |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | :loading="exportLoading" |
| | | @click="handleExport" |
| | | v-hasPermi="['system:config:export']" |
| | | >导出</el-button> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, refreshCache } from "@/api/system/config"; |
| | | import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config"; |
| | | |
| | | export default { |
| | | name: "Config", |
| | |
| | | return { |
| | | // 遮罩层 |
| | | loading: true, |
| | | // 导出遮罩层 |
| | | exportLoading: false, |
| | | // 选中数组 |
| | | ids: [], |
| | | // 非单个禁用 |
| | |
| | | }, |
| | | /** 导出按钮操作 */ |
| | | handleExport() { |
| | | const queryParams = this.queryParams; |
| | | this.$modal.confirm('是否确认导出所有参数数据项?').then(() => { |
| | | this.exportLoading = true; |
| | | return exportConfig(queryParams); |
| | | }).then(response => { |
| | | this.$download.name(response.msg); |
| | | this.exportLoading = false; |
| | | }).catch(() => {}); |
| | | this.download('system/config/export', { |
| | | ...this.queryParams |
| | | }, `config_${new Date().getTime()}.xlsx`) |
| | | }, |
| | | /** 刷新缓存按钮操作 */ |
| | | handleRefreshCache() { |
| | |
| | | plain
|
| | | icon="el-icon-download"
|
| | | size="mini"
|
| | | :loading="exportLoading"
|
| | | @click="handleExport"
|
| | | v-hasPermi="['system:dict:export']"
|
| | | >导出</el-button>
|
| | |
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { listData, getData, delData, addData, updateData, exportData } from "@/api/system/dict/data";
|
| | | import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data";
|
| | | import { listType, getType } from "@/api/system/dict/type";
|
| | |
|
| | | export default {
|
| | |
| | | return {
|
| | | // 遮罩层
|
| | | loading: true,
|
| | | // 导出遮罩层
|
| | | exportLoading: false,
|
| | | // 选中数组
|
| | | ids: [],
|
| | | // 非单个禁用
|
| | |
| | | },
|
| | | /** 导出按钮操作 */
|
| | | handleExport() {
|
| | | const queryParams = this.queryParams;
|
| | | this.$modal.confirm('是否确认导出所有数据项?').then(() => {
|
| | | this.exportLoading = true;
|
| | | return exportData(queryParams);
|
| | | }).then(response => {
|
| | | this.$download.name(response.msg);
|
| | | this.exportLoading = false;
|
| | | }).catch(() => {});
|
| | | this.download('system/dict/data/export', {
|
| | | ...this.queryParams
|
| | | }, `data_${new Date().getTime()}.xlsx`)
|
| | | }
|
| | | }
|
| | | };
|
| | |
| | | plain
|
| | | icon="el-icon-download"
|
| | | size="mini"
|
| | | :loading="exportLoading"
|
| | | @click="handleExport"
|
| | | v-hasPermi="['system:dict:export']"
|
| | | >导出</el-button>
|
| | |
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { listType, getType, delType, addType, updateType, exportType, refreshCache } from "@/api/system/dict/type";
|
| | | import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type";
|
| | |
|
| | | export default {
|
| | | name: "Dict",
|
| | |
| | | return {
|
| | | // 遮罩层
|
| | | loading: true,
|
| | | // 导出遮罩层
|
| | | exportLoading: false,
|
| | | // 选中数组
|
| | | ids: [],
|
| | | // 非单个禁用
|
| | |
| | | },
|
| | | /** 导出按钮操作 */
|
| | | handleExport() {
|
| | | const queryParams = this.queryParams;
|
| | | this.$modal.confirm('是否确认导出所有类型数据项?').then(() => {
|
| | | this.exportLoading = true;
|
| | | return exportType(queryParams);
|
| | | }).then(response => {
|
| | | this.$download.name(response.msg);
|
| | | this.exportLoading = false;
|
| | | }).catch(() => {});
|
| | | this.download('system/dict/type/export', {
|
| | | ...this.queryParams
|
| | | }, `type_${new Date().getTime()}.xlsx`)
|
| | | },
|
| | | /** 刷新缓存按钮操作 */
|
| | | handleRefreshCache() {
|
| | |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | :loading="exportLoading" |
| | | @click="handleExport" |
| | | v-hasPermi="['system:post:export']" |
| | | >导出</el-button> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/api/system/post"; |
| | | import { listPost, getPost, delPost, addPost, updatePost } from "@/api/system/post"; |
| | | |
| | | export default { |
| | | name: "Post", |
| | |
| | | return { |
| | | // 遮罩层 |
| | | loading: true, |
| | | // 导出遮罩层 |
| | | exportLoading: false, |
| | | // 选中数组 |
| | | ids: [], |
| | | // 非单个禁用 |
| | |
| | | }, |
| | | /** 导出按钮操作 */ |
| | | handleExport() { |
| | | const queryParams = this.queryParams; |
| | | this.$modal.confirm('是否确认导出所有岗位数据项?').then(() => { |
| | | this.exportLoading = true; |
| | | return exportPost(queryParams); |
| | | }).then(response => { |
| | | this.$download.name(response.msg); |
| | | this.exportLoading = false; |
| | | }).catch(() => {}); |
| | | this.download('system/post/export', { |
| | | ...this.queryParams |
| | | }, `post_${new Date().getTime()}.xlsx`) |
| | | } |
| | | } |
| | | }; |
| | |
| | | plain
|
| | | icon="el-icon-download"
|
| | | size="mini"
|
| | | :loading="exportLoading"
|
| | | @click="handleExport"
|
| | | v-hasPermi="['system:role:export']"
|
| | | >导出</el-button>
|
| | |
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { listRole, getRole, delRole, addRole, updateRole, exportRole, dataScope, changeRoleStatus } from "@/api/system/role";
|
| | | import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus } from "@/api/system/role";
|
| | | import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu";
|
| | | import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept";
|
| | |
|
| | |
| | | return {
|
| | | // 遮罩层
|
| | | loading: true,
|
| | | // 导出遮罩层
|
| | | exportLoading: false,
|
| | | // 选中数组
|
| | | ids: [],
|
| | | // 非单个禁用
|
| | |
| | | },
|
| | | /** 导出按钮操作 */
|
| | | handleExport() {
|
| | | const queryParams = this.queryParams;
|
| | | this.$modal.confirm('是否确认导出所有用户数据项?').then(() => {
|
| | | this.exportLoading = true;
|
| | | return exportRole(queryParams);
|
| | | }).then(response => {
|
| | | this.$download.name(response.msg);
|
| | | this.exportLoading = false;
|
| | | }).catch(() => {});
|
| | | this.download('system/role/export', {
|
| | | ...this.queryParams
|
| | | }, `role_${new Date().getTime()}.xlsx`)
|
| | | }
|
| | | }
|
| | | };
|
| | |
| | | plain
|
| | | icon="el-icon-download"
|
| | | size="mini"
|
| | | :loading="exportLoading"
|
| | | @click="handleExport"
|
| | | v-hasPermi="['system:user:export']"
|
| | | >导出</el-button>
|
| | |
| | | </template>
|
| | |
|
| | | <script>
|
| | | import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from "@/api/system/user";
|
| | | import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
|
| | | import { getToken } from "@/utils/auth";
|
| | | import { treeselect } from "@/api/system/dept";
|
| | | import Treeselect from "@riophae/vue-treeselect";
|
| | |
| | | return {
|
| | | // 遮罩层
|
| | | loading: true,
|
| | | // 导出遮罩层
|
| | | exportLoading: false,
|
| | | // 选中数组
|
| | | ids: [],
|
| | | // 非单个禁用
|
| | |
| | | },
|
| | | /** 导出按钮操作 */
|
| | | handleExport() {
|
| | | const queryParams = this.queryParams;
|
| | | this.$modal.confirm('是否确认导出所有用户数据项?').then(() => {
|
| | | this.exportLoading = true;
|
| | | return exportUser(queryParams);
|
| | | }).then(response => {
|
| | | this.$download.name(response.msg);
|
| | | this.exportLoading = false;
|
| | | }).catch(() => {});
|
| | | this.download('system/user/export', {
|
| | | ...this.queryParams
|
| | | }, `user_${new Date().getTime()}.xlsx`)
|
| | | },
|
| | | /** 导入按钮操作 */
|
| | | handleImport() {
|
| | |
| | | },
|
| | | /** 下载模板操作 */
|
| | | importTemplate() {
|
| | | importTemplate().then(response => {
|
| | | this.$download.name(response.msg);
|
| | | });
|
| | | this.download('system/user/importTemplate', {
|
| | | ...this.queryParams
|
| | | }, `user_template_${new Date().getTime()}.xlsx`)
|
| | | },
|
| | | // 文件上传中处理
|
| | | handleFileUploadProgress(event, file, fileList) {
|