StandardForm.vue 4.6 KB

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