AchAwardsForm.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. <view class="common-section-card">
  7. <view class="section-title">基本信息</view>
  8. <view class="info-row"><text class="label">获奖项目名称</text><text class="value">{{ form.projectSource || '-' }}</text></view>
  9. <view class="info-row"><text class="label">所在科室</text><text class="value">{{ form.deptName || '-' }}</text></view>
  10. <view class="info-row"><text class="label">批文年月日</text><text class="value">{{ form.awardDate || '-' }}</text></view>
  11. <view class="info-row"><text class="label">奖项所属年度</text><text class="value">{{ form.awardYear || '-' }}</text></view>
  12. <view class="info-row">
  13. <text class="label">获奖类别</text>
  14. <text class="value">{{ form.awardType === '10' ? '教学成果' : '科研奖项' }}</text>
  15. </view>
  16. <view class="info-row">
  17. <text class="label">获奖等级</text>
  18. <text class="value">{{ getDictLabel('sci_awards_grade', form.awardGrade) }}</text>
  19. </view>
  20. <view class="info-row">
  21. <text class="label">获奖级别</text>
  22. <text class="value">{{ getDictLabel('sci_awards_level', form.awardLevel) }}</text>
  23. </view>
  24. <view class="info-row"><text class="label">获奖人(备案人)</text><text class="value">{{ showMembers(form.memberList) }}</text></view>
  25. <view class="info-row"><text class="label">颁奖机构</text><text class="value">{{ form.awardIssueAuthority || '-' }}</text></view>
  26. <view class="info-row"><text class="label">完成单位</text><text class="value">{{ form.completionUnit || '-' }}</text></view>
  27. <view class="info-row">
  28. <text class="label">获奖金额(万元)</text>
  29. <text class="value primary-color">{{ form.awardAmount || 0 }}</text>
  30. </view>
  31. <view class="info-row column">
  32. <text class="label">全部获奖完成人(按获奖顺序排列)</text>
  33. <text class="value remark">{{ form.remark || '-' }}</text>
  34. </view>
  35. </view>
  36. <!-- 附件信息 -->
  37. <AttachmentList :list="mergedFileList" title="电子附件" />
  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 to from 'await-to-js';
  47. import AttachmentList from './AttachmentList.vue';
  48. const props = defineProps<{
  49. code: string;
  50. }>();
  51. const { getDictLabel } = useDict('sci_awards_grade', 'sci_awards_level');
  52. const documentApi = useDocumentApi();
  53. const form = ref<any>(null);
  54. const loading = ref(false);
  55. const mergedFileList = computed(() => {
  56. if (!form.value?.awardCertificate) return [];
  57. try {
  58. const list = JSON.parse(form.value.awardCertificate);
  59. if (Array.isArray(list)) {
  60. const types = ['获奖批文', '获奖证书', '获奖金额证明'];
  61. return list.map((item, index) => ({
  62. ...item,
  63. fileType: types[index] || '其他附件'
  64. }));
  65. }
  66. return [];
  67. } catch (e) {
  68. return [];
  69. }
  70. });
  71. const fetchData = async () => {
  72. if (!props.code) return;
  73. loading.value = true;
  74. const awardCode = props.code.includes('-') ? props.code.split('-')[1] : props.code;
  75. const [err, res] = await to(documentApi.getAwardsByCode(awardCode));
  76. if (!err && res?.data) {
  77. form.value = res.data;
  78. }
  79. loading.value = false;
  80. };
  81. onMounted(() => {
  82. fetchData();
  83. });
  84. watch(() => props.code, () => {
  85. fetchData();
  86. });
  87. const showMembers = (list: any[]) => {
  88. return list?.map(m => m.memberName).join(', ') || '-';
  89. };
  90. </script>
  91. <style lang="scss" scoped>
  92. @import "./common.scss";
  93. </style>