InspectionForm.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. <view class="common-section-card">
  7. <view class="section-title">中检批次信息</view>
  8. <view class="info-row">
  9. <text class="label">中检名称</text>
  10. <text class="value">{{ form.batchName || '-' }}</text>
  11. </view>
  12. <view class="info-row" v-if="form.projectType === '20'">
  13. <text class="label">中检周期</text>
  14. <text class="value">{{ stateBatchDate || '-' }}</text>
  15. </view>
  16. </view>
  17. <!-- 2. 基本信息 (纵向/自发) -->
  18. <template v-if="form.projectType === '10' || form.projectType === '30'">
  19. <view class="common-section-card mt20">
  20. <view class="section-title">基本信息</view>
  21. <view class="info-row">
  22. <text class="label">项目名称</text>
  23. <text class="value">{{ form.projectTitle || '-' }}</text>
  24. </view>
  25. <view class="info-row">
  26. <text class="label">项目实施周期</text>
  27. <text class="value">{{ form.implementCycle || '-' }} 月</text>
  28. </view>
  29. <view class="info-row">
  30. <text class="label">进行时间</text>
  31. <text class="value">{{ form.implementExecute || '-' }} 月</text>
  32. </view>
  33. <view class="info-row">
  34. <text class="label">项目完成占比</text>
  35. <text class="value">{{ form.implementCycleProp || '0' }} %</text>
  36. </view>
  37. <view class="info-row">
  38. <text class="label">项目经费总额</text>
  39. <text class="value red-color font-bold">{{ formatAmount(form.fundsTotal) }} 万元</text>
  40. </view>
  41. </view>
  42. </template>
  43. <!-- 2. 基本信息 (横向) -->
  44. <template v-else-if="form.projectType === '20'">
  45. <view class="common-section-card mt20">
  46. <view class="section-title">基本信息</view>
  47. <view class="info-row">
  48. <text class="label">项目名称</text>
  49. <text class="value">{{ form.projectTitle || '-' }}</text>
  50. </view>
  51. <view class="info-row">
  52. <text class="label">起止日期</text>
  53. <text class="value">{{ formatDate(form.projectStartDate) }} ~ {{ formatDate(form.projectEndDate) }}</text>
  54. </view>
  55. <view class="info-row">
  56. <text class="label">实施周期</text>
  57. <text class="value">{{ form.implCycle || '-' }}</text>
  58. </view>
  59. <view class="info-row">
  60. <text class="label">完成占比</text>
  61. <text class="value">{{ form.implementCycleProp || '0' }} %</text>
  62. </view>
  63. <view class="info-row">
  64. <text class="label">{{ form.isClinicalTrial === '10' ? '合同经费' : '科研经费' }}</text>
  65. <text class="value red-color font-bold">{{ formatAmount(form.fundsTotal) }} 万元</text>
  66. </view>
  67. <view class="info-row">
  68. <text class="label">经费使用总额</text>
  69. <text class="value red-color">{{ formatAmountV2(form.fundsUsed) }} 元</text>
  70. </view>
  71. <view class="info-row">
  72. <text class="label">费用使用占比</text>
  73. <text class="value">{{ form.fundsProp || '0' }} %</text>
  74. </view>
  75. <view class="info-row">
  76. <text class="label">项目进展</text>
  77. <text class="value">{{ form.projectProgress || '-' }}</text>
  78. </view>
  79. </view>
  80. <!-- 3. 费用经费支出 (横向特有) -->
  81. <view class="common-section-card mt20" v-if="form.expenseList?.length">
  82. <view class="section-title">费用经费支出</view>
  83. <view class="expense-list">
  84. <view class="expense-item" v-for="(item, index) in form.expenseList" :key="index">
  85. <view class="ex-header">
  86. <text class="ex-no">No.{{ item.expenseNo || '-' }}</text>
  87. <text class="ex-type">{{ item.expenseType === '10' ? '直接费用' : '间接费用' }}</text>
  88. </view>
  89. <view class="ex-row">
  90. <text class="el">支出科目</text>
  91. <text class="ev">{{ item.subject || '-' }}</text>
  92. </view>
  93. <view class="ex-row">
  94. <text class="el">合同金额</text>
  95. <text class="ev red-color">{{ formatAmount(item.contractAmount) }} 万元</text>
  96. </view>
  97. <view class="ex-grid mt20">
  98. <view class="eg-item">
  99. <text class="egl">支出金额</text>
  100. <text class="egv red-color">¥{{ formatAmountV2(item.amount) }}</text>
  101. </view>
  102. <view class="eg-item">
  103. <text class="egl">财政拨款</text>
  104. <text class="egv red-color">¥{{ formatAmountV2(item.projectAmount) }}</text>
  105. </view>
  106. <view class="eg-item">
  107. <text class="egl">匹配经费</text>
  108. <text class="egv red-color">¥{{ formatAmountV2(item.otherAmount) }}</text>
  109. </view>
  110. <view class="eg-item">
  111. <text class="egl">自筹经费</text>
  112. <text class="egv red-color">¥{{ formatAmountV2(item.raiseAmount) }}</text>
  113. </view>
  114. </view>
  115. <view class="ex-row mt20">
  116. <text class="el">收款人</text>
  117. <text class="ev">{{ item.receiver || '-' }}</text>
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. </template>
  123. <!-- 附件信息 (公共) -->
  124. <view class="common-section-card mt20" v-if="form.fileList?.length">
  125. <view class="section-title">附件资料</view>
  126. <view class="common-file-list">
  127. <view class="file-item" v-for="(file, index) in form.fileList" :key="index" @click="previewFile(file.fileUrl, file.fileName)">
  128. <view class="file-info">
  129. <text class="f-name">{{ file.fileName }}</text>
  130. <text class="f-meta">{{ file.fileType }}{{ file.required ? ' *' : '' }}</text>
  131. </view>
  132. </view>
  133. </view>
  134. </view>
  135. </template>
  136. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  137. </view>
  138. </template>
  139. <script setup lang="ts">
  140. import { ref, onMounted, watch, computed } from 'vue';
  141. import { useDocumentApi } from '@/api/document';
  142. import { formatAmount } from '@/utils/format';
  143. import { formatDate } from '@/utils/date';
  144. import { previewFile } from '@/utils/file';
  145. import to from 'await-to-js';
  146. const props = defineProps<{
  147. code: string;
  148. }>();
  149. const documentApi = useDocumentApi();
  150. const form = ref<any>(null);
  151. const loading = ref(false);
  152. const stateBatchDate = computed(() => {
  153. if (!form.value?.batchStartDate || !form.value?.batchEndDate) return '';
  154. return `${formatDate(form.value.batchStartDate)} ~ ${formatDate(form.value.batchEndDate)}`;
  155. });
  156. const formatAmountV2 = (num: number | string) => {
  157. if (!num && num !== 0) return '0.00';
  158. return Number(num).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
  159. };
  160. const fetchData = async () => {
  161. if (!props.code) return;
  162. loading.value = true;
  163. const [err, res] = await to(documentApi.getInspectionByCode(props.code));
  164. if (!err && res?.data) {
  165. form.value = res.data;
  166. }
  167. loading.value = false;
  168. };
  169. onMounted(() => {
  170. fetchData();
  171. });
  172. watch(() => props.code, () => {
  173. fetchData();
  174. });
  175. </script>
  176. <style lang="scss" scoped>
  177. @import "./common.scss";
  178. .expense-list {
  179. .expense-item {
  180. background: #f8f9fc;
  181. border-radius: 12rpx;
  182. padding: 24rpx;
  183. margin-bottom: 24rpx;
  184. &:last-child { margin-bottom: 0; }
  185. .ex-header {
  186. display: flex;
  187. justify-content: space-between;
  188. align-items: center;
  189. margin-bottom: 16rpx;
  190. padding-bottom: 12rpx;
  191. border-bottom: 1rpx solid #eef0f5;
  192. .ex-no { font-size: 26rpx; color: #333; font-weight: 500; }
  193. .ex-type { font-size: 20rpx; background: #e6f7ff; color: #1890ff; padding: 2rpx 12rpx; border-radius: 4rpx; }
  194. }
  195. .ex-row {
  196. display: flex;
  197. justify-content: space-between;
  198. font-size: 24rpx;
  199. margin-top: 8rpx;
  200. .el { color: #999; }
  201. .ev { color: #555; }
  202. }
  203. .ex-grid {
  204. display: grid;
  205. grid-template-columns: repeat(2, 1fr);
  206. gap: 16rpx;
  207. .eg-item {
  208. background: #fff;
  209. padding: 12rpx 16rpx;
  210. border-radius: 8rpx;
  211. display: flex;
  212. flex-direction: column;
  213. .egl { font-size: 20rpx; color: #999; margin-bottom: 4rpx; }
  214. .egv { font-size: 24rpx; font-weight: bold; }
  215. }
  216. }
  217. }
  218. }
  219. .font-bold { font-weight: bold; }
  220. </style>