Browse Source

Merge branch 'eta_1.9.0'

hbchen 9 months ago
parent
commit
fd301b6ba7
2 changed files with 22 additions and 2 deletions
  1. 11 1
      src/views/ppt/components/SheetWrap.vue
  2. 11 1
      src/views/ppt/hooks/usePPTPublish.js

+ 11 - 1
src/views/ppt/components/SheetWrap.vue

@@ -20,7 +20,17 @@ async function getSheetInfo(){
     const res=await apiSheet.infoByCode({UniqueCode:props.itemData.sheetId})
     if(res.Ret===200){
         list.value=res.Data?.TableInfo?.TableDataList||[]
-        sourceFrom.value= res.Data?.SourcesFrom ? JSON.parse(res.Data.SourcesFrom):''
+        sourceFrom.value= res.Data?.SourcesFrom ? JSON.parse(res.Data.SourcesFrom):
+        res.Data.ExcelSource?setDefaultSource(res.Data.ExcelSource):''
+    }
+}
+
+function setDefaultSource(sourceText){
+    return {
+        isShow: true,
+        text: sourceText,
+        color: "#606266",
+        fontSize: 9
     }
 }
 

+ 11 - 1
src/views/ppt/hooks/usePPTPublish.js

@@ -613,7 +613,8 @@ async function pageToPPT(){
                 const res=await apiSheet.infoByCode({UniqueCode:sheetId})
                 if(res.Ret===200){
                     sheetData.list = getTableData(res.Data?.TableInfo?.TableDataList||[])
-                    sheetData.SourcesFrom = res.Data?.SourcesFrom
+                    sheetData.SourcesFrom = res.Data?.SourcesFrom ? res.Data.SourcesFrom:
+                      res.Data.ExcelSource?setDefaultSource(res.Data.ExcelSource):''
                 }
             }
             const { x, y, width, height } = getPosition(
@@ -783,6 +784,15 @@ async function pageToPPT(){
     // pptx2.writeFile({ fileName: "test.pptx" }) //本地测试可直接用该方法生成ppt文件
 }
 
+function setDefaultSource(sourceText){
+  return JSON.stringify({
+      isShow: true,
+      text: sourceText,
+      color: "#606266",
+      fontSize: 9
+  })
+}
+
 /* 生成ppt时 图表、表格 追加底部文字 来源 */
 function transBottomInfo(slide,{x,y,width,height},data){
   let yPercent = Number(Math.ceil(height.replace(/%/,''))+Math.ceil(y.replace(/%/,'')))+'%';