PlanListForm.vue 7.0 KB

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