需求--Excel分享链接

qianming 2 years ago
parent f3e4bb8b1d
commit 0108025b34

@ -60,4 +60,6 @@ public class ReportShareDto extends GaeaBaseDTO implements Serializable {
private boolean sharePasswordFlag = false;
private String reportType;
}

@ -45,5 +45,8 @@ public class ReportShare extends GaeaBaseEntity {
@TableField(exist = false)
private boolean sharePasswordFlag;
/** 大屏类型 report excel */
@TableField(exist = false)
private String reportType;
}

@ -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 (REPORT.equals(entity.getReportType())) {
if (entity.getShareUrl().contains(SHARE_URL)) {
String prefix = entity.getShareUrl().substring(0, entity.getShareUrl().indexOf("#"));
entity.setShareUrl(prefix + SHARE_FLAG + shareCode);
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 {
entity.setShareUrl(entity.getShareUrl() + SHARE_FLAG + shareCode);
return;
}
entity.setShareValidTime(DateUtil.getFutureDateTmdHms(entity.getShareValidType()));

@ -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,

@ -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: "创建链接成功!",

@ -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) {

@ -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: "创建链接成功!",

@ -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>

@ -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) {

Loading…
Cancel
Save