Browse Source

feature:调整奖项荣誉字段

liuzhenlin 9 giờ trước cách đây
mục cha
commit
4d1ac176d1

+ 1 - 1
api/achievement/index.ts

@@ -54,7 +54,7 @@ export function useAchievementApi() {
       return specialRequest.get('/cxy/dict/data/list', { params: { dictType } });
     },
     // 免登录获取SCITOKEN
-    getSciToken: (userId: string | number) => {
+    getSciToken: (userId: string | number):Promise<any> => {
       return specialRequest.post('/lams/avoid/login', { userId, code: 'dshc-cq-ky' });
     },
   };

+ 116 - 19
pages/todo/components/document/AchAwardsForm.vue

@@ -4,18 +4,15 @@
     <template v-else-if="form">
       <!-- 基本信息 -->
       <CommonSection title="基本信息" :isFirst="true">
+        <CommonInfoRow label="奖项荣誉名称" :value="form.awardName || '-'" />
+        <CommonInfoRow label="编号" :value="form.awardCode || '-'" />
         <CommonInfoRow label="所在部门" :value="form.deptName" />
-        <CommonInfoRow label="批文年月日" :value="formatDate(form.awardDate)" />
         <CommonInfoRow label="奖项所属年度" :value="form.awardYear ? formatDate(form.awardYear, 'YYYY') : '-'" />
-        <CommonInfoRow label="获奖项目名称" :value="form.projectSource" />
-        <CommonInfoRow label="获奖类别" :value="form.awardType === '10' ? '教学成果' : '科研奖项'" />
+        <CommonInfoRow label="获奖类别" :value="awardTypeText" />
         <CommonInfoRow label="获奖等级" :value="getDictLabel('sci_awards_grade', form.awardGrade)" />
-        <CommonInfoRow label="获奖级别" :value="getDictLabel('sci_awards_level', form.awardLevel)" /> 
+        <CommonInfoRow label="获奖级别" :value="getDictLabel('sci_awards_level', form.awardLevel)" />
         <CommonInfoRow label="获奖人(备案人)" :value="form.members || showMembers(form.memberList)" />
-        <CommonInfoRow label="全部获奖完成人(按获奖顺序排列)" :value="form.remark" isColumn />
-        <CommonInfoRow label="颁奖机构" :value="form.awardIssueAuthority" />
         <CommonInfoRow label="完成单位" :value="form.completionUnit" />
-        <CommonInfoRow label="获奖金额" :value="'¥' + amountUnitTransferToYuan(form.awardAmount) + '元'" isAmount />
         <CommonInfoRow label="所属平台" isColumn>
           <view class="platform-tags">
             <template v-if="platformList.length > 0">
@@ -25,10 +22,18 @@
           </view>
         </CommonInfoRow>
         <CommonInfoRow label="所属团队" :value="form.belongTeam || '-'" />
+        <CommonInfoRow label="全部获奖完成人(按获奖顺序排列)" :value="form.remark || '-'" isColumn />
       </CommonSection>
 
-      <!-- 电子附件 -->
-      <CommonSection title="电子附件">
+      <!-- 授权信息 -->
+      <CommonSection title="授权信息">
+        <CommonInfoRow label="批文年月日" :value="formatDate(form.awardDate)" />
+        <CommonInfoRow label="颁奖机构" :value="form.awardIssueAuthority || '-'" />
+        <CommonInfoRow label="获奖金额(万元)" :value="formatAmountInTenThousand(form.awardAmount)" />
+      </CommonSection>
+
+      <!-- 附件 -->
+      <CommonSection title="附件">
         <CommonInfoRow label="获奖批文" isColumn>
           <view class="file-links">
             <template v-if="awardIssueAuthorityProofList.length">
@@ -61,8 +66,26 @@
         </CommonInfoRow>
       </CommonSection>
 
-      <!-- 审批记录 -->
-      <CommonSection title="审批记录" v-if="form.id">
+      <!-- 关联项目 -->
+      <CommonSection title="关联项目">
+        <view class="related-list" v-if="relatedProjectList.length">
+          <view class="related-item" v-for="(item, index) in relatedProjectList" :key="item.id || item.projectSource || index">
+            <text class="related-index">{{ Number(index) + 1 }}</text>
+            <view class="related-content">
+              <view class="related-top">
+                <text class="related-type-tag" :class="{ subject: item.sourceType === '20' }">
+                  {{ item.sourceType === '10' ? '项目' : item.sourceType === '20' ? '学科' : '-' }}
+                </text>
+              </view>
+              <text class="related-name">{{ item.projectSource || '-' }}</text>
+            </view>
+          </view>
+        </view>
+        <text v-else>-</text>
+      </CommonSection>
+
+      <!-- 审批信息 -->
+      <CommonSection title="审批信息" v-if="form.id">
         <FlowTable :id="form.id" :businessCode="'奖项荣誉-' + String(form.awardCode)" defCode="sci_academic_achievement" />
       </CommonSection>
 
