SciAchievementStandard.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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.standardName" />
  8. <CommonInfoRow label="标准编号" :value="form.standardCode" />
  9. <CommonInfoRow label="成果所属单位" :value="form.achievementBelongUnitName" />
  10. <CommonInfoRow label="提交部门" :value="form.commitDeptName" />
  11. <CommonInfoRow label="提交日期" :value="formatDate(form.commitDate, 'YYYY-MM-DD')" />
  12. <CommonInfoRow label="是否已发布" :value="form.isPublished === '10' ? '已发布' : '未发布'" />
  13. <CommonInfoRow label="发布日期" :value="formatDate(form.publishDate, 'YYYY-MM-DD')" />
  14. <CommonInfoRow label="单位排名" :value="form.unitRanking" />
  15. <CommonInfoRow label="所有制定单位" :value="form.belongEnactedUnit" isColumn />
  16. <CommonInfoRow label="所有参与人员" :value="form.belongEngagePersonal" isColumn />
  17. <CommonInfoRow label="标准类型" :value="getDictLabel('achievement_standard_type', form.standardType)" />
  18. <CommonInfoRow label="标准电子版" isColumn>
  19. <view class="file-links">
  20. <view v-if="attachment" class="file-item" @click="handlePreview(attachment)">
  21. <text class="file-link">{{ attachment.fileName || attachment.name || '-' }}</text>
  22. </view>
  23. <text v-else>-</text>
  24. </view>
  25. </CommonInfoRow>
  26. <CommonInfoRow label="归属年度" :value="form.belongYear" />
  27. <CommonInfoRow label="归属团队" :value="form.belongTeam" />
  28. <CommonInfoRow label="所属平台" isColumn>
  29. <view class="platform-tags">
  30. <template v-if="platformList.length > 0">
  31. <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>
  32. </template>
  33. <text v-else>-</text>
  34. </view>
  35. </CommonInfoRow>
  36. <CommonInfoRow label="备注" :value="form.remark" isColumn />
  37. </CommonSection>
  38. <!-- 制定人信息 -->
  39. <view class="common-section-card mt20" v-if="form.enactedPersonal?.length">
  40. <view class="section-title">制定人信息</view>
  41. <view class="achievement-card" v-for="(item, index) in form.enactedPersonal" :key="index">
  42. <view class="a-header mb20">
  43. <text class="a-name">{{ item.enactedPersonName }}</text>
  44. <text class="a-tag">{{ getDictLabel('enacted_person_type', item.enactedPersonType) }}</text>
  45. </view>
  46. <view class="a-body">
  47. <view class="a-row">
  48. <text class="al">学位:</text>
  49. <text class="av">{{ getDictLabel('sci_academic_degree', item.enactedPersonDegree) }}</text>
  50. </view>
  51. <view class="a-row">
  52. <text class="al">贡献率:</text>
  53. <text class="av">{{ item.contributionRate }}%</text>
  54. </view>
  55. <view class="a-row">
  56. <text class="al">工作单位:</text>
  57. <text class="av">{{ item.workUnitName || '-' }}</text>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <!-- 审批记录 -->
  63. <CommonSection title="审批记录" v-if="form.id">
  64. <FlowTable :id="form.id" :businessCode="String(form.id)" defCode="sci_achievement_standard" />
  65. </CommonSection>
  66. </template>
  67. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  68. </view>
  69. </template>
  70. <script setup lang="ts">
  71. import { ref, onMounted, watch, computed } from 'vue';
  72. import { useDict } from '@/hooks/useDict';
  73. import { useDocumentApi } from '@/api/document';
  74. import { formatDate } from '@/utils/date';
  75. import { previewFile } from '@/utils/file';
  76. import to from 'await-to-js';
  77. import FlowTable from '@/pages/project/components/detail/FlowTable.vue';
  78. import CommonSection from '@/components/ui/CommonSection.vue';
  79. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  80. const props = defineProps<{
  81. code: string;
  82. }>();
  83. const { getDictLabel } = useDict('achievement_standard_type', 'enacted_person_type', 'sci_academic_degree');
  84. const documentApi = useDocumentApi();
  85. const form = ref<any>(null);
  86. const loading = ref(false);
  87. const attachment = computed(() => {
  88. if (form.value?.standardFile) {
  89. try {
  90. return JSON.parse(form.value.standardFile);
  91. } catch (e) {
  92. return null;
  93. }
  94. }
  95. return null;
  96. });
  97. const platformList = computed(() => {
  98. if (form.value?.belongPlatform) {
  99. try {
  100. const data = JSON.parse(form.value.belongPlatform);
  101. return Array.isArray(data) ? data : [];
  102. } catch (e) {
  103. if (form.value.belongPlatform === '其他') return [{ platformName: '其他' }];
  104. return [{ platformName: form.value.belongPlatform }];
  105. }
  106. }
  107. return [];
  108. });
  109. const handlePreview = (file: any) => {
  110. const url = file.fileUrl || file.url;
  111. const name = file.fileName || file.name;
  112. if (url) {
  113. previewFile(url, name);
  114. }
  115. };
  116. const fetchData = async () => {
  117. if (!props.code) return;
  118. loading.value = true;
  119. // 直接通过 ID 获取以对齐 PC 逻辑
  120. const [err, res] = await to(documentApi.getAchievementStandardById(props.code));
  121. if (!err && res?.data) {
  122. form.value = res.data;
  123. }
  124. loading.value = false;
  125. };
  126. onMounted(() => {
  127. fetchData();
  128. });
  129. watch(() => props.code, () => {
  130. fetchData();
  131. });
  132. </script>
  133. <style lang="scss" scoped>
  134. @import "./common.scss";
  135. .info-row {
  136. display: flex;
  137. justify-content: space-between;
  138. padding: 24rpx 0;
  139. border-bottom: 2rpx dashed #f5f5f5;
  140. font-size: 28rpx;
  141. .label {
  142. color: #343a3f;
  143. width: 200rpx;
  144. flex-shrink: 0;
  145. margin-right: 20rpx;
  146. }
  147. }
  148. .file-links {
  149. .file-item {
  150. padding: 6rpx 0;
  151. }
  152. .file-link {
  153. color: #2979ff;
  154. text-decoration: underline;
  155. word-break: break-all;
  156. }
  157. }
  158. </style>