AchAwardsAuthForm.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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.awardCode || '-'" />
  8. <CommonInfoRow label="获奖项目名称" :value="form.projectSource || '-'" />
  9. <CommonInfoRow label="获奖类别" :value="form.awardType === '10' ? '教学成果' : form.awardType === '20' ? '科研奖项' : '-'" />
  10. <CommonInfoRow label="获奖等级" :value="getDictLabel('sci_awards_grade', form.awardGrade)" />
  11. <CommonInfoRow label="获奖级别" :value="getDictLabel('sci_awards_level', form.awardLevel)" />
  12. <CommonInfoRow label="奖项所属年度" :value="form.awardYear || '-'" />
  13. <CommonInfoRow label="批文年月日" :value="formatDate(form.awardDate)" />
  14. <CommonInfoRow label="完成单位" :value="form.completionUnit || '-'" />
  15. <CommonInfoRow label="颁奖机构" :value="form.awardIssueAuthority || '-'" />
  16. <CommonInfoRow label="获奖金额(万元)" :value="form.awardAmount || '-'" />
  17. <CommonInfoRow label="所属平台">
  18. <view class="platform-tags">
  19. <template v-if="platformList.length > 0">
  20. <text v-for="(p, index) in platformList" :key="index" class="platform-tag">
  21. {{ p.platformName }}
  22. </text>
  23. </template>
  24. <text v-else>-</text>
  25. </view>
  26. </CommonInfoRow>
  27. <CommonInfoRow label="所属团队" :value="form.belongTeam || '-'" />
  28. <CommonInfoRow label="备注" :value="form.remark || '-'" isColumn />
  29. </CommonSection>
  30. <!-- 获奖人信息 -->
  31. <CommonSection title="获奖人信息" v-if="form.memberList?.length">
  32. <view class="member-list">
  33. <view class="member-item" v-for="(row, index) in form.memberList" :key="index">
  34. <view class="member-header">
  35. <view class="name-box">
  36. <text class="m-name">{{ row.memberName }}</text>
  37. <text class="m-tag">{{ row.memberType === '10' ? '负责人' : '成员' }}</text>
  38. </view>
  39. </view>
  40. <view class="m-body">
  41. <view class="m-line" v-if="row.deptName"><text class="l">所属部门:</text><text class="v">{{ row.deptName }}</text></view>
  42. </view>
  43. </view>
  44. </view>
  45. </CommonSection>
  46. <!-- 附件信息 -->
  47. <AttachmentList :list="mergedFileList" title="附件列表" />
  48. </template>
  49. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  50. </view>
  51. </template>
  52. <script setup lang="ts">
  53. import { ref, onMounted, watch, computed } from 'vue';
  54. import { useDict } from '@/hooks/useDict';
  55. import { useDocumentApi } from '@/api/document';
  56. import { formatDate } from '@/utils/date';
  57. import to from 'await-to-js';
  58. import AttachmentList from './AttachmentList.vue';
  59. import CommonSection from '@/components/ui/CommonSection.vue';
  60. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  61. const props = defineProps<{
  62. code: string;
  63. }>();
  64. const { getDictLabel } = useDict('sci_awards_grade', 'sci_awards_level');
  65. const documentApi = useDocumentApi();
  66. const form = ref<any>(null);
  67. const loading = ref(false);
  68. const platformList = computed(() => {
  69. if (form.value?.belongPlatform) {
  70. try {
  71. const data = JSON.parse(form.value.belongPlatform);
  72. return Array.isArray(data) ? data : [];
  73. } catch (e) {
  74. if (form.value.belongPlatform === '其他') return [{ platformName: '其他' }];
  75. return [{ platformName: form.value.belongPlatform }];
  76. }
  77. }
  78. return [];
  79. });
  80. const mergedFileList = computed(() => {
  81. if (!form.value?.fileList?.length) return [];
  82. return form.value.fileList.map((item: any) => ({
  83. fileName: item.name,
  84. fileUrl: item.url,
  85. fileType: '附件'
  86. }));
  87. });
  88. const fetchData = async () => {
  89. if (!props.code) return;
  90. loading.value = true;
  91. const awardCode = props.code.includes('-') ? props.code.split('-')[1] : props.code;
  92. const [err, res] = await to(documentApi.getAwardsByCode(awardCode));
  93. if (!err && res?.data) {
  94. form.value = res.data;
  95. }
  96. loading.value = false;
  97. };
  98. onMounted(() => {
  99. fetchData();
  100. });
  101. watch(() => props.code, () => {
  102. fetchData();
  103. });
  104. </script>
  105. <style lang="scss" scoped>
  106. @import "./common.scss";
  107. .platform-tags {
  108. display: flex;
  109. flex-wrap: wrap;
  110. justify-content: flex-end;
  111. gap: 8rpx;
  112. .platform-tag {
  113. font-size: 20rpx;
  114. padding: 2rpx 12rpx;
  115. background-color: #f6f8fa;
  116. color: #64748b;
  117. border-radius: 4rpx;
  118. border: 1rpx solid #e2e8f0;
  119. }
  120. }
  121. </style>