Browse Source

月报2.0改造(4.9):月报预览

洪海涛 4 năm trước cách đây
mục cha
commit
a9b762898f

+ 8 - 0
src/api/qualityMonthlyReport/edit.js

@@ -188,6 +188,14 @@ export function getMonthlyReportPreView(reportId) {
     method: 'get'
   })
 }
+// 月报PDF阅览
+export function getMonthlyReportPrePdfView(reportId) {
+  return request({
+    url: projectManagementUrl + '/monthlyReport/getMonthlReportPdfPreview?id=' + reportId,
+    timeout: '100000',
+    method: 'get'
+  })
+}
 
 // 获取月报负责人
 // /monthlyReport/getDeptCharge

+ 46 - 1
src/views/monthlyReport/childrenPage/editReport/index.vue

@@ -36,6 +36,15 @@
         >
           取消
         </el-button>
+        <el-button
+          v-if="pageType.search(/All/) > -1 && pageDate && pageDate.status === 20 && (roleCode === 100 || roleCode === 0)"
+          slot="reference"
+          type="primary"
+          size="small"
+          @click="dialogOpen('dialogViewPdf')"
+        >
+          PDF预览
+        </el-button>
         <el-button
           v-if="pageType.search(/All/) > -1 && pageDate && pageDate.status === 20 && (roleCode === 100 || roleCode === 0)"
           slot="reference"
@@ -166,6 +175,7 @@
       is-succes
       :show-dialog="false"
       :title="'邮件预览'"
+      submit-button="发布"
       width="70%"
       @succes="publishAllReport">
       <div class="report-delete" style="text-align: initial;min-height: 30vh;max-height: 70vh;overflow-y: scroll;">
@@ -173,6 +183,22 @@
         <div v-if="monthlyReportPreView" style="" v-html="monthlyReportPreView.content" />
       </div>
     </normal-dialog>
+    <!-- 月报pdf预览 -->
+    <normal-dialog
+      ref="dialogViewPdf"
+      class="view-report"
+      style="margin-top: 5vh"
+      is-succes
+      :show-dialog="false"
+      :title="'PDF预览'"
+      submit-button="下载"
+      width="70%"
+      @succes="downloadReportPdf">
+      <div class="report-delete" style="text-align: initial;min-height: 30vh;max-height: 70vh;overflow-y: scroll;">
+        <!--        月报数据已检查无误,确认发布?-->
+        <div v-if="monthlyReportPrePdfView" style="" v-html="monthlyReportPrePdfView" />
+      </div>
+    </normal-dialog>
     <!-- 月报确认 -->
     <normal-dialog
       ref="dialogConfirm"
@@ -197,7 +223,8 @@ import Menu from './components/menu'
 import Core from './components/core'
 import Clickoutside from 'element-ui/src/utils/clickoutside'
 import normalDialog from '@/components/dialog/normalDialog'
-import { getMonthlyReportPreView } from '@/api/qualityMonthlyReport/edit'
+import { projectManagementUrl } from '@/apiConfig/api'
+import { getMonthlyReportPreView, getMonthlyReportPrePdfView } from '@/api/qualityMonthlyReport/edit'
 
 export default {
   name: '',
@@ -217,6 +244,7 @@ export default {
       anchorActive: '',
       bodyLoading: false,
       monthlyReportPreView: null,
+      monthlyReportPrePdfView: null,
       scrollTop: 0
     }
   },
@@ -424,6 +452,13 @@ export default {
         }
       })
     },
+    // 下载月报pdf
+    downloadReportPdf(key) {
+      this.$refs['dialogViewPdf'].visible = false
+      const { reportId } = this.$route.query
+      const url = `${projectManagementUrl}/monthlyReport/downloadMonthlyReport?id=${reportId}&refrash=true`
+      window.open(url, '_blank')
+    },
     tabClick(tab, event) {
       this.bodyLoading = true
       this.$store.dispatch('monthlyReportEdit/tabActiveChange', {
@@ -439,6 +474,9 @@ export default {
       if (key === 'dialogPublishAll') {
         this.setMonthlyReportPreView()
       }
+      if (key === 'dialogViewPdf') {
+        this.setMonthlyReportPrePdfView()
+      }
       this.$refs[key].visible = true
     },
     sendReport(key) {
@@ -492,6 +530,13 @@ export default {
         this.monthlyReportPreView = res.data
       }
     },
+    // 月报Pdf预览
+    async setMonthlyReportPrePdfView() {
+      const res = await getMonthlyReportPrePdfView(this.$route.query.reportId)
+      if (res.code === 200) {
+        this.monthlyReportPrePdfView = res.data
+      }
+    },
     // 埋点
     monthlyReportBuriedPoint() {
       const { pageType, type } = this.$route.query