소스 검색

bug修复

hbchen 10 달 전
부모
커밋
6a24e1743c

+ 33 - 2
src/views/approve_manage/approveDetail.vue

@@ -63,6 +63,7 @@ import Reportdtl from '@/views/report_manage/reportdtl.vue'
 import TimeLine from './components/timeLine.vue';
 import RejectDialog from './components/rejectDialog.vue';
 import {approveInterence} from '@/api/modules/approve.js';
+import {departInterence} from '@/api/api.js'
 import reportApproveConfig from "@/mixins/reportApproveConfig.js"
 
 const ApproveType = ['','依次审批','会签','或签']
@@ -90,6 +91,7 @@ export default {
                 stateText:'pending',//审批状态对应图片文字:待审批(pending),已同意(passed),已驳回(reject),已撤回(return)
                 isCurrentApprover:false,//审批进行中的节点审批人是否是当前用户,控制通过&驳回按钮显示
             },
+            waterMarkStr:'',//水印
         };
     },
     computed:{
@@ -110,6 +112,7 @@ export default {
                 const {Report={},Approve={}} = res.Data||{}
                 this.reportInfo = {
                     reportId:Report.ReportId||0,
+                    reportCode:Report.ReportCode,
                     title:Report.ReportTitle||'',
                     classify:Report.ReportClassify||'',
                     approver:Approve.ApplyUserName||'',
@@ -270,13 +273,26 @@ export default {
             }
             if(type==='pass'){
                 res = await approveInterence.passApprove({
-                    ReportApproveId:Number(approveId)
+                    ReportApproveId:Number(approveId),
+                    ReportUrl:this.generatePdfLinks(this.reportInfo.reportCode,this.reportInfo.type)
                 })
             }
             if(res.Ret!==200) return 
             this.$message.success( type==='return'?this.$t('AprrovalPage.revoke_success') :this.$t('AprrovalDetailPage.passed_success'));
             type!=='reject'&&(this.$router.replace("/approveList"))
         },
+        generatePdfLinks(code,type){
+            if(type == 1){
+                const baseUrl= localStorage.getItem('dynamicOutLinks') ? JSON.parse(localStorage.getItem('dynamicOutLinks')).ReportViewUrl : '';
+                return `${baseUrl}/reportshare_pdf?code=${code}&flag=${this.waterMarkStr}`
+            }else if(type == 2){
+                const baseUrl= localStorage.getItem('dynamicOutLinks') ? JSON.parse(localStorage.getItem('dynamicOutLinks')).ReportViewUrl : '';
+                return `${baseUrl}/reportshare_pdf_en?code=${code}&flag=${this.waterMarkStr}`
+            }else if(type==3){
+                const baseUrl= localStorage.getItem('dynamicOutLinks') ? JSON.parse(localStorage.getItem('dynamicOutLinks')).ReportViewUrl : '';
+                return `${baseUrl}/reportshare_smart_pdf?code=${code}`
+            }
+        },
         rejectApprove(reason){
             this.isDetailDialogShow = false
             approveInterence.rejectApprove({
@@ -287,10 +303,25 @@ export default {
                 this.$message.success(this.$t('AprrovalDetailPage.rejected_success') )
                 this.$router.replace("/approveList")
             })
-        }
+        },
+        getSystemUserInfo(){
+            departInterence.systemUserInfo().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)
+                        this.waterMarkStr=Base64.encode(waterMarkString)
+                    }
+                }
+            })
+        },
     },
     mounted(){
         this.getApproveDetail()
+        this.getSystemUserInfo()
     },
     components: { TimeLine, ReportDetail, Reportdtl, RejectDialog }
 };

+ 26 - 3
src/views/report_manage/addreportNew.vue

@@ -366,7 +366,8 @@ import {
 	getDraft,
 	dataBaseInterface,
 	sandInterface,
-	reportSetPrepublish
+	reportSetPrepublish,
+	departInterence
 } from '@/api/api.js';
 import http from '@/api/http.js';
 import VueFroala from 'vue-froala-wysiwyg';
@@ -437,6 +438,7 @@ export default {
 			},
 			lastEditRange: null,
 			report_draft_id: 0,
+			waterMarkStr:''
 		};
 	},
 	mounted() {
@@ -445,6 +447,7 @@ export default {
 		this.getreportauthor();
 		this.getSandTable();
 		this.getSheetList();
+		this.getSystemUserInfo()
 		this.timer = setInterval(() => {
 			this.autoSave();
 		}, 6000);
@@ -734,15 +737,19 @@ export default {
 				}
 			}
 		},
