AchWorkForm.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <view class="document-form">
  3. <uv-loading-icon
  4. v-if="loading"
  5. mode="circle"
  6. text="正在加载著作详情..."
  7. ></uv-loading-icon>
  8. <template v-else-if="form">
  9. <!-- 基本信息 -->
  10. <CommonSection title="基本信息" :isFirst="true">
  11. <CommonInfoRow label="著作名称" :value="form.workName" />
  12. <CommonInfoRow
  13. label="著作类别"
  14. :value="getDictLabel('sci_work_class', form.workClass)"
  15. />
  16. <CommonInfoRow label="出版单位" :value="form.workPublisher" />
  17. <CommonInfoRow
  18. label="出版社类型"
  19. :value="
  20. getDictLabel('sci_work_publisherType', form.workPublisherType)
  21. "
  22. />
  23. <CommonInfoRow
  24. label="出版时间"
  25. :value="formatDate(form.workPublicationDate)"
  26. />
  27. <CommonInfoRow label="所属科室" :value="form.deptName" />
  28. <CommonInfoRow label="CIP号" :value="form.cip" />
  29. <CommonInfoRow label="字数" :value="form.wordsNum" />
  30. <CommonInfoRow label="所属年份" :value="form.statisticalYear" />
  31. <CommonInfoRow
  32. label="是否国家规范化教材"
  33. :value="form.isStandard === '10' ? '是' : '否'"
  34. />
  35. <CommonInfoRow
  36. label="是否翻译著作"
  37. :value="form.isTranslation === '10' ? '是' : '否'"
  38. />
  39. <CommonInfoRow label="所属平台">
  40. <view class="platform-tags">
  41. <template v-if="platformList.length > 0">
  42. <uv-tags
  43. v-for="(p, index) in platformList"
  44. :key="index"
  45. :text="
  46. p.platformName === '其他'
  47. ? '其他'
  48. : p.platformType
  49. ? p.platformName + ' (' + p.platformType + ')'
  50. : p.platformName
  51. "
  52. type="primary"
  53. plain
  54. size="mini"
  55. class="mr5"
  56. ></uv-tags>
  57. </template>
  58. <text v-else>-</text>
  59. </view>
  60. </CommonInfoRow>
  61. </CommonSection>
  62. <!-- 标注经济来源 -->
  63. <CommonSection title="标注经济来源" v-if="form.projList?.length">
  64. <view
  65. class="achievement-card"
  66. v-for="(row, index) in form.projList"
  67. :key="index"
  68. >
  69. <view class="a-row">
  70. <text class="al">关联类型:</text>
  71. <text class="av">{{
  72. row.sourceType === "10" ? "项目" : "学科"
  73. }}</text>
  74. </view>
  75. <view class="a-row">
  76. <text class="al">项目/学科:</text>
  77. <text class="av">{{ row.projectSource || "-" }}</text>
  78. </view>
  79. </view>
  80. </CommonSection>
  81. <!-- 著作人 -->
  82. <CommonSection title="著作人信息" v-if="form.memberList?.length">
  83. <view class="member-list">
  84. <view
  85. class="member-item"
  86. v-for="(row, index) in form.memberList"
  87. :key="index"
  88. >
  89. <view class="member-header">
  90. <view class="m-left">
  91. <text class="m-name mr20">{{ row.memberName }}</text>
  92. <text class="m-tag" v-if="row.roleContent">{{
  93. getDictLabel("sci_work_roleContent", row.roleContent)
  94. }}</text>
  95. </view>
  96. <text class="m-tag blue" v-if="row.position"
  97. >第{{ row.position }}位</text
  98. >
  99. </view>
  100. <view class="m-body">
  101. <view class="m-line"
  102. ><text class="l">贡献率:</text
  103. ><text class="v">{{ row.contributionRate }}%</text></view
  104. >
  105. </view>
  106. </view>
  107. </view>
  108. </CommonSection>
  109. <!-- 附件 -->
  110. <AttachmentList :list="mergedFileList" title="著作附件(封面和版权页)" />
  111. <!-- 审批记录 -->
  112. <CommonSection title="审批记录" v-if="form.id">
  113. <FlowTable
  114. :id="form.id"
  115. :businessCode="'学术著作-' + String(form.workCode)"
  116. defCode="sci_academic_achievement"
  117. />
  118. </CommonSection>
  119. </template>
  120. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  121. </view>
  122. </template>
  123. <script setup lang="ts">
  124. import { ref, onMounted, watch, computed } from "vue";
  125. import { useDict } from "@/hooks/useDict";
  126. import { useDocumentApi } from "@/api/document";
  127. import { formatDate } from "@/utils/date";
  128. import to from "await-to-js";
  129. import AttachmentList from "./AttachmentList.vue";
  130. import FlowTable from "@/pages/project/components/detail/FlowTable.vue";
  131. import CommonSection from "@/components/ui/CommonSection.vue";
  132. import CommonInfoRow from "@/components/ui/CommonInfoRow.vue";
  133. const props = defineProps<{
  134. code: string;
  135. }>();
  136. const { getDictLabel } = useDict(
  137. "sci_work_class",
  138. "sci_work_publisherType",
  139. "sci_work_roleContent"
  140. );
  141. const documentApi = useDocumentApi();
  142. const form = ref<any>(null);
  143. const loading = ref(false);
  144. const platformList = computed(() => {
  145. if (form.value?.belongPlatform) {
  146. try {
  147. const data = JSON.parse(form.value.belongPlatform);
  148. return Array.isArray(data) ? data : [];
  149. } catch (e) {
  150. if (form.value.belongPlatform === "其他")
  151. return [{ platformName: "其他" }];
  152. return [{ platformName: form.value.belongPlatform }];
  153. }
  154. }
  155. return [];
  156. });
  157. const mergedFileList = computed(() => {
  158. if (!form.value?.workFile) return [];
  159. try {
  160. const file = JSON.parse(form.value.workFile);
  161. return [{ ...file, fileType: "著作附件" }];
  162. } catch (e) {
  163. return [];
  164. }
  165. });
  166. const fetchData = async () => {
  167. if (!props.code) return;
  168. loading.value = true;
  169. const workCode = props.code.includes("-")
  170. ? props.code.split("-")[1]
  171. : props.code;
  172. const [err, res] = await to(documentApi.getWorkByCode(workCode));
  173. if (!err && res?.data) {
  174. form.value = res.data;
  175. }
  176. loading.value = false;
  177. };
  178. onMounted(() => {
  179. fetchData();
  180. });
  181. watch(
  182. () => props.code,
  183. () => {
  184. fetchData();
  185. }
  186. );
  187. </script>
  188. <style lang="scss" scoped>
  189. @import "./common.scss";
  190. .platform-tags {
  191. display: flex;
  192. flex-wrap: wrap;
  193. justify-content: flex-end;
  194. gap: 8rpx;
  195. flex: 1;
  196. align-items: center;
  197. }
  198. </style>