export.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. <component :is="partsSearch" :is_back="true" @toBack="toBack()">
  7. <template v-slot:custombtn>
  8. <el-button type="success" size="small" @click="toExport()">导出</el-button>
  9. </template>
  10. </component>
  11. </el-col>
  12. <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">
  13. <el-col :span="24" class="two_1" style="text-align: center; margin: 10px 0 15px 0; font-weight: none; font-size: 48px; font-family: 仿宋">
  14. 吉林省科学家工作室申报基本信息表
  15. </el-col>
  16. <el-col :span="24" class="two_2" style="padding: 0 0%">
  17. <table border="1" style="border-spacing: 0; width: 100%">
  18. <tr>
  19. <td rowspan="2" class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">科学家工作室</td>
  20. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">名称</td>
  21. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.name }}</td>
  22. </tr>
  23. <tr>
  24. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">专业领域</td>
  25. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.zy_fields_name }}</td>
  26. </tr>
  27. <tr>
  28. <td rowspan="3" class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">依托单位</td>
  29. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">名称</td>
  30. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.company_name }}</td>
  31. </tr>
  32. <tr>
  33. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">联系人</td>
  34. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.company_contact }}</td>
  35. </tr>
  36. <tr>
  37. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">联系方式</td>
  38. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.company_contact_phone }}</td>
  39. </tr>
  40. <tr>
  41. <td :rowspan="sci_num" class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">入驻科学家</td>
  42. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">姓名</td>
  43. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.scientist_name }}</td>
  44. </tr>
  45. <tr>
  46. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">所在单位</td>
  47. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.scientistinfo_company }}</td>
  48. </tr>
  49. <tr>
  50. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">联系方式</td>
  51. <td style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.scientistinfo_phone }}</td>
  52. </tr>
  53. <tr>
  54. <td :rowspan="info.team.length + 1" class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">团队成员</td>
  55. </tr>
  56. <tr v-for="(t, tindex) in info.team" :key="tindex">
  57. <td class="team" style="font-size: 28px; font-family: 仿宋; padding: 8px">
  58. <p style="margin: 0 0 5px 0; font-size: 28px">{{ t.name }}</p>
  59. <p style="margin: 0 0 5px 0; font-size: 28px">职称:{{ t.zc }}</p>
  60. <p style="margin: 0 0 5px 0; font-size: 28px">工作单位:{{ t.company }}</p>
  61. </td>
  62. </tr>
  63. <tr>
  64. <td class="key" style="font-weight: none; font-size: 28px; font-family: 仿宋; padding: 8px">申报日期</td>
  65. <td colspan="2" style="font-size: 28px; font-family: 仿宋; padding: 8px">{{ info.apply_time }}</td>
  66. </tr>
  67. </table>
  68. </el-col>
  69. </el-col>
  70. </el-col>
  71. </el-row>
  72. </div>
  73. </template>
  74. <script lang="ts" setup>
  75. import partsSearch from '@/components/c-search.vue';
  76. import type { Ref } from 'vue';
  77. import { ref, onMounted } from 'vue';
  78. import { useRoute } from 'vue-router';
  79. import { ElMessageBox } from 'element-plus';
  80. import htmlToPdf from '@common/src/util/htmlToPdf.ts';
  81. // #region 接口
  82. import { StudioStore } from '@common/src/stores/studio/studios/studio'; // 列表 // 列表
  83. import { DictDataStore } from '@common/src/stores/users/sysdictdata'; // 字典表
  84. import { ScientistsettleStore } from '@common/src/stores/studio/studios/scientistsettle';
  85. import { UnitStudioApplyStore } from '@common/src/stores/studio/role/unitStudioApply';
  86. import { UserStudioApplyStore } from '@common/src/stores/studio/role/userStudioApply';
  87. import type { IQueryResult } from '@/util/types.util';
  88. const studio = StudioStore();
  89. const sysdictdata = DictDataStore();
  90. const scientistsettle = ScientistsettleStore();
  91. const unitStudioApply = UnitStudioApplyStore();
  92. const userStudioApply = UserStudioApplyStore();
  93. let route = useRoute();
  94. interface Item {}
  95. interface teamItem {
  96. name: string;
  97. zc: string;
  98. company: string;
  99. }
  100. // #endregion
  101. // #region 数据
  102. // 依托单位基本信息
  103. let unitInfo: Ref<{ unit_contact: string; unit_phone: { phone: string } }> = ref({ unit_contact: '', unit_phone: { phone: '' } });
  104. // 科学家信息
  105. let sciInfo: Ref<{ company: string; phone: { phone: string } }> = ref({ company: '', phone: { phone: '' } });
  106. let info: Ref<{
  107. team: Array<teamItem>;
  108. zy_fields: Array<Item>;
  109. name: string;
  110. zy_fields_name: string;
  111. company_name: string;
  112. company_contact: string;
  113. company_contact_phone: string;
  114. scientist_name: string;
  115. scientistinfo_company: string;
  116. scientistinfo_phone: string;
  117. apply_time: string;
  118. }> = ref({
  119. team: [],
  120. zy_fields: [],
  121. name: '',
  122. zy_fields_name: '',
  123. company_name: '',
  124. company_contact: '',
  125. company_contact_phone: '',
  126. scientist_name: '',
  127. scientistinfo_company: '',
  128. scientistinfo_phone: '',
  129. apply_time: '',
  130. });
  131. let fieldList: Ref<any[]> = ref([]);
  132. // 入驻科学家入驻条数
  133. let sci_num: Ref<number> = ref(0);
  134. let loading: Ref<boolean> = ref(false);
  135. let company_id = route.query.company_id;
  136. let scientistinfo_id = route.query.scientistinfo_id;
  137. let id = route.query.id;
  138. // #endregion
  139. onMounted(async () => {
  140. await searchOther();
  141. await searchunitBasic();
  142. await searchsciBasic();
  143. await search();
  144. });
  145. // 查询企业基本信息
  146. const searchunitBasic = async () => {
  147. if (company_id) {
  148. const res: IQueryResult = await unitStudioApply.fetch(company_id);
  149. unitInfo.value = res.data as { unit_contact: string; unit_phone: { phone: string } };
  150. }
  151. };
  152. // 查询科学家基本信息
  153. const searchsciBasic = async () => {
  154. if (scientistinfo_id) {
  155. const res: IQueryResult = await userStudioApply.fetch(scientistinfo_id);
  156. sciInfo.value = res.data as { company: string; phone: { phone: string } };
  157. }
  158. };
  159. const search = async () => {
  160. if (id) {
  161. const res: IQueryResult = await studio.fetch(id);
  162. let infos = res.data as {
  163. team: Array<teamItem>;
  164. zy_fields: Array<Item>;
  165. name: string;
  166. zy_fields_name: string;
  167. company_name: string;
  168. company_contact: string;
  169. company_contact_phone: string;
  170. scientist_name: string;
  171. scientistinfo_company: string;
  172. scientistinfo_phone: string;
  173. apply_time: string;
  174. };
  175. infos.team = await sarchTeam();
  176. if (infos.zy_fields && infos.zy_fields.length > 0) infos.zy_fields_name = searchDict(infos.zy_fields, 'fieldList');
  177. infos.company_contact = unitInfo.value.unit_contact;
  178. infos.company_contact_phone = unitInfo.value.unit_phone.phone;
  179. infos.scientistinfo_company = sciInfo.value.company;
  180. infos.scientistinfo_phone = sciInfo.value.phone.phone;
  181. sci_num.value = 4 + infos.team.length;
  182. info.value = infos;
  183. }
  184. };
  185. // 查询团队信息
  186. const sarchTeam = async () => {
  187. let list = [];
  188. let res = await scientistsettle.query({ studio_id: id });
  189. if (res.total > 0) {
  190. let data = res.data[0];
  191. list = data.team;
  192. }
  193. return list;
  194. };
  195. const searchDict = (e, type) => {
  196. let data = [];
  197. for (const val of e) {
  198. let info = [type].find((i) => i.dict_value == val);
  199. if (info) data.push(info.dict_label);
  200. }
  201. return data.join(',');
  202. };
  203. // 导出
  204. const toExport = () => {
  205. ElMessageBox.confirm('您确认要导出此信息吗', '提示', {
  206. confirmButtonText: '确认',
  207. cancelButtonText: '取消',
  208. type: 'warning',
  209. }).then(async () => {
  210. loading.value = true;
  211. let ele = document.querySelector('#demo');
  212. let pdfName = info.value.name;
  213. htmlToPdf.createPDF(ele, pdfName, { is_water: false, water: ``, is_show: 'p' });
  214. loading.value = false;
  215. });
  216. };
  217. // 返回
  218. const toBack = () => {
  219. window.history.go(-1);
  220. };
  221. // 查询其他信息
  222. const searchOther = async () => {
  223. // 专业领域
  224. const p1: IQueryResult = await sysdictdata.query({ dict_type: 'studio_field' });
  225. fieldList.value = p1.data as [];
  226. };
  227. </script>
  228. <style lang="scss" scoped></style>