-		publishreport(id) {
+		publishreport(id,code) {
 			//发布报告
-			reportpublish({ ReportIds: String(id) }).then((res) => {
+			reportpublish({ ReportIds: String(id) ,ReportUrl:this.generatePdfLinks(code)}).then((res) => {
 				if (res.Ret == 200) {
 					this.isPublishloading = false;
 					this.$router.push({ path: '/reportlist' });
 				}
 			});
 		},
+		generatePdfLinks(Code){
+			const baseUrl= localStorage.getItem('dynamicOutLinks') ? JSON.parse(localStorage.getItem('dynamicOutLinks')).ReportViewUrl : '';
+			return `${baseUrl}/reportshare_pdf?code=${Code}&flag=${this.waterMarkStr}`
+		},
 		// 定时发布报告
 		handleSetReportPrepublish(){
 			if(!this.taskTime){
@@ -771,6 +778,7 @@ export default {
 								ReportId:Number(this.report_draft_id),
 								PrePublishTime:this.taskTime,
 								PreMsgSend:0,
+								ReportUrl:this.generatePdfLinks(this.reportCode)
 							}).then(res=>{
 								if(res.Ret===200){
 									this.$message.success(this.$t('ReportManage.smart_msg.timed_success'))
@@ -784,6 +792,7 @@ export default {
 							ReportId:Number(this.report_draft_id),
 							PrePublishTime:this.taskTime,
 							PreMsgSend:isPost?1:0,
+							ReportUrl:this.generatePdfLinks(this.reportCode)
 						}).then(res=>{
 							if(res.Ret===200){
 								this.$message.success(this.$t('ReportManage.smart_msg.timed_success'))
@@ -911,6 +920,20 @@ export default {
 				}
 			});
 		},
+		getSystemUserInfo(){
+      departInterence.systemUserInfo().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)
+            this.waterMarkStr=Base64.encode(waterMarkString)
+          }
+        }
+      })
+    },
 	},
 	components: {importMyChart,importSemantics},
 	watch: {

+ 27 - 3
src/views/report_manage/editreportNew.vue

@@ -362,7 +362,8 @@ import {
 	classifyIdDetail,
 	dataBaseInterface,
 	sandInterface,
-	reportSetPrepublish
+	reportSetPrepublish,
+	departInterence
 } from 'api/api.js';
 import VueFroala from 'vue-froala-wysiwyg';
 import urlSlug from 'url-slug';
@@ -448,6 +449,7 @@ export default {
 		this.getreportauthor();
 		this.getSandTable();
 		this.getSheetList();
+		this.getSystemUserInfo()
 		this.timer = setInterval(() => {
 			this.autoSave();
 		}, 6000);
@@ -727,15 +729,19 @@ export default {
 			// 	}
 			// });
 		},
-		publishreport(id) {
+		publishreport(id,code) {
 			//发布报告
-			reportpublish({ ReportIds: String(id) }).then((res) => {
+			reportpublish({ ReportIds: String(id) ,ReportCode:this.generatePdfLinks(code)}).then((res) => {
 				if (res.Ret == 200) {
 					this.isPublishloading = false;
 					this.$router.push({ path: '/reportlist' });
 				}
 			});
 		},
+		generatePdfLinks(Code){
+			const baseUrl= localStorage.getItem('dynamicOutLinks') ? JSON.parse(localStorage.getItem('dynamicOutLinks')).ReportViewUrl : '';
+			return `${baseUrl}/reportshare_pdf?code=${Code}&flag=${this.waterMarkStr}`
+		},
 		// 定时发布报告
 		handleSetReportPrepublish(){
 			if(!this.taskTime){
@@ -747,12 +753,14 @@ export default {
 				this.$message.warning(this.$t('ReportManage.smart_msg.than_current_time'))
 				return
 			}
+			// return console.log(this.reportCode,'reportCode');
 			// 如果改报告已经推送过模板消息
 			if(this.ThsMsgIsSend==1){
 				reportSetPrepublish({
 					ReportId:Number(this.report_id),
 					PrePublishTime:this.taskTime,
 					PreMsgSend:0,
+					ReportUrl:this.generatePdfLinks(this.reportCode)
 				}).then(res=>{
 					if(res.Ret===200){
 						this.$message.success(this.$t('ReportManage.smart_msg.timed_success'))
@@ -777,6 +785,7 @@ export default {
 								ReportId:Number(this.report_id),
 								PrePublishTime:this.taskTime,
 								PreMsgSend:0,
+								ReportUrl:this.generatePdfLinks(this.reportCode)
 							}).then(res=>{
 								if(res.Ret===200){
 									this.$message.success(this.$t('ReportManage.smart_msg.timed_success'))
@@ -790,6 +799,7 @@ export default {
 							ReportId:Number(this.report_id),
 							PrePublishTime:this.taskTime,
 							PreMsgSend:isPost?1:0,
+							ReportUrl:this.generatePdfLinks(this.reportCode)
 						}).then(res=>{
 							if(res.Ret===200){
 								this.$message.success(this.$t('ReportManage.smart_msg.timed_success'))
@@ -917,6 +927,20 @@ export default {
 				}
 			});
 		},
+		getSystemUserInfo(){
+      departInterence.systemUserInfo().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)
+            this.waterMarkStr=Base64.encode(waterMarkString)
+          }
+        }
+      })
+    },
 	},
 	components: {importMyChart,importSemantics},
 };

+ 9 - 6
src/views/report_manage/mixins/messagePush.js

@@ -7,6 +7,7 @@ export default {
     return {
       isMessagePost: false,
       isRightFormShow:true,
+      reportCode:''
     };
   },
   methods: {
@@ -14,6 +15,7 @@ export default {
       reportedit(params2).then(async (res) => {
         if (res.Ret == 200) {
           this.$message.success(res.Msg);
+          this.reportCode=res.Data.ReportCode
           if (tp == "yl") {
             // this.$router.push({name:'预览报告',query:{id:res.report_id}});
             let { href } = this.$router.resolve({
@@ -23,16 +25,16 @@ export default {
             window.open(href, "_blank");
           } else if (tp == "fb") {
             if(this.isApprove){
-                await this.publishreport(res.Data.ReportId);
+                await this.publishreport(res.Data.ReportId,res.Data.ReportCode);
                 return 
             }
             if (this.isMessagePost) {
-              await this.publishreport(res.Data.ReportId);
+              await this.publishreport(res.Data.ReportId,res.Data.ReportCode);
               await reportMessageSend({
                 ReportId: res.Data.ReportId,
               }).then(() => {});
             } else {
-              this.publishreport(res.Data.ReportId);
+              this.publishreport(res.Data.ReportId,res.Data.ReportCode);
             }
           } else if(tp=='dsfb'){
             this.showDSFB=true
@@ -48,6 +50,7 @@ export default {
         if (res.Ret == 200) {
           this.$message.success(res.Msg);
           this.report_draft_id = res.Data.ReportId;
+          this.reportCode=res.Data.ReportCode
           if (tp == "yl") {
             // this.$router.push({name:'预览报告',query:{id:res.report_id}});
             let { href } = this.$router.resolve({
@@ -57,16 +60,16 @@ export default {
             window.open(href, "_blank");
           } else if (tp == "fb") {
             if(this.isApprove){
-                await this.publishreport(res.Data.ReportId);
+                await this.publishreport(res.Data.ReportId,res.Data.ReportCode);
                 return 
             }
             if (this.isMessagePost) {
-              await this.publishreport(res.Data.ReportId);
+              await this.publishreport(res.Data.ReportId,res.Data.ReportCode);
               await reportMessageSend({
                 ReportId: res.Data.ReportId,
               }).then(() => {});
             } else {
-              this.publishreport(res.Data.ReportId);
+              this.publishreport(res.Data.ReportId,res.Data.ReportCode);
             }
           } else if(tp=='dsfb'){
             this.showDSFB=true

+ 29 - 5
src/views/report_manage/reportEn/reportEditor.vue

@@ -376,7 +376,8 @@
 import {
 	reportauthor,
 	dataBaseInterface,
-	sandInterface
+	sandInterface,
+	departInterence
 } from 'api/api.js';
 import {authorEn} from '@/api/modules/reportAuthorApi.js';
 import * as reportEnInterface from '@/api/modules/reportEnApi';
@@ -524,6 +525,8 @@ export default {
 				},
 				selectableRange:'00:00:00 - 23:59:59'
 			},
+			publishReportCode:'',
+			waterMarkStr:''
 		};
 	},
 	beforeRouteEnter(to, from, next) {
@@ -541,6 +544,7 @@ export default {
 		this.getreportauthor();
 		this.getSandTable();
 		this.getSheetList();
+		this.getSystemUserInfo()
 		this.timer = setInterval(() => {
 			this.autoSave();
 		}, 6000);
@@ -700,6 +704,7 @@ export default {
 						content: data.Content,
             overview:data.Overview||''
 					};
+					this.publishReportCode=res.Data.ReportCode
 					// 回显定时发布时间
 					if(data.PrePublishTime){
 						this.taskTime=data.PrePublishTime
@@ -819,15 +824,19 @@ export default {
 			})
 		},
 
-		publishreport(id) {
+		publishreport(id,code) {
 			//发布报告
-			reportEnInterface.reportPublish({ ReportIds: String(id) }).then((res) => {
+			return console.log(this.generatePdfLinks(code));
+			reportEnInterface.reportPublish({ ReportIds: String(id),ReportUrl:this.generatePdfLinks(this.publishReportCode)}).then((res) => {
 				if (res.Ret !== 200) return
 				this.isPublishloading = false;
 				this.$router.push({ path: '/reportEnList' });
 			});
 		},
-
+		generatePdfLinks(Code){
+			const baseUrl= localStorage.getItem('dynamicOutLinks') ? JSON.parse(localStorage.getItem('dynamicOutLinks')).ReportViewUrl : '';
+			return `${baseUrl}/reportshare_pdf_en?code=${Code}&flag=${this.waterMarkStr}`
+		},
 		//定时发布报告
 		handleConfirmDSFB(){
 			if(!this.taskTime){
@@ -843,7 +852,8 @@ export default {
 			}
 			reportEnInterface.enReportPrepblish({
 				ReportId:this.report_id,
-				PrePublishTime:this.taskTime
+				PrePublishTime:this.taskTime,
+				ReportUrl:this.generatePdfLinks(this.publishReportCode)
 			}).then(res=>{
 				if(res.Ret===200){
 					this.$message.success(this.$t('ReportManage.smart_msg.timed_success'))
@@ -997,6 +1007,20 @@ export default {
 				}
 			});
 		},
+		getSystemUserInfo(){
+			departInterence.systemUserInfo().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)
+						this.waterMarkStr=Base64.encode(waterMarkString)
+					}
+				}
+			})
+	},
 	},
 	components: {importMyChart,setEnNameDia,importSemantics},
 };

+ 33 - 40
src/views/report_manage/reportEn/reportlist.vue

@@ -584,8 +584,7 @@ export default {
         {label:"群发邮件",permission:this.permissionBtn.isShowBtn('enReportManageBtn','enReport_sendEmail'),States:[2,6],text:'ReportManage.smart_btn.send_email'},
         {label:"群发日志",permission:this.permissionBtn.isShowBtn('enReportManageBtn','enReport_sendEmail'),States:[2,6],text:'ReportManage.smart_btn.send_log'}
       ],
-      systemUserInfo:null,
-      isPdfImgExporting:null
+      waterMarkStr:'',
     };
   },
   mounted() {
@@ -764,7 +763,7 @@ export default {
     publishReport(item) {
       this.$confirm(item.PrePublishTime? this.$t('ReportManage.smart_msg.is_publish_immediately'):this.$t('ReportManage.smart_msg.report_publish_immediately'),this.$t('Confirm.prompt'),{type: 'warning'}).then(()=>{
 
-				reportEnInterface.reportPublish({ReportIds:String(item.Id)}).then(res=>{
+				reportEnInterface.reportPublish({ReportIds:String(item.Id),ReportUrl:this.generatePdfLinks(item.ReportCode)}).then(res=>{
           if(res.Ret!==200) return
           this.$message.success(this.$t('MsgPrompt.publish_msg'));
           this.getTableData();
@@ -773,7 +772,10 @@ export default {
 			})
       
     },
-
+    generatePdfLinks(Code){
+			const baseUrl= localStorage.getItem('dynamicOutLinks') ? JSON.parse(localStorage.getItem('dynamicOutLinks')).ReportViewUrl : '';
+			return `${baseUrl}/reportshare_pdf_en?code=${Code}&flag=${this.waterMarkStr}`
+		},
     /* 编辑报告 */
     editReport(item) {
       //编辑前mark一下
@@ -1024,24 +1026,30 @@ export default {
     // 搞成前面一部分按钮,后面一部分按钮的形式
     getbuttonList(row,type){
       if(!type) return []
+
+      const commonFilter=(but)=>{
+        return but.permission &&
+          (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
+          ( row.CanEdit || (![1,3].includes(row.State)) )
+      }
+
       let buttonArr=this.allButtons.filter(but =>{
+        const commonFilterPass=commonFilter(but)
         if(but.label==='编辑中'){
           return but.permission &&
               (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
               (!row.CanEdit)
         }else if(but.label==='群发邮件'){
-          return but.permission &&
-              (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
-              row.EmailState===0&&row.EmailAuth
+          return commonFilterPass && row.EmailState===0&&row.EmailAuth
         }else if(but.label==='群发日志'){
-          return but.permission &&
-              (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
-              row.EmailState===1&&row.EmailAuth
+          return commonFilterPass && row.EmailState===1&&row.EmailAuth
+        }else if(but.label==='下载Pdf'){
+          return commonFilterPass && row.DetailPdfUrl    
+        }else if(but.label==='下载长图'){
+          return commonFilterPass && row.DetailImgUrl           
         }
 
-        return but.permission &&
-              (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
-              ( row.CanEdit || (![1,3].includes(row.State)) )
+        return commonFilterPass
       })
 
       if(type=='f') return buttonArr.slice(0,2)
@@ -1089,38 +1097,23 @@ export default {
     getSystemUserInfo(){
       departInterence.systemUserInfo().then(res=>{
         if(res.Ret===200){
-          this.systemUserInfo=res.Data
+          const systemUserInfo=res.Data
+          // 设置水印文案
+          let waterMarkString=''
+          if(systemUserInfo){
+            waterMarkString=`${systemUserInfo.RealName}${systemUserInfo.Mobile?systemUserInfo.Mobile:systemUserInfo.Email}`
+            waterMarkString=encodeURIComponent(waterMarkString)
+            this.waterMarkStr=Base64.encode(waterMarkString)
+          }
         }
       })
     },
     downloadPdfImg(row,type){
-      (!this.isPdfImgExporting) && (this.isPdfImgExporting=this.$message({
-          type:"info",
-          message:'下载中···',
-          duration:0,
-          iconClass:'el-icon-loading'
-      }))
-      // 设置水印文案
-      let waterMarkStr=''
-      if(this.systemUserInfo){
-        waterMarkStr=`${this.systemUserInfo.RealName}${this.systemUserInfo.Mobile?this.systemUserInfo.Mobile:this.systemUserInfo.Email}`
-        waterMarkStr=encodeURIComponent(waterMarkStr)
-        waterMarkStr=Base64.encode(waterMarkStr)
+      if(type == 1){
+          window.open(row.DetailPdfUrl,"_blank")
+      }else{
+          this.handleDownloadResource(row.DetailImgUrl,`${row.Title}`)
       }
-      const baseUrl= localStorage.getItem('dynamicOutLinks') ? JSON.parse(localStorage.getItem('dynamicOutLinks')).ReportViewUrl : '';
-      let reportUrl = `${baseUrl}/reportshare_pdf_en?code=${row.ReportCode}&flag=${waterMarkStr}&viewType=!pdf!`
-      report2PdfImg({ReportUrl:reportUrl,ReportCode:row.ReportCode,Type:type}).then(res=>{
-        if(res.Ret == 200 && res.Data){
-          if(res.Data.endsWith('.pdf')){
-            window.open(res.Data,"_blank")
-          }else{
-            this.handleDownloadResource(res.Data,`${row.Title}`)
-          }
-        }
-      }).finally(()=>{
-          this.isPdfImgExporting.close()
-          this.isPdfImgExporting=null
-      })
     }
   },
 };

+ 1 - 1
src/views/report_manage/reportdtl.vue

@@ -83,7 +83,7 @@
 						waterMarkStr=`${this.systemUserInfo.RealName}${this.systemUserInfo.Mobile?this.systemUserInfo.Mobile:this.systemUserInfo.Email}`
 						const base64=new http.Base64()
 						waterMarkStr=encodeURIComponent(waterMarkStr)
-						waterMarkStr=Base64.encode(waterMarkStr)
+						waterMarkStr=base64.encode(waterMarkStr)
 					}
 					
 					if(this.$route.query.fromPage == 'en'){

+ 39 - 47
src/views/report_manage/reportlist.vue

@@ -745,8 +745,8 @@ export default {
         {label:"音频下载A",permission:this.permissionBtn.isShowBtn('reportManageBtn','reportManage_audioDownload'),States:true,text:'ReportManage.smart_audio_download_btn'},
         {label:"音频下载",permission:this.permissionBtn.isShowBtn('reportManageBtn','reportManage_audioDownload'),States:true,text:'ReportManage.smart_audio_download_btn'},
       ],
-      systemUserInfo:null,
-      isPdfImgExporting:null,
+      waterMarkStr:"",
+      publishReportCode:''
     };
   },
   mounted() {
@@ -773,7 +773,7 @@ export default {
     //点击显示下载音频弹窗
     handleShowDownloadAudio(item) {
       this.downloadAudio.show = true;
-      this.downloadAudio.title = item.Title;
+      this.downloadAudio.title = item.Title;  
       this.downloadAudio.list = item.ChapterVideoList;
       this.downloadAudio.select = [];
     },
@@ -1003,6 +1003,7 @@ export default {
       //发布报告
       this.batches = [];
       this.batches.push(item.Id);
+      this.publishReportCode = item.ReportCode
       this.isDSFB=item.PrePublishTime?true:false
 
       // 周报不需要弹窗直接发布
@@ -1050,7 +1051,7 @@ export default {
     // 点击确认发布&推送报告
     // 1 仅发布 2发布且推送
     handlePublic(type) {
-      reportpublish({ ReportIds: this.batches.join(",") }).then((res) => {
+      reportpublish({ ReportIds: this.batches.join(","),ReportUrl:this.generatePdfLinks(this.publishReportCode)}).then((res) => {
         if (res.Ret == 200) {
           if (type == 2) {
             reportMessageSend({
@@ -1082,6 +1083,10 @@ export default {
         }
       });
     },
+    generatePdfLinks(Code){
+			const baseUrl= localStorage.getItem('dynamicOutLinks') ? JSON.parse(localStorage.getItem('dynamicOutLinks')).ReportViewUrl : '';
+			return `${baseUrl}/reportshare_pdf?code=${Code}&flag=${this.waterMarkStr}`
+		},
     handleClosePublish() {
       this.batches = [];
       this.showPublish = false;
@@ -1275,38 +1280,40 @@ export default {
     // 搞成前面一部分按钮,后面一部分按钮的形式
     getbuttonList(row,type){
       if(!type) return []
+
+      const commonFilter=(but)=>{
+        return but.permission &&
+          (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
+          ( row.CanEdit || (![1,3].includes(row.State)) )
+      }
       let buttonArr=this.allButtons.filter(but =>{
+        const commonFilterPass=commonFilter(but)
         if(but.label==='编辑中'){
           return but.permission &&
               (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
               (!row.CanEdit)
         }else if(but.label==='推送消息'){
-          return but.permission &&
-              (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
-              row.MsgIsSend==0
+          return commonFilterPass && row.MsgIsSend==0
         }else if(but.label==='已推送消息'){
-          return but.permission &&
-              (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
-              row.MsgIsSend!==0
-        }else if(['音频上传','下载Pdf','下载长图'].includes(but.label)){
-          return but.permission &&
-              (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
+          return commonFilterPass && row.MsgIsSend!==0
+        }else if(['音频上传'].includes(but.label)){
+          return commonFilterPass&&
               (![this.$t('ReportManage.smart_btn.morning_paper'), this.$t('ReportManage.smart_btn.weekly')].includes(row.ClassifyNameFirst))
         }else if(but.label==='音频下载A'){
-          return but.permission &&
-              (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
+          return commonFilterPass &&
               (![this.$t('ReportManage.smart_btn.morning_paper'), this.$t('ReportManage.smart_btn.weekly')].includes(row.ClassifyNameFirst))&&
               row.VideoUrl
         }else if(but.label==='音频下载'){
-          return but.permission &&
-              (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
+          return commonFilterPass &&
               [this.$t('ReportManage.smart_btn.morning_paper'), this.$t('ReportManage.smart_btn.weekly')].includes(row.ClassifyNameFirst)&&
               row.ChapterVideoList.length > 0                    
+        }else if(but.label==='下载Pdf'){
+          return commonFilterPass && row.DetailPdfUrl    
+        }else if(but.label==='下载长图'){
+          return commonFilterPass && row.DetailImgUrl           
         }
 
-        return but.permission &&
-              (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
-              ( row.CanEdit || (![1,3].includes(row.State)) )
+        return commonFilterPass
       })
 
       if(type=='f') return buttonArr.slice(0,2)
@@ -1357,38 +1364,23 @@ export default {
     getSystemUserInfo(){
       departInterence.systemUserInfo().then(res=>{
         if(res.Ret===200){
-          this.systemUserInfo=res.Data
+          const systemUserInfo=res.Data
+          // 设置水印文案
+          let waterMarkString=''
+          if(systemUserInfo){
+            waterMarkString=`${systemUserInfo.RealName}${systemUserInfo.Mobile?systemUserInfo.Mobile:systemUserInfo.Email}`
+            waterMarkString=encodeURIComponent(waterMarkString)
+            this.waterMarkStr=Base64.encode(waterMarkString)
+          }
         }
       })
     },
     downloadPdfImg(row,type){
-      (!this.isPdfImgExporting) && (this.isPdfImgExporting=this.$message({
-          type:"info",
-          message:'下载中···',
-          duration:0,
-          iconClass:'el-icon-loading'
-      }))
-      // 设置水印文案
-      let waterMarkStr=''
-      if(this.systemUserInfo){
-        waterMarkStr=`${this.systemUserInfo.RealName}${this.systemUserInfo.Mobile?this.systemUserInfo.Mobile:this.systemUserInfo.Email}`
-        waterMarkStr=encodeURIComponent(waterMarkStr)
-        waterMarkStr=Base64.encode(waterMarkStr)
+      if(type == 1){
+          window.open(row.DetailPdfUrl,"_blank")
+      }else{
+          this.handleDownloadResource(row.DetailImgUrl,`${row.Title}`)
       }
-      const baseUrl= localStorage.getItem('dynamicOutLinks') ? JSON.parse(localStorage.getItem('dynamicOutLinks')).ReportViewUrl : '';
-      let reportUrl = `${baseUrl}/reportshare_pdf?code=${row.ReportCode}&flag=${waterMarkStr}&viewType=!pdf!`
-      report2PdfImg({ReportUrl:reportUrl,ReportCode:row.ReportCode,Type:type}).then(res=>{
-        if(res.Ret == 200 && res.Data){
-          if(res.Data.endsWith('.pdf')){
-            window.open(res.Data,"_blank")
-          }else{
-            this.handleDownloadResource(res.Data,`${row.Title}`)
-          }
-        }
-      }).finally(()=>{
-        this.isPdfImgExporting.close()
-        this.isPdfImgExporting=null
-      })
     }
   },
 };

+ 10 - 3
src/views/smartReport/editReport.vue

@@ -1022,7 +1022,8 @@ export default {
                 apiSmartReport.prePublishReport({
                     SmartReportId:Number(this.$route.query.id),
                     PrePublishTime:this.taskTime,
-                    PreMsgSend:0
+                    PreMsgSend:0,
+                    ReportUrl:this.generatePdfLinks(this.reportInfo.ReportCode)
                 }).then(res=>{
                     if(res.Ret===200){
                         this.$message.success(this.$t('ReportManage.smart_msg.timed_success'))
@@ -1048,6 +1049,7 @@ export default {
 								SmartReportId:Number(this.$route.query.id),
 								PrePublishTime:this.taskTime,
 								PreMsgSend:0,
+                                ReportUrl:this.generatePdfLinks(this.reportInfo.ReportCode)
 							}).then(res=>{
 								if(res.Ret===200){
 									this.$message.success(this.$t('ReportManage.smart_msg.timed_success'))
@@ -1061,6 +1063,7 @@ export default {
 							SmartReportId:Number(this.$route.query.id),
 							PrePublishTime:this.taskTime,
 							PreMsgSend:isPost?1:0,
+                            ReportUrl:this.generatePdfLinks(this.reportInfo.ReportCode)
 						}).then(res=>{
 							if(res.Ret===200){
 								this.$message.success(this.$t('ReportManage.smart_msg.timed_success'))
@@ -1077,7 +1080,8 @@ export default {
         reportPublish({sendMsg}){
             apiSmartReport.publishReport({
                 SmartReportId:Number(this.$route.query.id),
-                PublishState:2
+                PublishState:2,
+                ReportUrl:this.generatePdfLinks(this.reportInfo.ReportCode)
             }).then(res=>{
                 if(res.Ret===200){
                     if(sendMsg){
@@ -1087,7 +1091,10 @@ export default {
                 }
             })
         },
-
+        generatePdfLinks(Code){
+            const baseUrl= localStorage.getItem('dynamicOutLinks') ? JSON.parse(localStorage.getItem('dynamicOutLinks')).ReportViewUrl : '';
+            return `${baseUrl}/reportshare_smart_pdf?code=${Code}`
+        },
         //报告消息推送
         reportSendMsg(){
             apiSmartReport.reportMsgSend({SmartReportId:Number(this.$route.query.id)}).then(res=>{})

+ 27 - 45
src/views/smartReport/reportList.vue

@@ -522,6 +522,7 @@ export default {
 
             showPublish:false,
             activeReportId:0,
+            publishReportCode:'',
             isDSFB:false,
 
             reportImgUrl:'',
@@ -549,8 +550,6 @@ export default {
                 {label:"音频上传",permission:this.permissionBtn.isShowBtn('smartReportManageBtn','reportManage_audioUpload'),States:true,text:'ReportManage.smart_audio_upload_btn'},
                 {label:"音频下载",permission:this.permissionBtn.isShowBtn('smartReportManageBtn','reportManage_audioDownload'),States:true,text:'ReportManage.smart_audio_download_btn'},
             ],
-            systemUserInfo:null,
-            isPdfImgExporting:null,
         }
     },
     methods:{
@@ -613,6 +612,7 @@ export default {
         // 发布报告
         handlePublishReportOpt(item){
             this.activeReportId=item.SmartReportId
+            this.publishReportCode=item.ReportCode
             // this.isDSFB=item.PrePublishTime?true:false
             // this.showPublish=true
             if(this.isApprove){
@@ -643,7 +643,7 @@ export default {
             )
         },
         handleConfirmPublishReport(){
-            apiSmartReport.publishReport({ SmartReportId: this.activeReportId,PublishState:2 }).then((res) => {
+            apiSmartReport.publishReport({ SmartReportId: this.activeReportId,ReportUrl:this.generatePdfLinks(this.publishReportCode),PublishState:2}).then((res) => {
                 if (res.Ret === 200) {
                     this.$message.success(res.Msg);
                     this.getReportList();
@@ -651,8 +651,13 @@ export default {
                 }
             });
         },
+        generatePdfLinks(Code){
+            const baseUrl= localStorage.getItem('dynamicOutLinks') ? JSON.parse(localStorage.getItem('dynamicOutLinks')).ReportViewUrl : '';
+            return `${baseUrl}/reportshare_smart_pdf?code=${Code}`
+        },
         handleClosePublish(){
             this.activeReportId=0
+            this.publishReportCode=""
             this.isDSFB=false
             this.showPublish=false
         },
@@ -936,21 +941,29 @@ export default {
         // 搞成前面一部分按钮,后面一部分按钮的形式
         getbuttonList(row,type){
             if(!type) return []
+            const commonFilter=(but)=>{
+                return but.permission &&
+                    (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
+                    ( row.CanEdit || (![1,3].includes(row.State)) )
+            }
+ 
             let buttonArr=this.allButtons.filter(but =>{
+                const commonFilterPass=commonFilter(but) 
                 if(but.label==='编辑中'){
-                return but.permission &&
+                    return but.permission &&
                     (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
                     (!row.CanEdit)
                 }else if(but.label==='音频下载'){
-                return but.permission &&
-                    (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
+                    return commonFilterPass &&
                     [this.$t('ReportManage.smart_btn.morning_paper'), this.$t('ReportManage.smart_btn.weekly')].includes(row.ClassifyNameFirst)&&
                     row.VideoUrl             
+                }else if(but.label==='下载Pdf'){
+                    return commonFilterPass && row.DetailPdfUrl           
+                }else if(but.label==='下载长图'){
+                    return commonFilterPass && row.DetailImgUrl           
                 }
 
-                return but.permission &&
-                    (typeof(but.States)=='boolean' || but.States.includes(row.State) ) &&
-                    ( row.CanEdit || (![1,3].includes(row.State)) )
+                return commonFilterPass
             })
             if(type=='f') return buttonArr.slice(0,2)
             else return buttonArr.slice(2)
@@ -994,49 +1007,18 @@ export default {
                 break;
             }
         },
-        getSystemUserInfo(){
-            departInterence.systemUserInfo().then(res=>{
-                if(res.Ret===200){
-                this.systemUserInfo=res.Data
-                }
-            })
-        },
         downloadPdfImg(row,type){
-            (!this.isPdfImgExporting) && (this.isPdfImgExporting=this.$message({
-                type:"info",
-                message:'下载中···',
-                duration:0,
-                iconClass:'el-icon-loading'
-            }))
-            // 设置水印文案
-            let waterMarkStr=''
-            if(this.systemUserInfo){
-                waterMarkStr=`${this.systemUserInfo.RealName}${this.systemUserInfo.Mobile?this.systemUserInfo.Mobile:this.systemUserInfo.Email}`
-                waterMarkStr=encodeURIComponent(waterMarkStr)
-                waterMarkStr=Base64.encode(waterMarkStr)
+            if(type == 1){
+                window.open(row.DetailPdfUrl,"_blank")
+            }else{
+                this.handleDownloadResource(row.DetailImgUrl,`${row.Title}`)
             }
-            const baseUrl= localStorage.getItem('dynamicOutLinks') ? JSON.parse(localStorage.getItem('dynamicOutLinks')).ReportViewUrl : '';
-            let reportUrl = `${baseUrl}/reportshare_smart_pdf?code=${row.ReportCode}&flag=${waterMarkStr}&viewType=!pdf!`
-            report2PdfImg({ReportUrl:reportUrl,ReportCode:row.ReportCode,Type:type}).then(res=>{
-                if(res.Ret == 200 && res.Data){
-
-                    if(res.Data.endsWith('.pdf')){
-                        window.open(res.Data,"_blank")
-                    }else{
-                        this.handleDownloadResource(res.Data,`${row.Title}`)
-                    }
-                }
-            }).finally(()=>{
-                this.isPdfImgExporting.close()
-                this.isPdfImgExporting=null
-            })
-        }
+        } 
     },
 
     created() {
         this.getclassifylist()
         this.getReportList()
-        this.getSystemUserInfo()
     },
 }
 </script>