SciFundExternalAllot.vue 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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.projectIncharge" />
  9. <CommonInfoRow label="项目类型" :value="formatterProjectType(form.projectType)" />
  10. <CommonInfoRow label="项目时间" :value="formatDate(form.startDate) + ' 至 ' + formatDate(form.endDate)" />
  11. <CommonInfoRow label="外拨金额" :value="'¥' + (form.externalAllotAmount || 0)" isAmount />
  12. <CommonInfoRow label="申请外拨日期" :value="form.applyTime ? formatDate(form.applyTime) : '-'" />
  13. <CommonInfoRow label="摘要" :value="form.remark" isColumn />
  14. </CommonSection>
  15. <!-- 外拨明细 -->
  16. <view class="common-section-card mt20" v-if="form.detail?.length">
  17. <view class="section-title">外拨明细</view>
  18. <view class="member-list">
  19. <view class="member-item" v-for="(row, index) in form.detail" :key="index">
  20. <view class="member-header">
  21. <text class="m-name">{{ row.unit }}</text>
  22. <text class="m-amount">¥{{ row.amount || 0 }}</text>
  23. </view>
  24. <view class="m-body">
  25. <view class="m-line"><text class="l">开户行:</text><text class="v">{{ row.bankName || '-' }}</text></view>
  26. <view class="m-line"><text class="l">银行账号:</text><text class="v">{{ row.bankNo || '-' }}</text></view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 附件信息 -->
  32. <AttachmentList :list="mergedFileList" title="电子附件" />
  33. </template>
  34. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  35. </view>
  36. </template>
  37. <script setup lang="ts">
  38. import { ref, onMounted, watch, computed } from 'vue';
  39. import { useDocumentApi } from '@/api/document';
  40. import { formatDate } from '@/utils/date';
  41. import to from 'await-to-js';
  42. import AttachmentList from './AttachmentList.vue';
  43. import CommonSection from '@/components/ui/CommonSection.vue';
  44. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  45. const props = defineProps<{
  46. code: string | number;
  47. }>();
  48. const documentApi = useDocumentApi();
  49. const form = ref<any>(null);
  50. const loading = ref(false);
  51. const formatterProjectType = (val: string) => {
  52. const map: any = { '10': '纵向项目', '20': '横向项目', '30': '内部项目', '40': '重点学科' };
  53. return map[val] || val;
  54. };
  55. const mergedFileList = computed(() => {
  56. if (!form.value || !form.value.attachmentUrl) return [];
  57. try {
  58. const file = JSON.parse(form.value.attachmentUrl);
  59. return [{ fileName: file.name || '附件', fileUrl: file.url, fileType: '申请附件' }];
  60. } catch (e) {
  61. return [];
  62. }
  63. });
  64. const fetchData = async () => {
  65. if (!props.code) return;
  66. loading.value = true;
  67. const [err, res] = await to(documentApi.getExternalAllotByCode(props.code));
  68. if (!err && res?.data) {
  69. form.value = res.data;
  70. }
  71. loading.value = false;
  72. };
  73. onMounted(() => {
  74. fetchData();
  75. });
  76. watch(() => props.code, () => {
  77. fetchData();
  78. });
  79. </script>
  80. <style lang="scss" scoped>
  81. @import "./common.scss";
  82. .m-amount {
  83. color: #ff4d4f;
  84. font-weight: bold;
  85. font-size: 28rpx;
  86. }
  87. </style>