export.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <div id="info">
  3. <el-row>
  4. <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
  5. <el-col :span="24" class="one">
  6. <c-search :is_back="true" @toBack="toBack()">
  7. <template v-slot="custombtn">
  8. <el-button type="success" size="small" @click="toExport()">导出</el-button>
  9. <!-- <el-button type="success" size="small" v-print="{ id: 'demo', popTitle: info.name }">打印</el-button> -->
  10. </template>
  11. </c-search>
  12. </el-col>
  13. <el-col :span="24" class="two" id="demo" ref="print" style="box-shadow: 0 0 10px #f1f1f1; margin: 0 0 10px 0; padding: 10px 200px">
  14. <el-col :span="24" class="two_1" style="text-align: center; margin: 10px 0 15px 0; font-weight: none; font-size: 48px; font-family: 仿宋">
  15. 吉林省科学家工作室申报基本信息表
  16. </el-col>
  17. <el-col :span="24" class="two_2" style="padding: 0 0%">
  18. <table border="1" style="border-spacing: 0; width: 100%">
  19. <tr>
  20. <td rowspan="2" class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">科学家工作室</td>
  21. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">名称</td>
  22. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.name }}</td>
  23. </tr>
  24. <tr>
  25. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">专业领域</td>
  26. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.zy_fields_name }}</td>
  27. </tr>
  28. <tr>
  29. <td rowspan="3" class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">依托单位</td>
  30. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">名称</td>
  31. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.company_name }}</td>
  32. </tr>
  33. <tr>
  34. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">联系人</td>
  35. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.company_contact }}</td>
  36. </tr>
  37. <tr>
  38. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">联系方式</td>
  39. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.company_contact_phone }}</td>
  40. </tr>
  41. <tr>
  42. <td :rowspan="sci_num" class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">入驻科学家</td>
  43. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">姓名</td>
  44. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.scientist_name }}</td>
  45. </tr>
  46. <tr>
  47. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">所在单位</td>
  48. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.scientistinfo_company }}</td>
  49. </tr>
  50. <tr>
  51. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">联系方式</td>
  52. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.scientistinfo_phone }}</td>
  53. </tr>
  54. <tr>
  55. <td :rowspan="info.team.length + 1" class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">团队成员</td>
  56. </tr>
  57. <tr v-for="(t, tindex) in info.team" :key="tindex">
  58. <td class="team" style="font-size: 28px; font-family: 仿宋; padding: 8px">
  59. <p style="margin: 0 0 5px 0; font-size: 28px">{{ t.name }}</p>
  60. <p style="margin: 0 0 5px 0; font-size: 28px">职称:{{ t.zc }}</p>
  61. <p style="margin: 0 0 5px 0; font-size: 28px">工作单位:{{ t.company }}</p>
  62. </td>
  63. </tr>
  64. <tr>
  65. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">申报日期</td>
  66. <td colspan="2" style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.apply_time }}</td>
  67. </tr>
  68. </table>
  69. </el-col>
  70. </el-col>
  71. </el-col>
  72. </el-row>
  73. </div>
  74. </template>
  75. <script>
  76. import { mapState, createNamespacedHelpers } from 'vuex';
  77. const { mapActions } = createNamespacedHelpers('studio');
  78. const { mapActions: scientistsettle } = createNamespacedHelpers('scientistsettle');
  79. const { mapActions: sysdictdata } = createNamespacedHelpers('sysdictdata');
  80. const { mapActions: unitStudioApply } = createNamespacedHelpers('unitStudioApply');
  81. const { mapActions: userStudioApply } = createNamespacedHelpers('userStudioApply');
  82. import htmlToPdf from '@common/src/util/htmlToPdf.js';
  83. export default {
  84. name: 'info',
  85. props: {},
  86. components: {},
  87. data: function () {
  88. return {
  89. // 依托单位基本信息
  90. unitInfo: {},
  91. // 科学家信息
  92. sciInfo: {},
  93. info: { team: [], zy_fields: [] },
  94. fieldList: [],
  95. // 入驻科学家入驻条数
  96. sci_num: 0,
  97. loading: false,
  98. };
  99. },
  100. async created() {
  101. await this.searchOther();
  102. await this.searchunitBasic();
  103. await this.searchsciBasic();
  104. await this.search();
  105. },
  106. methods: {
  107. ...mapActions(['fetch']),
  108. ...scientistsettle(['query']),
  109. ...sysdictdata({ dQuery: 'query' }),
  110. ...unitStudioApply({ uFetch: 'fetch' }),
  111. ...userStudioApply({ sFetch: 'fetch' }),
  112. // 查询企业基本信息
  113. async searchunitBasic() {
  114. if (this.company_id) {
  115. let res = await this.uFetch(this.company_id);
  116. if (this.$checkRes(res)) {
  117. this.$set(this, `unitInfo`, res.data);
  118. }
  119. }
  120. },
  121. // 查询科学家基本信息
  122. async searchsciBasic() {
  123. if (this.scientistinfo_id) {
  124. let res = await this.sFetch(this.scientistinfo_id);
  125. if (this.$checkRes(res)) {
  126. this.$set(this, `sciInfo`, res.data);
  127. }
  128. }
  129. },
  130. async search() {
  131. if (this.id) {
  132. let res = await this.fetch(this.id);
  133. if (this.$checkRes(res)) {
  134. let info = res.data;
  135. info.team = await this.sarchTeam();
  136. if (info.zy_fields && info.zy_fields.length > 0) info.zy_fields_name = this.searchDict(info.zy_fields, 'fieldList');
  137. info.company_contact = this.unitInfo.unit_contact;
  138. info.company_contact_phone = this.unitInfo.unit_phone.phone;
  139. info.scientistinfo_company = this.sciInfo.company;
  140. info.scientistinfo_phone = this.sciInfo.phone.phone;
  141. this.$set(this, `sci_num`, 4 + info.team.length);
  142. this.$set(this, `info`, info);
  143. }
  144. }
  145. },
  146. // 查询团队信息
  147. async sarchTeam() {
  148. let list = [];
  149. let res = await this.query({ studio_id: this.id });
  150. if (this.$checkRes(res)) {
  151. if (res.total > 0) {
  152. let data = res.data[0];
  153. list = data.team;
  154. }
  155. }
  156. return list;
  157. },
  158. searchDict(e, type) {
  159. let data = [];
  160. for (const val of e) {
  161. let info = this[type].find((i) => i.dict_value == val);
  162. if (info) data.push(info.dict_label);
  163. }
  164. return data.join(',');
  165. },
  166. // 导出
  167. toExport() {
  168. let that = this;
  169. this.$confirm('您确认要导出此信息吗?', '提示', {
  170. confirmButtonText: '确定',
  171. cancelButtonText: '取消',
  172. type: 'warning',
  173. })
  174. .then(() => {
  175. that.loading = true;
  176. let ele = document.querySelector('#demo');
  177. let pdfName = this.info.name;
  178. htmlToPdf.createPDF(ele, pdfName);
  179. that.loading = false;
  180. })
  181. .catch(() => {});
  182. },
  183. // 返回
  184. toBack() {
  185. window.history.go('-1');
  186. },
  187. // 查询其他信息
  188. async searchOther() {
  189. let res;
  190. // 专业领域
  191. res = await this.dQuery({ dict_type: 'studio_field' });
  192. if (this.$checkRes(res)) {
  193. this.$set(this, `fieldList`, res.data);
  194. }
  195. },
  196. },
  197. computed: {
  198. ...mapState(['user']),
  199. id() {
  200. return this.$route.query.id;
  201. },
  202. company_id() {
  203. return this.$route.query.company_id;
  204. },
  205. scientistinfo_id() {
  206. return this.$route.query.scientistinfo_id;
  207. },
  208. },
  209. metaInfo() {
  210. return { title: this.$route.meta.title };
  211. },
  212. watch: {
  213. test: {
  214. deep: true,
  215. immediate: true,
  216. handler(val) {},
  217. },
  218. },
  219. };
  220. </script>
  221. <style lang="scss" scoped>
  222. // .main {
  223. // .two {
  224. // box-shadow: 0 0 10px #f1f1f1;
  225. // margin: 0 0 10px 0;
  226. // padding: 10px 20px;
  227. // .two_1 {
  228. // text-align: center;
  229. // margin: 0 0 1vw 0;
  230. // font-weight: none;
  231. // font-size: 30px;
  232. // font-family: 仿宋;
  233. // }
  234. // .two_2 {
  235. // padding: 0 14%;
  236. // table {
  237. // tr {
  238. // td {
  239. // font-size: 28px;
  240. // font-family: 仿宋;
  241. // padding: 8px;
  242. // }
  243. // .team {
  244. // p {
  245. // margin: 0 0 5px 0;
  246. // font-size: 14px;
  247. // }
  248. // }
  249. // .key {
  250. // font-weight: none;
  251. // }
  252. // }
  253. // }
  254. // }
  255. // }
  256. // }
  257. </style>