|
@@ -7,6 +7,7 @@ import ReportPublishTimeSet from './components/ReportPublishTimeSet.vue'
|
|
|
import apiReport from '@/api/report'
|
|
|
// import {getSystemInfo} from '@/api/common'
|
|
|
import moment from 'moment'
|
|
|
+import { getChartShareToken } from '@/api/etaConfig.js';
|
|
|
import { showToast,showDialog } from 'vant'
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
import {useCachedViewsStore} from '@/store/modules/cachedViews'
|
|
@@ -18,7 +19,7 @@ import { useReportHandles,useChapterRepoprtHandles } from './hooks/useReport'
|
|
|
|
|
|
const cachedViewsStore=useCachedViewsStore()
|
|
|
const publicSettingStore = usePublicSettingStore()
|
|
|
-const {isApprove,hasApproveFlow,getEtaConfig,checkClassifyNameArr} = useReportApprove()
|
|
|
+const {isApprove,hasApproveFlow,getEtaConfig,checkClassifyNameArr,isLinkChartExpired} = useReportApprove()
|
|
|
const router=useRouter()
|
|
|
const route=useRoute()
|
|
|
const {checkAuthBtn} = useAuthBtn()
|
|
@@ -157,6 +158,18 @@ async function handleReportBaseInfoChange(e){
|
|
|
showReportBaseInfo.value=false
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+async function getLinkAuthToken(UniqueCode,Source='chart') {
|
|
|
+ let authToken = ''
|
|
|
+ if(isLinkChartExpired.value) { //开启了图表有效期
|
|
|
+ const res = await getChartShareToken({ UniqueCode,Source })
|
|
|
+ if(res.Ret !== 200) return
|
|
|
+ authToken = res.Data;
|
|
|
+ }
|
|
|
+
|
|
|
+ return authToken;
|
|
|
+}
|
|
|
+
|
|
|
// 报告插入数据弹窗
|
|
|
const showReportInsertPop=ref(false)
|
|
|
/**
|
|
@@ -164,7 +177,7 @@ const showReportInsertPop=ref(false)
|
|
|
* type:iframe/img 插入的为iframe或者图片
|
|
|
* chartType: chart-图表,sheet-表格
|
|
|
*/
|
|
|
-function handleInsert({list,type,chartType}){
|
|
|
+async function handleInsert({list,type,chartType}){
|
|
|
reportContentEditorIns.events.focus()
|
|
|
if(lastFocusPosition.value){
|
|
|
reportContentEditorIns.selection.get().removeAllRanges()
|
|
@@ -172,21 +185,28 @@ function handleInsert({list,type,chartType}){
|
|
|
}
|
|
|
if(type==='iframe'){
|
|
|
let link=publicSettingStore.publicSetting.ChartViewUrl;
|
|
|
+
|
|
|
if(chartType==='chart'){
|
|
|
// link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/chartshow':'https://charttest.hzinsights.com/chartshow'
|
|
|
link=link+'/chartshow'
|
|
|
- list.forEach(item => {
|
|
|
- const isETAForumChart=item.startsWith('isETAForumChart_')?true:false
|
|
|
+ list.forEach(async(item) => {
|
|
|
+ const isETAForumChart=item.startsWith('isETAForumChart_')?true:false;
|
|
|
+ //临时权限token
|
|
|
+ let authToken = await getLinkAuthToken(item);
|
|
|
+
|
|
|
reportContentEditorIns.html.insert(`<p style='text-align:left; margin-top:10px;'>
|
|
|
- <iframe src='${link}?code=${isETAForumChart?item.replace(/^isETAForumChart_/, ''):item}&fromPage=&isETAForumChart=${isETAForumChart}' width='100%' height='350' style='border-width:0px; min-height:350px;'></iframe>
|
|
|
+ <iframe src='${link}?code=${isETAForumChart?item.replace(/^isETAForumChart_/, ''):item}&fromPage=&isETAForumChart=${isETAForumChart}&authToken=${authToken}' width='100%' height='350' style='border-width:0px; min-height:350px;'></iframe>
|
|
|
</p>`,false)
|
|
|
});
|
|
|
}else if(chartType==='sheet'){
|
|
|
// link=import.meta.env.MODE==='production'?'https://chartlib.hzinsights.com/sheetshow':'https://charttest.hzinsights.com/sheetshow'
|
|
|
link=link+'/sheetshow'
|
|
|
- list.forEach(item => {
|
|
|
+ list.forEach(async(item) => {
|
|
|
+ //临时权限token
|
|
|
+ let authToken = await getLinkAuthToken(item,'table');
|
|
|
+
|
|
|
reportContentEditorIns.html.insert(`<p style='text-align:left; margin-top:10px;'>
|
|
|
- <iframe src='${link}?code=${item}' class='iframe${item}' width='100%' style='border-width:0px;'></iframe>
|
|
|
+ <iframe src='${link}?code=${item}&authToken=${authToken}' class='iframe${item}' width='100%' style='border-width:0px;'></iframe>
|
|
|
</p>`,false)
|
|
|
});
|
|
|
}
|