CarryForwardForm.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. <CommonSection title="项目信息" :isFirst="true">
  6. <CommonInfoRow label="项目名称" :value="form.projectName" />
  7. <CommonInfoRow label="项目类型" :value="getProjectTypeName(form.projectType)" />
  8. <CommonInfoRow label="项目编号" :value="form.projectNo" />
  9. <CommonInfoRow label="负责人" :value="form.projectIncharge" />
  10. <CommonInfoRow label="可结转金额" :value="form.projectBudgetAmount / 10000" suffix=" 万元" isAmount />
  11. <CommonInfoRow label="结转经费卡" :value="form.conclusionCardName" />
  12. <CommonInfoRow label="结题报告" v-if="form.conclusionReport" >
  13. <text class="value link-text" @click="previewFile(form.conclusionReport, '结题报告文件')">查看文件</text>
  14. </CommonInfoRow>
  15. <CommonInfoRow label="说明" :value="form.remark" isColumn />
  16. </CommonSection>
  17. </template>
  18. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  19. </view>
  20. </template>
  21. <script setup lang="ts">
  22. import { ref, onMounted, watch } from 'vue';
  23. import { useDocumentApi } from '@/api/document';
  24. import { previewFile } from '@/utils/file';
  25. import to from 'await-to-js';
  26. import CommonSection from '@/components/ui/CommonSection.vue';
  27. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  28. const props = defineProps<{
  29. code: string;
  30. }>();
  31. const documentApi = useDocumentApi();
  32. const form = ref<any>(null);
  33. const loading = ref(false);
  34. const getProjectTypeName = (val: string) => {
  35. const map: Record<string, string> = {
  36. '10': '纵向项目',
  37. '20': '横向项目',
  38. '30': '内部项目',
  39. '40': '重点学科',
  40. };
  41. return map[val] || val;
  42. };
  43. const fetchData = async () => {
  44. if (!props.code) return;
  45. loading.value = true;
  46. const [err, res] = await to(documentApi.getFundCarryoverById(props.code));
  47. if (!err && res?.data) {
  48. form.value = res.data;
  49. }
  50. loading.value = false;
  51. };
  52. onMounted(() => {
  53. fetchData();
  54. });
  55. watch(() => props.code, () => {
  56. fetchData();
  57. });
  58. </script>
  59. <style lang="scss" scoped>
  60. @import "./common.scss";
  61. .link-text { color: #3b82f6; font-weight: 600; }
  62. </style>