@@ -122,6 +145,12 @@ const parseFileList = (fileStr: string) => {
 const awardIssueAuthorityProofList = computed(() => parseFileList(form.value?.awardIssueAuthorityProof));
 const awardCertificateList = computed(() => parseFileList(form.value?.awardCertificate));
 const awardAmountProofList = computed(() => parseFileList(form.value?.awardAmountProof));
+const relatedProjectList = computed(() => Array.isArray(form.value?.projList) ? form.value.projList : []);
+const awardTypeText = computed(() => {
+  if (form.value?.awardType === '10') return '教学成果';
+  if (form.value?.awardType === '20') return '科研奖项';
+  return '-';
+});
 
 const handlePreview = (file: any) => {
   const url = file.fileUrl || file.url;
@@ -154,14 +183,10 @@ const showMembers = (list: any[]) => {
   return list?.map(m => m.memberName).join(', ') || '-';
 };
 
-const amountUnitTransferToYuan = (amount: number | string) => {
-  const num = Number(amount || 0);
-  const amountInYuan = num * 10000;
-  const formattedYuan = amountInYuan.toFixed(2);
-  const parts = formattedYuan.split('.');
-  const integerPart = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
-  const decimalPart = parts[1];
-  return `${integerPart}.${decimalPart}`;
+const formatAmountInTenThousand = (amount: number | string) => {
+  const num = Number(amount);
+  if (Number.isNaN(num)) return '-';
+  return num.toFixed(2);
 };
 </script>
 
@@ -195,4 +220,76 @@ const amountUnitTransferToYuan = (amount: number | string) => {
     word-break: break-all;
   }
 }
+
+.related-list {
+  width: 100%;
+}
+
+.related-item {
+  display: flex;
+  align-items: flex-start;
+  padding: 16rpx 18rpx;
+  border-radius: 12rpx;
+  background: #f8fafc;
+  border: 1rpx solid #e2e8f0;
+  margin-bottom: 12rpx;
+
+  &:last-child {
+    margin-bottom: 0;
+  }
+}
+
+.related-index {
+  min-width: 36rpx;
+  height: 36rpx;
+  line-height: 36rpx;
+  text-align: center;
+  border-radius: 50%;
+  background: #e0f2fe;
+  color: #0284c7;
+  font-size: 22rpx;
+  font-weight: 700;
+  margin-right: 12rpx;
+}
+
+.related-content {
+  display: flex;
+  flex-direction: column;
+  gap: 8rpx;
+  flex: 1;
+  min-width: 0;
+}
+
+.related-top {
+  display: flex;
+  align-items: center;
+  gap: 10rpx;
+}
+
+.related-label {
+  font-size: 22rpx;
+  color: #64748b;
+}
+
+.related-type-tag {
+  font-size: 20rpx;
+  color: #2563eb;
+  background: #dbeafe;
+  border: 1rpx solid #bfdbfe;
+  border-radius: 100rpx;
+  padding: 2rpx 12rpx;
+
+  &.subject {
+    color: #7c3aed;
+    background: #ede9fe;
+    border-color: #ddd6fe;
+  }
+}
+
+.related-name {
+  font-size: 24rpx;
+  color: #1e293b;
+  line-height: 1.5;
+  word-break: break-all;
+}
 </style>

+ 1 - 1
store/modules/user.ts

@@ -163,7 +163,7 @@ export const useUserStore = defineStore('user', () => {
       const achievementApi = useAchievementApi();
       const [sciErr, sciRes] = await to(achievementApi.getSciToken(userInfo.value.id));
       console.log(sciRes)
-      const sciToken = sciRes?.data?.token;
+      const sciToken = sciRes?.token;
       if (!sciErr && sciToken) {
         Local.set(CACHE_KEY.SCITOKEN, sciToken);
       }

+ 17 - 1
utils/special_request.ts

@@ -1,5 +1,6 @@
 import axios from 'axios';
 import { CACHE_KEY } from '@/constants';
+import { Local, Session } from '@/utils/storage';
 
 const api = axios.create({
   baseURL: import.meta.env.VITE_SCIENTIFIC_API_URL || import.meta.env.VITE_API_URL, 
@@ -44,7 +45,22 @@ api.interceptors.response.use(
     if (response.data.code === 200) {
       return Promise.resolve(response.data);
     } else if (response.data.code === 401) {
-      uni.showToast({ title: '登录状态失效,请重新登录', icon: 'none' });
+      uni.showModal({
+        title: '系统提示',
+        content: '登录状态已过期,您可以继续留在该页面,或者重新登录',
+        confirmText: '重新登录',
+        cancelText: '取消',
+        success: function (modalRes) {
+          if (modalRes.confirm) {
+            Session.clear();
+            Local.remove(CACHE_KEY.TOKEN);
+            uni.reLaunch({
+              url: '/pages/login/index'
+            });
+          }
+        }
+      });
+      return Promise.reject(response.data);
     } else {
       const msg = response.data.msg || '系统错误';
       uni.showToast({ title: msg, icon: 'none' });