HorizontalForm.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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. <!-- 基本信息 -->
  6. <CommonSection title="基本信息" :isFirst="true">
  7. <CommonInfoRow label="项目名称" :value="form.projectName" />
  8. <CommonInfoRow label="学科分类" :value="form.disciplineFirstName" />
  9. <CommonInfoRow label="负责人类型" :value="getLeaderTypeLabel(form.projectLeaderType)" />
  10. <CommonInfoRow label="负责人" :value="form.projectLeaderName" />
  11. <CommonInfoRow label="合同类别" :value="getDictLabel('contract_type', form.contractType)" />
  12. <CommonInfoRow label="归属部门" :value="form.deptName" />
  13. <CommonInfoRow label="签订日期" :value="formatDate(form.signDate)" />
  14. <CommonInfoRow label="执行期" :value="formatDateRange(form.planStartDate, form.planEndDate)" />
  15. <CommonInfoRow label="统计年度" :value="form.statisticalYear" />
  16. <CommonInfoRow label="所属平台">
  17. <view class="platform-tags">
  18. <template v-if="platformList.length > 0">
  19. <uv-tags v-for="(p, index) in platformList" :key="index" :text="p.platformName === '其他' ? '其他' : (p.platformType ? p.platformName + ' (' + p.platformType + ')' : p.platformName)" type="primary" plain size="mini" class="mr5"></uv-tags>
  20. </template>
  21. <text v-else>-</text>
  22. </view>
  23. </CommonInfoRow>
  24. <CommonInfoRow label="所属团队" :value="form.belongTeam || '-'" />
  25. <CommonInfoRow label="备注" :value="form.remark" isColumn />
  26. </CommonSection>
  27. <!-- 经费信息 -->
  28. <CommonSection title="经费信息">
  29. <CommonInfoRow label="合同经费" :value="formatAmount(form.contractFunds)" isAmount />
  30. <CommonInfoRow label="配套经费" :value="formatAmount(form.supportFunds)" isAmount />
  31. <CommonInfoRow label="总金额" :value="formatAmount(form.totalAmount)" isAmount />
  32. <CommonInfoRow label="到账金额" :value="formatAmount(form.arrivalFunds)" isAmount />
  33. <CommonInfoRow label="到账日期" :value="formatDate(form.arrivalDate)" />
  34. </CommonSection>
  35. <!-- 分包信息 -->
  36. <CommonSection title="分包信息" v-if="form.isSubcontract === '10'">
  37. <view class="member-list">
  38. <view class="member-item" v-for="(item, index) in subcontractList" :key="index">
  39. <view class="member-header">
  40. <text class="m-name">{{ item.subProjectName }}</text>
  41. </view>
  42. <view class="m-body">
  43. <view class="m-line"><text class="l">负责人:</text><text class="v">{{ item.projectLeaderName }}</text></view>
  44. <view class="m-line"><text class="l">分包金额:</text><text class="v price">¥{{ formatAmount(item.subcontractAmount) }}</text></view>
  45. </view>
  46. </view>
  47. </view>
  48. </CommonSection>
  49. <!-- 合作单位 -->
  50. <CommonSection title="合作单位" v-if="form.companyList?.length">
  51. <view class="member-list">
  52. <view class="member-item" v-for="(item, index) in form.companyList" :key="index">
  53. <view class="member-header">
  54. <text class="m-name">{{ item.compName }}</text>
  55. <text class="m-type-tag" v-if="item.compType">{{ getDictLabel('sci_pjt_company_type', item.compType) }}</text>
  56. </view>
  57. <view class="m-body">
  58. <view class="m-line" v-if="item.compCode"><text class="l">单位编号:</text><text class="v">{{ item.compCode }}</text></view>
  59. <view class="m-line" v-if="item.contractParty"><text class="l">合同方:</text><text class="v">{{ getDictLabel('project_company_type', item.contractParty) }}</text></view>
  60. <view class="m-line" v-if="item.compContact"><text class="l">联系人:</text><text class="v">{{ item.compContact }} ({{ item.compPhoneNum || '-' }})</text></view>
  61. <view class="m-line" v-if="item.compLocalArea"><text class="l">单位地址:</text><text class="v">{{ item.compLocalArea }}</text></view>
  62. </view>
  63. </view>
  64. </view>
  65. </CommonSection>
  66. <!-- 成员信息 -->
  67. <CommonSection title="成员信息" v-if="form.member?.length">
  68. <view class="member-list">
  69. <view class="member-item" v-for="(row, index) in form.member" :key="index">
  70. <view class="member-header">
  71. <view class="name-box">
  72. <text class="m-name">{{ row.memberName }}</text>
  73. <text class="m-tag leader" v-if="row.projectRole === '10'">负责人</text>
  74. <text class="m-tag" v-else>参与人</text>
  75. </view>
  76. <text class="m-type-tag blue" v-if="row.memberType">{{ row.memberType === '10' ? '本院人员' : row.memberType === '20' ? '非本院人员' : '研究生' }}</text>
  77. </view>
  78. <view class="m-body">
  79. <view class="m-line" v-if="row.deptName"><text class="l">所属科室:</text><text class="v">{{ row.deptName }}</text></view>
  80. <view class="m-line" v-if="row.technicalTitle"><text class="l">职称:</text><text class="v">{{ row.technicalTitle }}</text></view>
  81. <view class="m-line" v-if="row.degree"><text class="l">学位:</text><text class="v">{{ getDictLabel('sci_academic_degree', row.degree) }}</text></view>
  82. <view class="m-line" v-if="row.contributionRate"><text class="l">贡献率:</text><text class="v">{{ row.contributionRate }}%</text></view>
  83. <view class="m-line column" v-if="row.responsibleContent">
  84. <text class="l">负责内容:</text>
  85. <text class="v remark">{{ row.responsibleContent }}</text>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. </CommonSection>
  91. <!-- 预算信息 -->
  92. <CommonSection title="预算信息" v-if="form.budget?.length">
  93. <view class="funds-list">
  94. <view class="funds-item" v-for="(item, index) in form.budget" :key="index">
  95. <view class="f-row">
  96. <text class="f-name">{{ item.fundsSubjName }}</text>
  97. </view>
  98. <view class="f-grid">
  99. <view class="g-item"><text class="gl">财政拨款</text><text class="gv">¥{{ item.projectFundsAmount || 0 }}</text></view>
  100. <view class="g-item"><text class="gl">匹配经费</text><text class="gv">¥{{ item.otherFundsAmount || 0 }}</text></view>
  101. <view class="g-item"><text class="gl">自筹经费</text><text class="gv">¥{{ item.raiseFundsAmount || 0 }}</text></view>
  102. <view class="g-item highlight"><text class="gl">预算金额</text><text class="gv">¥{{ item.totalFundsAmount || 0 }}</text></view>
  103. </view>
  104. </view>
  105. </view>
  106. </CommonSection>
  107. <!-- 附件信息 -->
  108. <AttachmentList :list="form.files" title="附件资料" />
  109. </template>
  110. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  111. </view>
  112. </template>
  113. <script setup lang="ts">
  114. import { ref, onMounted, watch, computed } from 'vue';
  115. import { useDict } from '@/hooks/useDict';
  116. import { useDocumentApi } from '@/api/document';
  117. import { formatDate } from '@/utils/date';
  118. import { formatAmount } from '@/utils/format';
  119. import AttachmentList from './AttachmentList.vue';
  120. import CommonSection from '@/components/ui/CommonSection.vue';
  121. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  122. import to from 'await-to-js';
  123. const props = defineProps<{
  124. code: string | number;
  125. }>();
  126. const { getDictLabel } = useDict('contract_type', 'sci_academic_degree', 'sci_pjt_company_type', 'project_company_type');
  127. const documentApi = useDocumentApi();
  128. const form = ref<any>(null);
  129. const loading = ref(false);
  130. const platformList = computed(() => {
  131. if (form.value?.belongPlatform) {
  132. try {
  133. const data = JSON.parse(form.value.belongPlatform);
  134. return Array.isArray(data) ? data : [];
  135. } catch (e) {
  136. if (form.value.belongPlatform === '其他') return [{ platformName: '其他' }];
  137. return [{ platformName: form.value.belongPlatform }];
  138. }
  139. }
  140. return [];
  141. });
  142. const subcontractList = computed(() => {
  143. const list = form.value?.subcontractList || form.value?.subContractList || [];
  144. if (Array.isArray(list)) return list;
  145. if (typeof list === 'string' && list.trim()) {
  146. try {
  147. return JSON.parse(list);
  148. } catch (e) {
  149. return [];
  150. }
  151. }
  152. return [];
  153. });
  154. const getLeaderTypeLabel = (val: string) => {
  155. const map: Record<string, string> = { '10': '教师', '20': '学生', '30': '校外人员' };
  156. return map[val] || val || '-';
  157. };
  158. const formatDateRange = (start: string, end: string) => {
  159. if (!start && !end) return '-';
  160. return `${formatDate(start)} 至 ${formatDate(end)}`;
  161. };
  162. const fetchData = async () => {
  163. if (!props.code) return;
  164. loading.value = true;
  165. const [err, res] = await to(documentApi.getHorizontalByCode(String(props.code)));
  166. if (!err && res?.data) {
  167. form.value = res.data;
  168. }
  169. loading.value = false;
  170. };
  171. onMounted(() => {
  172. fetchData();
  173. });
  174. watch(() => props.code, () => {
  175. fetchData();
  176. });
  177. </script>
  178. <style lang="scss" scoped>
  179. @import "./common.scss";
  180. .price {
  181. color: #ff4d4f;
  182. font-weight: bold;
  183. }
  184. .m-type-tag {
  185. font-size: 20rpx;
  186. padding: 2rpx 8rpx;
  187. background-color: #f0f7ff;
  188. color: #007aff;
  189. border-radius: 4rpx;
  190. border: 1px solid #d0e7ff;
  191. }
  192. </style>