ConferenceForm.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. <CommonSection title="基本信息" :isFirst="true">
  7. <CommonInfoRow label="会议名称" :value="form.codTitle" />
  8. <CommonInfoRow label="会议类型" :value="getLecTypeLabel(form.codType)" />
  9. <CommonInfoRow label="主办单位" :value="form.codOrganizer" />
  10. <CommonInfoRow label="会议日期" :value="formatDate(form.codStartTime) + ' 至 ' + formatDate(form.codEndTime)" />
  11. <CommonInfoRow label="主讲人" :value="form.applicantName" />
  12. <CommonInfoRow label="会议地址" :value="form.codAddress" />
  13. <CommonInfoRow label="所属平台">
  14. <view class="platform-tags">
  15. <template v-if="platformList.length > 0">
  16. <uv-tags v-for="(item, index) in platformList" :key="index" :text="item.platformName === '其他' ? '其他' : (item.platformType ? item.platformName + ' (' + item.platformType + ')' : item.platformName)" type="primary" plain size="mini" class="mr5"></uv-tags>
  17. </template>
  18. <text v-else>-</text>
  19. </view>
  20. </CommonInfoRow>
  21. <CommonInfoRow label="所属团队" :value="form.belongTeam || '-'" />
  22. <CommonInfoRow label="会议简介" :value="form.codBriefInfo" isColumn />
  23. </CommonSection>
  24. <!-- 学术贡献 -->
  25. <CommonSection title="学术贡献">
  26. <CommonInfoRow label="论文题目" :value="form.paperName" />
  27. <CommonInfoRow label="第一作者" :value="form.firstName" />
  28. <CommonInfoRow label="通讯作者" :value="form.phoneName" />
  29. <CommonInfoRow label="交流方式" :value="getDictLabel('sci_communicate_type', form.communicateType)" />
  30. <CommonInfoRow label="论文摘要" :value="form.paperSummary" isColumn />
  31. </CommonSection>
  32. <!-- 相关附件 -->
  33. <AttachmentList :list="uploadList" title="相关附件" />
  34. <!-- 审批记录 -->
  35. <CommonSection title="审批记录" v-if="form.id">
  36. <FlowTable :id="form.id" :businessCode="String(form.id)" defCode="sci_academic_conferences" />
  37. </CommonSection>
  38. </template>
  39. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  40. </view>
  41. </template>
  42. <script setup lang="ts">
  43. import { ref, onMounted, watch, computed } from 'vue';
  44. import { useDict } from '@/hooks/useDict';
  45. import { useDocumentApi } from '@/api/document';
  46. import { formatDate } from '@/utils/date';
  47. import { previewFile } from '@/utils/file';
  48. import to from 'await-to-js';
  49. import AttachmentList from './AttachmentList.vue';
  50. import FlowTable from '@/pages/project/components/detail/FlowTable.vue';
  51. import CommonSection from '@/components/ui/CommonSection.vue';
  52. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  53. const props = defineProps<{
  54. code: string;
  55. }>();
  56. const { getDictLabel } = useDict('sci_communicate_type');
  57. const documentApi = useDocumentApi();
  58. const form = ref<any>(null);
  59. const loading = ref(false);
  60. const LecTypeList = [
  61. { value: '50', label: '院内会议' },
  62. { value: '10', label: '学校会议' },
  63. { value: '20', label: '省级会议' },
  64. { value: '30', label: '国内学术会议' },
  65. { value: '40', label: '国际学术会议' }
  66. ];
  67. const getLecTypeLabel = (value: string | number) => {
  68. const item = LecTypeList.find(i => i.value === String(value));
  69. return item ? item.label : (value || '-');
  70. };
  71. const platformList = computed(() => {
  72. if (form.value?.belongPlatform) {
  73. try {
  74. const data = JSON.parse(form.value.belongPlatform);
  75. if (Array.isArray(data) && data.length > 0) {
  76. return data;
  77. }
  78. } catch (e) {
  79. return [];
  80. }
  81. }
  82. return [];
  83. });
  84. const uploadList = computed(() => {
  85. if (!form.value) return [];
  86. const list = [];
  87. try {
  88. if (form.value.codNotice) {
  89. const notice = JSON.parse(form.value.codNotice);
  90. if (notice && notice.url) {
  91. list.push({ ...notice, type: '会议通知' });
  92. }
  93. }
  94. if (form.value.codDocument) {
  95. const doc = JSON.parse(form.value.codDocument);
  96. if (doc && doc.url) {
  97. list.push({ ...doc, type: '相关文档' });
  98. }
  99. }
  100. } catch (e) {
  101. console.error('Failed to parse attachment JSON', e);
  102. }
  103. return list;
  104. });
  105. const fetchData = async () => {
  106. if (!props.code) return;
  107. loading.value = true;
  108. const [err, res] = await to(documentApi.getConferenceById(props.code));
  109. if (!err && res?.data) {
  110. form.value = res.data;
  111. }
  112. loading.value = false;
  113. };
  114. onMounted(() => {
  115. fetchData();
  116. });
  117. watch(() => props.code, () => {
  118. fetchData();
  119. });
  120. </script>
  121. <style lang="scss" scoped>
  122. @import "./common.scss";
  123. </style>