preview.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div id="preview">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="top">
  6. <el-button type="primary" size="mini" @click="download">PDF下载</el-button>
  7. <el-button type="primary" size="mini" @click="back">返回</el-button>
  8. </el-col>
  9. <el-col :span="24" class="down">
  10. <div id="demo">
  11. <el-col :span="24" class="common one">
  12. <el-col :span="24" class="title"> {{ form.basic.achieve_name }}({{ type == '1' ? '专家评分鉴定意见' : '专家会审鉴定意见' }}) </el-col>
  13. <listpdf :list="list"></listpdf>
  14. </el-col>
  15. </div>
  16. </el-col>
  17. </el-col>
  18. </el-row>
  19. </div>
  20. </template>
  21. <script>
  22. import listpdf from './parts/listpdf.vue';
  23. import htmlToPdf from '@/unit/htmlToPdf.js';
  24. import { mapState, createNamespacedHelpers } from 'vuex';
  25. const { mapActions: achieveApply } = createNamespacedHelpers('achieveApply');
  26. const { mapActions: achieveApplyExpert } = createNamespacedHelpers('achieveApplyExpert');
  27. export default {
  28. name: 'preview',
  29. props: {},
  30. components: { listpdf },
  31. data: function() {
  32. return {
  33. form: {
  34. // 基本信息
  35. basic: {},
  36. // 信息简介
  37. brief: {},
  38. // 参加人员
  39. research: [],
  40. // 图片
  41. file: {},
  42. },
  43. list: [],
  44. };
  45. },
  46. async created() {
  47. await this.search();
  48. },
  49. methods: {
  50. ...achieveApply(['fetch', 'update']),
  51. ...achieveApplyExpert(['query']),
  52. async search({ skip, limit = 10, ...info } = {}) {
  53. if (this.id) {
  54. let res = await this.fetch(this.id);
  55. if (this.$checkRes(res)) {
  56. this.$set(this, 'form', res.data);
  57. }
  58. res = await this.query({ ...info, apply_id: this.id, expert: true, type: this.type });
  59. if (this.$checkRes(res)) {
  60. this.$set(this, `list`, res.data);
  61. }
  62. }
  63. },
  64. // PDF下载
  65. download() {
  66. htmlToPdf.downloadPDF(document.querySelector('#demo'), '专家意见');
  67. },
  68. // 返回
  69. back() {
  70. if (this.type == '1') {
  71. this.$router.push({ path: '/adminScore/detail', query: { id: this.id } });
  72. } else if (this.type == '2') {
  73. this.$router.push({ path: '/adminMeet/expert', query: { id: this.id } });
  74. }
  75. },
  76. },
  77. computed: {
  78. ...mapState(['user']),
  79. id() {
  80. return this.$route.query.id;
  81. },
  82. type() {
  83. return this.$route.query.type;
  84. },
  85. },
  86. metaInfo() {
  87. return { title: this.$route.meta.title };
  88. },
  89. watch: {
  90. test: {
  91. deep: true,
  92. immediate: true,
  93. handler(val) {},
  94. },
  95. },
  96. };
  97. </script>
  98. <style lang="less" scoped>
  99. .main {
  100. .top {
  101. text-align: center;
  102. margin: 0 0 15px 0;
  103. }
  104. .down {
  105. padding: 0 20%;
  106. #demo {
  107. width: 100%;
  108. height: 1389px;
  109. border: 1px solid #ff0000;
  110. .one {
  111. height: 1389px;
  112. padding: 20px;
  113. .title {
  114. text-align: center;
  115. margin: 0 0 10px 0;
  116. font-size: 18px;
  117. font-family: monospace;
  118. font-weight: bold;
  119. }
  120. }
  121. }
  122. }
  123. }
  124. .common {
  125. width: 100%;
  126. height: 1389px;
  127. border-bottom: 1px solid #666666;
  128. padding: 40px 20px;
  129. }
  130. </style>