AchDecisionForm.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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.reportTitle" />
  8. <CommonInfoRow label="提交单位" :value="form.submitUnit" />
  9. <CommonInfoRow label="提交日期" :value="form.submitDate ? formatDate(form.submitDate, 'YYYY-MM-DD') : '-'" />
  10. <CommonInfoRow label="所属单位" :value="form.belongUnit" />
  11. <CommonInfoRow label="所属年度" :value="form.belongYear" />
  12. <CommonInfoRow label="所属平台" isColumn>
  13. <view class="platform-tags">
  14. <template v-if="platformList.length > 0">
  15. <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>
  16. </template>
  17. <text v-else>-</text>
  18. </view>
  19. </CommonInfoRow>
  20. <CommonInfoRow label="所属团队" :value="form.belongTeam" />
  21. <CommonInfoRow label="学校署名" :value="form.schoolSignature === '10' ? '第一单位' : form.schoolSignature === '20' ? '非第一单位' : form.schoolSignature" />
  22. <CommonInfoRow label="是否被采纳" :value="form.isAdopted === 1 ? '是' : '否'" />
  23. <template v-if="form.isAdopted === 1">
  24. <CommonInfoRow label="采纳对象" :value="getDictLabel('adopt_subject', form.adoptTarget)" />
  25. <CommonInfoRow label="采纳单位名称" :value="form.adoptUnitName" />
  26. </template>
  27. <CommonInfoRow label="是否被批示" :value="form.isInstruction === 1 ? '是' : '否'" />
  28. <template v-if="form.isInstruction === 1">
  29. <CommonInfoRow label="批示人姓名" :value="form.instructionPersonName" />
  30. <CommonInfoRow label="批示领导级别" :value="getDictLabel('leader_level', form.instructionLeaderLevel)" />
  31. <CommonInfoRow label="批示人职务" :value="form.instructionPersonPosition" />
  32. </template>
  33. <CommonInfoRow label="总字数" :value="(form.wordCount || '0') + '万字'" />
  34. <CommonInfoRow label="报告电子版" isColumn>
  35. <view class="file-links">
  36. <view v-if="reportFile" class="file-item" @click="handlePreview(reportFile)">
  37. <text class="file-link">{{ reportFile.fileName || '-' }}</text>
  38. </view>
  39. <text v-else>-</text>
  40. </view>
  41. </CommonInfoRow>
  42. <CommonInfoRow v-if="form.isInstruction === 1" label="批示主要内容" :value="form.instructionContent" isColumn />
  43. <CommonInfoRow label="备注" :value="form.remark" isColumn />
  44. </CommonSection>
  45. <!-- 完成人列表 -->
  46. <CommonSection title="完成人列表" >
  47. <view class="member-list">
  48. <view class="member-item" v-for="(member, index) in form.memberList" :key="index">
  49. <view class="member-header">
  50. <view class="m-left">
  51. <text class="m-name mr20">{{ member.memberName }}</text>
  52. <text class="m-type-tag blue">{{ member.memberType || '完成人' }}</text>
  53. </view>
  54. <text class="m-tag" v-if="member.contributionRate">{{ member.contributionRate }}% 贡献率</text>
  55. </view>
  56. <view class="m-body">
  57. <view class="m-line">
  58. <text class="l">单位:</text>
  59. <text class="v">{{ member.workUnit || '-' }}</text>
  60. </view>
  61. <view class="m-line">
  62. <text class="l">学历/职称:</text>
  63. <text class="v">{{ member.education || '-' }} / {{ member.professionalTitle || '-' }}</text>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </CommonSection>
  69. <!-- 关联项目列表 -->
  70. <CommonSection title="关联项目列表">
  71. <view class="funds-list" v-if="form.projectList?.length">
  72. <view class="funds-item" v-for="(project, index) in form.projectList" :key="index">
  73. <view class="f-row">
  74. <text class="f-name">{{ project.projectName }}</text>
  75. <text class="m-type-tag" :class="project.projectType === '10' ? 'blue' : project.projectType === '20' ? 'orange' : 'green'">
  76. {{ getProjectType(project.projectType) }}
  77. </text>
  78. </view>
  79. <view class="f-grid">
  80. <view class="g-item highlight">
  81. <text class="gl">负责人</text>
  82. <text class="gv">{{ project.projectLeader || '-' }}</text>
  83. </view>
  84. <view class="g-item highlight">
  85. <text class="gl">项目状态</text>
  86. <text class="gv">{{ getProjectStatus(project.projectStatus) }}</text>
  87. </view>
  88. </view>
  89. </view>
  90. </view>
  91. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  92. </CommonSection>
  93. <!-- 附件信息 -->
  94. <AttachmentList :list="mergedFileList" title="附件列表" />
  95. <!-- 审批记录 -->
  96. <CommonSection title="审批记录" v-if="form.id">
  97. <FlowTable :id="form.id" :businessCode="String(form.id)" defCode="sci_achievement_decision" />
  98. </CommonSection>
  99. </template>
  100. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  101. </view>
  102. </template>
  103. <script setup lang="ts">
  104. import { ref, onMounted, watch, computed } from 'vue';
  105. import { useDict } from '@/hooks/useDict';
  106. import { formatDate } from '@/utils/date';
  107. import { previewFile } from '@/utils/file';
  108. import AttachmentList from './AttachmentList.vue';
  109. import FlowTable from '@/pages/project/components/detail/FlowTable.vue';
  110. import CommonSection from '@/components/ui/CommonSection.vue';
  111. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  112. import { useDocumentApi } from '@/api/document/index';
  113. const props = defineProps<{
  114. code: string | number;
  115. }>();
  116. const { getDictLabel } = useDict('adopt_subject', 'leader_level');
  117. const documentApi = useDocumentApi();
  118. const form = ref<any>(null);
  119. const loading = ref(false);
  120. const platformList = computed(() => {
  121. if (form.value?.belongPlatform) {
  122. try {
  123. const data = JSON.parse(form.value.belongPlatform);
  124. return Array.isArray(data) ? data : [];
  125. } catch (e) {
  126. if (form.value.belongPlatform === '其他') return [{ platformName: '其他' }];
  127. return [{ platformName: form.value.belongPlatform }];
  128. }
  129. }
  130. return [];
  131. });
  132. const mergedFileList = computed(() => {
  133. if (!form.value) return [];
  134. const list: any[] = [];
  135. // 其他附件
  136. if (form.value.fileList?.length) {
  137. form.value.fileList.forEach((f: any) => {
  138. list.push({
  139. fileName: f.adoptFileName,
  140. fileUrl: f.adoptFileUrl,
  141. fileType: f.fileType === 10 ? '采纳材料' : '批示材料'
  142. });
  143. });
  144. }
  145. return list;
  146. });
  147. const reportFile = computed(() => {
  148. if (form.value?.reportFileUrl) {
  149. return {
  150. fileName: form.value.reportFileName || '查看附件',
  151. fileUrl: form.value.reportFileUrl
  152. };
  153. }
  154. return null;
  155. });
  156. const handlePreview = (file: any) => {
  157. const url = file.fileUrl || file.url;
  158. const name = file.fileName || file.name;
  159. if (url) {
  160. previewFile(url, name);
  161. }
  162. };
  163. const getProjectType = (type: string) => {
  164. const map: any = { '10': '纵向', '20': '横向', '30': '内部' };
  165. return map[type] || type;
  166. };
  167. const getProjectStatus = (status: string) => {
  168. const map: any = { '10': '立项', '20': '在研', '30': '结题验收', '50': '临近结题' };
  169. return map[status] || status;
  170. };
  171. const fetchData = async () => {
  172. if (!props.code) return;
  173. loading.value = true;
  174. try {
  175. const res: any = await documentApi.getDecisionById(props.code);
  176. if (res.code == 200) {
  177. form.value = res.data;
  178. }
  179. } catch (error) {
  180. console.error('Fetch Decision error:', error);
  181. }
  182. loading.value = false;
  183. };
  184. onMounted(() => {
  185. fetchData();
  186. });
  187. watch(() => props.code, () => {
  188. fetchData();
  189. });
  190. </script>
  191. <style lang="scss" scoped>
  192. @import "./common.scss";
  193. .file-links {
  194. .file-item {
  195. padding: 6rpx 0;
  196. }
  197. .file-link {
  198. color: #2979ff;
  199. text-decoration: underline;
  200. word-break: break-all;
  201. }
  202. }
  203. </style>