diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportshare/controller/dto/ReportShareDto.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportshare/controller/dto/ReportShareDto.java index f9a42cce..b0c4944b 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportshare/controller/dto/ReportShareDto.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportshare/controller/dto/ReportShareDto.java @@ -60,4 +60,6 @@ public class ReportShareDto extends GaeaBaseDTO implements Serializable { private boolean sharePasswordFlag = false; + private String reportType; + } diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportshare/dao/entity/ReportShare.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportshare/dao/entity/ReportShare.java index 5b2af8a5..b581504c 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportshare/dao/entity/ReportShare.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportshare/dao/entity/ReportShare.java @@ -45,5 +45,8 @@ public class ReportShare extends GaeaBaseEntity { @TableField(exist = false) private boolean sharePasswordFlag; + /** 大屏类型 report excel */ + @TableField(exist = false) + private String reportType; } diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportshare/service/impl/ReportShareServiceImpl.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportshare/service/impl/ReportShareServiceImpl.java index 1fe00e40..02eec6eb 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportshare/service/impl/ReportShareServiceImpl.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/modules/reportshare/service/impl/ReportShareServiceImpl.java @@ -29,7 +29,11 @@ import org.springframework.stereotype.Service; **/ @Service public class ReportShareServiceImpl implements ReportShareService { + private static final String SHARE_AJFLAG = "#/aj/"; + private static final String SHARE_ELFLAG = "#/el/"; + private static final String REPORT = "report_screen"; + private static final String EXCEL = "report_excel"; /** * 默认跳转路由为aj的页面 */ @@ -126,11 +130,31 @@ public class ReportShareServiceImpl implements ReportShareService { //http://127.0.0.1:9095/reportDashboard/getData String shareCode = UuidUtil.generateShortUuid(); entity.setShareCode(shareCode); - if (entity.getShareUrl().contains(SHARE_URL)) { - String prefix = entity.getShareUrl().substring(0, entity.getShareUrl().indexOf("#")); - entity.setShareUrl(prefix + SHARE_FLAG + shareCode); - } else { - entity.setShareUrl(entity.getShareUrl() + SHARE_FLAG + shareCode); + +// if (entity.getShareUrl().contains(SHARE_URL)) { +// String prefix = entity.getShareUrl().substring(0, entity.getShareUrl().indexOf("#")); +// entity.setShareUrl(prefix + SHARE_FLAG + shareCode); +// } else { +// entity.setShareUrl(entity.getShareUrl() + SHARE_FLAG + shareCode); +// } + + + if (REPORT.equals(entity.getReportType())) { + if (entity.getShareUrl().contains(SHARE_URL)) { + String prefix = entity.getShareUrl().substring(0, entity.getShareUrl().indexOf("#")); + entity.setShareUrl(prefix + SHARE_AJFLAG + shareCode); + }else { + entity.setShareUrl(entity.getShareUrl() + SHARE_AJFLAG + shareCode); + } + }else if (EXCEL.equals(entity.getReportType())) { + if (entity.getShareUrl().contains(SHARE_URL)) { + String prefix = entity.getShareUrl().substring(0, entity.getShareUrl().indexOf("#")); + entity.setShareUrl(prefix + SHARE_ELFLAG + shareCode); + }else { + entity.setShareUrl(entity.getShareUrl() + SHARE_ELFLAG + shareCode); + } + }else { + return; } entity.setShareValidTime(DateUtil.getFutureDateTmdHms(entity.getShareValidType())); diff --git a/report-ui/src/router/index.js b/report-ui/src/router/index.js index cb0dcfec..5ee8db7e 100644 --- a/report-ui/src/router/index.js +++ b/report-ui/src/router/index.js @@ -35,6 +35,11 @@ export const constantRouterMap = [ component: () => import('@/views/bigScreenReport/aj'), hidden: true }, + { + path: '/el/**', + component: () => import('@/views/excelreport/el'), + hidden: true + }, { path: '/index', component: Layout, diff --git a/report-ui/src/views/bigScreenReport/components/share.vue b/report-ui/src/views/bigScreenReport/components/share.vue index 04bf6166..7245e818 100644 --- a/report-ui/src/views/bigScreenReport/components/share.vue +++ b/report-ui/src/views/bigScreenReport/components/share.vue @@ -114,6 +114,13 @@ export default { default: () => { return ""; } + }, + reportType: { + required : true, + type: String, + default: () =>{ + return ""; + } } }, data() { @@ -124,6 +131,7 @@ export default { dialogForm: { shareValidType: 0, reportCode: "", + reportType: "", shareUrl: "", shareCode: "", sharePassword: "", @@ -164,12 +172,11 @@ export default { this.dialogForm.sharePassword = ""; }, async createShare() { + this.dialogForm.reportType = this.reportType; this.dialogForm.reportCode = this.reportCode; this.dialogForm.shareUrl = window.location.href; - // console.log(this.dialogForm) const { code, data } = await reportShareAdd(this.dialogForm); if (code != "200") return; - // console.log(data) this.shareLinkFlag1 = false; this.$message({ message: "创建链接成功!", diff --git a/report-ui/src/views/bigScreenReport/index.vue b/report-ui/src/views/bigScreenReport/index.vue index 430e9715..6f911441 100644 --- a/report-ui/src/views/bigScreenReport/index.vue +++ b/report-ui/src/views/bigScreenReport/index.vue @@ -101,6 +101,7 @@ :visib="visibleForShareDialog" :reportCode="reportCodeForShareDialog" :reportName="reportNameForShareDialog" + :reportType="reportTypeForShareDialog" @handleClose="visibleForShareDialog = false" /> </div> @@ -130,7 +131,8 @@ export default { // 分享 visibleForShareDialog: false, reportCodeForShareDialog: "", - reportNameForShareDialog: "" + reportNameForShareDialog: "", + reportTypeForShareDialog: "", }; }, mounted() {}, @@ -176,6 +178,7 @@ export default { share(val) { this.reportCodeForShareDialog = val.reportCode; this.reportNameForShareDialog = val.reportName; + this.reportTypeForShareDialog = val.reportType; this.visibleForShareDialog = true; }, openDesign(val) { diff --git a/report-ui/src/views/excelreport/components/share.vue b/report-ui/src/views/excelreport/components/share.vue index 2339f6aa..c79a36da 100644 --- a/report-ui/src/views/excelreport/components/share.vue +++ b/report-ui/src/views/excelreport/components/share.vue @@ -110,6 +110,13 @@ export default { default: () => { return ""; } + }, + reportType: { + required : true, + type: String, + default: () =>{ + return ""; + } } }, data() { @@ -120,6 +127,7 @@ export default { dialogForm: { shareValidType: 0, reportCode: "", + reportType: "", shareUrl: "", shareCode: "", sharePassword: "", @@ -160,12 +168,12 @@ export default { this.dialogForm.sharePassword = ""; }, async createShare() { + this.dialogForm.reportType = this.reportType; this.dialogForm.reportCode = this.reportCode; this.dialogForm.shareUrl = window.location.href; - // console.log(this.dialogForm) + console.log(this.dialogForm) const { code, data } = await reportShareAdd(this.dialogForm); if (code != "200") return; - // console.log(data) this.shareLinkFlag1 = false; this.$message({ message: "创建链接成功!", diff --git a/report-ui/src/views/excelreport/el/index.vue b/report-ui/src/views/excelreport/el/index.vue new file mode 100644 index 00000000..457ac387 --- /dev/null +++ b/report-ui/src/views/excelreport/el/index.vue @@ -0,0 +1,85 @@ +<!-- + * @Author: lide1202@hotmail.com + * @Date: 2021-3-13 11:04:24 + * @Last Modified by: lide1202@hotmail.com + * @Last Modified time: 2021-3-13 11:04:24 + !--> +<template> + <div> + <el-dialog + title="请输入分享码" + :visible.sync="dialogVisible" + width="30%" + :close-on-click-modal="false" + :before-close="handleClose" + > + <el-input v-model="password" placeholder="请输入分享码"></el-input> + <span slot="footer" class="dialog-footer"> + <el-button @click="dialogVisible = false">取 消</el-button> + <el-button type="primary" @click="checkPassword()">确 定</el-button> + </span> + </el-dialog> + </div> +</template> +<script> +import { reportShareDetailByCode } from "@/api/reportShare"; +import { setShareToken } from "@/utils/auth"; +export default { + name: "Excel", + components: {}, + data() { + return { + password: "", + sharePassword: "", + dialogVisible: false, + reportCode: "", + shareToken: "" + }; + }, + + created() { + this.handleOpen(); + }, + methods: { + async handleOpen() { + const url = window.location.href; + const shareCode = url.substring(url.lastIndexOf("/") + 1); + const { code, data } = await reportShareDetailByCode(shareCode); + if (code != "200") return; + this.reportCode = data.reportCode; + this.sharePassword = data.sharePassword; + this.shareToken = data.shareToken; + if (this.sharePassword) { + this.dialogVisible = true; + } else { + this.pushEl(); + } + }, + checkPassword() { + const md5 = require("js-md5"); + const inputPassword = md5(this.password); + if (inputPassword == this.sharePassword) { + this.pushEl(); + } else { + this.$message.error("分享码输入不正确"); + } + }, + pushEl() { + setShareToken(this.shareToken); + this.$router.push({ + path: "/excelreport/viewer", + query: { + reportCode: this.reportCode + } + }); + }, + handleClose(done) { + this.$confirm("确认关闭?") + .then(_ => { + done(); + }) + .catch(_ => {}); + } + } +}; +</script> diff --git a/report-ui/src/views/excelreport/index.vue b/report-ui/src/views/excelreport/index.vue index fe9a9a95..a8ff8aca 100644 --- a/report-ui/src/views/excelreport/index.vue +++ b/report-ui/src/views/excelreport/index.vue @@ -101,6 +101,7 @@ :visib="visibleForShareDialog" :reportCode="reportCodeForShareDialog" :reportName="reportNameForShareDialog" + :reportType="reportTypeForShareDialog" @handleClose="visibleForShareDialog = false" /> </div> @@ -130,7 +131,8 @@ export default { // 分享 visibleForShareDialog: false, reportCodeForShareDialog: "", - reportNameForShareDialog: "" + reportNameForShareDialog: "", + reportTypeForShareDialog: "" }; }, mounted() {}, @@ -174,12 +176,9 @@ export default { }, // 分享 share(val) { - //excel暂不支持 - this.$message.warning("暂不支持excel报表分享"); - return; - this.reportCodeForShareDialog = val.reportCode; this.reportNameForShareDialog = val.reportName; + this.reportTypeForShareDialog = val.reportType; this.visibleForShareDialog = true; }, openDesign(val) {