|
@@ -6,6 +6,7 @@ import ReportInsertContent from './components/reportInsert/Index.vue'
|
|
|
import ReportPublishTimeSet from './components/ReportPublishTimeSet.vue'
|
|
|
import apiReport from '@/api/report'
|
|
|
import apiChart from '@/api/chart'
|
|
|
+import {getSystemInfo} from '@/api/common'
|
|
|
import moment from 'moment'
|
|
|
import { showToast,showDialog } from 'vant'
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
@@ -13,6 +14,8 @@ import {useCachedViewsStore} from '@/store/modules/cachedViews'
|
|
|
import {usePublicSettingStore} from '@/store/modules/publicSetting'
|
|
|
import {reportManageBtn,useAuthBtn} from '@/hooks/useAuthBtn'
|
|
|
import {useReportApprove} from '@/hooks/useReportApprove'
|
|
|
+import {Base64} from 'js-base64'
|
|
|
+
|
|
|
const cachedViewsStore=useCachedViewsStore()
|
|
|
const publicSettingStore = usePublicSettingStore()
|
|
|
const {isApprove,hasApproveFlow,getEtaConfig,checkClassifyNameArr} = useReportApprove()
|
|
@@ -20,12 +23,12 @@ const router=useRouter()
|
|
|
const route=useRoute()
|
|
|
const {checkAuthBtn} = useAuthBtn()
|
|
|
|
|
|
-
|
|
|
-
|
|
|
const {lastFocusPosition,initFroalaEditor,imgUploadFlag,frolaEditorContentChange}=useInitFroalaEditor()
|
|
|
let reportContentEditorIns=null//报告内容编辑器实例
|
|
|
|
|
|
let autoSaveTimer=null
|
|
|
+// 水印
|
|
|
+const waterMarkStr=ref('')
|
|
|
|
|
|
onMounted(() => {
|
|
|
const el=document.getElementById('editor')
|
|
@@ -35,6 +38,7 @@ onMounted(() => {
|
|
|
autoSaveTimer=setInterval(() => {
|
|
|
autoSaveReportContent()
|
|
|
}, 6000);
|
|
|
+ getSystemInfoFun()
|
|
|
})
|
|
|
onUnmounted(()=>{
|
|
|
clearInterval(autoSaveTimer)
|
|
@@ -334,10 +338,10 @@ async function handleConfirmPublish(e){
|
|
|
}
|
|
|
const saveRes=await apiReport.reportEdit(params)
|
|
|
if(e===1){//仅发布
|
|
|
- reportPublish(saveRes.Data.ReportId)
|
|
|
+ reportPublish(saveRes.Data.ReportId,saveRes.Data.ReportCode)
|
|
|
}else if(e===2){
|
|
|
if(reportData.value.MsgIsSend===1) return
|
|
|
- const pubRes=await apiReport.reportPublish({ReportIds:saveRes.Data.ReportId.toString()})
|
|
|
+ const pubRes=await apiReport.reportPublish({ReportIds:saveRes.Data.ReportId.toString(),ReportUrl:generatePdfLinks(saveRes.Data.ReportCode)})
|
|
|
if(pubRes.Ret!==200) return
|
|
|
const msgRes=await apiReport.reportMessageSend({ReportId:saveRes.Data.ReportId})
|
|
|
if(msgRes.Ret!==200) return
|
|
@@ -345,8 +349,12 @@ async function handleConfirmPublish(e){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-async function reportPublish(id){
|
|
|
- const res=await apiReport.reportPublish({ReportIds:id.toString()})
|
|
|
+function generatePdfLinks(Code){
|
|
|
+ return `${publicSettingStore.publicSetting.ReportViewUrl}/reportshare_pdf?code=${Code}&flag=${waterMarkStr.value}`
|
|
|
+}
|
|
|
+
|
|
|
+async function reportPublish(id,code){
|
|
|
+ const res=await apiReport.reportPublish({ReportIds:id.toString(),ReportUrl:generatePdfLinks(code)})
|
|
|
if(res.Ret===200){
|
|
|
console.log('back');
|
|
|
router.back()
|
|
@@ -361,7 +369,8 @@ function onConfirmDSFBTime(time){
|
|
|
apiReport.reportPublishTimeSet({
|
|
|
ReportId:reportData.value.Id,
|
|
|
PrePublishTime:time,
|
|
|
- PreMsgSend:0
|
|
|
+ PreMsgSend:0,
|
|
|
+ ReportUrl:generatePdfLinks(reportData.value.ReportCode)
|
|
|
}).then(res=>{
|
|
|
if(res.Ret===200){
|
|
|
showToast('定时发布成功!')
|
|
@@ -384,7 +393,8 @@ function onConfirmDSFBTime(time){
|
|
|
apiReport.reportPublishTimeSet({
|
|
|
ReportId:reportData.value.Id,
|
|
|
PrePublishTime:time,
|
|
|
- PreMsgSend:0
|
|
|
+ PreMsgSend:0,
|
|
|
+ ReportUrl:generatePdfLinks(reportData.value.ReportCode)
|
|
|
}).then(res=>{
|
|
|
if(res.Ret===200){
|
|
|
showToast('定时发布成功!')
|
|
@@ -399,7 +409,8 @@ function onConfirmDSFBTime(time){
|
|
|
apiReport.reportPublishTimeSet({
|
|
|
ReportId:reportData.value.Id,
|
|
|
PrePublishTime:time,
|
|
|
- PreMsgSend:1
|
|
|
+ PreMsgSend:1,
|
|
|
+ ReportUrl:generatePdfLinks(reportData.value.ReportCode)
|
|
|
}).then(res=>{
|
|
|
if(res.Ret===200){
|
|
|
showToast('定时发布成功!')
|
|
@@ -414,7 +425,8 @@ function onConfirmDSFBTime(time){
|
|
|
apiReport.reportPublishTimeSet({
|
|
|
ReportId:reportData.value.Id,
|
|
|
PrePublishTime:time,
|
|
|
- PreMsgSend:0
|
|
|
+ PreMsgSend:0,
|
|
|
+ ReportUrl:generatePdfLinks(reportData.value.ReportCode)
|
|
|
}).then(res=>{
|
|
|
if(res.Ret===200){
|
|
|
showToast('定时发布成功!')
|
|
@@ -445,7 +457,20 @@ async function handleReportSubmit(params){
|
|
|
}).catch(()=>{})
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+const getSystemInfoFun=()=>{
|
|
|
+ getSystemInfo().then(res=>{
|
|
|
+ if(res.Ret===200){
|
|
|
+ const systemUserInfo=res.Data
|
|
|
+ // 设置水印文案
|
|
|
+ let waterMarkString=''
|
|
|
+ if(systemUserInfo){
|
|
|
+ waterMarkString=`${systemUserInfo.RealName}${systemUserInfo.Mobile?systemUserInfo.Mobile:systemUserInfo.Email}`
|
|
|
+ waterMarkString=encodeURIComponent(waterMarkString)
|
|
|
+ waterMarkStr.value=Base64.encode(waterMarkString)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|