SafetyForm.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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.projectCode || '-'" />
  8. <CommonInfoRow label="项目名称" :value="form.projectName || '-'" />
  9. <CommonInfoRow label="学科分类" :value="getDictLabel('project_class', form.disciplineFirstName) || '-'" />
  10. <CommonInfoRow label="负责人类型" :value="form.projectLeaderType === '10' ? '教师' : form.projectLeaderType === '20' ? '学生' : '校外人员'" />
  11. <CommonInfoRow label="负责人" :value="form.projectLeaderName || '-'" />
  12. <CommonInfoRow label="合同类别" :value="getDictLabel('contract_type', form.contractType) || '-'" />
  13. <CommonInfoRow label="统计年度" :value="form.statisticalYear || '-'" />
  14. <CommonInfoRow label="签订时间" :value="formatDate(form.signDate)" />
  15. <CommonInfoRow label="项目时间" :value="`${formatDate(form.planStartDate)} 至 ${formatDate(form.planEndDate)}`" />
  16. <CommonInfoRow label="合同经费(元)" :value="`¥${formatAmount(form.contractFunds)}`" isAmount />
  17. <CommonInfoRow label="配套经费(元)" :value="`¥${formatAmount(form.supportFunds)}`" isAmount />
  18. <CommonInfoRow label="到账金额(元)" :value="`¥${formatAmount(form.arrivalFunds)}`" isAmount />
  19. <CommonInfoRow label="到账时间" :value="formatDate(form.arrivalDate)" />
  20. <CommonInfoRow label="所属平台" isColumn>
  21. <view class="platform-tags">
  22. <template v-if="platformList.length > 0">
  23. <uv-tags
  24. v-for="(p, index) in platformList"
  25. :key="index"
  26. :text="p.platformName === '其他' ? '其他' : (p.platformType ? p.platformName + ' (' + p.platformType + ')' : p.platformName)"
  27. type="primary"
  28. plain
  29. size="mini"
  30. class="mr5"
  31. ></uv-tags>
  32. </template>
  33. <text v-else>-</text>
  34. </view>
  35. </CommonInfoRow>
  36. <CommonInfoRow label="所属团队" :value="form.belongTeam || '-'" />
  37. <CommonInfoRow label="备注" :value="form.remark || '无'" isColumn noBorder />
  38. </CommonSection>
  39. <!-- 合作单位 -->
  40. <view class="common-section-card mt20" v-if="form.companyList?.length">
  41. <view class="section-title">合作单位</view>
  42. <view class="company-list">
  43. <view class="company-item" v-for="(comp, index) in form.companyList" :key="index">
  44. <view class="comp-header">
  45. <text class="c-name">{{ comp.compName }}</text>
  46. <text class="c-tag">{{ getDictLabel('project_company_type', comp.contractParty) }}</text>
  47. </view>
  48. <view class="c-body">
  49. <view class="c-line"><text class="l">单位级别:</text><text class="v">{{ getDictLabel('sci_tripartite_type', comp.compType) }}</text></view>
  50. <view class="c-line"><text class="l">联系人:</text><text class="v">{{ comp.compContact || '-' }} ({{ comp.compPhoneNum || '-' }})</text></view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 成员信息 -->
  56. <view class="common-section-card mt20" v-if="form.member?.length">
  57. <view class="section-title">成员信息</view>
  58. <view class="member-list">
  59. <view class="member-item" v-for="(row, index) in form.member" :key="index">
  60. <view class="member-header">
  61. <text class="m-name">{{ row.memberName }}</text>
  62. <text class="m-tag leader" v-if="row.projectRole === '10'">负责人</text>
  63. <text class="m-tag参与人 v-else">参与人</text>
  64. <text class="m-rate" v-if="row.contributionRate">贡献率: {{ row.contributionRate }}%</text>
  65. </view>
  66. <view class="m-body">
  67. <view class="m-line" v-if="row.deptName"><text class="l">所属科室:</text><text class="v">{{ row.deptName }}</text></view>
  68. <view class="m-line" v-if="row.technicalTitle"><text class="l">职称:</text><text class="v">{{ row.technicalTitle }}</text></view>
  69. <view class="m-line" v-if="row.degree"><text class="l">学位:</text><text class="v">{{ getDictLabel('sci_academic_degree', row.degree) }}</text></view>
  70. <view class="m-line" v-if="row.responsibleContent"><text class="l">负责内容:</text><text class="v">{{ row.responsibleContent }}</text></view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <!-- 预算信息 -->
  76. <view class="common-section-card mt20" v-if="form.budget?.length">
  77. <view class="section-title">预算信息</view>
  78. <view class="budget-list">
  79. <view class="budget-item" v-for="(item, index) in form.budget" :key="index">
  80. <view class="b-header">
  81. <text class="b-name">{{ item.fundsSubjName }}</text>
  82. <text class="b-tag">{{ item.fundsClass === '10' ? '直接费用' : '间接费用/管理费' }}</text>
  83. </view>
  84. <view class="b-grid">
  85. <view class="g-item"><text class="l">财政拨款</text><text class="v">¥{{ item.projectFundsAmount || 0 }}</text></view>
  86. <view class="g-item"><text class="l">匹配经费</text><text class="v">¥{{ item.otherFundsAmount || 0 }}</text></view>
  87. <view class="g-item"><text class="l">自筹经费</text><text class="v">¥{{ item.raiseFundsAmount || 0 }}</text></view>
  88. <view class="g-item total"><text class="l">预算金额</text><text class="v">¥{{ item.totalFundsAmount || 0 }}</text></view>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. <!-- 附件信息 -->
  94. <view class="common-section-card mt20" v-if="form.files?.length">
  95. <view class="section-title">附件资料</view>
  96. <view class="attachment-list">
  97. <view class="file-item" v-for="(file, index) in form.files" :key="index" @click="previewFile(file.fileUrl, file.fileName)">
  98. <view class="file-info-box">
  99. <text class="f-name">{{ file.fileName }}</text>
  100. <text class="f-type">{{ file.fileType || '附件' }}</text>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. </template>
  106. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  107. </view>
  108. </template>
  109. <script setup lang="ts">
  110. import { ref, onMounted, watch, computed } from 'vue';
  111. import { useDict } from '@/hooks/useDict';
  112. import { useDocumentApi } from '@/api/document';
  113. import { previewFile } from '@/utils/file';
  114. import { formatAmount } from '@/utils/format';
  115. import { formatDate } from '@/utils/date';
  116. import to from 'await-to-js';
  117. import CommonSection from '@/components/ui/CommonSection.vue';
  118. import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
  119. const props = defineProps<{
  120. code: string;
  121. }>();
  122. const { getDictLabel } = useDict('project_class', 'contract_type', 'project_company_type', 'sci_tripartite_type', 'sci_academic_degree');
  123. const documentApi = useDocumentApi();
  124. const form = ref<any>(null);
  125. const loading = ref(false);
  126. const fetchData = async () => {
  127. if (!props.code) return;
  128. loading.value = true;
  129. const [err, res] = await to(documentApi.getSafetyByCode(props.code));
  130. if (!err && res?.data) {
  131. form.value = res.data;
  132. }
  133. loading.value = false;
  134. };
  135. const platformList = computed(() => {
  136. if (form.value?.belongPlatform) {
  137. try {
  138. const data = JSON.parse(form.value.belongPlatform);
  139. return Array.isArray(data) ? data : [];
  140. } catch (e) {
  141. if (form.value.belongPlatform === '其他') return [{ platformName: '其他' }];
  142. return [{ platformName: form.value.belongPlatform }];
  143. }
  144. }
  145. return [];
  146. });
  147. onMounted(() => {
  148. fetchData();
  149. });
  150. watch(() => props.code, () => {
  151. fetchData();
  152. });
  153. </script>
  154. <style lang="scss" scoped>
  155. @import "./common.scss";
  156. .platform-tags {
  157. display: flex;
  158. flex-wrap: wrap;
  159. gap: 10rpx;
  160. justify-content: flex-end;
  161. flex: 1;
  162. .p-tag {
  163. font-size: 22rpx;
  164. background-color: #f0f7ff;
  165. color: #007aff;
  166. padding: 4rpx 12rpx;
  167. border-radius: 4rpx;
  168. }
  169. }
  170. .num-color {
  171. color: #666;
  172. font-weight: 500;
  173. }
  174. .company-item, .budget-item {
  175. background-color: #fcfdfe;
  176. border: 1rpx solid #eff3f8;
  177. border-radius: 12rpx;
  178. padding: 24rpx;
  179. margin-bottom: 20rpx;
  180. .comp-header, .b-header {
  181. display: flex;
  182. justify-content: space-between;
  183. align-items: center;
  184. margin-bottom: 16rpx;
  185. padding-bottom: 12rpx;
  186. border-bottom: 1rpx solid #f1f5f9;
  187. .c-name, .b-name {
  188. font-size: 28rpx;
  189. font-weight: 600;
  190. color: #333;
  191. }
  192. .c-tag, .b-tag {
  193. font-size: 20rpx;
  194. padding: 2rpx 12rpx;
  195. border-radius: 4rpx;
  196. background-color: #f8fafc;
  197. color: #64748b;
  198. }
  199. }
  200. .c-body {
  201. .c-line {
  202. display: flex;
  203. font-size: 24rpx;
  204. margin-bottom: 8rpx;
  205. .l { color: #94a3b8; width: 140rpx; }
  206. .v { color: #475569; }
  207. }
  208. }
  209. .b-grid {
  210. display: grid;
  211. grid-template-columns: 1fr 1fr;
  212. gap: 12rpx;
  213. .g-item {
  214. display: flex;
  215. flex-direction: column;
  216. background-color: #f8fafc;
  217. padding: 12rpx;
  218. border-radius: 8rpx;
  219. .l { font-size: 20rpx; color: #94a3b8; margin-bottom: 4rpx; }
  220. .v { font-size: 24rpx; color: #475569; font-weight: 500; }
  221. &.total {
  222. background-color: #f0f7ff;
  223. .v { color: #1c9bfd; font-weight: bold; }
  224. }
  225. }
  226. }
  227. }
  228. .attachment-list {
  229. .file-item {
  230. display: flex;
  231. align-items: center;
  232. padding: 20rpx;
  233. background-color: #f8fbfd;
  234. border-radius: 12rpx;
  235. border: 1rpx solid #eef2f7;
  236. margin-bottom: 16rpx;
  237. .file-info-box {
  238. flex: 1;
  239. display: flex;
  240. flex-direction: column;
  241. .f-name {
  242. font-size: 26rpx;
  243. color: #1c9bfd;
  244. word-break: break-all;
  245. }
  246. .f-type {
  247. font-size: 20rpx;
  248. color: #94a3b8;
  249. margin-top: 4rpx;
  250. }
  251. }
  252. }
  253. }
  254. .m-rate {
  255. font-size: 22rpx;
  256. color: #94a3b8;
  257. margin-left: auto;
  258. }
  259. </style>