Browse Source

Merge branch 'eta2.3.9' into debug

yujinwen 1 month ago
parent
commit
fd752b956c
1 changed files with 86 additions and 10 deletions
  1. 86 10
      src/views/reportEn/List.vue

+ 86 - 10
src/views/reportEn/List.vue

@@ -12,15 +12,17 @@ import { useRouter } from 'vue-router';
 import { useWindowSize } from '@vueuse/core'
 import {useCachedViewsStore} from '@/store/modules/cachedViews'
 import {usePublicSettingStore} from '@/store/modules/publicSetting'
-import {useDownLoadFile} from '@/hooks/useDownLoadFile'
+import {useDownLoadFileAddWaterMark} from '@/hooks/useDownLoadFile'
 import {enReportManageBtn,useAuthBtn} from '@/hooks/useAuthBtn'
 import {useReportApprove} from '@/hooks/useReportApprove'
 import {Base64} from 'js-base64'
+import { useConfigSettingStore } from '@/store/modules/etaConfig'
+import { storeToRefs } from 'pinia'
 
 const cachedViewsStore=useCachedViewsStore()
 const publicSettingStore = usePublicSettingStore()
 
-const {startDownload}=useDownLoadFile()
+const {startDownload}=useDownLoadFileAddWaterMark()
 const {checkAuthBtn} = useAuthBtn()
 const {isApprove,isOtherApprove,getEtaConfig} = useReportApprove()
 
@@ -186,16 +188,52 @@ function handleReportPublishCancle(item){
     })
 }
 
-// type 1-pdf 2-长图
-function downloadPdfImg(item,type){
+const showDownloadPdfImg=ref(false)
+const downloadPdfImgType=ref('pdf')
+// type 1-电脑版pdf 2-电脑版长图 3-移动版pdf 4-移动版长图
+async function downloadPdfImg(item,type){
+    let waterMark=''
+    // 判断是否需要水印
+    await useConfigSettingStore().getBaseConfigSetting()
+    const configSettingStore = useConfigSettingStore()
+    const { etaConfigInfo } = storeToRefs(configSettingStore)
+    if(etaConfigInfo.value.WatermarkDownloadPdf==='true'){
+        // 设置水印
+        waterMark=decodeURIComponent(Base64.decode(waterMarkStr.value))
+    }
     showReportItemOpt.value=false
     let name = `${item.Title}${moment().format('YYYYMMDD')}`
     if(type == 1){
         // window.open(item.DetailPdfUrl,"_blank")
-        startDownload(item.DetailPdfUrl,`${name}.pdf`)
-    }else{
-        startDownload(item.DetailImgUrl,`${name}.jpeg`)
+        startDownload({
+            url:item.DetailPdfUrl,
+            filename:`${name}.pdf`,
+            waterMark:waterMark,
+            type:'pdf'
+        })
+    }else if(type===2){
+        startDownload({
+            url:item.DetailImgUrl,
+            filename:`${name}.jpeg`,
+            waterMark:waterMark,
+            type:'img'
+        })
+    }else if(type===3){
+        startDownload({
+            url:item.DetailPdfUrlMobile,
+            filename:`${name}.jpeg`,
+            waterMark:waterMark,
+            type:'pdf'
+        })
+    }else if(type===4){
+        startDownload({
+            url:item.DetailImgUrlMobile,
+            filename:`${name}.jpeg`,
+            waterMark:waterMark,
+            type:'img'
+        })
     }
+    showDownloadPdfImg.value=false
 }
 
 //提交报告
@@ -691,6 +729,41 @@ onMounted(()=>{
         </svg>
     </div>
 
+    <!-- 下载pdf和图片选择下载类型 -->
+    <van-action-sheet 
+        v-model:show="showDownloadPdfImg"
+        cancel-text="取消"
+        close-on-click-action
+    >
+        <div class="report-item-action-box" v-if="activeItem">
+            <div class="title">{{downloadPdfImgType==='pdf'?'下载pdf':'下载长图'}}</div>
+            <template v-if="downloadPdfImgType==='pdf'">
+                <div 
+                    class="item" 
+                    v-if="checkAuthBtn(enReportManageBtn.enReport_exportPdf) && activeItem.DetailPdfUrl"
+                    @click="downloadPdfImg(activeItem,1)"
+                >电脑版</div>
+                <div 
+                    class="item" 
+                    v-if="checkAuthBtn(enReportManageBtn.enReport_exportPdf) && activeItem.DetailPdfUrlMobile"
+                    @click="downloadPdfImg(activeItem,3)"
+                >手机版</div>
+            </template>
+            <template v-if="downloadPdfImgType==='img'">
+                <div 
+                    class="item" 
+                    v-if="checkAuthBtn(enReportManageBtn.enReport_exportImg) && activeItem.DetailImgUrl"
+                    @click="downloadPdfImg(activeItem,2)"
+                >电脑版</div>
+                <div 
+                    class="item" 
+                    v-if="checkAuthBtn(enReportManageBtn.enReport_exportImg) && activeItem.DetailImgUrlMobile"
+                    @click="downloadPdfImg(activeItem,4)"
+                >手机版</div>
+            </template>
+        </div>
+    </van-action-sheet>
+
     <!-- 报告item操作 -->
     <van-action-sheet
         teleport="body"
@@ -724,9 +797,9 @@ onMounted(()=>{
                 <div class="item" v-if="checkAuthBtn(enReportManageBtn.enReport_cancelPublish)&&activeItem.State===6"
                     @click="handleReportCancle(activeItem)">撤销</div>
                 <div class="item" v-if="checkAuthBtn(enReportManageBtn.enReport_exportPdf) && activeItem.DetailPdfUrl"
-                    @click="downloadPdfImg(activeItem,1)">下载pdf</div>
+                    @click="showDownloadPdfImg=true;downloadPdfImgType='pdf'">下载pdf</div>
                 <div class="item" v-if="checkAuthBtn(enReportManageBtn.enReport_exportImg) && activeItem.DetailImgUrl"
-                    @click="downloadPdfImg(activeItem,2)">下载长图</div>   
+                    @click="showDownloadPdfImg=true;downloadPdfImgType='img'">下载长图</div>   
             </template>
             <!-- 待审批,已驳回 -->
             <template v-if="[4,5].includes(activeItem.State)">
@@ -1011,7 +1084,10 @@ onMounted(()=>{
 
 .report-item-action-box{
     .title{
-        padding: 20px 32px;
+        padding: 30px 32px;
+        font-weight: 700;
+        text-align: center;
+        background: #eee;
     }
     .item{
         text-align: center;