CredentialForm.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.credentialName" />
  8. <CommonInfoRow label="药证号" :value="form.credentialCode" />
  9. <CommonInfoRow label="药证类型" :value="form.credentialType === '10' ? '中药' : form.credentialType === '20' ? '西药' : '-'" />
  10. <CommonInfoRow label="批准单位" :value="form.ratifyDept" />
  11. <CommonInfoRow label="批准时间" :value="formatDate(form.ratifyTime)" />
  12. <CommonInfoRow label="一级学科" :value="form.disciplineName" />
  13. <CommonInfoRow label="所属单位" :value="form.deptName" />
  14. <CommonInfoRow label="备注" :value="form.remark" isColumn />
  15. </CommonSection>
  16. <!-- 作者信息 -->
  17. <CommonSection title="作者信息" v-if="form.memberList?.length">
  18. <view class="member-list">
  19. <view class="member-item" v-for="(member, index) in form.memberList" :key="index">
  20. <view class="member-header">
  21. <view class="m-left">
  22. <text class="m-name">{{ member.memberName }}</text>
  23. <text class="m-type-tag blue">{{ getDictLabel('sci_paper_author_type', member.memberType) }}</text>
  24. </view>
  25. <text class="m-tag" v-if="member.signOrder">署名顺序: {{ member.signOrder }}</text>
  26. </view>
  27. <view class="m-body">
  28. <view class="m-line"><text class="l">职工号/学号:</text><text class="v">{{ member.memberCode || '-' }}</text></view>
  29. <view class="m-line">
  30. <text class="l">性别:</text>
  31. <text class="v">{{ member.gender === '10' ? '男' : member.gender === '20' ? '女' : '-' }}</text>
  32. </view>
  33. <view class="m-line">
  34. <text class="l">学历:</text>
  35. <text class="v">{{ getDictLabel('sci_academic_degree', member.educated) }}</text>
  36. </view>
  37. <view class="m-line">
  38. <text class="l">职称:</text>
  39. <text class="v">{{ getDictLabel('sci_discipline_job_title', member.technicalTitle) }}</text>
  40. </view>
  41. <view class="m-line"><text class="l">单位/学校:</text><text class="v">{{ member.deptName || '-' }}</text></view>
  42. <view class="m-line"><text class="l">贡献率:</text><text class="v">{{ member.contributionRate || 0 }}%</text></view>
  43. </view>
  44. </view>
  45. </view>
  46. </CommonSection>
  47. <!-- 附件信息 -->
  48. <AttachmentList :list="mergedFileList" title="审批附件" />
  49. </template>
  50. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  51. </view>
  52. </template>
  53. <script setup lang="ts">
  54. import { ref, onMounted, watch, computed } from 'vue';
  55. import { useDict } from '@/hooks/useDict';
  56. import { useDocumentApi } from '@/api/document';
  57. import { formatDate } from '@/utils/date';
  58. import to from 'await-to-js';
  59. import CommonSection from '@/components/ui/CommonSection.vue';
  60. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  61. import AttachmentList from './AttachmentList.vue';
  62. const props = defineProps<{
  63. code: string;
  64. }>();
  65. const { getDictLabel } = useDict(
  66. 'sci_paper_author_type',
  67. 'sci_academic_degree',
  68. 'sci_discipline_job_title'
  69. );
  70. const documentApi = useDocumentApi();
  71. const form = ref<any>(null);
  72. const loading = ref(false);
  73. const mergedFileList = computed(() => {
  74. if (!form.value?.fileName || !form.value?.fileUrl) return [];
  75. return [{
  76. fileName: form.value.fileName,
  77. fileUrl: form.value.fileUrl,
  78. fileType: '审批附件'
  79. }];
  80. });
  81. const fetchData = async () => {
  82. if (!props.code) return;
  83. loading.value = true;
  84. const [err, res] = await to(documentApi.getCredentialByCode(props.code));
  85. if (!err && res?.data) {
  86. form.value = res.data;
  87. }
  88. loading.value = false;
  89. };
  90. onMounted(() => {
  91. fetchData();
  92. });
  93. watch(() => props.code, () => {
  94. fetchData();
  95. });
  96. </script>
  97. <style lang="scss" scoped>
  98. @import "./common.scss";
  99. </style>