SpontaneityForm.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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.projectName" />
  8. <CommonInfoRow label="项目分类" :value="form.projectClazzName" />
  9. <CommonInfoRow label="项目来源" :value="form.projectSource" />
  10. <CommonInfoRow label="项目日期" :value="formatDate(form.startDate) + ' 至 ' + formatDate(form.endDate)" />
  11. <CommonInfoRow label="所属科室" :value="form.deptName" />
  12. <CommonInfoRow label="统计年度" :value="form.statisticalYear" />
  13. <CommonInfoRow label="项目负责人" :value="form.projectLeaderName" />
  14. <CommonInfoRow label="负责人类型" :value="getDictLabel('sci_leader_type', form.projectLeaderType)" />
  15. <CommonInfoRow label="负责人电话" :value="form.projectLeaderPhone" />
  16. <CommonInfoRow label="负责人邮箱" :value="form.projectLeaderMail" />
  17. <CommonInfoRow label="所属平台">
  18. <view class="platform-tags">
  19. <template v-if="platformList.length > 0">
  20. <uv-tags v-for="(p, index) in platformList" :key="index" :text="p.platformName === '其他' ? '其他' : (p.platformType ? p.platformName + ' (' + p.platformType + ')' : p.platformName)" type="primary" plain size="mini" class="mr5"></uv-tags>
  21. </template>
  22. <text v-else>-</text>
  23. </view>
  24. </CommonInfoRow>
  25. <CommonInfoRow label="研究类别" :value="form.researchCategory" isColumn />
  26. <CommonInfoRow label="预期成果" :value="form.expectedResults" isColumn />
  27. <CommonInfoRow label="备注" :value="form.remark" isColumn />
  28. </CommonSection>
  29. <!-- 成员信息 -->
  30. <CommonSection title="成员信息" v-if="form.memberList?.length">
  31. <view class="member-list">
  32. <view class="member-item" v-for="(row, index) in form.memberList" :key="index">
  33. <view class="member-header">
  34. <view class="name-box">
  35. <text class="m-name">{{ row.memberName }}</text>
  36. <text class="m-tag" :class="{ leader: row.projectRole === '10' }">
  37. {{ row.projectRole === '10' ? '负责人' : row.projectRole === '20' ? '主要参与人' : '一般参与人' }}
  38. </text>
  39. </view>
  40. <text class="m-type-tag blue" v-if="row.memberType">{{ getMemberTypeLabel(row.memberType) }}</text>
  41. </view>
  42. <view class="m-body">
  43. <view class="m-line" v-if="row.deptName"><text class="l">单位:</text><text class="v">{{ row.deptName }}</text></view>
  44. <view class="m-line" v-if="row.degree"><text class="l">学位:</text><text class="v">{{ getDictLabel('sci_academic_degree', row.degree) }}</text></view>
  45. <view class="m-line" v-if="row.technicalTitle"><text class="l">职称:</text><text class="v">{{ row.technicalTitle }}</text></view>
  46. <view class="m-line" v-if="row.documentNum">
  47. <text class="l">{{ row.documentType === '10' ? '身份证' : '证件' }}:</text>
  48. <text class="v">{{ row.documentNum }}</text>
  49. </view>
  50. <view class="m-line column" v-if="row.responsibleContent">
  51. <text class="l">负责内容:</text>
  52. <text class="v remark">{{ row.responsibleContent }}</text>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </CommonSection>
  58. <!-- 附件信息 -->
  59. <AttachmentList :list="form.fileList" title="附件资料" />
  60. </template>
  61. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  62. </view>
  63. </template>
  64. <script setup lang="ts">
  65. import { ref, onMounted, watch, computed } from 'vue';
  66. import { useDict } from '@/hooks/useDict';
  67. import { useDocumentApi } from '@/api/document';
  68. import { formatDate } from '@/utils/date';
  69. import to from 'await-to-js';
  70. import CommonSection from '@/components/ui/CommonSection.vue';
  71. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  72. import AttachmentList from './AttachmentList.vue';
  73. const props = defineProps<{
  74. code: string;
  75. }>();
  76. const { getDictLabel } = useDict('sci_leader_type', 'sci_academic_degree');
  77. const documentApi = useDocumentApi();
  78. const form = ref<any>(null);
  79. const loading = ref(false);
  80. const getMemberTypeLabel = (type: string) => {
  81. const map: Record<string, string> = {
  82. '10': '本院人员',
  83. '20': '非本院人员',
  84. '30': '研究生'
  85. };
  86. return map[type] || type;
  87. };
  88. const platformList = computed(() => {
  89. if (form.value?.belongPlatform) {
  90. try {
  91. const data = JSON.parse(form.value.belongPlatform);
  92. return Array.isArray(data) ? data : [];
  93. } catch (e) {
  94. if (form.value.belongPlatform === '其他') return [{ platformName: '其他' }];
  95. return [{ platformName: form.value.belongPlatform }];
  96. }
  97. }
  98. return [];
  99. });
  100. const fetchData = async () => {
  101. if (!props.code) return;
  102. loading.value = true;
  103. const [err, res] = await to(documentApi.getSpontaneityByCode(props.code));
  104. if (!err && res?.data) {
  105. form.value = res.data;
  106. }
  107. loading.value = false;
  108. };
  109. onMounted(() => {
  110. fetchData();
  111. });
  112. watch(() => props.code, () => {
  113. fetchData();
  114. });
  115. </script>
  116. <style lang="scss" scoped>
  117. @import "./common.scss";
  118. </style>