AchCommitteeForm.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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">
  9. <text class="label">所属委员会</text>
  10. <text class="value">{{ committeeLabel || '-' }}</text>
  11. </view>
  12. <view class="info-row">
  13. <text class="label">变更类型</text>
  14. <text class="value">{{ getChangeTypeLabel(form.changeType) }}</text>
  15. </view>
  16. <view class="info-row">
  17. <text class="label">变更时间</text>
  18. <text class="value">{{ form.changeDate || '-' }}</text>
  19. </view>
  20. <view class="info-row">
  21. <text class="label">备注说明</text>
  22. <text class="value">{{ form.remark || '-' }}</text>
  23. </view>
  24. </view>
  25. <!-- 变更材料 -->
  26. <view class="common-section-card mt20" v-if="form.changeFile">
  27. <view class="section-title">变更材料</view>
  28. <view class="common-file-list">
  29. <view class="file-item" @click="previewFile(form.changeFile, '变更材料')">
  30. <view class="file-info">
  31. <text class="f-name">下载变更材料</text>
  32. <view class="f-meta">
  33. <text class="f-type">附件</text>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <!-- 如果是主任变更 (10) -->
  40. <template v-if="form.changeType === '10'">
  41. <view class="common-section-card mt20">
  42. <view class="section-title">现委员会主任</view>
  43. <view class="info-box" v-if="acadeCommittee">
  44. <view class="info-row"><text class="label">主任委员</text><text class="value">{{ acadeCommittee.directorName || '-' }}</text></view>
  45. <view class="info-row"><text class="label">所属科室</text><text class="value">{{ acadeCommittee.directorDeptName || '-' }}</text></view>
  46. <view class="info-row"><text class="label">职称</text><text class="value">{{ acadeCommittee.directorTechnicalTitle || '-' }}</text></view>
  47. <view class="info-row"><text class="label">邮箱</text><text class="value">{{ acadeCommittee.directorEmail || '-' }}</text></view>
  48. </view>
  49. <text v-else class="empty-text">暂无数据</text>
  50. </view>
  51. <view class="common-section-card mt20">
  52. <view class="section-title">变更委员会主任</view>
  53. <view class="info-box highlight-box" v-if="acadeCommitteeChange">
  54. <view class="info-row"><text class="label">主任委员</text><text class="value">{{ acadeCommitteeChange.userName || '-' }}</text></view>
  55. <view class="info-row"><text class="label">所属科室</text><text class="value">{{ acadeCommitteeChange.deptName || '-' }}</text></view>
  56. <view class="info-row"><text class="label">职称</text><text class="value">{{ acadeCommitteeChange.technicalTitle || '-' }}</text></view>
  57. <view class="info-row"><text class="label">邮箱</text><text class="value">{{ acadeCommitteeChange.userEmail || '-' }}</text></view>
  58. </view>
  59. </view>
  60. </template>
  61. <!-- 如果是副主任/委员变更 (20/30) -->
  62. <template v-else>
  63. <!-- 现人员信息 -->
  64. <view class="common-section-card mt20">
  65. <view class="section-title">现人员信息</view>
  66. <view class="staff-list" v-if="acadeMemberList?.length">
  67. <view class="staff-item" v-for="(item, index) in acadeMemberList" :key="index">
  68. <view class="staff-header">
  69. <text class="s-name">{{ item.userName }}</text>
  70. <text class="s-tag">{{ getUserTypeLabel(item.userType) }}</text>
  71. </view>
  72. <view class="s-body">
  73. <text class="s-text">{{ item.deptName }} | {{ item.technicalTitle }}</text>
  74. <text class="s-text mt5">{{ item.userEmail }}</text>
  75. </view>
  76. </view>
  77. </view>
  78. <uv-empty v-else mode="data" text="暂无人员信息"></uv-empty>
  79. </view>
  80. <!-- 变更人员信息 -->
  81. <view class="common-section-card mt20">
  82. <view class="section-title">变更人员信息</view>
  83. <view class="staff-list" v-if="acadeCommitteeChangeList?.length">
  84. <view class="staff-item highlight-border" v-for="(item, index) in acadeCommitteeChangeList" :key="index">
  85. <view class="staff-header">
  86. <text class="s-name">{{ item.userName }}</text>
  87. <text class="s-tag primary">{{ getUserTypeLabel(item.userType) }}</text>
  88. </view>
  89. <view class="s-body">
  90. <text class="s-text">{{ item.deptName }} | {{ item.technicalTitle }}</text>
  91. <text class="s-text mt5">{{ item.userEmail }}</text>
  92. </view>
  93. </view>
  94. </view>
  95. <uv-empty v-else mode="data" text="暂无变更信息"></uv-empty>
  96. </view>
  97. </template>
  98. </template>
  99. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  100. </view>
  101. </template>
  102. <script setup lang="ts">
  103. import { ref, onMounted, watch, computed } from 'vue';
  104. import { useDocumentApi } from '@/api/document';
  105. import { previewFile } from '@/utils/file';
  106. import to from 'await-to-js';
  107. const props = defineProps<{
  108. code: string;
  109. }>();
  110. const documentApi = useDocumentApi();
  111. const form = ref<any>(null); // 变更单据
  112. const acadeCommittee = ref<any>(null); // 变更前的委员会详情
  113. const acadeCommitteeChange = ref<any>(null); // 变更后的主任信息
  114. const acadeMemberList = ref<any[]>([]); // 变更前的人员列表
  115. const acadeCommitteeChangeList = ref<any[]>([]); // 变更后的人员列表
  116. const committees = ref<any[]>([]); // 所有委员会列表,用于翻译名称
  117. const loading = ref(false);
  118. const committeeLabel = computed(() => {
  119. if (!form.value?.committeeId) return '';
  120. const item = committees.value.find(c => c.id === form.value.committeeId);
  121. return item ? item.committeeName : '-';
  122. });
  123. const getChangeTypeLabel = (val: string) => {
  124. const map: any = { '10': '主任变更', '20': '副主任变更', '30': '委员变更' };
  125. return map[val] || val || '-';
  126. };
  127. const getUserTypeLabel = (val: string) => {
  128. const map: any = { '10': '主任委员', '20': '副主任委员', '30': '委员' };
  129. return map[val] || val || '-';
  130. };
  131. const fetchData = async () => {
  132. if (!props.code) return;
  133. loading.value = true;
  134. // 1. 获取委员会列表(用于翻译ID)
  135. const [cErr, cRes] = await to(documentApi.getCommitteeList());
  136. if (!cErr && cRes?.data?.list) {
  137. committees.value = cRes.data.list;
  138. }
  139. // 2. 获取变更单据详情
  140. const [err, res] = await to(documentApi.getCommitteeByCode(props.code));
  141. if (!err && res?.data) {
  142. form.value = res.data;
  143. acadeCommitteeChange.value = res.data.acadeCommitteeMember;
  144. acadeCommitteeChangeList.value = res.data.acadeCommitteeList || [];
  145. // 3. 根据委员会ID获取原始详情(現人员信息)
  146. const [e, r] = await to(documentApi.getCommitteeById(res.data.committeeId, res.data.changeType));
  147. if (!e && r?.data) {
  148. acadeCommittee.value = r.data;
  149. acadeMemberList.value = r.data.acadeCommitteeList || [];
  150. }
  151. }
  152. loading.value = false;
  153. };
  154. onMounted(() => {
  155. fetchData();
  156. });
  157. watch(() => props.code, () => {
  158. fetchData();
  159. });
  160. </script>
  161. <style lang="scss" scoped>
  162. @import "./common.scss";
  163. .info-box {
  164. background-color: #f8fafc;
  165. border-radius: 12rpx;
  166. padding: 10rpx 20rpx;
  167. &.highlight-box {
  168. background-color: #f0f9ff;
  169. border: 1rpx solid #e0f2fe;
  170. }
  171. }
  172. .empty-text {
  173. font-size: 24rpx;
  174. color: #999;
  175. padding: 20rpx;
  176. }
  177. .staff-list {
  178. .staff-item {
  179. padding: 20rpx;
  180. background-color: #f8fafc;
  181. border-radius: 12rpx;
  182. margin-bottom: 16rpx;
  183. border: 1rpx solid #eef2f7;
  184. &.highlight-border {
  185. border-color: #bae6fd;
  186. background-color: #f0f9ff;
  187. }
  188. .staff-header {
  189. display: flex;
  190. justify-content: space-between;
  191. align-items: center;
  192. margin-bottom: 10rpx;
  193. .s-name {
  194. font-size: 28rpx;
  195. font-weight: 600;
  196. color: #334155;
  197. }
  198. .s-tag {
  199. font-size: 20rpx;
  200. color: #64748b;
  201. background-color: #f1f5f9;
  202. padding: 2rpx 12rpx;
  203. border-radius: 4rpx;
  204. &.primary {
  205. color: #0284c7;
  206. background-color: #e0f2fe;
  207. }
  208. }
  209. }
  210. .s-body {
  211. display: flex;
  212. flex-direction: column;
  213. .s-text {
  214. font-size: 24rpx;
  215. color: #64748b;
  216. }
  217. .mt5 { margin-top: 6rpx; }
  218. }
  219. }
  220. }
  221. </style>