RewardForm.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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.projectName || '-' }}</text>
  11. </view>
  12. <view class="info-row">
  13. <text class="label">项目类型</text>
  14. <text class="value">{{ getProjectTypeName(form.projectType) }}</text>
  15. </view>
  16. <view class="info-row">
  17. <text class="label">项目编号</text>
  18. <text class="value">{{ form.projectNo || '-' }}</text>
  19. </view>
  20. <view class="info-row">
  21. <text class="label">负责人</text>
  22. <text class="value">{{ form.projectIncharge || '-' }}</text>
  23. </view>
  24. <view class="info-row">
  25. <text class="label">预算金额</text>
  26. <text class="value red-color">{{ formatAmount(form.projectBudgetAmount) }} 万元</text>
  27. </view>
  28. <view class="info-row">
  29. <text class="label">已分割绩效</text>
  30. <text class="value red-color">{{ formatAmount(form.projectIssuedAmount) }} 万元</text>
  31. </view>
  32. <view class="info-row">
  33. <text class="label">未分割绩效</text>
  34. <text class="value red-color">{{ formatAmount(form.projectNotIssuedAmount) }} 万元</text>
  35. </view>
  36. <view class="info-row">
  37. <text class="label">项目到账</text>
  38. <text class="value red-color">{{ formatAmount(form.projectReceivedAmount) }} 万元</text>
  39. </view>
  40. <view class="info-row">
  41. <text class="label">绩效总额</text>
  42. <text class="value red-color font-bold">{{ formatAmount(form.projectRewardAmount) }} 万元</text>
  43. </view>
  44. <view class="info-row">
  45. <text class="label">备注摘要</text>
  46. <text class="value">{{ form.remark || '-' }}</text>
  47. </view>
  48. </view>
  49. <!-- 2. 分割明细 -->
  50. <view class="common-section-card mt20" v-if="form.detail?.length">
  51. <view class="section-title">分割明细</view>
  52. <view class="member-list">
  53. <view class="member-item" v-for="(item, index) in form.detail" :key="index">
  54. <view class="m-header">
  55. <text class="m-name">{{ item.memberName }}</text>
  56. <text class="m-no">{{ item.memberNo }}</text>
  57. </view>
  58. <view class="m-row">
  59. <text class="ml">工作单位</text>
  60. <text class="pv">{{ item.unit || '-' }}</text>
  61. </view>
  62. <view class="m-row">
  63. <text class="ml">分割金额</text>
  64. <text class="pv red-color">¥{{ item.amount }} 元</text>
  65. </view>
  66. <view class="m-row">
  67. <text class="ml">创建时间</text>
  68. <text class="pv">{{ formatDate(item.createdTime) }}</text>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 3. 附件 (保留原有上传附件查看) -->
  74. <view class="common-section-card mt20" v-if="form.fileList?.length">
  75. <view class="section-title">相关附件</view>
  76. <view class="common-file-list">
  77. <view class="file-item" v-for="(file, index) in form.fileList" :key="index" @click="previewFile(file.fileUrl, file.fileName)">
  78. <view class="file-info">
  79. <text class="f-name">{{ file.fileName }}</text>
  80. <text class="f-meta">附件</text>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  87. </view>
  88. </template>
  89. <script setup lang="ts">
  90. import { ref, onMounted, watch } from 'vue';
  91. import { useDocumentApi } from '@/api/document';
  92. import { formatDate } from '@/utils/date';
  93. import { previewFile } from '@/utils/file';
  94. import to from 'await-to-js';
  95. const props = defineProps<{
  96. code: string;
  97. }>();
  98. const documentApi = useDocumentApi();
  99. const form = ref<any>(null);
  100. const loading = ref(false);
  101. const getProjectTypeName = (val: string) => {
  102. const map: Record<string, string> = {
  103. '10': '纵向项目',
  104. '20': '横向项目',
  105. '30': '内部项目',
  106. '40': '重点学科',
  107. };
  108. return map[val] || val;
  109. };
  110. const formatAmount = (num: number | string) => {
  111. if (!num && num !== 0) return '0.00';
  112. return Number(num).toFixed(2);
  113. };
  114. const fetchData = async () => {
  115. if (!props.code) return;
  116. loading.value = true;
  117. const [err, res] = await to(documentApi.getFundRewardById(props.code));
  118. if (!err && res?.data) {
  119. form.value = res.data;
  120. }
  121. loading.value = false;
  122. };
  123. onMounted(() => {
  124. fetchData();
  125. });
  126. watch(() => props.code, () => {
  127. fetchData();
  128. });
  129. </script>
  130. <style lang="scss" scoped>
  131. @import "./common.scss";
  132. .member-list {
  133. .member-item {
  134. background: #f8f9fc;
  135. border-radius: 8rpx;
  136. padding: 20rpx;
  137. margin-bottom: 20rpx;
  138. &:last-child { margin-bottom: 0; }
  139. .m-header {
  140. display: flex;
  141. justify-content: space-between;
  142. align-items: center;
  143. margin-bottom: 12rpx;
  144. padding-bottom: 12rpx;
  145. border-bottom: 1rpx solid #eee;
  146. .m-name { font-size: 28rpx; color: #333; font-weight: bold; }
  147. .m-no { font-size: 24rpx; color: #999; }
  148. }
  149. .m-row {
  150. display: flex;
  151. justify-content: space-between;
  152. margin-top: 8rpx;
  153. font-size: 24rpx;
  154. .ml { color: #999; }
  155. .pv { color: #555; }
  156. }
  157. }
  158. }
  159. .font-bold { font-weight: bold; }
  160. </style>