diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java index 642acddc..8022cf44 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java @@ -85,7 +85,12 @@ public class TokenFilter implements Filter { return; } + if (SLASH.equals(uri) || SLASH.concat(BusinessConstant.SLASH).equals(uri)) { + if (BusinessConstant.SLASH.equals(uri)) { + response.sendRedirect("/index.html"); + return; + } response.sendRedirect(SLASH + "/index.html"); return; } diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/controller/ReportController.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/controller/ReportController.java index 65c06afe..fa44a3a3 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/controller/ReportController.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/controller/ReportController.java @@ -43,11 +43,11 @@ public class ReportController extends GaeaBaseController { /** * 复制大屏 - * @param reportId + * @param dto */ - void copy(Long reportId); + void copy(ReportDto dto); } diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/service/impl/ReportServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/service/impl/ReportServiceImpl.java index 4a36d9f0..e44400b0 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/service/impl/ReportServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/report/service/impl/ReportServiceImpl.java @@ -3,7 +3,9 @@ package com.anjiplus.template.gaea.business.modules.report.service.impl; import com.anji.plus.gaea.constant.BaseOperationEnum; import com.anji.plus.gaea.curd.mapper.GaeaBaseMapper; import com.anji.plus.gaea.exception.BusinessException; +import com.anji.plus.gaea.exception.BusinessExceptionBuilder; import com.anji.plus.gaea.utils.GaeaBeanUtils; +import com.anjiplus.template.gaea.business.code.ResponseCode; import com.anjiplus.template.gaea.business.enums.ReportTypeEnum; import com.anjiplus.template.gaea.business.modules.dashboard.dao.entity.ReportDashboard; import com.anjiplus.template.gaea.business.modules.dashboard.service.ReportDashboardService; @@ -16,6 +18,7 @@ import com.anjiplus.template.gaea.business.modules.report.service.ReportService; import com.anjiplus.template.gaea.business.modules.reportexcel.dao.entity.ReportExcel; import com.anjiplus.template.gaea.business.modules.reportexcel.service.ReportExcelService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -107,10 +110,16 @@ public class ReportServiceImpl implements ReportService { } @Override - public void copy(Long reportId) { - Report report = selectOne(reportId); + public void copy(ReportDto dto) { + if (null == dto.getId()) { + throw BusinessExceptionBuilder.build(ResponseCode.NOT_NULL, "id"); + } + if (StringUtils.isBlank(dto.getReportCode())) { + throw BusinessExceptionBuilder.build(ResponseCode.NOT_NULL, "报表编码"); + } + Report report = selectOne(dto.getId()); String reportCode = report.getReportCode(); - Report copyReport = copyReport(report); + Report copyReport = copyReport(report, dto); //复制主表数据 insert(copyReport); String copyReportCode = copyReport.getReportCode(); @@ -150,17 +159,12 @@ public class ReportServiceImpl implements ReportService { } } - private Report copyReport(Report report){ + private Report copyReport(Report report, ReportDto dto){ //复制主表数据 Report copyReport = new Report(); GaeaBeanUtils.copyAndFormatter(report, copyReport); - copyReport.setId(null); - String copyReportCode = copyReport.getReportCode().concat("_").concat(String.valueOf(System.currentTimeMillis())); - if (copyReportCode.length() >= 100) { - copyReportCode = copyReportCode.substring(0, 100); - } - copyReport.setReportCode(copyReportCode); - copyReport.setReportName(copyReport.getReportName().concat("_copy")); + copyReport.setReportCode(dto.getReportCode()); + copyReport.setReportName(dto.getReportName()); return copyReport; } diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/util/FileUtil.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/util/FileUtil.java index 6fcdbacf..5532b53d 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/util/FileUtil.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/util/FileUtil.java @@ -97,11 +97,13 @@ public class FileUtil { if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } - FileWriter fw = new FileWriter(filePath); - BufferedWriter bw = new BufferedWriter(fw); + FileOutputStream outputStream = new FileOutputStream(filePath); + OutputStreamWriter outputWriter = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8); + BufferedWriter bw = new BufferedWriter(outputWriter); bw.write(content); bw.close(); - fw.close(); + outputWriter.close(); + outputStream.close(); } catch (Exception e) { log.error("写入文件失败", e); throw BusinessExceptionBuilder.build(ResponseCode.FAIL_CODE, e.getMessage()); @@ -178,7 +180,7 @@ public class FileUtil { try { out = new FileOutputStream(dstFile); CheckedOutputStream cos = new CheckedOutputStream(out, new CRC32()); - zipOut = new ZipOutputStream(cos); + zipOut = new ZipOutputStream(cos, StandardCharsets.UTF_8); String baseDir = ""; compress(srcFile, zipOut, baseDir); } catch (IOException e) { diff --git a/report-ui/src/api/reportmanage.js b/report-ui/src/api/reportmanage.js index 3858fde0..75affa48 100644 --- a/report-ui/src/api/reportmanage.js +++ b/report-ui/src/api/reportmanage.js @@ -42,8 +42,8 @@ export function reportDetail(data) { export function reportCopy(data) { return request({ url: '/report/copy', - method: 'get', - params: { reportId: data.id } + method: 'post', + data }) } diff --git a/report-ui/src/views/bigscreenDesigner/designer/components/dynamicForm.vue b/report-ui/src/views/bigscreenDesigner/designer/components/dynamicForm.vue index 99eb92de..9544eca0 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/components/dynamicForm.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/components/dynamicForm.vue @@ -344,6 +344,7 @@ export default { } else { this.$set(this.formData, key, val); } + this.$emit("onChanged", this.formData); // key为当前用户操作的表单组件 for (let i = 0; i < this.options.length; i++) { diff --git a/report-ui/src/views/bigscreenDesigner/designer/index.vue b/report-ui/src/views/bigscreenDesigner/designer/index.vue index 06795127..5a989550 100644 --- a/report-ui/src/views/bigscreenDesigner/designer/index.vue +++ b/report-ui/src/views/bigscreenDesigner/designer/index.vue @@ -199,7 +199,9 @@ 'background-origin': 'initial', 'background-clip': 'initial' }" - @click.self="setOptionsOnClickScreen" @drop="widgetOnDragged($event)" @dragover="dragOver($event)" + @click.self="setOptionsOnClickScreen" + @drop="widgetOnDragged($event)" + @dragover="dragOver($event)" >
- V0.9.7 + V0.9.7.2
+ + diff --git a/report-ui/src/views/reportManage/index.vue b/report-ui/src/views/reportManage/index.vue index d7811f83..a07f047e 100644 --- a/report-ui/src/views/reportManage/index.vue +++ b/report-ui/src/views/reportManage/index.vue @@ -4,7 +4,7 @@ * @Author: qianlishi * @Date: 2021-12-11 14:48:27 * @LastEditors: qianlishi - * @LastEditTime: 2022-05-15 10:44:58 + * @LastEditTime: 2022-05-17 17:38:44 --> @@ -28,13 +29,15 @@ import { reportCopy } from "@/api/reportmanage"; import Share from "./components/share"; +import copyDialog from "./components/copyDialog.vue"; import { validateEngOrNum } from "@/utils/validate"; import { verificationSet } from "@/api/report"; export default { name: "Report", components: { anjiCrud: require("@/components/AnjiPlus/anji-crud/anji-crud").default, - Share + Share, + copyDialog }, data() { return { @@ -306,7 +309,11 @@ export default { } } } - } + }, + + // 复制 + copyVisible: false, + rowData: {} }; }, @@ -358,11 +365,17 @@ export default { }, //复制 async copyReport(val) { - const { code } = await reportCopy(val); - if (code != "200") { - return; - } - this.$message.success("复制成功"); + this.copyVisible = true; + this.rowData = val; + // const { code } = await reportCopy(val); + // if (code != "200") { + // return; + // } + // this.$message.success("复制成功"); + // this.$refs.listPage.handleQueryForm("query"); + }, + close() { + this.copyVisible = false; this.$refs.listPage.handleQueryForm("query"); } }