Procházet zdrojové kódy

🎨 修复指定级别审核按钮状态问题

快乐的梦鱼 před 2 týdny
rodič
revize
45cfc53fa2

+ 11 - 1
src/pages/admin.vue

@@ -179,7 +179,7 @@
 </template>
 
 <script setup lang="ts">
-import { computed, h, ref, watch } from 'vue';
+import { computed, h, onMounted, ref, watch } from 'vue';
 import { useRoute, useRouter } from 'vue-router';
 import { useAuthStore } from '@/stores/auth';
 import { message, Modal } from 'ant-design-vue';
@@ -203,6 +203,16 @@ const authStore = useAuthStore();
 const activeKey = ref(route.query.tab as string || '1');
 const inheritorData = ref<GetContentListItem[]>([]);
 
+onMounted(() => {
+  switch (activeKey.value) {
+    case '1': document.title = '传承人列表'; break;
+    case '3': document.title = '传习所列表'; break;
+    case '5': document.title = '老字号'; break;
+    case '9': document.title = '传承协议签署表'; break;
+    case '8': document.title = '自查评估表列表'; break;
+  }
+});
+
 const { variable: lastValueCategory } = useMemorizeVar('categoryLastSelectValue', 0);
 const { variable: lastValueStatus } = useMemorizeVar('statusLastSelectValue', -10);
 const { variable: lastAgreementProgress } = useMemorizeVar('adminUserAgreementProgress', -100);

+ 14 - 0
src/pages/collect/assessment/composeables/GroupData.ts

@@ -0,0 +1,14 @@
+/** 用户组 → 本环节提交后的 progress */
+export const GROUP_TO_REVIEW_PROGRESS: Record<number, number> = {
+  9: 2, // 项目保护单位
+  5: 3, // 县(区)文旅部门
+  10: 4, // 设区市文旅部门、省非遗中心
+  11: 5, // 省文化和旅游厅
+};
+
+export const PROGRESS_SUBMIT_LABELS: Record<number, string> = {
+  2: '2 — 项目保护单位审核完成',
+  3: '3 — 县(区)文旅部门审核完成',
+  4: '4 — 设区市文旅部门、省非遗中心审核完成',
+  5: '5 — 省文化和旅游厅审核完成',
+};

+ 18 - 4
src/pages/collect/assessment/evaluation-form-list.vue

@@ -37,7 +37,7 @@
           <a-button type="link" @click.stop="router.push({ name: 'CollectEvaluationForm', query: { id: item.checkId ?? item.id, userId: item.userId } })">编辑</a-button>
           <a-button
             type="primary"
-            v-if="item.checkId && item.progress != null && item.progress >= 1 && item.progress < 5"
+            v-if="canReview(item)"
             @click.stop="handleReviewSelfAssessment(item)"
           >
             审核
@@ -76,13 +76,15 @@
 </template>
 
 <script setup lang="ts">
-import { ref } from 'vue';
+import { computed, ref } from 'vue';
 import { useRouter } from 'vue-router';
 import { message } from 'ant-design-vue';
 import { ExclamationCircleOutlined, InfoCircleOutlined } from '@ant-design/icons-vue';
 import CommonListBlock, { type DropdownCommonItem } from '@/components/content/CommonListBlock.vue';
-import AssessmentContentApi from '@/api/collect/AssessmentContent';
+import AssessmentContentApi, { SelfAssessmentDetail } from '@/api/collect/AssessmentContent';
 import { useMemorizeVar } from '@/composeables/useMemorizeVar';
+import { useAuthStore } from '@/stores/auth';
+import { GROUP_TO_REVIEW_PROGRESS } from './composeables/GroupData';
 
 const router = useRouter();
 
@@ -126,6 +128,18 @@ const checkLogReviewTypeOptions: DropdownCommonItem[] = [
   { id: 5, name: '省文化和旅游厅' },
 ];
 
+
+const authStore = useAuthStore();
+const currentUserGroups = computed(() => authStore.userInfo?.adminGroup || []);
+
+function canReview(item: SelfAssessmentDetail) { 
+  const currentUserGroup = currentUserGroups.value.find((group) => GROUP_TO_REVIEW_PROGRESS[group.id]);
+  const currentUserReviewProgress = GROUP_TO_REVIEW_PROGRESS[currentUserGroup?.id ?? 0] ?? 0;
+  return item.checkId 
+    && item.progress != null && item.progress >= 1 && item.progress < 5 //必须已经提交
+    && item.progress < currentUserReviewProgress; // 当前审核阶段未完成
+}
+
 function selfAssessmentProgressLabel(progress: number | null | undefined) {
   if (progress === null || progress === undefined)
     return '未填写';
@@ -193,7 +207,7 @@ async function loadCheckLogList(page: number, pageSize: number, searchText: stri
   };
 }
 
-function handleReviewSelfAssessment(item: { checkId: number | null; userId: number | null; progress?: number | null }) {
+function handleReviewSelfAssessment(item: SelfAssessmentDetail) {
   const cid = item.checkId;
   const uid = item.userId;
   if (!cid || !uid) {

+ 1 - 13
src/pages/collect/assessment/evaluation-form-review.vue

@@ -130,6 +130,7 @@ import SelfAssessmentFormDisplay from './components/SelfAssessmentFormDisplay.vu
 import { useSimpleDataLoader } from '@/composeables/useSimpleDataLoader';
 import { useAuthStore } from '@/stores/auth';
 import { useMemorizeVar } from '@/composeables/useMemorizeVar';
+import { GROUP_TO_REVIEW_PROGRESS, PROGRESS_SUBMIT_LABELS } from './composeables/GroupData.ts';
 
 function formatErr(e: unknown): string {
   if (e instanceof RequestApiError)
@@ -165,20 +166,7 @@ const reviewOpinion = ref<number | null>(null);
 const reviewPoints = ref<number | null>(null);
 const rejectReason = ref<string | null>(null);
 
-/** 用户组 → 本环节提交后的 progress */
-const GROUP_TO_REVIEW_PROGRESS: Record<number, number> = {
-  9: 2, // 项目保护单位
-  5: 3, // 县(区)文旅部门
-  10: 4, // 设区市文旅部门、省非遗中心
-  11: 5, // 省文化和旅游厅
-};
 
-const PROGRESS_SUBMIT_LABELS: Record<number, string> = {
-  2: '2 — 项目保护单位审核完成',
-  3: '3 — 县(区)文旅部门审核完成',
-  4: '4 — 设区市文旅部门、省非遗中心审核完成',
-  5: '5 — 省文化和旅游厅审核完成',
-};
 
 const opinionSelectOptions = [
   { label: '优秀', value: 1 },