|
@@ -1,6 +1,8 @@
|
|
|
<script setup name="ReportPreview">
|
|
|
import { ref,computed, nextTick, reactive,toRefs } from 'vue'
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
+import {getSystemInfo,shareGenerate} from '@/api/common'
|
|
|
+import {Base64} from 'js-base64'
|
|
|
import apiReport from '@/api/report'
|
|
|
import AudioBox from './components/AudioBox.vue'
|
|
|
import {showToast} from 'vant'
|
|
@@ -8,6 +10,8 @@ import {reportManageBtn,useAuthBtn} from '@/hooks/useAuthBtn'
|
|
|
import { copyText } from 'vue3-clipboard'
|
|
|
import {usePublicSettingStore} from '@/store/modules/publicSetting'
|
|
|
import vueQr from 'vue-qr/src/packages/vue-qr.vue'
|
|
|
+import { useConfigSettingStore } from '@/store/modules/etaConfig'
|
|
|
+import { storeToRefs } from 'pinia'
|
|
|
|
|
|
|
|
|
const {checkAuthBtn} = useAuthBtn()
|
|
@@ -35,8 +39,20 @@ function formatSmartStyle() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+const configStore = useConfigSettingStore()
|
|
|
+const { etaConfigInfo } = storeToRefs(configStore)
|
|
|
+ //获取基本配置,判断是否走审批流
|
|
|
+async function getEtaConfig(){
|
|
|
+ await configStore.getBaseConfigSetting()
|
|
|
+}
|
|
|
+getEtaConfig()
|
|
|
+const dynamicClassName = computed(() => {
|
|
|
+ return etaConfigInfo.value.IsOpenChartExpired==='true'?'select-text-disabled':'';
|
|
|
+})
|
|
|
+
|
|
|
// 获取报告详情
|
|
|
let reportInfo=ref(null)
|
|
|
+let shareUrls=ref(null)
|
|
|
const smartState = reactive({
|
|
|
bgColor:'',
|
|
|
headImgStyle:null,//版头style
|
|
@@ -69,6 +85,7 @@ async function getReportDetail(){
|
|
|
if(res.Data.ReportLayout===2){
|
|
|
formatSmartStyle()
|
|
|
}
|
|
|
+ getSystemInfoFun()
|
|
|
}
|
|
|
}
|
|
|
if(route.query.id==-1){
|
|
@@ -84,36 +101,73 @@ const { bgColor,headImgStyle,endImgStyle,layoutBaseInfo } = toRefs(smartState)
|
|
|
|
|
|
|
|
|
const showImgPop = ref(false)
|
|
|
-const linkUrl = computed(() =>{
|
|
|
- console.log(publicSettingStore)
|
|
|
+const handleCopyLink = (type) =>{
|
|
|
let str=''
|
|
|
+ let url=''
|
|
|
const baseUrl= publicSettingStore.publicSetting.ReportViewUrl;
|
|
|
if(reportInfo.value.ReportCode){
|
|
|
// 设置水印文案
|
|
|
- let waterMarkStr= '';
|
|
|
+ // let waterMarkStr= '';
|
|
|
|
|
|
str= reportInfo.value.ReportLayout===1
|
|
|
- ? `${baseUrl}/reportshare_crm_report?code=${reportInfo.value.ReportCode}&flag=${waterMarkStr}& ${reportInfo.value.Title}`
|
|
|
- : `${baseUrl}/reportshare_smart_report?code=${reportInfo.value.ReportCode}&flag=${waterMarkStr}& ${reportInfo.value.Title}`
|
|
|
+ ? `${baseUrl}/reportshare_crm_report?code=${reportInfo.value.ReportCode}&flag=${waterMarkStr.value}& ${reportInfo.value.Title}`
|
|
|
+ : `${baseUrl}/reportshare_smart_report?code=${reportInfo.value.ReportCode}& ${reportInfo.value.Title}`
|
|
|
+
|
|
|
+ const params={
|
|
|
+ "Url":str,
|
|
|
+ "ReportId":reportInfo.value.Id
|
|
|
+ }
|
|
|
+ shareGenerate(params).then(res=>{
|
|
|
+ if(res.Ret===200){
|
|
|
+ console.log(res)
|
|
|
+ if(location.port=='5173'){
|
|
|
+ url='http://8.136.199.33:8611'
|
|
|
+ }else{
|
|
|
+ url=location.origin
|
|
|
+ }
|
|
|
+ shareUrls.value=url+'/v1/share/'+res.Data.UrlToken
|
|
|
+
|
|
|
+ if(type==='urcode') {
|
|
|
+ showImgPop.value=true
|
|
|
+ }else {
|
|
|
+ copyText(shareUrls.value,undefined,(error,event)=>{
|
|
|
+ if(error){
|
|
|
+ showToast('复制链接失败')
|
|
|
+
|
|
|
+ throw new Error('复制数据失败'+JSON.stringify(error))
|
|
|
+ }else{
|
|
|
+ showToast('复制链接成功')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
-
|
|
|
- return str
|
|
|
+}
|
|
|
+const shareCodeUrls = computed(() => {
|
|
|
+ let index = shareUrls.value.indexOf(' ');
|
|
|
+ return shareUrls.value.substring(0,index)
|
|
|
})
|
|
|
-function handleCopyLink() {
|
|
|
- copyText(linkUrl.value,undefined,(error,event)=>{
|
|
|
- if(error){
|
|
|
- showToast('复制链接成功')
|
|
|
|
|
|
- throw new Error('复制数据失败'+JSON.stringify(error))
|
|
|
- }else{
|
|
|
- showToast('复制链接成功')
|
|
|
+const waterMarkStr=ref('')
|
|
|
+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>
|
|
|
- <div class="report-detail-page" v-if="reportInfo" :style="{backgroundColor:bgColor}">
|
|
|
+ <div class="report-detail-page" :class="dynamicClassName" v-if="reportInfo" :style="{backgroundColor:bgColor}">
|
|
|
<!-- <div class="top-stage-box" v-if="$route.query.id!=-1">
|
|
|
<span class="stage">第{{reportInfo.Stage}}期 / {{reportInfo.Frequency}}</span>
|
|
|
</div> -->
|
|
@@ -177,7 +231,7 @@ function handleCopyLink() {
|
|
|
<img class="icon" src="@/assets/imgs/report/icon_copy.png" alt="">
|
|
|
<div>复制链接</div>
|
|
|
</div>
|
|
|
- <div class="item" @click="showImgPop=true" v-permission="reportManageBtn.reportManage_reportView_wechartShare">
|
|
|
+ <div class="item" @click="handleCopyLink('urcode')" v-permission="reportManageBtn.reportManage_reportView_wechartShare">
|
|
|
<img class="icon" src="@/assets/imgs/report/icon_wx_black.png" alt="">
|
|
|
<div>微信分享</div>
|
|
|
</div>
|
|
@@ -189,7 +243,7 @@ function handleCopyLink() {
|
|
|
v-model:show="showImgPop"
|
|
|
round
|
|
|
>
|
|
|
- <vue-qr :text="linkUrl" colorDark="#333" colorLight="#fff" :dotScale="1"></vue-qr>
|
|
|
+ <vue-qr :text="shareCodeUrls" colorDark="#333" colorLight="#fff" :dotScale="1"></vue-qr>
|
|
|
</van-popup>
|
|
|
</template>
|
|
|
|