ProjectAuditForm.vue 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <view class="document-form">
  3. <uv-loading-icon v-if="loading" mode="circle" :text="'正在加载' + title + '详情...'"></uv-loading-icon>
  4. <template v-else-if="form">
  5. <view class="common-section-card">
  6. <view class="section-title">{{ title }}管理详情</view>
  7. <view class="info-row"><text class="label">项目名称</text><text class="value">{{ form.projectName }}</text></view>
  8. <view class="info-row"><text class="label">所属科室</text><text class="value">{{ form.deptName }}</text></view>
  9. <view class="info-row"><text class="label">负责人</text><text class="value">{{ form.projectLeaderName }}</text></view>
  10. <view class="info-row"><text class="label">申请日期</text><text class="value">{{ formatDate(form.applyDate) }}</text></view>
  11. <view class="info-row"><text class="label">审核年份</text><text class="value">{{ form.auditYear }}</text></view>
  12. <view class="info-row"><text class="label">进度说明</text><text class="value">{{ form.progressDesc || '-' }}</text></view>
  13. <view class="info-row"><text class="label">备注</text><text class="value">{{ form.remark || '-' }}</text></view>
  14. </view>
  15. <!-- 附件 -->
  16. <view class="common-section-card mt20" v-if="form.fileList?.length">
  17. <view class="section-title">相关附件</view>
  18. <view class="common-file-list">
  19. <view class="file-item" v-for="(file, index) in form.fileList" :key="index" @click="previewFile(file.fileUrl, file.fileName)">
  20. <view class="file-info">
  21. <text class="f-name">{{ file.fileName }}</text>
  22. <view class="f-meta">
  23. <text class="f-type">附件</text>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  31. </view>
  32. </template>
  33. <script setup lang="ts">
  34. import { ref, computed, onMounted, watch } from 'vue';
  35. import { useDocumentApi } from '@/api/document';
  36. import { previewFile } from '@/utils/file';
  37. import { formatDate } from '@/utils/date';
  38. import to from 'await-to-js';
  39. const props = defineProps<{
  40. code: string;
  41. defCode: string;
  42. }>();
  43. const title = computed(() => props.defCode === 'sci_project_inspection' ? '中期检查' : '结项审核');
  44. const documentApi = useDocumentApi();
  45. const form = ref<any>(null);
  46. const loading = ref(false);
  47. const fetchData = async () => {
  48. if (!props.code) return;
  49. loading.value = true;
  50. const [err, res] = await to(documentApi.getProjectAuditById(props.code));
  51. if (!err && res?.data) {
  52. form.value = res.data;
  53. }
  54. loading.value = false;
  55. };
  56. onMounted(() => {
  57. fetchData();
  58. });
  59. watch(() => props.code, () => {
  60. fetchData();
  61. });
  62. </script>
  63. <style lang="scss" scoped>
  64. @import "./common.scss";
  65. </style>