ConclusionForm.vue 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. <view class="common-section-card">
  8. <view class="section-title">基本信息</view>
  9. <view class="info-row">
  10. <text class="label">实际执行周期</text>
  11. <text class="value">{{ form.actualExecutionCycle || '-' }} 月</text>
  12. </view>
  13. <view class="info-row">
  14. <text class="label">经费执行比例</text>
  15. <text class="value">{{ form.fundsExecRatio || '-' }} %</text>
  16. </view>
  17. <view class="info-row">
  18. <text class="label">结题申请日期</text>
  19. <text class="value">{{ formatDate(form.conclusionDate) }}</text>
  20. </view>
  21. </view>
  22. </template>
  23. <!-- 2. 项目终止 (横向项目) -->
  24. <template v-else-if="form.projectType === '20'">
  25. <view class="common-section-card">
  26. <view class="section-title">终止信息</view>
  27. <view class="info-row">
  28. <text class="label">项目终止时间</text>
  29. <text class="value">{{ formatDate(form.conclusionDate) }}</text>
  30. </view>
  31. <view class="info-row">
  32. <text class="label">项目终止说明</text>
  33. <text class="value">{{ form.conclusionDesc || '-' }}</text>
  34. </view>
  35. </view>
  36. </template>
  37. <!-- 3. 附件信息 (公共) -->
  38. <view class="common-section-card mt20" v-if="form.fileList?.length">
  39. <view class="section-title">附件资料</view>
  40. <view class="common-file-list">
  41. <view class="file-item" v-for="(file, index) in form.fileList" :key="index" @click="previewFile(file.fileUrl, file.fileName)">
  42. <view class="file-info">
  43. <text class="f-name">{{ file.fileName }}</text>
  44. <view class="f-meta">
  45. <text class="f-type">{{ file.fileType }}{{ file.required ? ' *' : '' }}</text>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  53. </view>
  54. </template>
  55. <script setup lang="ts">
  56. import { ref, onMounted, watch } from 'vue';
  57. import { useDocumentApi } from '@/api/document';
  58. import { formatDate } from '@/utils/date';
  59. import { previewFile } from '@/utils/file';
  60. import to from 'await-to-js';
  61. const props = defineProps<{
  62. code: string;
  63. }>();
  64. const documentApi = useDocumentApi();
  65. const form = ref<any>(null);
  66. const loading = ref(false);
  67. const fetchData = async () => {
  68. if (!props.code) return;
  69. loading.value = true;
  70. const [err, res] = await to(documentApi.getConclusionByCode(props.code));
  71. if (!err && res?.data) {
  72. form.value = res.data;
  73. }
  74. loading.value = false;
  75. };
  76. onMounted(() => {
  77. fetchData();
  78. });
  79. watch(() => props.code, () => {
  80. fetchData();
  81. });
  82. </script>
  83. <style lang="scss" scoped>
  84. @import "./common.scss";
  85. </style>