InspectionForm.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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. <CommonSection title="中检批次信息" :isFirst="true">
  7. <CommonInfoRow label="中检名称" :value="form.batchName" />
  8. <CommonInfoRow label="中检周期" v-if="form.projectType === '20'" :value="stateBatchDate" />
  9. </CommonSection>
  10. <!-- 2. 基本信息 (纵向/自发) -->
  11. <template v-if="form.projectType === '10' || form.projectType === '30'">
  12. <CommonSection title="基本信息">
  13. <CommonInfoRow label="项目名称" :value="form.projectTitle" />
  14. <CommonInfoRow label="项目实施周期" :value="form.implementCycle + ' 月'" />
  15. <CommonInfoRow label="进行时间" :value="form.implementExecute + ' 月'" />
  16. <CommonInfoRow label="项目完成占比" :value="form.implementCycleProp + ' %'" />
  17. <CommonInfoRow label="项目经费总额" :value="form.fundsTotal" suffix=" 万元" isAmount />
  18. </CommonSection>
  19. </template>
  20. <!-- 2. 基本信息 (横向) -->
  21. <template v-else-if="form.projectType === '20'">
  22. <CommonSection title="基本信息">
  23. <CommonInfoRow label="项目名称" :value="form.projectTitle" />
  24. <CommonInfoRow label="起止日期" :value="formatDate(form.projectStartDate) + ' ~ ' + formatDate(form.projectEndDate)" />
  25. <CommonInfoRow label="实施周期" :value="form.implCycle" />
  26. <CommonInfoRow label="完成占比" :value="form.implementCycleProp + ' %'" />
  27. <CommonInfoRow :label="form.isClinicalTrial === '10' ? '合同经费' : '科研经费'" :value="form.fundsTotal" suffix=" 万元" isAmount />
  28. <CommonInfoRow label="经费使用总额" :value="form.fundsUsed" isAmount />
  29. <CommonInfoRow label="费用使用占比" :value="form.fundsProp + ' %'" />
  30. <CommonInfoRow label="项目进展" :value="form.projectProgress" />
  31. </CommonSection>
  32. <!-- 3. 费用经费支出 (横向特有) -->
  33. <CommonSection title="费用经费支出" v-if="form.expenseList?.length">
  34. <view class="expense-list">
  35. <view class="expense-item" v-for="(item, index) in form.expenseList" :key="index">
  36. <view class="ex-header">
  37. <text class="ex-no">No.{{ item.expenseNo }}</text>
  38. <text class="ex-type m-type-tag blue">{{ item.expenseType === '10' ? '直接费用' : '间接费用' }}</text>
  39. </view>
  40. <view class="ex-row">
  41. <text class="el">支出科目</text>
  42. <text class="ev">{{ item.subject || '-' }}</text>
  43. </view>
  44. <view class="ex-row">
  45. <text class="el">合同金额</text>
  46. <text class="ev primary-color">{{ formatAmount(item.contractAmount) }} 万元</text>
  47. </view>
  48. <view class="ex-grid mt20">
  49. <view class="eg-item">
  50. <text class="egl">支出金额</text>
  51. <text class="egv primary-color">¥{{ formatAmountV2(item.amount) }}</text>
  52. </view>
  53. <view class="eg-item">
  54. <text class="egl">财政拨款</text>
  55. <text class="egv primary-color">¥{{ formatAmountV2(item.projectAmount) }}</text>
  56. </view>
  57. <view class="eg-item">
  58. <text class="egl">匹配经费</text>
  59. <text class="egv primary-color">¥{{ formatAmountV2(item.otherAmount) }}</text>
  60. </view>
  61. <view class="eg-item">
  62. <text class="egl">自筹经费</text>
  63. <text class="egv primary-color">¥{{ formatAmountV2(item.raiseAmount) }}</text>
  64. </view>
  65. </view>
  66. <view class="ex-row mt20">
  67. <text class="el">收款人</text>
  68. <text class="ev">{{ item.receiver || '-' }}</text>
  69. </view>
  70. </view>
  71. </view>
  72. </CommonSection>
  73. </template>
  74. <!-- 附件信息 (公共) -->
  75. <AttachmentList :list="form.fileList" title="附件资料" />
  76. </template>
  77. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  78. </view>
  79. </template>
  80. <script setup lang="ts">
  81. import { ref, onMounted, watch, computed } from 'vue';
  82. import { useDocumentApi } from '@/api/document';
  83. import { formatAmount } from '@/utils/format';
  84. import { formatDate } from '@/utils/date';
  85. import to from 'await-to-js';
  86. import CommonSection from '@/components/ui/CommonSection.vue';
  87. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  88. import AttachmentList from './AttachmentList.vue';
  89. const props = defineProps<{
  90. code: string;
  91. }>();
  92. const documentApi = useDocumentApi();
  93. const form = ref<any>(null);
  94. const loading = ref(false);
  95. const stateBatchDate = computed(() => {
  96. if (!form.value?.batchStartDate || !form.value?.batchEndDate) return '';
  97. return `${formatDate(form.value.batchStartDate)} ~ ${formatDate(form.value.batchEndDate)}`;
  98. });
  99. const formatAmountV2 = (num: number | string) => {
  100. if (!num && num !== 0) return '0.00';
  101. return Number(num).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
  102. };
  103. const fetchData = async () => {
  104. if (!props.code) return;
  105. loading.value = true;
  106. const [err, res] = await to(documentApi.getInspectionByCode(props.code));
  107. if (!err && res?.data) {
  108. form.value = res.data;
  109. }
  110. loading.value = false;
  111. };
  112. onMounted(() => {
  113. fetchData();
  114. });
  115. watch(() => props.code, () => {
  116. fetchData();
  117. });
  118. </script>
  119. <style lang="scss" scoped>
  120. @import "./common.scss";
  121. .expense-list {
  122. .expense-item {
  123. background: #f8fafc;
  124. border-radius: 12rpx;
  125. padding: 24rpx;
  126. margin-bottom: 24rpx;
  127. border: 1rpx solid #f1f5f9;
  128. &:last-child { margin-bottom: 0; }
  129. .ex-header {
  130. display: flex;
  131. justify-content: space-between;
  132. align-items: center;
  133. margin-bottom: 16rpx;
  134. padding-bottom: 16rpx;
  135. border-bottom: 1rpx dashed #e2e8f0;
  136. .ex-no { font-size: 28rpx; color: #1e293b; font-weight: 600; }
  137. }
  138. .ex-row {
  139. display: flex;
  140. justify-content: space-between;
  141. font-size: 26rpx;
  142. margin-top: 12rpx;
  143. .el { color: #64748b; }
  144. .ev { color: #334155; font-weight: 500; }
  145. }
  146. .ex-grid {
  147. display: grid;
  148. grid-template-columns: repeat(2, 1fr);
  149. gap: 16rpx;
  150. .eg-item {
  151. background: #fff;
  152. padding: 16rpx;
  153. border-radius: 8rpx;
  154. display: flex;
  155. flex-direction: column;
  156. border: 1rpx solid #f1f5f9;
  157. .egl { font-size: 22rpx; color: #64748b; margin-bottom: 8rpx; }
  158. .egv { font-size: 26rpx; font-weight: 800; font-family: 'Inter', sans-serif; }
  159. }
  160. }
  161. }
  162. }
  163. </style>