SafetyForm.vue 11 KB

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