AchAwardsAuthForm.vue 4.9 KB

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