SciAchievementSoftware.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. <CommonSection title="基本信息" :isFirst="true">
  6. <CommonInfoRow label="软件名称" :value="form.softwareName" />
  7. <CommonInfoRow label="著作权人" :value="form.applicant" />
  8. <CommonInfoRow label="所属单位" :value="form.organization" />
  9. <CommonInfoRow label="版本号" :value="form.version" />
  10. <CommonInfoRow label="开发完成日期" :value="form.developmentFinishDate ? formatDate(form.developmentFinishDate, 'YYYY-MM-DD') : '-'" />
  11. <CommonInfoRow label="首次发表日期" :value="form.firstPublishDate ? formatDate(form.firstPublishDate, 'YYYY-MM-DD') : '-'" />
  12. <CommonInfoRow label="成果权属" :value="getDictLabel('achievement_owner_unit', form.achievementOwnerUnit) || form.achievementOwnerUnit || '-'" />
  13. <CommonInfoRow label="权利范围" :value="getDictLabel('rights_scope', form.rightsScope) || form.rightsScope || '-'" />
  14. <CommonInfoRow label="权利取得方式" :value="getDictLabel('rights_acquire_method', form.rightsAcquireMethod) || form.rightsAcquireMethod || '-'" />
  15. <CommonInfoRow label="开发方式" :value="getDictLabel('development_method', form.developmentMethod) || form.developmentMethod || '-'" />
  16. <CommonInfoRow label="所属平台" isColumn>
  17. <view class="platform-tags">
  18. <template v-if="platformList.length > 0">
  19. <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>
  20. </template>
  21. <text v-else>-</text>
  22. </view>
  23. </CommonInfoRow>
  24. <CommonInfoRow label="所属团队" :value="form.belongTeam || '-'" />
  25. <CommonInfoRow v-if="form.developmentMethod === '20'" label="合作单位" :value="form.partnerUnit || '-'" />
  26. <CommonInfoRow label="佐证附件" isColumn>
  27. <view class="file-links">
  28. <view v-if="attachment" class="file-item" @click="handlePreview(attachment)">
  29. <text class="file-link">{{ attachment.fileName || '-' }}</text>
  30. </view>
  31. <text v-else>-</text>
  32. </view>
  33. </CommonInfoRow>
  34. <CommonInfoRow label="备注" :value="form.remark" isColumn />
  35. </CommonSection>
  36. <!-- 审批记录 -->
  37. <CommonSection title="审批记录" v-if="form.id">
  38. <FlowTable :id="form.id" :businessCode="String(form.id)" defCode="sci_achievement_software" />
  39. </CommonSection>
  40. </template>
  41. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  42. </view>
  43. </template>
  44. <script setup lang="ts">
  45. import { ref, onMounted, watch, computed } from 'vue';
  46. import { useDict } from '@/hooks/useDict';
  47. import { useDocumentApi } from '@/api/document';
  48. import { formatDate } from '@/utils/date';
  49. import { previewFile } from '@/utils/file';
  50. import to from 'await-to-js';
  51. import FlowTable from '@/pages/project/components/detail/FlowTable.vue';
  52. import CommonSection from '@/components/ui/CommonSection.vue';
  53. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  54. const props = defineProps<{
  55. code: string;
  56. }>();
  57. const { getDictLabel } = useDict('achievement_owner_unit', 'rights_scope', 'rights_acquire_method', 'development_method');
  58. const documentApi = useDocumentApi();
  59. const form = ref<any>(null);
  60. const loading = ref(false);
  61. const platformList = computed(() => {
  62. if (form.value?.belongPlatform) {
  63. try {
  64. const data = JSON.parse(form.value.belongPlatform);
  65. return Array.isArray(data) ? data : [];
  66. } catch (e) {
  67. if (form.value.belongPlatform === '其他') return [{ platformName: '其他' }];
  68. return [{ platformName: form.value.belongPlatform }];
  69. }
  70. }
  71. return [];
  72. });
  73. const attachment = computed(() => {
  74. if (form.value?.fileUrl) {
  75. return {
  76. fileName: form.value.fileName || '佐证附件',
  77. fileUrl: form.value.fileUrl
  78. };
  79. }
  80. return null;
  81. });
  82. const handlePreview = (file: any) => {
  83. const url = file.fileUrl || file.url;
  84. const name = file.fileName || file.name;
  85. if (url) {
  86. previewFile(url, name);
  87. }
  88. };
  89. const fetchData = async () => {
  90. if (!props.code) return;
  91. loading.value = true;
  92. const [err, res] = await to(documentApi.getSoftwareAchievementById(props.code));
  93. if (!err && res?.data) {
  94. form.value = res.data;
  95. }
  96. loading.value = false;
  97. };
  98. onMounted(() => {
  99. fetchData();
  100. });
  101. watch(() => props.code, () => {
  102. fetchData();
  103. });
  104. </script>
  105. <style lang="scss" scoped>
  106. @import "./common.scss";
  107. .file-links {
  108. .file-item {
  109. padding: 6rpx 0;
  110. }
  111. .file-link {
  112. color: #2979ff;
  113. text-decoration: underline;
  114. word-break: break-all;
  115. }
  116. }
  117. </style>