VarietyForm.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. <view class="common-section-card">
  7. <view class="section-title">基本信息</view>
  8. <view class="info-row">
  9. <text class="label">新品种名称</text>
  10. <text class="value">{{ form.varietyName || '-' }}</text>
  11. </view>
  12. <view class="info-row">
  13. <text class="label">所属单位</text>
  14. <text class="value">{{ form.deptName || '-' }}</text>
  15. </view>
  16. <view class="info-row">
  17. <text class="label">品种号</text>
  18. <text class="value">{{ form.varietyCode || '-' }}</text>
  19. </view>
  20. <view class="info-row">
  21. <text class="label">审订单位</text>
  22. <text class="value">{{ form.ratifyDept || '-' }}</text>
  23. </view>
  24. <view class="info-row">
  25. <text class="label">审订时间</text>
  26. <text class="value">{{ formatDate(form.ratifyTime, 'YYYY-MM-DD') }}</text>
  27. </view>
  28. <view class="info-row">
  29. <text class="label">审订类别</text>
  30. <text class="value">{{ getDictLabel('sci_variety_type', form.varietyType) }}</text>
  31. </view>
  32. <view class="info-row">
  33. <text class="label">备注</text>
  34. <text class="value">{{ form.remark || '-' }}</text>
  35. </view>
  36. </view>
  37. <!-- 作者信息 -->
  38. <view class="common-section-card mt20" v-if="form.memberList?.length">
  39. <view class="section-title">作者信息</view>
  40. <view class="member-list">
  41. <view class="member-item" v-for="(member, index) in form.memberList" :key="index">
  42. <view class="member-header">
  43. <text class="m-name">{{ member.memberName }}</text>
  44. <text class="m-tag">署名顺序: {{ member.signOrder }}</text>
  45. </view>
  46. <view class="m-body">
  47. <view class="m-line">
  48. <text class="l">作者类型:</text>
  49. <text class="v">{{ getDictLabel('sci_paper_author_type', member.memberType) }}</text>
  50. </view>
  51. <view class="m-line"><text class="l">职工号/学号:</text><text class="v">{{ member.memberCode || '-' }}</text></view>
  52. <view class="m-line">
  53. <text class="l">性别:</text>
  54. <text class="v">{{ member.gender === '10' ? '男' : member.gender === '20' ? '女' : '-' }}</text>
  55. </view>
  56. <view class="m-line">
  57. <text class="l">学历:</text>
  58. <text class="v">{{ getDictLabel('sci_academic_degree', member.educated) }}</text>
  59. </view>
  60. <view class="m-line">
  61. <text class="l">职称:</text>
  62. <text class="v">{{ getDictLabel('sci_discipline_job_title', member.technicalTitle) }}</text>
  63. </view>
  64. <view class="m-line"><text class="l">所属单位/学校:</text><text class="v">{{ member.deptName || '-' }}</text></view>
  65. <view class="m-line"><text class="l">贡献率:</text><text class="v">{{ member.contributionRate || 0 }}%</text></view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. <!-- 附件信息 -->
  71. <AttachmentList
  72. v-if="form.fileName"
  73. :file="{ fileName: form.fileName, fileUrl: form.fileUrl }"
  74. title="审批附件"
  75. />
  76. </template>
  77. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  78. </view>
  79. </template>
  80. <script setup lang="ts">
  81. import { ref, onMounted, watch } from 'vue';
  82. import { useDict } from '@/hooks/useDict';
  83. import { useDocumentApi } from '@/api/document';
  84. import { formatDate } from '@/utils/date';
  85. import to from 'await-to-js';
  86. import AttachmentList from './AttachmentList.vue';
  87. const props = defineProps<{
  88. code: string;
  89. }>();
  90. const { getDictLabel } = useDict(
  91. 'sci_variety_type',
  92. 'sci_paper_author_type',
  93. 'sci_academic_degree',
  94. 'sci_discipline_job_title'
  95. );
  96. const documentApi = useDocumentApi();
  97. const form = ref<any>(null);
  98. const loading = ref(false);
  99. const fetchData = async () => {
  100. if (!props.code) return;
  101. loading.value = true;
  102. const [err, res] = await to(documentApi.getVarietyByCode(props.code));
  103. if (!err && res?.data) {
  104. form.value = res.data;
  105. }
  106. loading.value = false;
  107. };
  108. onMounted(() => {
  109. fetchData();
  110. });
  111. watch(() => props.code, () => {
  112. fetchData();
  113. });
  114. </script>
  115. <style lang="scss" scoped>
  116. @import "./common.scss";
  117. .m-body {
  118. padding: 10rpx 0;
  119. .m-line {
  120. font-size: 26rpx;
  121. line-height: 1.6;
  122. display: flex;
  123. .l { color: #888; width: 180rpx; flex-shrink: 0; }
  124. .v { color: #333; }
  125. }
  126. }
  127. </style>