CarryForwardForm.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. <view class="common-section-card">
  6. <view class="section-title">项目信息</view>
  7. <view class="info-row">
  8. <text class="label">项目名称</text>
  9. <text class="value">{{ form.projectName || '-' }}</text>
  10. </view>
  11. <view class="info-row">
  12. <text class="label">项目类型</text>
  13. <text class="value">{{ getProjectTypeName(form.projectType) }}</text>
  14. </view>
  15. <view class="info-row">
  16. <text class="label">项目编号</text>
  17. <text class="value">{{ form.projectNo || '-' }}</text>
  18. </view>
  19. <view class="info-row">
  20. <text class="label">负责人</text>
  21. <text class="value">{{ form.projectIncharge || '-' }}</text>
  22. </view>
  23. <view class="info-row">
  24. <text class="label">可结转金额</text>
  25. <text class="value red-color font-bold">{{ formatAmount(form.projectBudgetAmount) }} 万元</text>
  26. </view>
  27. <view class="info-row">
  28. <text class="label">结转经费卡</text>
  29. <text class="value">{{ form.conclusionCardName || '-' }}</text>
  30. </view>
  31. <view class="info-row" v-if="form.conclusionReport">
  32. <text class="label">附件查看</text>
  33. <text class="value link-text" @click="previewFile(form.conclusionReport, '结题报告文件')">结题报告文件</text>
  34. </view>
  35. <view class="info-row">
  36. <text class="label">说明</text>
  37. <text class="value">{{ form.remark || '-' }}</text>
  38. </view>
  39. </view>
  40. </template>
  41. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  42. </view>
  43. </template>
  44. <script setup lang="ts">
  45. import { ref, onMounted, watch } from 'vue';
  46. import { useDocumentApi } from '@/api/document';
  47. import { previewFile } from '@/utils/file';
  48. import to from 'await-to-js';
  49. const props = defineProps<{
  50. code: string;
  51. }>();
  52. const documentApi = useDocumentApi();
  53. const form = ref<any>(null);
  54. const loading = ref(false);
  55. const getProjectTypeName = (val: string) => {
  56. const map: Record<string, string> = {
  57. '10': '纵向项目',
  58. '20': '横向项目',
  59. '30': '内部项目',
  60. '40': '重点学科',
  61. };
  62. return map[val] || val;
  63. };
  64. const formatAmount = (num: number | string) => {
  65. if (!num && num !== 0) return '0.00';
  66. return (Number(num) / 10000).toFixed(2);
  67. };
  68. const fetchData = async () => {
  69. if (!props.code) return;
  70. loading.value = true;
  71. const [err, res] = await to(documentApi.getFundCarryoverById(props.code));
  72. if (!err && res?.data) {
  73. form.value = res.data;
  74. }
  75. loading.value = false;
  76. };
  77. onMounted(() => {
  78. fetchData();
  79. });
  80. watch(() => props.code, () => {
  81. fetchData();
  82. });
  83. </script>
  84. <style lang="scss" scoped>
  85. @import "./common.scss";
  86. .link-text { color: #007aff; text-decoration: underline; }
  87. </style>