AchAwardsForm.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.projectSource" />
  8. <CommonInfoRow label="所在科室" :value="form.deptName" />
  9. <CommonInfoRow label="批文年月日" :value="formatDate(form.awardDate)" />
  10. <CommonInfoRow label="奖项所属年度" :value="form.awardYear" />
  11. <CommonInfoRow label="获奖类别" :value="form.awardType === '10' ? '教学成果' : '科研奖项'" />
  12. <CommonInfoRow label="获奖等级" :value="getDictLabel('sci_awards_grade', form.awardGrade)" />
  13. <CommonInfoRow label="获奖级别" :value="getDictLabel('sci_awards_level', form.awardLevel)" />
  14. <CommonInfoRow label="获奖人(备案人)" :value="showMembers(form.memberList)" />
  15. <CommonInfoRow label="颁奖机构" :value="form.awardIssueAuthority" />
  16. <CommonInfoRow label="完成单位" :value="form.completionUnit" />
  17. <CommonInfoRow label="获奖金额(万元)" :value="form.awardAmount" isAmount />
  18. <CommonInfoRow label="所属平台">
  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. <AttachmentList :list="mergedFileList" title="电子附件" />
  31. <!-- 审批记录 -->
  32. <CommonSection title="审批记录" v-if="form.id">
  33. <FlowTable :id="form.id" :businessCode="'奖项荣誉-' + String(form.awardCode)" defCode="sci_academic_achievement" />
  34. </CommonSection>
  35. </template>
  36. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  37. </view>
  38. </template>
  39. <script setup lang="ts">
  40. import { ref, onMounted, watch, computed } from 'vue';
  41. import { useDict } from '@/hooks/useDict';
  42. import { useDocumentApi } from '@/api/document';
  43. import { formatDate } from '@/utils/date';
  44. import to from 'await-to-js';
  45. import AttachmentList from './AttachmentList.vue';
  46. import FlowTable from '@/pages/project/components/detail/FlowTable.vue';
  47. import CommonSection from '@/components/ui/CommonSection.vue';
  48. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  49. const props = defineProps<{
  50. code: string;
  51. }>();
  52. const { getDictLabel } = useDict('sci_awards_grade', 'sci_awards_level');
  53. const documentApi = useDocumentApi();
  54. const form = ref<any>(null);
  55. const loading = ref(false);
  56. const platformList = computed(() => {
  57. if (form.value?.belongPlatform) {
  58. try {
  59. const data = JSON.parse(form.value.belongPlatform);
  60. return Array.isArray(data) ? data : [];
  61. } catch (e) {
  62. if (form.value.belongPlatform === '其他') return [{ platformName: '其他' }];
  63. return [{ platformName: form.value.belongPlatform }];
  64. }
  65. }
  66. return [];
  67. });
  68. const mergedFileList = computed(() => {
  69. if (!form.value?.awardCertificate) return [];
  70. try {
  71. const list = JSON.parse(form.value.awardCertificate);
  72. if (Array.isArray(list)) {
  73. const types = ['获奖批文', '获奖证书', '获奖金额证明'];
  74. return list.map((item, index) => ({
  75. ...item,
  76. fileType: types[index] || '其他附件'
  77. }));
  78. }
  79. return [];
  80. } catch (e) {
  81. return [];
  82. }
  83. });
  84. const fetchData = async () => {
  85. if (!props.code) return;
  86. loading.value = true;
  87. const awardCode = props.code.includes('-') ? props.code.split('-')[1] : props.code;
  88. const [err, res] = await to(documentApi.getAwardsByCode(awardCode));
  89. if (!err && res?.data) {
  90. form.value = res.data;
  91. }
  92. loading.value = false;
  93. };
  94. onMounted(() => {
  95. fetchData();
  96. });
  97. watch(() => props.code, () => {
  98. fetchData();
  99. });
  100. const showMembers = (list: any[]) => {
  101. return list?.map(m => m.memberName).join(', ') || '-';
  102. };
  103. </script>
  104. <style lang="scss" scoped>
  105. @import "./common.scss";
  106. .platform-tags {
  107. display: flex;
  108. flex-wrap: wrap;
  109. justify-content: flex-end;
  110. gap: 8rpx;
  111. .platform-tag {
  112. font-size: 20rpx;
  113. padding: 2rpx 12rpx;
  114. background-color: #f6f8fa;
  115. color: #64748b;
  116. border-radius: 4rpx;
  117. border: 1rpx solid #e2e8f0;
  118. }
  119. }
  120. </style>