SafetyForm.vue 11 KB

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