Browse Source

fix:[模板管理]导出

lkf
15881625488@163.com 2 months ago
parent
commit
162267dc3e
1 changed files with 38 additions and 51 deletions
  1. +38
    -51
      src/views/business/study/comp/tbbd/Xq.vue

+ 38
- 51
src/views/business/study/comp/tbbd/Xq.vue View File

@ -25,13 +25,11 @@
</el-button> </el-button>
<el-button type="primary" @click="exportExcel(999)">{{ $t('page.business.study.studyFormFill.dcbhsjgj') }} <el-button type="primary" @click="exportExcel(999)">{{ $t('page.business.study.studyFormFill.dcbhsjgj') }}
</el-button> </el-button>
<el-button type="primary" @click="generatePDF()">前端导出
</el-button>
<div class="edit-content "> <div class="edit-content ">
<div class="content" style="width: 100%; height: 100%;"> <div class="content" style="width: 100%; height: 100%;">
<vue-html2pdf :show-layout="false" pdf-content-width="100%" :pdf-format="'a1'" :pdf-quality="3" :float-layout="false"
pdf-orientation="landscape" :paginate-elements-by-height="794" :enable-download="true" :preview-modal="true"
ref="html2Pdf" @hasStartedGeneration="hasStarted" @hasGenerated="hasGenerated">
<vue-html2pdf :show-layout="false" pdf-content-width="100%" :pdf-format="form.templatePdfSize"
:pdf-quality="2" :float-layout="false" pdf-orientation="landscape" :paginate-elements-by-height="794"
:enable-download="true" :preview-modal="true" ref="html2Pdf" @progress="onProgress">
<section slot="pdf-content"> <section slot="pdf-content">
<div class="pdf-content"> <div class="pdf-content">
<TemplateTable ref="templateTable" :sn="form.templateSn" :templateData="form" fillType="detail" /> <TemplateTable ref="templateTable" :sn="form.templateSn" :templateData="form" fillType="detail" />
@ -39,29 +37,33 @@
<div class="line"></div> <div class="line"></div>
<div class="subtitle"> {{ $t('page.business.study.studyFormFill.qmxx') }}</div> <div class="subtitle"> {{ $t('page.business.study.studyFormFill.qmxx') }}</div>
</div> </div>
<div class="pal">
<el-table :data="qmxxList" v-loading="loadingQmxx">
<el-table-column :label="$t('page.business.study.studyFormFill.qmr')" align="center" prop="qmrMc"
width="150px" />
<el-table-column :label="$t('page.business.study.studyFormFill.qmyy')" align="center"
:prop="$i18n.locale === 'zh_CN' ? 'qmyy' : 'qmyyEn'" width="150px" />
<el-table-column :label="$t('page.business.study.studyFormFill.qmsj')" align="center"
prop="createTime" width="150px" />
<el-table-column :label="$t('page.business.study.studyFormFill.bzyy')" align="center" prop="remark"
:show-overflow-tooltip="true" />
</el-table>
</div>
<div class="pal">
<pagination v-show="totalQmxx > 0" :total="totalQmxx" :page.sync="queryParamsQmxx.pageNum"
:limit.sync="queryParamsQmxx.pageSize" @pagination="getQmxxList" />
</div>
<template v-if="!showExport">
<div class="pal">
<el-table :data="qmxxList" v-loading="loadingQmxx">
<el-table-column :label="$t('page.business.study.studyFormFill.qmr')" align="center" prop="qmrMc"
width="150px" />
<el-table-column :label="$t('page.business.study.studyFormFill.qmyy')" align="center"
:prop="$i18n.locale === 'zh_CN' ? 'qmyy' : 'qmyyEn'" width="150px" />
<el-table-column :label="$t('page.business.study.studyFormFill.qmsj')" align="center"
prop="createTime" width="150px" />
<el-table-column :label="$t('page.business.study.studyFormFill.bzyy')" align="center"
prop="remark" :show-overflow-tooltip="true" />
</el-table>
</div>
<div class="pal" v-if="showExport">
<pagination v-show="totalQmxx > 0" :total="totalQmxx" :page.sync="queryParamsQmxx.pageNum"
:limit.sync="queryParamsQmxx.pageSize" @pagination="getQmxxList" />
</div>
</template>
<div class="content-title"> <div class="content-title">
<div class="line"></div> <div class="line"></div>
<div class="subtitle"> {{ $t('page.business.study.studyFormFill.jcgj') }}</div> <div class="subtitle"> {{ $t('page.business.study.studyFormFill.jcgj') }}</div>
</div> </div>
<JcgjList ref="jcgjList" @handleQuery="getJjcgjList" :showXg="true" />
<pagination v-show="jcgjTotal > 0" small layout="prev, pager, next" :total="jcgjTotal"
@pagination="getJjcgjList" />
<template v-if="!showExport">
<JcgjList ref="jcgjList" @handleQuery="getJjcgjList" :showXg="true" />
<pagination v-show="jcgjTotal > 0" small layout="prev, pager, next" :total="jcgjTotal"
@pagination="getJjcgjList" />
</template>
</div> </div>
</section> </section>
</vue-html2pdf> </vue-html2pdf>
@ -172,7 +174,8 @@ export default {
pageNum: 1, pageNum: 1,
formId: null, formId: null,
pageSize: 9999, pageSize: 9999,
}
},
showExport: false,
} }
}, },
computed: { computed: {
@ -184,20 +187,19 @@ export default {
}, },
methods: { methods: {
onProgress(progress) { onProgress(progress) {
this.progress = progress
console.log(`生成进度: ${progress}%`)
if (progress == 100) {
this.$modal.closeLoading()
}
}, },
hasStarted() {
exportExcel(jcgjlx) {
this.$modal.loading() this.$modal.loading()
console.log('PDF生成开始')
this.showExport = true
setTimeout(() => {
this.$refs.html2Pdf.generatePdf()
}, 200);
}, },
hasGenerated() {
console.log('PDF生成完成')
this.$modal.closeLoading()
},
generatePDF() {
this.$refs.html2Pdf.generatePdf()
},
exportExcel(jcgjlx) {
exportExcel_bak(jcgjlx) {
this.$modal.loading() this.$modal.loading()
studyFormFill_exportDetail(_.merge({}, this.queryParamsJcgj, { jcgjlx: jcgjlx, lang: this.$store.getters.language.split("_")[0] })).then(response => { studyFormFill_exportDetail(_.merge({}, this.queryParamsJcgj, { jcgjlx: jcgjlx, lang: this.$store.getters.language.split("_")[0] })).then(response => {
window.open(process.env.VUE_APP_FILE_DOMAIN + response.msg) window.open(process.env.VUE_APP_FILE_DOMAIN + response.msg)
@ -205,21 +207,6 @@ export default {
this.$modal.closeLoading() this.$modal.closeLoading()
}) })
}, },
dcqbjcgj() {
this.$refs.html2Pdf.generatePdf()
},
dclcjcgj() {
this.$refs.html2Pdf.generatePdf()
},
dcbjjcgj() {
this.$refs.html2Pdf.generatePdf()
},
dcxgjcgj() {
this.$refs.html2Pdf.generatePdf()
},
dcbhsjgj() {
this.$refs.html2Pdf.generatePdf()
},
getJjcgjList(val) { getJjcgjList(val) {
this.$modal.loading() this.$modal.loading()
studyFormFill_jcgj(_.merge({}, this.queryParamsJcgj, val)).then(response => { studyFormFill_jcgj(_.merge({}, this.queryParamsJcgj, val)).then(response => {

Loading…
Cancel
Save