PlanListForm.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="document-form">
  3. <uv-loading-icon v-if="state.loading" mode="circle" text="正在加载项目计划详情..."></uv-loading-icon>
  4. <template v-else-if="state.form">
  5. <!-- 基本信息 -->
  6. <CommonSection title="基本信息" :isFirst="true">
  7. <CommonInfoRow label="项目名称" :value="state.form.projectName" />
  8. <CommonInfoRow label="项目级别" :value="getDictLabel('sci_pjt_level', state.form.projectLevel)" />
  9. <CommonInfoRow label="项目分类" :value="state.form.projectClazzName" />
  10. <CommonInfoRow label="项目来源" :value="state.form.projectSource || '-'" />
  11. <CommonInfoRow label="计划日期" :value="formatDateRange(state.form.planStartDate, state.form.planEndDate)" />
  12. <CommonInfoRow label="研究类型" :value="getDictLabel('sci_pjt_type', state.form.studyType)" />
  13. <CommonInfoRow label="所属科室" :value="state.form.deptName" />
  14. <CommonInfoRow label="项目负责人" :value="state.form.projectLeaderName" />
  15. <CommonInfoRow label="负责人电话" :value="state.form.projectLeaderPhone || '-'" />
  16. <CommonInfoRow label="负责人邮箱" :value="state.form.projectLeaderMail || '-'" />
  17. <CommonInfoRow label="所属平台">
  18. <view class="platform-tags">
  19. <template v-if="platformList.length > 0">
  20. <text v-for="(p, index) in platformList" :key="index" class="platform-tag">
  21. {{ p.platformName }}
  22. </text>
  23. </template>
  24. <text v-else>-</text>
  25. </view>
  26. </CommonInfoRow>
  27. <CommonInfoRow label="备注" :value="state.form.remark || '-'" isColumn />
  28. </CommonSection>
  29. <!-- 成员信息 -->
  30. <CommonSection title="成员信息" v-if="state.form.memberList?.length">
  31. <view class="member-list">
  32. <view class="member-item" v-for="(row, index) in state.form.memberList" :key="index">
  33. <view class="member-header">
  34. <view class="m-left">
  35. <text class="m-name">{{ row.memberName }}</text>
  36. <text class="m-type-tag" v-if="row.memberType">
  37. {{ row.memberType === '10' ? '本院人员' : row.memberType === '20' ? '非本院人员' : '研究生' }}
  38. </text>
  39. </view>
  40. <text class="m-tag" :class="{ 'leader': row.projectRole === '10' }">
  41. {{ row.projectRole === '10' ? '负责人' : row.projectRole === '20' ? '主要参与人' : '一般参与人' }}
  42. </text>
  43. </view>
  44. <view class="m-body">
  45. <view class="m-line" v-if="row.deptName">
  46. <text class="l">所属科室:</text><text class="v">{{ row.deptName }}</text>
  47. </view>
  48. <view class="m-line" v-if="row.degree || row.technicalTitle">
  49. <text class="l">职称学位:</text>
  50. <text class="v">{{ getDictLabel('sci_technical_title', row.technicalTitle) || '-' }} / {{ getDictLabel('sci_academic_degree', row.degree) || '-' }}</text>
  51. </view>
  52. <view class="m-line" v-if="row.responsibleContent">
  53. <text class="l">负责内容:</text><text class="v">{{ row.responsibleContent }}</text>
  54. </view>
  55. <view class="m-line" v-if="row.serialNum">
  56. <text class="l">签署顺序:</text><text class="v">{{ row.serialNum }}</text>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </CommonSection>
  62. <!-- 预算信息 -->
  63. <CommonSection title="预算信息" v-if="state.form.fundsList?.length">
  64. <view class="funds-list">
  65. <view class="funds-item" v-for="(item, index) in state.form.fundsList" :key="index">
  66. <view class="f-row">
  67. <text class="f-name">{{ item.fundsSubjName }}</text>
  68. <text class="f-class">{{ item.fundsClass === '10' ? '直接费用' : '间接费用/管理费' }}</text>
  69. </view>
  70. <view class="f-grid">
  71. <view class="g-item"><text class="gl">财政拨款(万)</text><text class="gv">{{ formatAmount(item.projectFundsAmount) }}</text></view>
  72. <view class="g-item"><text class="gl">匹配经费(万)</text><text class="gv">{{ formatAmount(item.otherFundsAmount) }}</text></view>
  73. <view class="g-item"><text class="gl">自筹经费(万)</text><text class="gv">{{ formatAmount(item.raiseFundsAmount) }}</text></view>
  74. <view class="g-item highlight"><text class="gl">预算金额(万)</text><text class="gv">{{ formatAmount(item.totalFundsAmount) }}</text></view>
  75. </view>
  76. </view>
  77. </view>
  78. </CommonSection>
  79. <!-- 附件信息 -->
  80. <AttachmentList :list="state.form.fileList" title="附件资料" />
  81. </template>
  82. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  83. </view>
  84. </template>
  85. <script setup lang="ts">
  86. import { reactive, onMounted, watch, nextTick, computed } from 'vue';
  87. import { useDict } from '@/hooks/useDict';
  88. import { useDocumentApi } from '@/api/document';
  89. import { formatDate } from '@/utils/date';
  90. import { formatAmount } from '@/utils/format';
  91. import AttachmentList from './AttachmentList.vue';
  92. import CommonSection from '@/components/ui/CommonSection.vue';
  93. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  94. import to from 'await-to-js';
  95. const props = defineProps<{
  96. code: string;
  97. }>();
  98. const { getDictLabel } = useDict('sci_pjt_level', 'sci_pjt_type', 'sci_academic_degree', 'sci_technical_title');
  99. const documentApi = useDocumentApi();
  100. const state = reactive({
  101. form: null as any,
  102. loading: false
  103. });
  104. const platformList = computed(() => {
  105. if (state.form?.belongPlatform) {
  106. try {
  107. const data = JSON.parse(state.form.belongPlatform);
  108. return Array.isArray(data) ? data : [];
  109. } catch (e) {
  110. if (state.form.belongPlatform === '其他') return [{ platformName: '其他' }];
  111. return [{ platformName: state.form.belongPlatform }];
  112. }
  113. }
  114. return [];
  115. });
  116. const formatDateRange = (start: string, end: string) => {
  117. if (!start && !end) return '-';
  118. return `${formatDate(start)} 至 ${formatDate(end)}`;
  119. };
  120. const initForm = async (code: string) => {
  121. if (!code) return;
  122. state.loading = true;
  123. const [err, res] = await to(documentApi.getVerticalByCode(code));
  124. if (!err && res?.data) {
  125. await nextTick();
  126. state.form = res.data;
  127. // 数据标准化
  128. state.form.fileList = state.form.fileList || [];
  129. state.form.fundsList = state.form.fundsList || [];
  130. state.form.memberList = state.form.memberList || [];
  131. state.form.unitsList = state.form.unitsList || [];
  132. }
  133. state.loading = false;
  134. };
  135. watch(() => props.code, (val) => {
  136. initForm(val);
  137. }, { immediate: true });
  138. defineExpose({
  139. initForm
  140. });
  141. </script>
  142. <style lang="scss" scoped>
  143. @import "./common.scss";
  144. .member-header {
  145. .leader {
  146. color: #f59e0b !important;
  147. background: #fff7e6 !important;
  148. border: 1rpx solid #ffd591 !important;
  149. }
  150. }
  151. </style>