ConclusionForm.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. <!-- 1. 正常结题/验收 (纵向/自发项目) -->
  6. <template v-if="form.projectType === '10' || form.projectType === '30'">
  7. <CommonSection title="基本信息" :isFirst="true">
  8. <CommonInfoRow label="实际执行周期" :value="form.actualExecutionCycle + ' 月'" />
  9. <CommonInfoRow label="经费执行比例" :value="form.fundsExecRatio + ' %'" />
  10. <CommonInfoRow label="结题申请日期" :value="formatDate(form.conclusionDate)" />
  11. </CommonSection>
  12. </template>
  13. <!-- 2. 项目终止 (横向项目) -->
  14. <template v-else-if="form.projectType === '20'">
  15. <CommonSection title="终止信息" :isFirst="true">
  16. <CommonInfoRow label="项目终止时间" :value="formatDate(form.conclusionDate)" />
  17. <CommonInfoRow label="项目终止说明" :value="form.conclusionDesc" isColumn />
  18. </CommonSection>
  19. </template>
  20. <!-- 3. 附件信息 (公共) -->
  21. <AttachmentList :list="form.fileList" title="附件资料" />
  22. </template>
  23. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  24. </view>
  25. </template>
  26. <script setup lang="ts">
  27. import { ref, onMounted, watch } from 'vue';
  28. import { useDocumentApi } from '@/api/document';
  29. import { formatDate } from '@/utils/date';
  30. import to from 'await-to-js';
  31. import CommonSection from '@/components/ui/CommonSection.vue';
  32. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  33. import AttachmentList from './AttachmentList.vue';
  34. const props = defineProps<{
  35. code: string;
  36. }>();
  37. const documentApi = useDocumentApi();
  38. const form = ref<any>(null);
  39. const loading = ref(false);
  40. const fetchData = async () => {
  41. if (!props.code) return;
  42. loading.value = true;
  43. const [err, res] = await to(documentApi.getConclusionByCode(props.code));
  44. if (!err && res?.data) {
  45. form.value = res.data;
  46. }
  47. loading.value = false;
  48. };
  49. onMounted(() => {
  50. fetchData();
  51. });
  52. watch(() => props.code, () => {
  53. fetchData();
  54. });
  55. </script>
  56. <style lang="scss" scoped>
  57. @import "./common.scss";
  58. </style>