AchWorkForm.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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"><text class="label">著作名称</text><text class="value">{{ form.workName || '-' }}</text></view>
  9. <view class="info-row">
  10. <text class="label">著作类别</text>
  11. <text class="value">{{ getDictLabel('sci_work_class', form.workClass) }}</text>
  12. </view>
  13. <view class="info-row"><text class="label">出版单位</text><text class="value">{{ form.workPublisher || '-' }}</text></view>
  14. <view class="info-row">
  15. <text class="label">出版社类型</text>
  16. <text class="value">{{ getDictLabel('sci_work_publisherType', form.workPublisherType) }}</text>
  17. </view>
  18. <view class="info-row"><text class="label">出版时间</text><text class="value">{{ form.workPublicationDate || '-' }}</text></view>
  19. <view class="info-row"><text class="label">所属科室</text><text class="value">{{ form.deptName || '-' }}</text></view>
  20. <view class="info-row"><text class="label">CIP号</text><text class="value">{{ form.cip || '-' }}</text></view>
  21. <view class="info-row"><text class="label">字数</text><text class="value">{{ form.wordsNum || '-' }}</text></view>
  22. <view class="info-row"><text class="label">所属年份</text><text class="value">{{ form.statisticalYear || '-' }}</text></view>
  23. <view class="info-row">
  24. <text class="label">是否国家规范化教材</text>
  25. <text class="value">{{ form.isStandard === '10' ? '是' : '否' }}</text>
  26. </view>
  27. <view class="info-row">
  28. <text class="label">是否翻译著作</text>
  29. <text class="value">{{ form.isTranslation === '10' ? '是' : '否' }}</text>
  30. </view>
  31. </view>
  32. <!-- 标注经济来源 -->
  33. <view class="common-section-card mt20" v-if="form.projList?.length">
  34. <view class="section-title">标注经济来源</view>
  35. <view class="achievement-card" v-for="(row, index) in form.projList" :key="index">
  36. <view class="a-row">
  37. <text class="al">关联类型:</text>
  38. <text class="av">{{ row.sourceType === '10' ? '项目' : '学科' }}</text>
  39. </view>
  40. <view class="a-row">
  41. <text class="al">关联对象:</text>
  42. <text class="av">{{ row.projectSource || '-' }}</text>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 著作人 -->
  47. <view class="common-section-card mt20" v-if="form.memberList?.length">
  48. <view class="section-title">著作人信息</view>
  49. <view class="member-list">
  50. <view class="member-item" v-for="(row, index) in form.memberList" :key="index">
  51. <view class="member-header">
  52. <text class="m-name">{{ row.memberName }}</text>
  53. <view class="name-box">
  54. <text class="m-tag" v-if="row.roleContent">{{ getDictLabel('sci_work_roleContent', row.roleContent) }}</text>
  55. <text class="m-tag" v-if="row.position">第{{ row.position }}位</text>
  56. </view>
  57. </view>
  58. <view class="m-body">
  59. <view class="m-line" v-if="row.deptName"><text class="l">单位:</text><text class="v">{{ row.deptName }}</text></view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 附件 -->
  65. <AttachmentList :list="mergedFileList" title="著作附件(封面和版权页)" />
  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 to from 'await-to-js';
  75. import AttachmentList from './AttachmentList.vue';
  76. const props = defineProps<{
  77. code: string;
  78. }>();
  79. const { getDictLabel } = useDict('sci_work_class', 'sci_work_publisherType', 'sci_work_roleContent');
  80. const documentApi = useDocumentApi();
  81. const form = ref<any>(null);
  82. const loading = ref(false);
  83. const mergedFileList = computed(() => {
  84. if (!form.value?.workFile) return [];
  85. try {
  86. const file = JSON.parse(form.value.workFile);
  87. return [{ ...file, fileType: '著作附件' }];
  88. } catch (e) {
  89. return [];
  90. }
  91. });
  92. const fetchData = async () => {
  93. if (!props.code) return;
  94. loading.value = true;
  95. const workCode = props.code.includes('-') ? props.code.split('-')[1] : props.code;
  96. const [err, res] = await to(documentApi.getWorkByCode(workCode));
  97. if (!err && res?.data) {
  98. form.value = res.data;
  99. }
  100. loading.value = false;
  101. };
  102. onMounted(() => {
  103. fetchData();
  104. });
  105. watch(() => props.code, () => {
  106. fetchData();
  107. });
  108. </script>
  109. <style lang="scss" scoped>
  110. @import "./common.scss";
  111. </style>