update 适配 ruoyi 关于优化导出数据操作
| | |
| | | @ApiOperation("导出系统访问记录列表") |
| | | @Log(title = "登录日志", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('monitor:logininfor:export')") |
| | | @GetMapping("/export") |
| | | @PostMapping("/export") |
| | | public void export(SysLogininfor logininfor, HttpServletResponse response) { |
| | | List<SysLogininfor> list = logininforService.selectLogininforList(logininfor); |
| | | ExcelUtil.exportExcel(list, "登录日志", SysLogininfor.class, response); |
| | |
| | | @ApiOperation("导出操作日志记录列表") |
| | | @Log(title = "操作日志", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('monitor:operlog:export')") |
| | | @GetMapping("/export") |
| | | @PostMapping("/export") |
| | | public void export(SysOperLog operLog, HttpServletResponse response) { |
| | | List<SysOperLog> list = operLogService.selectOperLogList(operLog); |
| | | ExcelUtil.exportExcel(list, "操作日志", SysOperLog.class, response); |
| | |
| | | @ApiOperation("导出参数配置列表") |
| | | @Log(title = "参数管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:config:export')") |
| | | @GetMapping("/export") |
| | | @PostMapping("/export") |
| | | public void export(SysConfig config, HttpServletResponse response) { |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | ExcelUtil.exportExcel(list, "参数数据", SysConfig.class, response); |
| | |
| | | @ApiOperation("导出字典数据列表") |
| | | @Log(title = "字典数据", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | @GetMapping("/export") |
| | | @PostMapping("/export") |
| | | public void export(SysDictData dictData, HttpServletResponse response) { |
| | | List<SysDictData> list = dictDataService.selectDictDataList(dictData); |
| | | ExcelUtil.exportExcel(list, "字典数据", SysDictData.class, response); |
| | |
| | | @ApiOperation("导出字典类型列表") |
| | | @Log(title = "字典类型", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')") |
| | | @GetMapping("/export") |
| | | @PostMapping("/export") |
| | | public void export(SysDictType dictType, HttpServletResponse response) { |
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType); |
| | | ExcelUtil.exportExcel(list, "字典类型", SysDictType.class, response); |
| | |
| | | @ApiOperation("导出岗位列表") |
| | | @Log(title = "岗位管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:post:export')") |
| | | @GetMapping("/export") |
| | | @PostMapping("/export") |
| | | public void export(SysPost post, HttpServletResponse response) { |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | ExcelUtil.exportExcel(list, "岗位数据", SysPost.class, response); |
| | |
| | | @ApiOperation("导出角色信息列表") |
| | | @Log(title = "角色管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:role:export')") |
| | | @GetMapping("/export") |
| | | @PostMapping("/export") |
| | | public void export(SysRole role, HttpServletResponse response) { |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | ExcelUtil.exportExcel(list, "角色数据", SysRole.class, response); |
| | |
| | | @ApiOperation("导出用户列表") |
| | | @Log(title = "用户管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:user:export')") |
| | | @GetMapping("/export") |
| | | @PostMapping("/export") |
| | | public void export(SysUser user, HttpServletResponse response) { |
| | | List<SysUser> list = userService.selectUserList(user); |
| | | List<SysUserExportVo> listVo = BeanUtil.copyToList(list, SysUserExportVo.class); |
| | |
| | | } |
| | | |
| | | @ApiOperation("下载导入模板") |
| | | @GetMapping("/importTemplate") |
| | | @PostMapping("/importTemplate") |
| | | public void importTemplate(HttpServletResponse response) { |
| | | ExcelUtil.exportExcel(new ArrayList<>(), "用户数据", SysUserImportVo.class, response); |
| | | } |
| | |
| | | @ApiOperation("导出测试单表列表") |
| | | @PreAuthorize("@ss.hasPermi('demo:demo:export')") |
| | | @Log(title = "测试单表", businessType = BusinessType.EXPORT) |
| | | @GetMapping("/export") |
| | | @PostMapping("/export") |
| | | public void export(@Validated TestDemoBo bo, HttpServletResponse response) { |
| | | List<TestDemoVo> list = iTestDemoService.queryList(bo); |
| | | // 测试雪花id导出 |
| | |
| | | const baseURL = process.env.VUE_APP_BASE_API |
| | | |
| | | export default { |
| | | excel(url, params) { |
| | | // get请求映射params参数 |
| | | if (params) { |
| | | let urlparams = url + '?'; |
| | | 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 + ']'; |
| | | let subPart = encodeURIComponent(params) + '='; |
| | | urlparams += subPart + encodeURIComponent(value[key]) + '&'; |
| | | } |
| | | } |
| | | } else { |
| | | urlparams += part + encodeURIComponent(value) + "&"; |
| | | } |
| | | } |
| | | } |
| | | urlparams = urlparams.slice(0, -1); |
| | | url = urlparams; |
| | | } |
| | | url = baseURL + url |
| | | axios({ |
| | | method: 'get', |
| | | url: url, |
| | | responseType: 'blob', |
| | | headers: { 'Authorization': 'Bearer ' + getToken() } |
| | | }).then(async (res) => { |
| | | const isLogin = await this.blobValidate(res.data); |
| | | if (isLogin) { |
| | | const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) |
| | | this.saveAs(blob, decodeURI(res.headers['download-filename'])) |
| | | } else { |
| | | Message.error('无效的会话,或者会话已过期,请重新登录。'); |
| | | } |
| | | }) |
| | | }, |
| | | oss(ossId) { |
| | | var url = baseURL + '/system/oss/download/' + ossId |
| | | axios({ |
| | |
| | | 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/octet-stream' }) |
| | | this.saveAs(blob, decodeURI(res.headers['download-filename'])) |
| | |
| | | ] |
| | | }, |
| | | { |
| | | path: '/monitor/job-log', |
| | | component: Layout, |
| | | hidden: true, |
| | | children: [ |
| | | { |
| | | path: 'index', |
| | | component: (resolve) => require(['@/views/monitor/job/log'], resolve), |
| | | name: 'JobLog', |
| | | meta: { title: '调度日志', activeMenu: '/monitor/job'} |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | path: '/tool/gen-edit', |
| | | component: Layout, |
| | | hidden: true, |
| | |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | :loading="exportLoading" |
| | | @click="handleExport" |
| | | v-hasPermi="['demo:demo:export']" |
| | | >导出</el-button> |
| | |
| | | buttonLoading: false, |
| | | // 遮罩层 |
| | | loading: true, |
| | | // 导出遮罩层 |
| | | exportLoading: false, |
| | | // 选中数组 |
| | | ids: [], |
| | | // 非单个禁用 |
| | |
| | | }, |
| | | /** 导出按钮操作 */ |
| | | handleExport() { |
| | | this.$download.excel('/demo/demo/export', this.queryParams); |
| | | this.download('demo/demo/export', { |
| | | ...this.queryParams |
| | | }, `demo_${new Date().getTime()}.xlsx`) |
| | | } |
| | | } |
| | | }; |