|
|
@@ -135,6 +135,7 @@ import { useAuthStore } from '@/stores/auth';
|
|
|
import { useMemorizeVar } from '@/composeables/useMemorizeVar';
|
|
|
import { GROUP_TO_REVIEW_PROGRESS, PROGRESS_SUBMIT_LABELS } from './composeables/GroupData.ts';
|
|
|
import { isInMiniProgram } from '@/composeables/MiniProgramIng.ts';
|
|
|
+import { useReview } from './composeables/Review.ts';
|
|
|
|
|
|
function formatErr(e: unknown): string {
|
|
|
if (e instanceof RequestApiError)
|
|
|
@@ -170,8 +171,6 @@ const reviewOpinion = ref<number | null>(null);
|
|
|
const reviewPoints = ref<number | null>(null);
|
|
|
const rejectReason = ref<string | null>(null);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
const opinionSelectOptions = [
|
|
|
{ label: '优秀', value: 1 },
|
|
|
{ label: '合格', value: 2 },
|
|
|
@@ -180,42 +179,8 @@ const opinionSelectOptions = [
|
|
|
{ label: '取消资格', value: 5 },
|
|
|
];
|
|
|
|
|
|
-const reviewProgress = computed(
|
|
|
- () => {
|
|
|
- const currentUserGroup = currentUserGroups.value.find((group) => GROUP_TO_REVIEW_PROGRESS[group.id]);
|
|
|
- return GROUP_TO_REVIEW_PROGRESS[currentUserGroup?.id ?? 0] ?? 0;
|
|
|
- },
|
|
|
-);
|
|
|
-
|
|
|
-const canSubmitReview = computed(
|
|
|
- () => reviewProgress.value >= 2 && reviewProgress.value <= 5,
|
|
|
-);
|
|
|
-
|
|
|
-const progressSubmitLabel = computed(
|
|
|
- () => PROGRESS_SUBMIT_LABELS[reviewProgress.value] ?? '—',
|
|
|
-);
|
|
|
-
|
|
|
-const reviewLevelLabel = computed(() => {
|
|
|
- switch (reviewProgress.value) {
|
|
|
- case 2:
|
|
|
- return '项目保护单位';
|
|
|
- case 3:
|
|
|
- return '县(区)文旅部门';
|
|
|
- case 4:
|
|
|
- return '设区市文旅部门、省非遗中心';
|
|
|
- case 5:
|
|
|
- return '省文化和旅游厅';
|
|
|
- default:
|
|
|
- return '';
|
|
|
- }
|
|
|
-});
|
|
|
-
|
|
|
-const progressHint = computed(() => {
|
|
|
- const roleText = canSubmitReview.value
|
|
|
- ? `当前账号审核环节:${reviewLevelLabel.value}`
|
|
|
- : `当前用户组 ${currentUserGroups.value.map((group) => group.name).join(',')} 无对应审核环节`;
|
|
|
- return `${roleText}。`;
|
|
|
-});
|
|
|
+const currentProgress = computed(() => currentForm.value?.progress ?? 0);
|
|
|
+const { reviewProgressInfo, canSubmitReview, reviewLevelLabel, progressHint } = useReview(currentProgress);
|
|
|
|
|
|
function levelTitleFromForm(f: SelfAssessmentDetail) {
|
|
|
if (f.level === 23) return '国家级';
|
|
|
@@ -241,7 +206,7 @@ async function loadCheckItems(f: SelfAssessmentDetail) {
|
|
|
}
|
|
|
|
|
|
function applyPrefillFromDetail(f: SelfAssessmentDetail) {
|
|
|
- const t = reviewProgress.value;
|
|
|
+ const t = reviewProgressInfo.value.target;
|
|
|
if (!canSubmitReview.value)
|
|
|
return;
|
|
|
if (t === 2) {
|
|
|
@@ -274,7 +239,7 @@ const loader = useSimpleDataLoader(async () => {
|
|
|
return detail;
|
|
|
}, { immediate: false });
|
|
|
|
|
|
-watch(reviewProgress, () => {
|
|
|
+watch(reviewProgressInfo, () => {
|
|
|
const f = currentForm.value;
|
|
|
if (f)
|
|
|
applyPrefillFromDetail(f as SelfAssessmentDetail);
|
|
|
@@ -306,13 +271,12 @@ async function submitReject() {
|
|
|
message.warning('请输入回退原因');
|
|
|
return;
|
|
|
}
|
|
|
- const t = reviewProgress.value;
|
|
|
try {
|
|
|
rejectLoading.value = true;
|
|
|
await AssessmentContentApi.reviewSelfAssessment({
|
|
|
id: f.id,
|
|
|
progress: f.progress,
|
|
|
- rejectType: t,
|
|
|
+ rejectType: reviewProgressInfo.value.rejectTarget,
|
|
|
rejectReason: reason,
|
|
|
});
|
|
|
message.success('已回退');
|
|
|
@@ -338,7 +302,7 @@ async function submitReview() {
|
|
|
message.warning('请选择审核意见');
|
|
|
return;
|
|
|
}
|
|
|
- const t = reviewProgress.value;
|
|
|
+ const t = reviewProgressInfo.value.target;
|
|
|
const base = { id: f.id, progress: t };
|
|
|
const points = reviewPoints.value != null && reviewPoints.value >= 0 ? reviewPoints.value : undefined;
|
|
|
const op = reviewOpinion.value;
|