ConferenceForm.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <view class="document-form">
  3. <uv-loading-icon v-if="loading" mode="circle" text="正在加载会议详情..."></uv-loading-icon>
  4. <template v-else-if="form">
  5. <!-- 基本信息 -->
  6. <view class="common-section-card">
  7. <view class="section-title">基本信息</view>
  8. <view class="info-row">
  9. <text class="label">会议名称</text>
  10. <text class="value">{{ form.codTitle || '-' }}</text>
  11. </view>
  12. <view class="info-row">
  13. <text class="label">会议类型</text>
  14. <text class="value">{{ getLecTypeLabel(form.codType) }}</text>
  15. </view>
  16. <view class="info-row">
  17. <text class="label">主办单位</text>
  18. <text class="value">{{ form.codOrganizer || '-' }}</text>
  19. </view>
  20. <view class="info-row">
  21. <text class="label">会议日期</text>
  22. <text class="value">{{ form.codStartTime || '-' }} 至 {{ form.codEndTime || '-' }}</text>
  23. </view>
  24. <view class="info-row">
  25. <text class="label">主讲人</text>
  26. <text class="value">{{ form.applicantName || '-' }}</text>
  27. </view>
  28. <view class="info-row">
  29. <text class="label">会议地址</text>
  30. <text class="value">{{ form.codAddress || '-' }}</text>
  31. </view>
  32. <view class="info-row column">
  33. <text class="label">会议简介</text>
  34. <text class="value remark">{{ form.codBriefInfo || '-' }}</text>
  35. </view>
  36. </view>
  37. <!-- 学术贡献 -->
  38. <view class="common-section-card mt20">
  39. <view class="section-title">学术贡献</view>
  40. <view class="info-row">
  41. <text class="label">论文题目</text>
  42. <text class="value">{{ form.paperName || '-' }}</text>
  43. </view>
  44. <view class="info-row">
  45. <text class="label">第一作者</text>
  46. <text class="value">{{ form.firstName || '-' }}</text>
  47. </view>
  48. <view class="info-row">
  49. <text class="label">通讯作者</text>
  50. <text class="value">{{ form.phoneName || '-' }}</text>
  51. </view>
  52. <view class="info-row">
  53. <text class="label">交流方式</text>
  54. <text class="value">{{ getDictLabel('sci_communicate_type', form.communicateType) }}</text>
  55. </view>
  56. <view class="info-row column">
  57. <text class="label">论文摘要</text>
  58. <text class="value remark">{{ form.paperSummary || '-' }}</text>
  59. </view>
  60. </view>
  61. <!-- 相关附件 -->
  62. <view class="common-section-card mt20" v-if="uploadList.length">
  63. <view class="section-title">相关附件</view>
  64. <view class="common-file-list">
  65. <view class="file-item" v-for="(file, index) in uploadList" :key="index" @click="previewFile(file.url, file.name)">
  66. <view class="file-info" v-if="file && file.url">
  67. <text class="f-name">{{ file.name }}</text>
  68. <view class="f-meta">
  69. <text class="f-type">{{ file.type }}</text>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </template>
  76. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  77. </view>
  78. </template>
  79. <script setup lang="ts">
  80. import { ref, onMounted, watch, computed } from 'vue';
  81. import { useDict } from '@/hooks/useDict';
  82. import { useDocumentApi } from '@/api/document';
  83. import { previewFile } from '@/utils/file';
  84. import to from 'await-to-js';
  85. const props = defineProps<{
  86. code: string;
  87. }>();
  88. const { getDictLabel } = useDict('sci_communicate_type');
  89. const documentApi = useDocumentApi();
  90. const form = ref<any>(null);
  91. const loading = ref(false);
  92. const LecTypeList = [
  93. { value: '50', label: '院内会议' },
  94. { value: '10', label: '学校会议' },
  95. { value: '20', label: '省级会议' },
  96. { value: '30', label: '国内学术会议' },
  97. { value: '40', label: '国际学术会议' }
  98. ];
  99. const getLecTypeLabel = (value: string | number) => {
  100. const item = LecTypeList.find(i => i.value === String(value));
  101. return item ? item.label : (value || '-');
  102. };
  103. const uploadList = computed(() => {
  104. if (!form.value) return [];
  105. const list = [];
  106. try {
  107. if (form.value.codNotice) {
  108. const notice = JSON.parse(form.value.codNotice);
  109. if (notice && notice.url) {
  110. list.push({ ...notice, type: '会议通知' });
  111. }
  112. }
  113. if (form.value.codDocument) {
  114. const doc = JSON.parse(form.value.codDocument);
  115. if (doc && doc.url) {
  116. list.push({ ...doc, type: '相关文档' });
  117. }
  118. }
  119. } catch (e) {
  120. console.error('Failed to parse attachment JSON', e);
  121. }
  122. return list;
  123. });
  124. const fetchData = async () => {
  125. if (!props.code) return;
  126. loading.value = true;
  127. const [err, res] = await to(documentApi.getConferenceById(props.code));
  128. if (!err && res?.data) {
  129. form.value = res.data;
  130. }
  131. loading.value = false;
  132. };
  133. onMounted(() => {
  134. fetchData();
  135. });
  136. watch(() => props.code, () => {
  137. fetchData();
  138. });
  139. </script>
  140. <style lang="scss" scoped>
  141. @import "./common.scss";
  142. </style>